public void registerExtension( final PluginDescriptor pluginDescriptor, final Element extensionElement) { final PluginId pluginId = pluginDescriptor.getPluginId(); String epName = extractEPName(extensionElement); ExtensionComponentAdapter adapter; final PicoContainer container = getPluginContainer(pluginId.getIdString()); final ExtensionPoint extensionPoint = getExtensionPoint(epName); if (extensionPoint.getKind() == ExtensionPoint.Kind.INTERFACE) { String implClass = extensionElement.getAttributeValue("implementation"); if (implClass == null) { throw new RuntimeException( "'implementation' attribute not specified for '" + epName + "' extension in '" + pluginId.getIdString() + "' plugin"); } adapter = new ExtensionComponentAdapter( implClass, extensionElement, container, pluginDescriptor, shouldDeserializeInstance(extensionElement)); } else { adapter = new ExtensionComponentAdapter( extensionPoint.getClassName(), extensionElement, container, pluginDescriptor, true); } myExtensionElement2extension.put(extensionElement, adapter); internalGetPluginContainer().registerComponent(adapter); getExtensionPoint(epName).registerExtensionAdapter(adapter); }
public void unregisterExtensionPoint(final String extensionPointName) { ExtensionPoint extensionPoint = myExtensionPoints.get(extensionPointName); if (extensionPoint != null) { extensionPoint.reset(); myExtensionPoints.remove(extensionPointName); notifyEPRemoved(extensionPoint); } }
public void resumeInteractions() { myAvailabilityNotificationsActive = true; ExtensionPoint[] extensionPoints = getExtensionPoints(); for (ExtensionPoint extensionPoint : extensionPoints) { extensionPoint.getExtensions(); // creates extensions from ComponentAdapters } for (Runnable action : mySuspendedListenerActions) { try { action.run(); } catch (Exception e) { myLogger.error(e); } } mySuspendedListenerActions.clear(); }
@SuppressWarnings({"unchecked"}) private void notifyEPRemoved(final ExtensionPoint extensionPoint) { Collection<ExtensionPointAvailabilityListener> listeners = myAvailabilityListeners.get(extensionPoint.getName()); for (final ExtensionPointAvailabilityListener listener : listeners) { notifyUnavailableListener(extensionPoint, listener); } }
private static void registerExtensionPointsAndExtensions( ExtensionsArea area, List<IdeaPluginDescriptorImpl> loadedPlugins) { for (IdeaPluginDescriptorImpl descriptor : loadedPlugins) { descriptor.registerExtensionPoints(area); } Set<String> epNames = ContainerUtil.newHashSet(); for (ExtensionPoint point : area.getExtensionPoints()) { epNames.add(point.getName()); } for (IdeaPluginDescriptorImpl descriptor : loadedPlugins) { for (String epName : epNames) { descriptor.registerExtensions(area, epName); } } }