Search in sources :

Example 1 with DefaultPicoContainer

use of com.intellij.util.pico.DefaultPicoContainer in project intellij-community by JetBrains.

the class EditorTypedHandlerBean method getHandler.

public TypedActionHandler getHandler(TypedActionHandler originalHandler) {
    if (myHandler == null) {
        try {
            DefaultPicoContainer container = new DefaultPicoContainer(ApplicationManager.getApplication().getPicoContainer());
            container.registerComponentInstance(originalHandler);
            myHandler = instantiate(implementationClass, container);
        } catch (Exception e) {
            LOG.error(e);
            return null;
        }
    }
    return myHandler;
}
Also used : DefaultPicoContainer(com.intellij.util.pico.DefaultPicoContainer)

Example 2 with DefaultPicoContainer

use of com.intellij.util.pico.DefaultPicoContainer in project intellij-community by JetBrains.

the class EditorActionHandlerBean method getHandler.

public EditorActionHandler getHandler(EditorActionHandler originalHandler) {
    if (myHandler == null) {
        try {
            DefaultPicoContainer container = new DefaultPicoContainer(ApplicationManager.getApplication().getPicoContainer());
            container.registerComponentInstance(originalHandler);
            myHandler = instantiate(implementationClass, container);
        } catch (Exception e) {
            LOG.error(e);
            return null;
        }
    }
    return myHandler;
}
Also used : DefaultPicoContainer(com.intellij.util.pico.DefaultPicoContainer)

Example 3 with DefaultPicoContainer

use of com.intellij.util.pico.DefaultPicoContainer in project android by JetBrains.

the class IdeComponents method doReplaceService.

private static <T> void doReplaceService(@NotNull ComponentManager componentManager, @NotNull Class<T> serviceType, @NotNull T newServiceInstance) {
    DefaultPicoContainer picoContainer = (DefaultPicoContainer) componentManager.getPicoContainer();
    String componentKey = serviceType.getName();
    ComponentAdapter componentAdapter = picoContainer.unregisterComponent(componentKey);
    assert componentAdapter != null;
    picoContainer.registerComponentInstance(componentKey, newServiceInstance);
    assertSame(newServiceInstance, picoContainer.getComponentInstance(componentKey));
}
Also used : DefaultPicoContainer(com.intellij.util.pico.DefaultPicoContainer) ComponentAdapter(org.picocontainer.ComponentAdapter)

Aggregations

DefaultPicoContainer (com.intellij.util.pico.DefaultPicoContainer)3 ComponentAdapter (org.picocontainer.ComponentAdapter)1