本文整理匯總了Java中com.intellij.openapi.components.ex.ComponentManagerEx類的典型用法代碼示例。如果您正苦於以下問題:Java ComponentManagerEx類的具體用法?Java ComponentManagerEx怎麽用?Java ComponentManagerEx使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ComponentManagerEx類屬於com.intellij.openapi.components.ex包,在下文中一共展示了ComponentManagerEx類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: installEP
import com.intellij.openapi.components.ex.ComponentManagerEx; //導入依賴的package包/類
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);
}
示例2: installEP
import com.intellij.openapi.components.ex.ComponentManagerEx; //導入依賴的package包/類
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);
}
示例3: MyComponentAdapter
import com.intellij.openapi.components.ex.ComponentManagerEx; //導入依賴的package包/類
public MyComponentAdapter(final ServiceDescriptor descriptor, final PluginDescriptor pluginDescriptor, ComponentManagerEx componentManager) {
myDescriptor = descriptor;
myPluginDescriptor = pluginDescriptor;
myComponentManager = componentManager;
myDelegate = null;
}