本文整理汇总了Java中com.intellij.openapi.components.ComponentManager类的典型用法代码示例。如果您正苦于以下问题:Java ComponentManager类的具体用法?Java ComponentManager怎么用?Java ComponentManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentManager类属于com.intellij.openapi.components包,在下文中一共展示了ComponentManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collect
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
private static void collect(@NotNull ComponentManager componentManager,
@NotNull Set<String> unknownMacros,
@NotNull Map<TrackingPathMacroSubstitutor, IComponentStore> substitutorToStore) {
IComponentStore store = ServiceKt.getStateStore(componentManager);
TrackingPathMacroSubstitutor substitutor = store.getStateStorageManager().getMacroSubstitutor();
if (substitutor == null) {
return;
}
Set<String> macros = substitutor.getUnknownMacros(null);
if (macros.isEmpty()) {
return;
}
unknownMacros.addAll(macros);
substitutorToStore.put(substitutor, store);
}
示例2: getSdkHomePath
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
@Override
public String getSdkHomePath(@Nullable final Module module) {
if (isSquirrelModule(module)) {
ComponentManager holder = ObjectUtils.notNull(module, myProject);
return CachedValuesManager.getManager(myProject).getCachedValue(holder, new CachedValueProvider<String>() {
@Nullable
@Override
public Result<String> compute() {
Sdk sdk = getSquirrelSdk(module);
return Result.create(sdk != null ? sdk.getHomePath() : null, SquirrelIdeaSdkService.this);
}
});
}
else {
return super.getSdkHomePath(module);
}
}
示例3: getSdkVersion
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
@Nullable
@Override
public String getSdkVersion(@Nullable final Module module) {
if (isSquirrelModule(module)) {
ComponentManager holder = ObjectUtils.notNull(module, myProject);
return CachedValuesManager.getManager(myProject).getCachedValue(holder, new CachedValueProvider<String>() {
@Nullable
@Override
public Result<String> compute() {
Sdk sdk = getSquirrelSdk(module);
return Result.create(sdk != null ? sdk.getVersionString() : null, SquirrelIdeaSdkService.this);
}
});
}
else {
return super.getSdkVersion(module);
}
}
示例4: getSdkVersion
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
@Nullable
public String getSdkVersion(@Nullable final Module module) {
ComponentManager holder = ObjectUtils.notNull(module, myProject);
return CachedValuesManager.getManager(myProject).getCachedValue(holder, new CachedValueProvider<String>() {
@Nullable
@Override
public Result<String> compute() {
String result = null;
String sdkHomePath = getSdkHomePath(module);
if (sdkHomePath != null) {
result = SquirrelSdkUtil.retrieveSquirrelVersion(sdkHomePath);
}
return Result.create(result, SquirrelSdkService.this);
}
});
}
示例5: installEP
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
protected void installEP(final ExtensionPointName<ServiceDescriptor> pointName, final ComponentManager componentManager) {
myExtensionPointName = pointName;
final ExtensionPoint<ServiceDescriptor> extensionPoint = Extensions.getArea(null).getExtensionPoint(pointName);
assert extensionPoint != null;
final MutablePicoContainer picoContainer = (MutablePicoContainer)componentManager.getPicoContainer();
myExtensionPointListener = new ExtensionPointListener<ServiceDescriptor>() {
public void extensionAdded(@NotNull final ServiceDescriptor descriptor, final PluginDescriptor pluginDescriptor) {
if (descriptor.overrides) {
ComponentAdapter oldAdapter =
picoContainer.unregisterComponent(descriptor.getInterface());// Allow to re-define service implementations in plugins.
if (oldAdapter == null) {
throw new RuntimeException("Service: " + descriptor.getInterface() + " doesn't override anything");
}
}
picoContainer.registerComponent(new MyComponentAdapter(descriptor, pluginDescriptor, (ComponentManagerEx)componentManager));
}
public void extensionRemoved(@NotNull final ServiceDescriptor extension, final PluginDescriptor pluginDescriptor) {
picoContainer.unregisterComponent(extension.getInterface());
}
};
extensionPoint.addExtensionPointListener(myExtensionPointListener);
}
示例6: run
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
@Override
public void run() {
Object res = get();
if (res == null) return;
if (res instanceof PsiElement) {
if (!((PsiElement)res).isValid()) return;
}
else if (res instanceof ComponentManager) {
if (((ComponentManager)res).isDisposed()) return;
}
myDelegate.run();
}
示例7: installEP
import com.intellij.openapi.components.ComponentManager; //导入依赖的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);
}
示例8: getSdkHomeLibPath
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
private String getSdkHomeLibPath(@Nullable Module module) {
ComponentManager holder = ObjectUtils.notNull(module, myProject);
return CachedValuesManager.getManager(myProject).getCachedValue(holder, new CachedValueProvider<String>() {
@Nullable
@Override
public Result<String> compute() {
return Result.create(ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@Nullable
@Override
public String compute() {
LibraryTable table = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject);
for (Library library : table.getLibraries()) {
String libraryName = library.getName();
if (libraryName != null && libraryName.startsWith(LIBRARY_NAME)) {
for (VirtualFile root : library.getFiles(OrderRootType.CLASSES)) {
if (isSquirrelSdkLibRoot(root)) {
return root.getCanonicalPath();
}
}
}
}
return null;
}
}), SquirrelSdkService.this);
}
});
}
示例9: loadStorageFile
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
public static StorageData loadStorageFile(ComponentManager componentManager, VirtualFile modulesXml) throws JDOMException, IOException {
final Document document = JDOMUtil.loadDocument(new ByteArrayInputStream(modulesXml.contentsToByteArray()));
StorageData storageData = new StorageData("project");
final Element element = document.getRootElement();
PathMacroManager.getInstance(componentManager).expandPaths(element);
storageData.load(element);
return storageData;
}
示例10: loadStorageFile
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
@NotNull
public static TreeMap<String, Element> loadStorageFile(@NotNull ComponentManager componentManager, @NotNull VirtualFile modulesXml) throws JDOMException, IOException {
return FileStorageCoreUtil.load(JDOMUtil.loadDocument(modulesXml.contentsToByteArray()).getRootElement(), PathMacroManager.getInstance(componentManager), false);
}
示例11: DisposeAwareProjectChange
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
protected DisposeAwareProjectChange(@NotNull ComponentManager componentManager) {
myComponentManager = componentManager;
}
示例12: registerComponentInstance
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
public static <T> T registerComponentInstance(final ComponentManager container, final Class<T> key, final T implementation) {
return registerComponentInstance((MutablePicoContainer)container.getPicoContainer(), key, implementation);
}
示例13: ConfigurablesGroupBase
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
protected ConfigurablesGroupBase(ComponentManager componentManager, final ExtensionPointName<ConfigurableEP<Configurable>> configurablesExtensionPoint,
boolean loadComponents) {
myComponentManager = componentManager;
myConfigurablesExtensionPoint = configurablesExtensionPoint;
myLoadComponents = loadComponents;
}
示例14: PlatformComponentManagerImpl
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
protected PlatformComponentManagerImpl(@Nullable ComponentManager parent) {
super(parent);
}
示例15: ComponentManagerImpl
import com.intellij.openapi.components.ComponentManager; //导入依赖的package包/类
protected ComponentManagerImpl(@Nullable ComponentManager parentComponentManager) {
myParentComponentManager = parentComponentManager;
bootstrapPicoContainer(toString());
}