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