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);
}
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);
}
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);
}
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);
}
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());
}
Aggregations