Search in sources :

Example 16 with MutablePicoContainer

use of org.picocontainer.MutablePicoContainer in project intellij-plugins by JetBrains.

the class Tests method changeServiceImplementation.

public static void changeServiceImplementation(Class key, Class implementation) {
    MutablePicoContainer picoContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
    picoContainer.unregisterComponent(key.getName());
    picoContainer.registerComponentImplementation(key.getName(), implementation);
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Example 17 with MutablePicoContainer

use of org.picocontainer.MutablePicoContainer in project intellij-community by JetBrains.

the class ActionsTreeTest method setRestrictions.

private static void setRestrictions(ActionShortcutRestrictions restrictions) {
    MutablePicoContainer picoContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
    String restrictionsKey = ActionShortcutRestrictions.class.getName();
    picoContainer.unregisterComponent(restrictionsKey);
    picoContainer.registerComponentInstance(restrictionsKey, restrictions);
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Example 18 with MutablePicoContainer

use of org.picocontainer.MutablePicoContainer in project intellij-community by JetBrains.

the class ReformatOnlyVcsChangedTextTest method registerCodeStyleManager.

private static void registerCodeStyleManager(@NotNull CodeStyleManager manager) {
    String componentKey = CodeStyleManager.class.getName();
    MutablePicoContainer container = (MutablePicoContainer) getProject().getPicoContainer();
    container.unregisterComponent(componentKey);
    container.registerComponentInstance(componentKey, manager);
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Example 19 with MutablePicoContainer

use of org.picocontainer.MutablePicoContainer in project intellij-community by JetBrains.

the class HgTest method registerMockVcsHelper.

/**
   * Registers HgMockVcsHelper as the AbstractVcsHelper.
   */
protected HgMockVcsHelper registerMockVcsHelper() {
    final String key = "com.intellij.openapi.vcs.AbstractVcsHelper";
    final MutablePicoContainer picoContainer = (MutablePicoContainer) myProject.getPicoContainer();
    picoContainer.unregisterComponent(key);
    picoContainer.registerComponentImplementation(key, HgMockVcsHelper.class);
    return (HgMockVcsHelper) AbstractVcsHelper.getInstance(myProject);
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Example 20 with MutablePicoContainer

use of org.picocontainer.MutablePicoContainer in project intellij-community by JetBrains.

the class ExtensionsAreaTest method testGetComponentAdapterDoesntDuplicateAdapters.

@Test
public void testGetComponentAdapterDoesntDuplicateAdapters() throws Exception {
    MutablePicoContainer picoContainer = new ExtensionsAreaImpl("foo", null, new DefaultPicoContainer(), new Extensions.SimpleLogProvider()).getPicoContainer();
    picoContainer.registerComponentImplementation("runnable", ExtensionsAreaTest.class);
    List adapters = picoContainer.getComponentAdaptersOfType(ExtensionsAreaTest.class);
    assertEquals(1, adapters.size());
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) DefaultPicoContainer(org.picocontainer.defaults.DefaultPicoContainer) List(java.util.List) Test(org.junit.Test)

Aggregations

MutablePicoContainer (org.picocontainer.MutablePicoContainer)21 Test (org.junit.Test)3 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)2 TemplateDataLanguageMappings (com.intellij.psi.templateLanguages.TemplateDataLanguageMappings)2 TemplateDataLanguagePatterns (com.intellij.psi.templateLanguages.TemplateDataLanguagePatterns)2 NotNull (org.jetbrains.annotations.NotNull)2 DefaultPicoContainer (org.picocontainer.defaults.DefaultPicoContainer)2 PropertiesComponentStub (com.dmarcotte.handlebars.config.PropertiesComponentStub)1 CoreASTFactory (com.intellij.core.CoreASTFactory)1 PsiBuilderFactoryImpl (com.intellij.lang.impl.PsiBuilderFactoryImpl)1 MockFileDocumentManagerImpl (com.intellij.mock.MockFileDocumentManagerImpl)1 Editor (com.intellij.openapi.editor.Editor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 CoreProgressManager (com.intellij.openapi.progress.impl.CoreProgressManager)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PomModelImpl (com.intellij.pom.core.impl.PomModelImpl)1 TreeAspect (com.intellij.pom.tree.TreeAspect)1 PsiCachedValuesFactory (com.intellij.psi.impl.PsiCachedValuesFactory)1