use of com.intellij.mock.MockFileDocumentManagerImpl in project buck by facebook.
the class BuckEventsConsumerTest method initialiseEventsConsumer.
public BuckEventsConsumer initialiseEventsConsumer() {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockProject project = new MockProjectEx(new MockDisposable());
MockApplication application = new MyMockApplication(mockDisposable);
ApplicationManager.setApplication(application, mockDisposable);
final BuckEventsConsumer buckEventsConsumer = new BuckEventsConsumer(project);
project.registerService(BuckUIManager.class, new BuckUIManager());
project.registerService(ToolWindowManager.class, new Mock.MyToolWindowManager());
application.registerService(FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
application.registerService(VirtualFileManager.class, EasyMock.createMock(VirtualFileManager.class));
return buckEventsConsumer;
}
use of com.intellij.mock.MockFileDocumentManagerImpl in project kotlin by JetBrains.
the class KtParsingTestCase method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
initApplication();
ComponentAdapter component = getApplication().getPicoContainer().getComponentAdapter(ProgressManager.class.getName());
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, MessageBusFactory.newMessageBus(getApplication()));
registerComponentInstance(appContainer, SchemesManagerFactory.class, new MockSchemesManagerFactory());
final MockEditorFactory editorFactory = new MockEditorFactory();
registerComponentInstance(appContainer, EditorFactory.class, editorFactory);
registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(new Function<CharSequence, Document>() {
@Override
public Document fun(CharSequence charSequence) {
return editorFactory.createDocument(charSequence);
}
}, HARD_REF_TO_DOCUMENT_KEY));
registerComponentInstance(appContainer, PsiDocumentManager.class, new MockPsiDocumentManager());
registerApplicationService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl());
registerApplicationService(DefaultASTFactory.class, new CoreASTFactory());
registerApplicationService(ReferenceProvidersRegistry.class, new ReferenceProvidersRegistryImpl());
registerApplicationService(ProgressManager.class, new CoreProgressManager());
myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager)));
myProject.registerService(PsiManager.class, myPsiManager);
this.registerExtensionPoint(FileTypeFactory.FILE_TYPE_FACTORY_EP, FileTypeFactory.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);
}
use of com.intellij.mock.MockFileDocumentManagerImpl in project intellij by bazelbuild.
the class BlazeAndroidModelTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
applicationServices.register(FileTypeManager.class, new MockFileTypeManager());
applicationServices.register(FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class));
applicationServices.register(BlazeBuildService.class, new BlazeBuildService());
projectServices.register(ProjectScopeBuilder.class, new ProjectScopeBuilderImpl(project));
projectServices.register(ProjectViewManager.class, new MockProjectViewManager());
projectServices.register(BlazeProjectDataManager.class, new BlazeProjectDataManagerImpl(project));
BlazeImportSettingsManager manager = new BlazeImportSettingsManager();
manager.setImportSettings(new BlazeImportSettings("", "", "", "", BuildSystem.Blaze));
projectServices.register(BlazeImportSettingsManager.class, manager);
facade = new MockJavaPsiFacade(project, new MockPsiManager(project), ImmutableList.of("com.google.example.Modified", "com.google.example.NotModified"));
projectServices.register(JavaPsiFacade.class, facade);
module = new MockModule(() -> {
});
model = new BlazeAndroidModel(project, module, null, mock(SourceProvider.class), null, "", 0);
}
Aggregations