Search in sources :

Example 1 with AbstractComponentAdapter

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

the class ParsingTestCase method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    initApplication();
    ComponentAdapter component = getApplication().getPicoContainer().getComponentAdapter(ProgressManager.class.getName());
    if (component == null) {
        getApplication().getPicoContainer().registerComponent(new AbstractComponentAdapter(ProgressManager.class.getName(), Object.class) {

            @Override
            public Object getComponentInstance(PicoContainer container) throws PicoInitializationException, PicoIntrospectionException {
                return new ProgressManagerImpl();
            }

            @Override
            public void verify(PicoContainer container) throws PicoIntrospectionException {
            }
        });
    }
    Extensions.registerAreaClass("IDEA_PROJECT", null);
    myProject = new MockProjectEx(getTestRootDisposable());
    myPsiManager = new MockPsiManager(myProject);
    myFileFactory = new PsiFileFactoryImpl(myPsiManager);
    MutablePicoContainer appContainer = getApplication().getPicoContainer();
    registerComponentInstance(appContainer, MessageBus.class, getApplication().getMessageBus());
    registerComponentInstance(appContainer, SchemeManagerFactory.class, new MockSchemeManagerFactory());
    final MockEditorFactory editorFactory = new MockEditorFactory();
    registerComponentInstance(appContainer, EditorFactory.class, editorFactory);
    registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(charSequence -> editorFactory.createDocument(charSequence), FileDocumentManagerImpl.HARD_REF_TO_DOCUMENT_KEY));
    registerComponentInstance(appContainer, PsiDocumentManager.class, new MockPsiDocumentManager());
    registerApplicationService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl());
    registerApplicationService(DefaultASTFactory.class, new DefaultASTFactoryImpl());
    registerApplicationService(ReferenceProvidersRegistry.class, new ReferenceProvidersRegistryImpl());
    myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager)));
    myProject.registerService(PsiManager.class, myPsiManager);
    myProject.registerService(StartupManager.class, new StartupManagerImpl(myProject));
    registerExtensionPoint(FileTypeFactory.FILE_TYPE_FACTORY_EP, FileTypeFactory.class);
    registerExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class);
    for (ParserDefinition definition : myDefinitions) {
        addExplicitExtension(LanguageParserDefinitions.INSTANCE, definition.getFileNodeType().getLanguage(), definition);
    }
    if (myDefinitions.length > 0) {
        configureFromParserDefinition(myDefinitions[0], myFileExt);
    }
    // That's for reparse routines
    final PomModelImpl pomModel = new PomModelImpl(myProject);
    myProject.registerService(PomModel.class, pomModel);
    new TreeAspect(pomModel);
}
Also used : CharsetToolkit(com.intellij.openapi.vfs.CharsetToolkit) AbstractComponentAdapter(org.picocontainer.defaults.AbstractComponentAdapter) ReferenceProvidersRegistryImpl(com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl) NonNls(org.jetbrains.annotations.NonNls) ProgressManagerImpl(com.intellij.openapi.progress.impl.ProgressManagerImpl) org.picocontainer(org.picocontainer) BlockSupportImpl(com.intellij.psi.impl.source.text.BlockSupportImpl) PathManagerEx(com.intellij.openapi.application.ex.PathManagerEx) StartupManagerImpl(com.intellij.ide.startup.impl.StartupManagerImpl) PsiCachedValuesFactory(com.intellij.psi.impl.PsiCachedValuesFactory) com.intellij.lang(com.intellij.lang) StartupManager(com.intellij.openapi.startup.StartupManager) PomModel(com.intellij.pom.PomModel) Disposer(com.intellij.openapi.util.Disposer) ReferenceProvidersRegistry(com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry) FileUtil(com.intellij.openapi.util.io.FileUtil) TestCase(junit.framework.TestCase) DebugUtil(com.intellij.psi.impl.DebugUtil) PsiFileFactoryImpl(com.intellij.psi.impl.PsiFileFactoryImpl) DiffLog(com.intellij.psi.impl.source.text.DiffLog) Extensions(com.intellij.openapi.extensions.Extensions) ProgressManager(com.intellij.openapi.progress.ProgressManager) FileTypeManager(com.intellij.openapi.fileTypes.FileTypeManager) LoadTextUtil(com.intellij.openapi.fileEditor.impl.LoadTextUtil) FileTypeFactory(com.intellij.openapi.fileTypes.FileTypeFactory) SchemeManagerFactory(com.intellij.openapi.options.SchemeManagerFactory) CachedValuesManagerImpl(com.intellij.util.CachedValuesManagerImpl) Set(java.util.Set) PsiBuilderFactoryImpl(com.intellij.lang.impl.PsiBuilderFactoryImpl) FileDocumentManager(com.intellij.openapi.fileEditor.FileDocumentManager) IOException(java.io.IOException) TextRange(com.intellij.openapi.util.TextRange) FileDocumentManagerImpl(com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl) Disposable(com.intellij.openapi.Disposable) File(java.io.File) CachedValuesManager(com.intellij.psi.util.CachedValuesManager) ExtensionPointName(com.intellij.openapi.extensions.ExtensionPointName) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) PomModelImpl(com.intellij.pom.core.impl.PomModelImpl) EditorFactory(com.intellij.openapi.editor.EditorFactory) com.intellij.mock(com.intellij.mock) com.intellij.psi(com.intellij.psi) NotNull(org.jetbrains.annotations.NotNull) TreeAspect(com.intellij.pom.tree.TreeAspect) MessageBus(com.intellij.util.messages.MessageBus) StartupManagerImpl(com.intellij.ide.startup.impl.StartupManagerImpl) TreeAspect(com.intellij.pom.tree.TreeAspect) AbstractComponentAdapter(org.picocontainer.defaults.AbstractComponentAdapter) ProgressManagerImpl(com.intellij.openapi.progress.impl.ProgressManagerImpl) CachedValuesManagerImpl(com.intellij.util.CachedValuesManagerImpl) PsiBuilderFactoryImpl(com.intellij.lang.impl.PsiBuilderFactoryImpl) PsiCachedValuesFactory(com.intellij.psi.impl.PsiCachedValuesFactory) PomModelImpl(com.intellij.pom.core.impl.PomModelImpl) AbstractComponentAdapter(org.picocontainer.defaults.AbstractComponentAdapter) ProgressManager(com.intellij.openapi.progress.ProgressManager) ReferenceProvidersRegistryImpl(com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl) PsiFileFactoryImpl(com.intellij.psi.impl.PsiFileFactoryImpl)

Aggregations

StartupManagerImpl (com.intellij.ide.startup.impl.StartupManagerImpl)1 com.intellij.lang (com.intellij.lang)1 PsiBuilderFactoryImpl (com.intellij.lang.impl.PsiBuilderFactoryImpl)1 com.intellij.mock (com.intellij.mock)1 Disposable (com.intellij.openapi.Disposable)1 PathManagerEx (com.intellij.openapi.application.ex.PathManagerEx)1 EditorFactory (com.intellij.openapi.editor.EditorFactory)1 ExtensionPointName (com.intellij.openapi.extensions.ExtensionPointName)1 Extensions (com.intellij.openapi.extensions.Extensions)1 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)1 FileDocumentManagerImpl (com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl)1 LoadTextUtil (com.intellij.openapi.fileEditor.impl.LoadTextUtil)1 FileTypeFactory (com.intellij.openapi.fileTypes.FileTypeFactory)1 FileTypeManager (com.intellij.openapi.fileTypes.FileTypeManager)1 SchemeManagerFactory (com.intellij.openapi.options.SchemeManagerFactory)1 EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 ProgressManagerImpl (com.intellij.openapi.progress.impl.ProgressManagerImpl)1 StartupManager (com.intellij.openapi.startup.StartupManager)1 Disposer (com.intellij.openapi.util.Disposer)1