Java Code Examples for com.intellij.mock.MockFileDocumentManagerImpl

The following examples show how to use com.intellij.mock.MockFileDocumentManagerImpl. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: intellij   Source File: BlazeAndroidModelTest.java    License: Apache License 2.0 5 votes vote down vote up
@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());

  BlazeProjectDataManager mockProjectDataManager =
      new MockBlazeProjectDataManager(MockBlazeProjectDataBuilder.builder().build());
  projectServices.register(BlazeProjectDataManager.class, mockProjectDataManager);

  BlazeImportSettingsManager manager = new BlazeImportSettingsManager(project);
  manager.setImportSettings(new BlazeImportSettings("", "", "", "", BuildSystem.Blaze));
  projectServices.register(BlazeImportSettingsManager.class, manager);
  projectServices.register(JvmPsiConversionHelper.class, new JvmPsiConversionHelperImpl());

  facade =
      new MockJavaPsiFacade(
          project,
          ImmutableList.of("com.google.example.Modified", "com.google.example.NotModified"));

  projectServices.register(JavaPsiFacade.class, facade);
  module = new MockModule(() -> {});
  model = new BlazeAndroidModel(project, null, mock(SourceProvider.class), null, 0, false);
}
 
Example 2
Source Project: buck   Source File: BuckEventsConsumerTest.java    License: Apache License 2.0 5 votes vote down vote up
public BuckEventsConsumer initialiseEventsConsumer(MockProject project) {
  MockDisposable mockDisposable = new MockDisposable();

  MockApplication application = new MyMockApplication(mockDisposable);
  ApplicationManager.setApplication(application, mockDisposable);
  application.registerService(
      FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
  application.registerService(
      VirtualFileManager.class,
      (VirtualFileManager) EasyMock.createMock(VirtualFileManager.class));
  project.registerService(BuckUIManager.class, new MockBuckUIManager(project));
  project.registerService(ToolWindowManager.class, new Mock.MyToolWindowManager());
  return new BuckEventsConsumer(project);
}
 
Example 3
Source Project: consulo   Source File: CoreApplicationEnvironment.java    License: Apache License 2.0 5 votes vote down vote up
public CoreApplicationEnvironment(@Nonnull Disposable parentDisposable) {
  myParentDisposable = parentDisposable;

  myFileTypeRegistry = new CoreFileTypeRegistry();

  myApplication = createApplication(myParentDisposable);
  ApplicationManager.setApplication(myApplication, myParentDisposable);
  myLocalFileSystem = createLocalFileSystem();
  myJarFileSystem = createJarFileSystem();

  final InjectingContainer appContainer = myApplication.getInjectingContainer();
  registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(DocumentImpl::new, null));

  VirtualFileSystem[] fs = {myLocalFileSystem, myJarFileSystem};
  VirtualFileManagerImpl virtualFileManager = new VirtualFileManagerImpl(myApplication, fs);
  registerComponentInstance(appContainer, VirtualFileManager.class, virtualFileManager);

  registerApplicationExtensionPoint(ASTLazyFactory.EP.getExtensionPointName(), ASTLazyFactory.class);
  registerApplicationExtensionPoint(ASTLeafFactory.EP.getExtensionPointName(), ASTLeafFactory.class);
  registerApplicationExtensionPoint(ASTCompositeFactory.EP.getExtensionPointName(), ASTCompositeFactory.class);

  addExtension(ASTLazyFactory.EP.getExtensionPointName(), new DefaultASTLazyFactory());
  addExtension(ASTLeafFactory.EP.getExtensionPointName(), new DefaultASTLeafFactory());
  addExtension(ASTCompositeFactory.EP.getExtensionPointName(), new DefaultASTCompositeFactory());

  registerApplicationService(EncodingManager.class, new CoreEncodingRegistry());
  registerApplicationService(VirtualFilePointerManager.class, createVirtualFilePointerManager());
  registerApplicationService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl());
  registerApplicationService(ReferenceProvidersRegistry.class, new MockReferenceProvidersRegistry());
  registerApplicationService(StubTreeLoader.class, new CoreStubTreeLoader());
  registerApplicationService(PsiReferenceService.class, new PsiReferenceServiceImpl());
  registerApplicationService(MetaDataRegistrar.class, new MetaRegistry());

  registerApplicationService(ProgressManager.class, createProgressIndicatorProvider());

  registerApplicationService(JobLauncher.class, createJobLauncher());
  registerApplicationService(CodeFoldingSettings.class, new CodeFoldingSettings());
  registerApplicationService(CommandProcessor.class, new CoreCommandProcessor());
}