Java 类com.intellij.openapi.components.ComponentManager 实例源码

项目:intellij-ce-playground    文件:StorageUtil.java   
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);
}
项目:squirrel-lang-idea-plugin    文件:SquirrelIdeaSdkService.java   
@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);
    }
}
项目:squirrel-lang-idea-plugin    文件:SquirrelIdeaSdkService.java   
@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);
    }
}
项目:squirrel-lang-idea-plugin    文件:SquirrelSdkService.java   
@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);
        }
    });
}
项目:tools-idea    文件:ServiceManagerImpl.java   
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);
}
项目:intellij-ce-playground    文件:DisposeAwareRunnable.java   
@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();
}
项目: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);
}
项目:squirrel-lang-idea-plugin    文件:SquirrelSdkService.java   
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);
        }
    });
}
项目:tools-idea    文件:CoreProjectLoader.java   
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;
}
项目:tools-idea    文件:DisposeAwareRunnable.java   
@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();
}
项目:consulo    文件:DisposeAwareRunnable.java   
@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();
}
项目:intellij-ce-playground    文件:CoreProjectLoader.java   
@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);
}
项目:intellij-ce-playground    文件:DisposeAwareProjectChange.java   
protected DisposeAwareProjectChange(@NotNull ComponentManager componentManager) {
  myComponentManager = componentManager;
}
项目:intellij-ce-playground    文件:PlatformLiteFixture.java   
public static <T> T registerComponentInstance(final ComponentManager container, final Class<T> key, final T implementation) {
  return registerComponentInstance((MutablePicoContainer)container.getPicoContainer(), key, implementation);
}
项目:intellij-ce-playground    文件:ConfigurablesGroupBase.java   
protected ConfigurablesGroupBase(ComponentManager componentManager, final ExtensionPointName<ConfigurableEP<Configurable>> configurablesExtensionPoint,
                                 boolean loadComponents) {
  myComponentManager = componentManager;
  myConfigurablesExtensionPoint = configurablesExtensionPoint;
  myLoadComponents = loadComponents;
}
项目:intellij-ce-playground    文件:PlatformComponentManagerImpl.java   
protected PlatformComponentManagerImpl(@Nullable ComponentManager parent) {
  super(parent);
}
项目:intellij-ce-playground    文件:PlatformComponentManagerImpl.java   
protected PlatformComponentManagerImpl(@Nullable ComponentManager parent, @NotNull String name) {
  super(parent, name);
}
项目:intellij-ce-playground    文件:ComponentManagerImpl.java   
protected ComponentManagerImpl(@Nullable ComponentManager parentComponentManager) {
  myParentComponentManager = parentComponentManager;
  bootstrapPicoContainer(toString());
}
项目:intellij-ce-playground    文件:ComponentManagerImpl.java   
protected ComponentManagerImpl(@Nullable ComponentManager parentComponentManager, @NotNull String name) {
  myParentComponentManager = parentComponentManager;
  bootstrapPicoContainer(name);
}
项目:intellij-ce-playground    文件:ComponentManagerImpl.java   
protected final ComponentManager getParentComponentManager() {
  return myParentComponentManager;
}
项目:tools-idea    文件:PlatformLiteFixture.java   
public static <T> T registerComponentInstance(final ComponentManager container, final Class<T> key, final T implementation) {
  return registerComponentInstance((MutablePicoContainer)container.getPicoContainer(), key, implementation);
}
项目:tools-idea    文件:ConfigurablesGroupBase.java   
protected ConfigurablesGroupBase(ComponentManager componentManager, final ExtensionPointName<ConfigurableEP<Configurable>> configurablesExtensionPoint,
                                 boolean loadComponents) {
  myComponentManager = componentManager;
  myConfigurablesExtensionPoint = configurablesExtensionPoint;
  myLoadComponents = loadComponents;
}
项目:consulo    文件:DisposeAwareProjectChange.java   
protected DisposeAwareProjectChange(@Nonnull ComponentManager componentManager) {
  myComponentManager = componentManager;
}
项目:consulo    文件:PlatformLiteFixture.java   
public static <T> T registerComponentInstance(final ComponentManager container, final Class<T> key, final T implementation) {
  return registerComponentInstance((MutablePicoContainer)container.getPicoContainer(), key, implementation);
}
项目:consulo    文件:MultiHostInjectorExtensionPoint.java   
@Nonnull
public MultiHostInjector getInstance(@Nonnull ComponentManager componentManager) {
  return instantiate(myImplementationClassHandler.getValue(), componentManager.getPicoContainer());
}
项目:consulo    文件:PlatformComponentManagerImpl.java   
protected PlatformComponentManagerImpl(ComponentManager parent) {
  super(parent);
}
项目:consulo    文件:PlatformComponentManagerImpl.java   
protected PlatformComponentManagerImpl(ComponentManager parent, @Nonnull String name) {
  super(parent, name);
}