Ejemplo n.º 1
0
  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);
  }
Ejemplo n.º 2
0
 public void unregisterExtensionPoint(final String extensionPointName) {
   ExtensionPoint extensionPoint = myExtensionPoints.get(extensionPointName);
   if (extensionPoint != null) {
     extensionPoint.reset();
     myExtensionPoints.remove(extensionPointName);
     notifyEPRemoved(extensionPoint);
   }
 }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
 @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);
      }
    }
  }