Java 类com.intellij.openapi.components.ex.ComponentManagerEx 实例源码

项目:consulo    文件:ServiceManagerImpl.java   
protected void installEP(final ExtensionPointName<ServiceDescriptor> pointName, final ComponentManager componentManager) {
  myExtensionPointName = pointName;
  final ExtensionPoint<ServiceDescriptor> extensionPoint = Extensions.getArea(null).getExtensionPoint(pointName);
  final MutablePicoContainer picoContainer = (MutablePicoContainer)componentManager.getPicoContainer();

  myExtensionPointListener = new ExtensionPointListener<ServiceDescriptor>() {
    @Override
    public void extensionAdded(@Nonnull final ServiceDescriptor descriptor, final PluginDescriptor pluginDescriptor) {
      picoContainer.registerComponent(new MyComponentAdapter(descriptor, pluginDescriptor, (ComponentManagerEx)componentManager));
    }

    @Override
    public void extensionRemoved(@Nonnull final ServiceDescriptor extension, final PluginDescriptor pluginDescriptor) {
      picoContainer.unregisterComponent(extension.getInterface());
    }
  };
  extensionPoint.addExtensionPointListener(myExtensionPointListener);
}
项目:intellij-ce-playground    文件:ServiceManagerImpl.java   
protected void installEP(@NotNull ExtensionPointName<ServiceDescriptor> pointName, @NotNull final ComponentManager componentManager) {
  LOG.assertTrue(myExtensionPointName == null, "Already called installEP with " + myExtensionPointName);
  myExtensionPointName = pointName;
  final ExtensionPoint<ServiceDescriptor> extensionPoint = Extensions.getArea(null).getExtensionPoint(pointName);
  final MutablePicoContainer picoContainer = (MutablePicoContainer)componentManager.getPicoContainer();

  myExtensionPointListener = new ExtensionPointListener<ServiceDescriptor>() {
    @Override
    public void extensionAdded(@NotNull final ServiceDescriptor descriptor, final PluginDescriptor pluginDescriptor) {
      if (descriptor.overrides) {
        // Allow to re-define service implementations in plugins.
        ComponentAdapter oldAdapter = picoContainer.unregisterComponent(descriptor.getInterface());
        if (oldAdapter == null) {
          throw new RuntimeException("Service: " + descriptor.getInterface() + " doesn't override anything");
        }
      }

      if (!ComponentManagerImpl.isComponentSuitableForOs(descriptor.os)) {
        return;
      }

      // empty serviceImplementation means we want to unregister service
      if (!StringUtil.isEmpty(descriptor.getImplementation())) {
        picoContainer.registerComponent(new MyComponentAdapter(descriptor, pluginDescriptor, (ComponentManagerEx)componentManager));
      }
    }

    @Override
    public void extensionRemoved(@NotNull final ServiceDescriptor extension, final PluginDescriptor pluginDescriptor) {
      picoContainer.unregisterComponent(extension.getInterface());
    }
  };
  extensionPoint.addExtensionPointListener(myExtensionPointListener);
}
项目:intellij-ce-playground    文件:ServiceManagerImpl.java   
public MyComponentAdapter(final ServiceDescriptor descriptor, final PluginDescriptor pluginDescriptor, ComponentManagerEx componentManager) {
  myDescriptor = descriptor;
  myPluginDescriptor = pluginDescriptor;
  myComponentManager = componentManager;
  myDelegate = null;
}
项目:tools-idea    文件:ServiceManagerImpl.java   
public MyComponentAdapter(final ServiceDescriptor descriptor, final PluginDescriptor pluginDescriptor, ComponentManagerEx componentManager) {
  myDescriptor = descriptor;
  myPluginDescriptor = pluginDescriptor;
  myComponentManager = componentManager;
  myDelegate = null;
}
项目:consulo    文件:ServiceManagerImpl.java   
public MyComponentAdapter(final ServiceDescriptor descriptor, final PluginDescriptor pluginDescriptor, ComponentManagerEx componentManager) {
  myDescriptor = descriptor;
  myPluginDescriptor = pluginDescriptor;
  myComponentManager = componentManager;
  myDelegate = null;
}