Search in sources :

Example 11 with MutablePicoContainer

use of org.picocontainer.MutablePicoContainer in project android by JetBrains.

the class ResourceFolderRepositoryTest method overrideCacheService.

private static ResourceFolderRepositoryFileCache overrideCacheService(ResourceFolderRepositoryFileCache newCache) {
    MutablePicoContainer applicationContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
    // Use a file cache that has per-test root directories instead of sharing the system directory.
    // Swap out cache services. We have to be careful. All tests share the same Application and PicoContainer.
    ResourceFolderRepositoryFileCache oldCache = (ResourceFolderRepositoryFileCache) applicationContainer.getComponentInstance(ResourceFolderRepositoryFileCache.class.getName());
    applicationContainer.unregisterComponent(ResourceFolderRepositoryFileCache.class.getName());
    applicationContainer.registerComponentInstance(ResourceFolderRepositoryFileCache.class.getName(), newCache);
    return oldCache;
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Example 12 with MutablePicoContainer

use of org.picocontainer.MutablePicoContainer in project android by JetBrains.

the class ResourceFolderRepositoryFileCacheTest method overrideCacheService.

private static ResourceFolderRepositoryFileCache overrideCacheService(ResourceFolderRepositoryFileCache newCache) {
    MutablePicoContainer applicationContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
    // Use a file cache that has per-test root directories instead of sharing the system directory.
    // Swap out cache services. We have to be careful. All tests share the same Application and PicoContainer.
    ResourceFolderRepositoryFileCache oldCache = (ResourceFolderRepositoryFileCache) applicationContainer.getComponentInstance(ResourceFolderRepositoryFileCache.class.getName());
    applicationContainer.unregisterComponent(ResourceFolderRepositoryFileCache.class.getName());
    applicationContainer.registerComponentInstance(ResourceFolderRepositoryFileCache.class.getName(), newCache);
    return oldCache;
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer)

Example 13 with MutablePicoContainer

use of org.picocontainer.MutablePicoContainer in project idea-handlebars by dmarcotte.

the class HbParserTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    final MutablePicoContainer appContainer = getApplication().getPicoContainer();
    appContainer.registerComponentInstance(PropertiesComponent.class.getName(), new PropertiesComponentStub());
    appContainer.registerComponentInstance(TemplateDataLanguageMappings.class.getName(), new TemplateDataLanguageMappings(getProject()));
    appContainer.registerComponentInstance(TemplateDataLanguagePatterns.class.getName(), new TemplateDataLanguagePatterns());
    addExplicitExtension(LanguageParserDefinitions.INSTANCE, HbLanguage.INSTANCE, new HbParseDefinition());
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) TemplateDataLanguagePatterns(com.intellij.psi.templateLanguages.TemplateDataLanguagePatterns) PropertiesComponentStub(com.dmarcotte.handlebars.config.PropertiesComponentStub) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) TemplateDataLanguageMappings(com.intellij.psi.templateLanguages.TemplateDataLanguageMappings)

Example 14 with MutablePicoContainer

use of org.picocontainer.MutablePicoContainer in project android by JetBrains.

the class AndroidTestCase method registerApplicationComponent.

@NotNull
protected <T> T registerApplicationComponent(@NotNull Class<T> key, @NotNull T instance) throws Exception {
    MutablePicoContainer picoContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
    @SuppressWarnings("unchecked") T old = (T) picoContainer.getComponentInstance(key.getName());
    picoContainer.unregisterComponent(key.getName());
    picoContainer.registerComponentInstance(key.getName(), instance);
    return old;
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with MutablePicoContainer

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

the class UserTree method invokeSendMessageAction.

protected void invokeSendMessageAction() {
    MutablePicoContainer container = BaseAction.getContainer(this);
    UserCommand command = Pico.getCommandManager().getCommand(SendMessageCommand.class, container);
    if (command.isEnabled()) {
        command.execute();
    }
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) UserCommand(jetbrains.communicator.core.commands.UserCommand)

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