示例#1
0
  public PluginRef unregPlugin(Plugin plugin) {
    try {
      if (plugin.getStatus() == PluginStatus.START) {
        plugin.stop();
      }
      if (plugin.getStatus() == PluginStatus.STOP) {
        plugin.destroy();
      }
    } catch (PluginException e) {
      _LOG.error(e.getLocalizedMessage());
    }

    synchronized (_plugins) {
      PluginRef ref = _plugins.get(plugin.getID());
      if (ref != null) {
        if (!ref.isUpdating()) {
          _plugins.remove(plugin.getID());
          ref.dispose();
        }
        removeDispatchSource(ref); //
        ref.setPlugin(null);
      }
      return ref;
    }
  }
 /**
  * Unloads the plugin. The effectively shuts the plugin down and removes it from the
  * PluginRegistry's resource loaders.
  *
  * @throws Exception
  */
 public synchronized void unload() throws Exception {
   if (plugin != null) {
     plugin.stop();
     // it's important that the plugin be removed from the resource loading system after shutdown
     // in
     // case the plugin needs to access the resource loader during shutdown
     registry.removeResourceLoader(plugin.getName());
   }
   loaded = false;
 }
示例#3
0
  /** This method is called when the plug-in is stopped */
  public void stop(BundleContext context) throws Exception {

    Object[] listeners = shutdownListeners.getListeners();
    for (int i = 0; i < listeners.length; ++i) {
      ((IShutdownListener) listeners[i]).shutdown();
    }
    shutdownListeners.clear();

    super.stop(context);

    ResourcesPlugin.getWorkspace().removeResourceChangeListener(projectConvertListener);

    ResourcesPlugin.getWorkspace().removeResourceChangeListener(reindexOperationListener);

    plugin = null;
  }
示例#4
0
 /** Terminates the plugin. */
 public void stop() {
   Plugin plugin = getPlugin();
   if (plugin != null) {
     try {
       LOGGER.log(Level.FINE, "Stopping {0}", shortName);
       plugin.stop();
     } catch (Throwable t) {
       LOGGER.log(WARNING, "Failed to shut down " + shortName, t);
     }
   } else {
     LOGGER.log(Level.FINE, "Could not find Plugin instance to stop for {0}", shortName);
   }
   // Work around a bug in commons-logging.
   // See http://www.szegedi.org/articles/memleak.html
   LogFactory.release(classLoader);
 }
示例#5
0
 /*
  * (non-Javadoc)
  * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
  */
 public void stop(BundleContext context) throws Exception {
   plugin = null;
   super.stop(context);
 }
 public void stop(BundleContext context) throws Exception {
   super.stop(context);
   tracker.close();
   jschService.unregister();
 }