Ejemplo n.º 1
0
 public void unregisterExtension(String pluginName, Element extensionElement) {
   String epName = extractEPName(extensionElement);
   if (!myExtensionElement2extension.containsKey(extensionElement)) {
     XMLOutputter xmlOutputter = new XMLOutputter();
     Format format =
         Format.getCompactFormat().setIndent("  ").setTextMode(Format.TextMode.NORMALIZE);
     xmlOutputter.setFormat(format);
     StringWriter stringWriter = new StringWriter();
     try {
       xmlOutputter.output(extensionElement, stringWriter);
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
     myLogger.warn(stringWriter.toString());
     throw new IllegalArgumentException(
         "Trying to unregister extension element that was never registered");
   }
   ExtensionComponentAdapter adapter = myExtensionElement2extension.remove(extensionElement);
   if (adapter == null) return;
   if (getExtensionPoint(epName).unregisterComponentAdapter(adapter)) {
     MutablePicoContainer pluginContainer = internalGetPluginContainer();
     pluginContainer.unregisterComponent(adapter.getComponentKey());
     if (pluginContainer.getComponentAdapters().isEmpty()) {
       disposePluginContainer(pluginName);
     }
   }
 }
Ejemplo n.º 2
0
 public void removeAllComponents(final Set<ExtensionComponentAdapter> extensionAdapters) {
   for (final Object extensionAdapter : extensionAdapters) {
     ExtensionComponentAdapter componentAdapter = (ExtensionComponentAdapter) extensionAdapter;
     internalGetPluginContainer().unregisterComponent(componentAdapter.getComponentKey());
   }
 }