Java 类org.eclipse.core.runtime.Plugin 实例源码

项目:egradle    文件:EclipseResourceHelper.java   
public IProject createLinkedProject(String projectName, Plugin plugin, IPath linkPath) throws CoreException {
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IProject project = workspace.getRoot().getProject(projectName);

    IProjectDescription desc = workspace.newProjectDescription(projectName);
    File file = getFileInPlugin(plugin, linkPath);
    IPath projectLocation = new Path(file.getAbsolutePath());
    if (Platform.getLocation().equals(projectLocation))
        projectLocation = null;
    desc.setLocation(projectLocation);

    project.create(desc, NULL_MONITOR);
    if (!project.isOpen())
        project.open(NULL_MONITOR);

    return project;
}
项目:bts    文件:ScopedPreferenceStore.java   
/**
 * Dispose the receiver.
 */
private void disposePreferenceStoreListener() {

    IEclipsePreferences root = (IEclipsePreferences) Platform
            .getPreferencesService().getRootNode().node(
                    Plugin.PLUGIN_PREFERENCE_SCOPE);
    try {
        if (!(root.nodeExists(nodeQualifier))) {
            return;
        }
    } catch (BackingStoreException e) {
        return;// No need to report here as the node won't have the
        // listener
    }

    IEclipsePreferences preferences = getStorePreferences();
    if (preferences == null) {
        return;
    }
    if (preferencesListener != null) {
        preferences.removePreferenceChangeListener(preferencesListener);
        preferencesListener = null;
    }
}
项目:bts    文件:BundleClasspathUriResolver.java   
public URI resolve(Object context, URI classpathUri) {
    if (context instanceof Plugin) {
        context = ((Plugin) context).getBundle();
    }
    if (!(context instanceof Bundle)) {
        throw new IllegalArgumentException("Context must implement Bundle");
    }
    Bundle bundle = (Bundle) context;
    try {
        if (ClasspathUriUtil.isClasspathUri(classpathUri)) {
            URI result = findResourceInBundle(bundle, classpathUri);
    if (classpathUri.fragment() != null)
        result = result.appendFragment(classpathUri.fragment());
    return result;
        }
    } catch (Exception exc) {
        throw new ClasspathUriResolutionException(exc);
    }
    return classpathUri;
}
项目:bts    文件:FixedScopedPreferenceStore.java   
/**
 * Dispose the preference store listener.
 */
private void disposePreferenceStoreListener() {

    IEclipsePreferences root = (IEclipsePreferences) Platform
            .getPreferencesService().getRootNode().node(
                    Plugin.PLUGIN_PREFERENCE_SCOPE);
    try {
        if (!(root.nodeExists(nodeQualifier))) {
            return;
        }
    } catch (BackingStoreException e) {
        return;// No need to report here as the node won't have the
        // listener
    }

    IEclipsePreferences preferences = getStorePreferences();
    if (preferences == null) {
        return;
    }
    if (preferencesListener != null) {
        preferences.removePreferenceChangeListener(preferencesListener);
        preferencesListener = null;
    }
}
项目:e4-cookbook-migration-guide    文件:ScopedPreferenceStore.java   
/**
 * Dispose the receiver.
 */
private void disposePreferenceStoreListener() {

    IEclipsePreferences root = (IEclipsePreferences) Platform
            .getPreferencesService().getRootNode().node(
                    Plugin.PLUGIN_PREFERENCE_SCOPE);
    try {
        if (!(root.nodeExists(nodeQualifier))) {
            return;
        }
    } catch (BackingStoreException e) {
        return;// No need to report here as the node won't have the
        // listener
    }

    IEclipsePreferences preferences = getStorePreferences();
    if (preferences == null) {
        return;
    }
    if (preferencesListener != null) {
        preferences.removePreferenceChangeListener(preferencesListener);
        preferencesListener = null;
    }
}
项目:e4-preferences    文件:ScopedPreferenceStore.java   
/**
 * Dispose the receiver.
 */
private void disposePreferenceStoreListener() {

    IEclipsePreferences root = (IEclipsePreferences) Platform
            .getPreferencesService().getRootNode().node(
                    Plugin.PLUGIN_PREFERENCE_SCOPE);
    try {
        if (!(root.nodeExists(nodeQualifier))) {
            return;
        }
    } catch (BackingStoreException e) {
        return;// No need to report here as the node won't have the
        // listener
    }

    IEclipsePreferences preferences = getStorePreferences();
    if (preferences == null) {
        return;
    }
    if (preferencesListener != null) {
        preferences.removePreferenceChangeListener(preferencesListener);
        preferencesListener = null;
    }
}
项目:gwt-eclipse-plugin    文件:AbstractGwtPlugin.java   
protected static void extractJar(
    Plugin plugin, String pathInPluginJar, String pathInStateLocation)
    throws IOException {
  IPath pluginStateLocation = plugin.getStateLocation();
  File fileInStateLocation = pluginStateLocation.append(
      pathInStateLocation).toFile();
  fileInStateLocation.delete();

  FileOutputStream os = null;
  InputStream is = FileLocator.openStream(
      plugin.getBundle(), new Path(pathInPluginJar), false);

  try {
    os = new FileOutputStream(fileInStateLocation);

    byte[] buf = new byte[2048];
    int bytesRead = 0;
    while ((bytesRead = is.read(buf)) != -1) {
      os.write(buf, 0, bytesRead);
    }
  } finally {
    closeStreams(is, os);
  }
}
项目:APICloud-Studio    文件:IdeLog.java   
/**
 * Flushes any cached logging messages
 */
public static void flushCache()
{
    caching = false;

    for (Map.Entry<Plugin, List<IStatus>> entry : earlyMessageCache.entrySet())
    {
        for (IStatus status : entry.getValue())
        {
            StatusLevel severity = getStatusLevel(status.getSeverity());
            if (status.getSeverity() == IStatus.ERROR || isOutputEnabled(entry.getKey(), severity, null))
            {
                log(entry.getKey(), status.getSeverity(), status.getMessage(), null, status.getException());
            }
        }
    }

    earlyMessageCache.clear();
}
项目:APICloud-Studio    文件:IdeLog.java   
/**
 * Are we currently outputting items of this severity and this scope? Use this method if you want to check before
 * actually composing an error message.
 * 
 * @return
 */
public static boolean isOutputEnabled(Plugin plugin, StatusLevel severity, String scope)
{
    if (!isSeverityEnabled(severity))
    {
        return false;
    }
    try
    {
        if (!Platform.inDebugMode())
        {
            return true;
        }
    }
    catch (Exception e)
    {
        // ignore. May happen if we're running unit tests outside IDE
    }

    return isScopeEnabled(scope);
}
项目:APICloud-Studio    文件:IdeLog.java   
/**
 * Constructs the message to log
 * 
 * @param plugin
 * @param severity
 * @param message
 * @param scope
 * @param th
 * @return
 */
public static String buildMessage(Plugin plugin, int severity, String message, String scope, Throwable th)
{
    if (scope == null)
    {
        scope = StringUtil.EMPTY;
    }

    String version;
    if (EclipseUtil.isStandalone())
    {
        version = EclipseUtil.getProductVersion();
    }
    else
    {
        version = EclipseUtil.getStudioVersion();
    }
    return MessageFormat.format("(Build {0}) {1} {2} {3}", //$NON-NLS-1$
            version, getLabel(severity), scope, message);
}
项目:OpenSPIFe    文件:TestUtil.java   
/**
 * Finds a URL for test data checked into a local data-test directory.
 * Should work if Run As a JUnit Test or JUnit Plugin Test,
 * as well as Bamboo.  (For Bamboo, remember to check the box for the data-test folder
 * in the plugin's build.xml editor)
 * @param yourPlugin -- use something like Activator.getDefault()
 * @param filePath -- e.g. "data-test/foo.xml" (use slash URL separator, not platform-specific File.separator).
 * @return URL (hint: call openStream)
 * @throws FileNotFoundException
 * @see SharedTestData for large data files you don't want checked out and delivered with the product
 */
public static URL findTestData(Plugin yourPlugin, String filePath) throws FileNotFoundException {
    URL url;
    try {
        if (yourPlugin==null) {
            url = new File(filePath).toURI().toURL();
        } else {
            url = FileLocator.find(yourPlugin.getBundle(),
                    new Path(filePath),
                    null);
        }
    } catch (IOException e) {
        throw(new FileNotFoundException(filePath + " (" + e.toString() + ")"));
    }
    if (url==null) {
        throw new FileNotFoundException("Can't find URL " + filePath);
    }
    return url;
}
项目:OpenSPIFe    文件:TestUtil.java   
/**
 * @param yourPlugin -- use something like Activator.getDefault()
 * @param directoryPath -- e.g. "data-test/" (use slash URL separator, not platform-specific File.separator).
 * @return Listing of directory as a List of URLs.
 * @throws FileNotFoundException
 * @see SharedTestData for large data files you don't want checked out and delivered with the product
 */
public static List<URL> listURLContents(Plugin yourPlugin, String directoryPath) throws FileNotFoundException {
    List<URL> toRet = new ArrayList<URL>();
    if (yourPlugin == null) {
        File dirFile = new File(directoryPath);
        for (File child : dirFile.listFiles()) {
            try {
                toRet.add(child.toURI().toURL());
            } catch (MalformedURLException e) {
                throw(new FileNotFoundException(directoryPath + " (" + e.toString() + ")"));
            }
        }
    } else {
        Bundle bundle = yourPlugin.getBundle();
        Enumeration entryPaths = bundle.getEntryPaths(directoryPath);
        while (entryPaths.hasMoreElements()) {
            String entryPath = (String) entryPaths.nextElement();
            toRet.add(bundle.getEntry(entryPath));
        }
    }
    return toRet;
}
项目:e4Preferences    文件:ScopedPreferenceStore.java   
/**
 * Dispose the receiver.
 */
private void disposePreferenceStoreListener() {

    IEclipsePreferences root = (IEclipsePreferences) Platform
            .getPreferencesService().getRootNode().node(
                    Plugin.PLUGIN_PREFERENCE_SCOPE);
    try {
        if (!(root.nodeExists(nodeQualifier))) {
            return;
        }
    } catch (BackingStoreException e) {
        return;// No need to report here as the node won't have the
        // listener
    }

    IEclipsePreferences preferences = getStorePreferences();
    if (preferences == null) {
        return;
    }
    if (preferencesListener != null) {
        preferences.removePreferenceChangeListener(preferencesListener);
        preferencesListener = null;
    }
}
项目:eclipse-silverstripedt    文件:DefaultLanguageModelProvider.java   
/**
 * Gets the plugin based on the project
 * @param project Project to look for the language plugin for
 * @return Language plugin for the current project
 */
public Plugin getPlugin(IScriptProject project) {
    String ssVersion=CorePreferencesSupport.getInstance().getProjectSpecificPreferencesValue(SilverStripePreferences.SILVERSTRIPE_VERSION, SilverStripeVersion.getDefaultVersion(), project.getProject());

    IConfigurationElement languageProvider=SilverStripeVersion.getLanguageDefinition(ssVersion);
    if(languageProvider!=null) {
        Object o;
        try {
            o = languageProvider.createExecutableExtension("activator");
            if(o instanceof AbstractUIPlugin) {
                return (AbstractUIPlugin) o;
            }
        } catch (CoreException e) {
            e.printStackTrace();
        }
    }

    return SilverStripePDTPlugin.getDefault();
}
项目:egradle    文件:EclipseResourceHelper.java   
public IFile createLinkedFile(IContainer container, IPath linkPath, Plugin plugin, IPath linkedFileTargetPath)
        throws CoreException {
    File file = getFileInPlugin(plugin, linkedFileTargetPath);
    IFile iFile = container.getFile(linkPath);
    iFile.createLink(new Path(file.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
    return iFile;
}
项目:egradle    文件:EclipseResourceHelper.java   
public IFolder createLinkedFolder(IContainer container, IPath linkPath, Plugin plugin, IPath linkedFolderTargetPath)
        throws CoreException {
    File file = getFileInPlugin(plugin, linkedFolderTargetPath);
    IFolder iFolder = container.getFolder(linkPath);
    iFolder.createLink(new Path(file.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
    return iFolder;
}
项目:egradle    文件:EclipseResourceHelper.java   
public File getFileInPlugin(Plugin plugin, IPath path) throws CoreException {
    try {
        URL installURL = plugin.getBundle().getEntry(path.toString());
        URL localURL = FileLocator.toFileURL(installURL);
        return new File(localURL.getFile());
    } catch (IOException e) {
        throw new PathException(IStatus.ERROR, path, "cannot get file in plugin", e);
    }
}
项目:http4e    文件:BaseUtils.java   
public static void writeToPrefs( String prefName, byte[] prefData){
   try {
      Plugin pl = (Plugin) CoreContext.getContext().getObject("p");
      Preferences prefs = pl.getPluginPreferences();

      String str64 = new String(Base64.encodeBase64(prefData), "UTF8");
      prefs.setValue(prefName, str64);
      pl.savePluginPreferences();

   } catch (UnsupportedEncodingException e) {
      ExceptionHandler.handle(e);
   } catch (Exception ignore) {
      ExceptionHandler.handle(ignore);
   }
}
项目:http4e    文件:BaseUtils.java   
public static byte[] readFromPrefs( String prefName){
   try {
      Plugin pl = (Plugin) CoreContext.getContext().getObject("p");
      Preferences prefs = pl.getPluginPreferences();
      String str64 = prefs.getString(prefName);
      byte[] data = Base64.decodeBase64(str64.getBytes("UTF8"));
      return data;

   } catch (UnsupportedEncodingException e) {
      ExceptionHandler.handle(e);
   } catch (Exception ignore) {
      ExceptionHandler.handle(ignore);
   }
   return null;
}
项目:gwt-eclipse-plugin    文件:PluginProperties.java   
/**
 * Create an instance by reading in the properties file associated with the
 * plugin class. If there is a failure while reading the file, then fail
 * silently and output an error message.
 * 
 * @param pluginClass the plugin class for which the associated properties
 *          should be loaded
 */
public PluginProperties(Class<? extends Plugin> pluginClass) {
  String propsPath = pluginClass.getName().replace('.', '/').concat(
      ".properties");

  props = new Properties();

  try {
    InputStream instream = pluginClass.getClassLoader().getResourceAsStream(
        propsPath);

    if (instream != null) {
      props.load(instream);
    } else {
      System.err.println("Unable to read properties from file " + propsPath
          + ". The " + pluginClass.getName()
          + " plugin may not run correctly.");
    }
  } catch (IOException iox) {
    /*
     * TODO: Once we start exposing property values through accessors off of
     * plugin classes, we'll be able to pass a proper logger. Right now, we
     * can't do this, because this code is called from static blocks in the
     * plugin classes.
     */
    System.err.println("Unable to read properties from file " + propsPath
        + ". The " + pluginClass.getName() + " plugin may not run correctly.");
    iox.printStackTrace();
  }
}
项目:PDFReporter-Studio    文件:PluginUtilities.java   
/**
 * Return the name of the given plug-in. If the plug-in does not have a name, return the unique
 * identifier for the plug-in instead.
 * 
 * @return the name of the given plug-in
 */
public static String getName(Plugin plugin) {
  String label;
  Object bundleName;
  label = null;
  bundleName = plugin.getBundle().getHeaders().get(org.osgi.framework.Constants.BUNDLE_NAME);
  if (bundleName instanceof String) {
    label = (String) bundleName;
  }
  if (label == null || label.trim().length() == 0) {
    return getId(plugin);
  }
  return label;
}
项目:PDFReporter-Studio    文件:PluginUtilities.java   
/**
 * Return the version identifier associated with the plug-in with the given identifier, or
 * <code>null</code> if there is no such plug-in.
 * 
 * @param pluginId
 *          the identifier of the plug-in
 * 
 * @return the version identifier for the specified plug-in
 */
public static Version getVersion(Plugin plugin) {
  String version;
  if (plugin == null) {
    return null;
  }
  version =
      (String) plugin.getBundle().getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
  return new Version(version);
}
项目:APICloud-Studio    文件:IdeLog.java   
/**
 * Logs an error
 * 
 * @param plugin
 * @param message
 * @param th
 */
public static void logError(Plugin plugin, String message, Throwable th, String scope)
{
    if (isErrorEnabled(plugin, scope))
    {
        log(plugin, IStatus.ERROR, message, scope, th);
    }
    else
    {
        logTrace(plugin, IStatus.ERROR, message, scope, th);
    }
}
项目:APICloud-Studio    文件:IdeLog.java   
/**
 * Logs a warning
 * 
 * @param plugin
 * @param message
 * @param th
 */
public static void logWarning(Plugin plugin, String message, Throwable th, String scope)
{
    if (isWarningEnabled(plugin, scope))
    {
        log(plugin, IStatus.WARNING, message, scope, th);
    }
    else
    {
        logTrace(plugin, IStatus.INFO, message, scope, th);
    }
}
项目:APICloud-Studio    文件:IdeLog.java   
/**
 * Logs an informational message
 * 
 * @param plugin
 * @param message
 * @param th
 */
public static void logInfo(Plugin plugin, String message, Throwable th, String scope)
{
    if (isInfoEnabled(plugin, scope))
    {
        log(plugin, IStatus.INFO, message, scope, th);
    }
    else
    {
        logTrace(plugin, IStatus.INFO, message, scope, th);
    }
}
项目:APICloud-Studio    文件:IdeLog.java   
/**
 * Trace this message out anyway if we are in debug mode
 * 
 * @param plugin
 * @param message
 * @param scope
 * @param th
 */
private static void logTrace(Plugin plugin, int severity, String message, String scope, Throwable th)
{
    if (isScopeEnabled(IDebugScopes.LOGGER))
    {
        StatusLevel newSeverity = getStatusLevel(severity);
        boolean inSeverity = isSeverityEnabled(newSeverity);

        String cause = StringUtil.EMPTY;
        if (!inSeverity)
        {
            cause = "Not logging items of current severity."; //$NON-NLS-1$
        }
        else if (!isScopeEnabled(scope))
        {
            cause = "Scope not enabled."; //$NON-NLS-1$
        }

        String traceMessage = MessageFormat.format(
                "(Build {0}) Skipping log of {1} {2} {3}. Cause: {4}", EclipseUtil.getPluginVersion(plugin), //$NON-NLS-1$
                getLabel(severity), scope, message, cause);

        if (plugin != null)
        {
            Status logStatus = new Status(severity, plugin.getBundle().getSymbolicName(), IStatus.OK, traceMessage,
                    th);
            plugin.getLog().log(logStatus);
        }
        else
        {
            System.err.println(traceMessage); // CHECKSTYLE:ON
        }
    }
}
项目:APICloud-Studio    文件:IdeLog.java   
/**
 * Logs an item to the current plugin's log
 * 
 * @param plugin
 * @param status
 * @param message
 * @param th
 */
public static void log(Plugin plugin, int severity, String message, String scope, Throwable th)
{
    String tempMessage = buildMessage(plugin, severity, message, scope, th);
    String symbolicName = CorePlugin.PLUGIN_ID;
    if (plugin != null && plugin.getBundle() != null)
    {
        symbolicName = plugin.getBundle().getSymbolicName();
    }
    Status logStatus = new Status(severity, symbolicName, IStatus.OK, tempMessage, th);
    log(plugin, logStatus, scope);
}
项目:APICloud-Studio    文件:EclipseUtil.java   
/**
 * Retrieves the bundle version of a plugin.
 * 
 * @param plugin
 *            the plugin to retrieve from
 * @return the bundle version, or null if not found.
 */
public static String getPluginVersion(Plugin plugin)
{
    if (!isPluginLoaded(plugin))
    {
        return null;
    }
    return plugin.getBundle().getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION).toString(); // $codepro.audit.disable
                                                                                                        // com.instantiations.assist.eclipse.analysis.unnecessaryToString
}
项目:txtUML    文件:Dialogs.java   
/**
 * Opens an {@link Dialogs}
 * @param title - The title  (if null it will be "Error")
 * @param body - The message (if null it will be e.getLocalizedMessage() )
 * @param e - A Throwable
 */
public static void errorMsgb(String title, String body, Throwable e){
    Plugin plugin = ResourcesPlugin.getPlugin();
    if(title == null){
        title = "Error";
    }

    if(body == null){
        body = e.getLocalizedMessage();
    }

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw);

    final String trace = sw.toString(); // stack trace as a string

    // Temp holder of child statuses
    List<Status> childStatuses = new ArrayList<>();

    // Split output by OS-independend new-line
    for (String line : trace.split(System.getProperty("line.separator"))) {
        // build & add status
        childStatuses.add(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), line));
    }

    MultiStatus ms = new MultiStatus(plugin.getBundle().getSymbolicName(), IStatus.ERROR,
            childStatuses.toArray(new Status[] {}), // convert to array of statuses
            e.getLocalizedMessage(), e);
    ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, body, ms);
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaCore.java   
private static ClasspathContainerInitializer computeClasspathContainerInitializer(String containerID) {
    Plugin jdtCorePlugin = JavaCore.getPlugin();
    if (jdtCorePlugin == null) return null;

    IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(JavaCore.PLUGIN_ID, JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID);
    if (extension != null) {
        IExtension[] extensions =  extension.getExtensions();
        for(int i = 0; i < extensions.length; i++){
            IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
            for(int j = 0; j < configElements.length; j++){
                IConfigurationElement configurationElement = configElements[j];
                String initializerID = configurationElement.getAttribute("id"); //$NON-NLS-1$
                if (initializerID != null && initializerID.equals(containerID)){
                    if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED)
                        verbose_found_container_initializer(containerID, configurationElement);
                    try {
                        Object execExt = configurationElement.createExecutableExtension("class"); //$NON-NLS-1$
                        if (execExt instanceof ClasspathContainerInitializer){
                            return (ClasspathContainerInitializer)execExt;
                        }
                    } catch(CoreException e) {
                        // executable extension could not be created: ignore this initializer
                        if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
                            verbose_failed_to_instanciate_container_initializer(containerID, configurationElement);
                            e.printStackTrace();
                        }
                    }
                }
            }
        }
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaCore.java   
/**
 * Returns deprecation message of a given classpath variable.
 *
 * @param variableName
 * @return A string if the classpath variable is deprecated, <code>null</code> otherwise.
 * @since 3.3
 */
public static String getClasspathVariableDeprecationMessage(String variableName) {
    JavaModelManager manager = JavaModelManager.getJavaModelManager();

    // Returns the stored deprecation message
    String message = (String) manager.deprecatedVariables.get(variableName);
    if (message != null) {
        return message;
    }

    // If the variable has been already initialized, then there's no deprecation message
    IPath variablePath = manager.variableGet(variableName);
    if (variablePath != null && variablePath != JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS) {
        return null;
    }

    // Search for extension point to get the possible deprecation message
    Plugin jdtCorePlugin = JavaCore.getPlugin();
    if (jdtCorePlugin == null) return null;

    IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(JavaCore.PLUGIN_ID, JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID);
    if (extension != null) {
        IExtension[] extensions =  extension.getExtensions();
        for(int i = 0; i < extensions.length; i++){
            IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
            for(int j = 0; j < configElements.length; j++){
                IConfigurationElement configElement = configElements[j];
                String varAttribute = configElement.getAttribute("variable"); //$NON-NLS-1$
                if (variableName.equals(varAttribute)) {
                    String deprecatedAttribute = configElement.getAttribute("deprecated"); //$NON-NLS-1$
                    if (deprecatedAttribute != null) {
                        return deprecatedAttribute;
                    }
                }
            }
        }
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaCore.java   
private static ClasspathContainerInitializer computeClasspathContainerInitializer(String containerID) {
    Plugin jdtCorePlugin = JavaCore.getPlugin();
    if (jdtCorePlugin == null) return null;

    IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(JavaCore.PLUGIN_ID, JavaModelManager.CPCONTAINER_INITIALIZER_EXTPOINT_ID);
    if (extension != null) {
        IExtension[] extensions =  extension.getExtensions();
        for(int i = 0; i < extensions.length; i++){
            IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
            for(int j = 0; j < configElements.length; j++){
                IConfigurationElement configurationElement = configElements[j];
                String initializerID = configurationElement.getAttribute("id"); //$NON-NLS-1$
                if (initializerID != null && initializerID.equals(containerID)){
                    if (JavaModelManager.CP_RESOLVE_VERBOSE_ADVANCED)
                        verbose_found_container_initializer(containerID, configurationElement);
                    try {
                        Object execExt = configurationElement.createExecutableExtension("class"); //$NON-NLS-1$
                        if (execExt instanceof ClasspathContainerInitializer){
                            return (ClasspathContainerInitializer)execExt;
                        }
                    } catch(CoreException e) {
                        // executable extension could not be created: ignore this initializer
                        if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
                            verbose_failed_to_instanciate_container_initializer(containerID, configurationElement);
                            e.printStackTrace();
                        }
                    }
                }
            }
        }
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaCore.java   
/**
 * Returns deprecation message of a given classpath variable.
 *
 * @param variableName
 * @return A string if the classpath variable is deprecated, <code>null</code> otherwise.
 * @since 3.3
 */
public static String getClasspathVariableDeprecationMessage(String variableName) {
    JavaModelManager manager = JavaModelManager.getJavaModelManager();

    // Returns the stored deprecation message
    String message = (String) manager.deprecatedVariables.get(variableName);
    if (message != null) {
        return message;
    }

    // If the variable has been already initialized, then there's no deprecation message
    IPath variablePath = manager.variableGet(variableName);
    if (variablePath != null && variablePath != JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS) {
        return null;
    }

    // Search for extension point to get the possible deprecation message
    Plugin jdtCorePlugin = JavaCore.getPlugin();
    if (jdtCorePlugin == null) return null;

    IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(JavaCore.PLUGIN_ID, JavaModelManager.CPVARIABLE_INITIALIZER_EXTPOINT_ID);
    if (extension != null) {
        IExtension[] extensions =  extension.getExtensions();
        for(int i = 0; i < extensions.length; i++){
            IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
            for(int j = 0; j < configElements.length; j++){
                IConfigurationElement configElement = configElements[j];
                String varAttribute = configElement.getAttribute("variable"); //$NON-NLS-1$
                if (variableName.equals(varAttribute)) {
                    String deprecatedAttribute = configElement.getAttribute("deprecated"); //$NON-NLS-1$
                    if (deprecatedAttribute != null) {
                        return deprecatedAttribute;
                    }
                }
            }
        }
    }
    return null;
}
项目:birt    文件:PreferencesAdapterFactory.java   
public Object getAdapter( Object adaptableObject, Class adapterType )
{
    String pluginId = ( (Plugin) adaptableObject ).getBundle( )
            .getSymbolicName( );
    if ( !factoryMap.containsKey( pluginId ) )
    {
        IDEReportPreferenceFactory factory = new IDEReportPreferenceFactory( (Plugin) adaptableObject );
        factoryMap.put( pluginId, factory );
    }
    return factoryMap.get( pluginId );
}
项目:logicobjects    文件:EclipsePluginConfigurator.java   
/**
 * Prepares an Eclipse plugin to be used with LOGICOBJECTS
 * @param plugin
 */
public static void configure(Plugin plugin) {
    //enabling javassist to work correctly in Eclipse
    ClassPool classPool = ClassPool.getDefault();
    classPool.appendClassPath(new LoaderClassPath(plugin.getClass().getClassLoader()));
    LogicObjects.getDefault().getContext().getLogicObjectFactory().setClassPool(classPool);

    Vfs.addDefaultURLTypes(new BundleUrlType(plugin.getBundle()));  //enabling the Reflections filters to work in Eclipse

    String pathLogicFiles = null;
    URL urlPlugin = ClasspathHelper.forClass(plugin.getClass());
    /**
     * adding all the classes in the plugin to the search path
     * This line has to be after the call to Vfs.addDefaultURLTypes(...)
     */
    LogicObjects.getDefault().getContext().addSearchUrl(urlPlugin);
    try {
        pathLogicFiles = FileLocator.toFileURL(urlPlugin).getPath();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    /**
     * move to the directory where the plugin is deployed
     * This code uses the bootstrap engine since this engine will not trigger the loading of Logtalk
     * After we have moved to the location of the plugin files we can load logtalk afterwards
     */
    //LogicEngine.getBootstrapEngine().cd(pathLogicFiles); TODO verify that this is not needed anymore (it should work without this since all the logic files are copied to a tmp directory)


}
项目:eclipse-optimus    文件:MetadataHandler.java   
/**
 * Creates new handler for plugin with formatter
 * 
 * @param plugin
 * @param formatter
 * @throws IOException
 * @throws SecurityException
 */
public MetadataHandler(Plugin plugin, Formatter formatter) throws IOException, SecurityException {
    String filePath = String
            .format(FILEPATTERN, plugin.getStateLocation().toOSString(), System.currentTimeMillis());
    File file = new File(filePath);
    if (file.getParentFile() == null || !file.getParentFile().exists())
        file.getParentFile().mkdirs();

    this.delegate = new FileHandler(filePath);
    this.delegate.setFormatter(formatter);
}
项目:egradle    文件:EclipseResourceHelper.java   
public File createTempFileInPlugin(Plugin plugin, IPath path) {
    IPath stateLocation = plugin.getStateLocation();
    stateLocation = stateLocation.append(path);
    return stateLocation.toFile();
}
项目:workspacemechanic    文件:MechanicLog.java   
MechanicLog(Plugin plugin) {
  this(plugin.getLog());
}
项目:andmore2    文件:Activator.java   
public static Plugin getPlugin() {
    return plugin;
}
项目:Migrate-Skeletal-Implementation-to-Interface-Refactoring    文件:EvaluateMigrationOfSkeletalImplementationToInterfaceRefactoringPlugin.java   
public static Plugin getDefault() {
    return plugin;
}