• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MockProject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.mock.MockProject的典型用法代码示例。如果您正苦于以下问题:Java MockProject类的具体用法?Java MockProject怎么用?Java MockProject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MockProject类属于com.intellij.mock包,在下文中一共展示了MockProject类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initialiseEventsConsumer

import com.intellij.mock.MockProject; //导入依赖的package包/类
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;
}
 
开发者ID:facebook,项目名称:buck,代码行数:20,代码来源:BuckEventsConsumerTest.java


示例2: createTemplateConfiguration

import com.intellij.mock.MockProject; //导入依赖的package包/类
@Test
public void createTemplateConfiguration() {

    Extensions.registerAreaClass("IDEA_PROJECT", null);

    MockDisposable mockDisposable = new MockDisposable();
    MockProject project = new MockProjectEx(mockDisposable);

    ConfigurationTypeLivingDoc configurationTypeLivingDoc = new ConfigurationTypeLivingDoc();
    RemoteConfigurationFactory remoteConfigurationFactory = new RemoteConfigurationFactory(configurationTypeLivingDoc);
    RunConfiguration runConfiguration = remoteConfigurationFactory
            .createTemplateConfiguration(project);

    Assert.assertNotNull(runConfiguration);
}
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-intellij,代码行数:16,代码来源:RemoteConfigurationFactoryTest.java


示例3: loadProject

import com.intellij.mock.MockProject; //导入依赖的package包/类
public static boolean loadProject(MockProject project, @NotNull VirtualFile virtualFile)
  throws IOException, JDOMException, InvalidDataException {
  if (virtualFile.isDirectory() && virtualFile.findChild(Project.DIRECTORY_STORE_FOLDER) != null) {
    project.setBaseDir(virtualFile);
    loadDirectoryProject(project, virtualFile);
    return true;
  }

  // TODO load .ipr
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CoreProjectLoader.java


示例4: loadDirectoryProject

import com.intellij.mock.MockProject; //导入依赖的package包/类
private static void loadDirectoryProject(MockProject project, VirtualFile projectDir) throws IOException, JDOMException,
                                                                                         InvalidDataException {
  VirtualFile dotIdea = projectDir.findChild(Project.DIRECTORY_STORE_FOLDER);
  if (dotIdea == null)
    throw new FileNotFoundException("Missing '" + Project.DIRECTORY_STORE_FOLDER + "' in " + projectDir.getPath());

  VirtualFile modulesXml = dotIdea.findChild("modules.xml");
  if (modulesXml == null)
    throw new FileNotFoundException("Missing 'modules.xml' in " + dotIdea.getPath());

  TreeMap<String, Element> storageData = loadStorageFile(project, modulesXml);
  final Element moduleManagerState = storageData.get("ProjectModuleManager");
  if (moduleManagerState == null) {
    throw new JDOMException("cannot find ProjectModuleManager state in modules.xml");
  }
  final CoreModuleManager moduleManager = (CoreModuleManager)ModuleManager.getInstance(project);
  moduleManager.loadState(moduleManagerState);

  VirtualFile miscXml = dotIdea.findChild("misc.xml");
  if (miscXml == null)
    throw new FileNotFoundException("Missing 'misc.xml' in " + dotIdea.getPath());
  storageData = loadStorageFile(project, miscXml);
  final Element projectRootManagerState = storageData.get("ProjectRootManager");
  if (projectRootManagerState == null) {
    throw new JDOMException("cannot find ProjectRootManager state in misc.xml");
  }
  ((ProjectRootManagerImpl) ProjectRootManager.getInstance(project)).loadState(projectRootManagerState);

  VirtualFile libraries = dotIdea.findChild("libraries");
  if (libraries != null) {
    Map<String, Element> data = DirectoryStorageUtil.loadFrom(libraries, PathMacroManager.getInstance(project).createTrackingSubstitutor());
    Element libraryTable = DefaultStateSerializer.deserializeState(DirectoryStorageUtil.getCompositeState(data, new ProjectLibraryTable.LibraryStateSplitter()), Element.class, null);
    ((LibraryTableBase) ProjectLibraryTable.getInstance(project)).loadState(libraryTable);
  }

  moduleManager.loadModules();
  project.projectOpened();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:CoreProjectLoader.java


示例5: ProjectEnvironment

import com.intellij.mock.MockProject; //导入依赖的package包/类
public ProjectEnvironment(CoreProjectEnvironment projectEnvironment) {
  MockProject project = projectEnvironment.getProject();
  project.registerService(GroovyPsiElementFactory.class, GroovyPsiElementFactoryImpl.class);

  project.registerService(GroovyPsiManager.class, GroovyPsiManager.class);
  project.registerService(GroovyCodeStyleManager.class, CoreGroovyCodeStyleManager.class);
  project.registerService(GroovyCodeStyleSettingsFacade.class, CoreGroovyCodeStyleSettingsFacade.class);
  project.registerService(GroovyExtensionProvider.class, GroovyExtensionProvider.class);
  projectEnvironment.addProjectExtension(PsiShortNamesCache.EP_NAME, new GroovyShortNamesCache(project));
  projectEnvironment.addProjectExtension(PsiElementFinder.EP_NAME, new GroovyClassFinder(project));
  TextEditorHighlightingPassRegistrar registrar = TextEditorHighlightingPassRegistrar.getInstance(project);
  projectEnvironment.registerProjectComponent(GroovyUnusedImportsPassFactory.class, new GroovyUnusedImportsPassFactory(project, registrar));
  projectEnvironment.registerProjectComponent(GrKeywordAndDeclarationHighlightFactory.class, new GrKeywordAndDeclarationHighlightFactory(project, registrar));
  projectEnvironment.registerProjectComponent(GrReferenceHighlighterFactory.class, new GrReferenceHighlighterFactory(project, registrar));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:GroovyCoreEnvironment.java


示例6: mockProject

import com.intellij.mock.MockProject; //导入依赖的package包/类
@NotNull
public static MockProject mockProject(
    @Nullable PicoContainer container, Disposable parentDisposable) {
  Extensions.registerAreaClass("IDEA_PROJECT", null);
  container = container != null ? container : new DefaultPicoContainer();
  return new MockProject(container, parentDisposable);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:8,代码来源:TestUtils.java


示例7: setup

import com.intellij.mock.MockProject; //导入依赖的package包/类
@Before
public final void setup() {
  testDisposable = new RootDisposable();
  TestUtils.createMockApplication(testDisposable);
  MutablePicoContainer applicationContainer =
      (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
  MockProject mockProject = TestUtils.mockProject(applicationContainer, testDisposable);

  Extensions.cleanRootArea(testDisposable);
  extensionsArea = (ExtensionsAreaImpl) Extensions.getRootArea();

  this.project = mockProject;

  initTest(new Container(applicationContainer), new Container(mockProject.getPicoContainer()));
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:16,代码来源:BlazeTestCase.java


示例8: mockProject

import com.intellij.mock.MockProject; //导入依赖的package包/类
/** Construct a mock project. */
@NotNull
public static MockProject mockProject(@Nullable PicoContainer container) {
  Extensions.registerAreaClass("IDEA_PROJECT", null);
  container = container != null ? container : new DefaultPicoContainer();
  return new MockProject(container, getParentDisposableForCleanup());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:8,代码来源:TestUtils.java


示例9: loadDirectoryProject

import com.intellij.mock.MockProject; //导入依赖的package包/类
private static void loadDirectoryProject(MockProject project, VirtualFile projectDir) throws IOException, JDOMException,
                                                                                         InvalidDataException {
  VirtualFile dotIdea = projectDir.findChild(Project.DIRECTORY_STORE_FOLDER);
  VirtualFile modulesXml = dotIdea.findChild("modules.xml");
  StorageData storageData = loadStorageFile(project, modulesXml);
  final Element moduleManagerState = storageData.getState("ProjectModuleManager");
  if (moduleManagerState == null) {
    throw new JDOMException("cannot find ProjectModuleManager state in modules.xml");
  }
  final CoreModuleManager moduleManager = (CoreModuleManager)ModuleManager.getInstance(project);
  moduleManager.loadState(moduleManagerState);

  VirtualFile miscXml = dotIdea.findChild("misc.xml");
  storageData = loadStorageFile(project, miscXml);
  final Element projectRootManagerState = storageData.getState("ProjectRootManager");
  if (projectRootManagerState == null) {
    throw new JDOMException("cannot find ProjectRootManager state in misc.xml");
  }
  ((ProjectRootManagerImpl) ProjectRootManager.getInstance(project)).readExternal(projectRootManagerState);

  VirtualFile libraries = dotIdea.findChild("libraries");
  if (libraries != null) {
    DirectoryStorageData data = new DirectoryStorageData();
    data.loadFrom(libraries, PathMacroManager.getInstance(project).createTrackingSubstitutor());
    final Element libraryTable = data.getMergedState("libraryTable", Element.class, new ProjectLibraryTable.LibraryStateSplitter(), null);
    ((LibraryTableBase) ProjectLibraryTable.getInstance(project)).loadState(libraryTable);
  }

  moduleManager.loadModules();
  project.projectOpened();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:CoreProjectLoader.java


示例10: CoreProjectEnvironment

import com.intellij.mock.MockProject; //导入依赖的package包/类
public CoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) {
  myParentDisposable = parentDisposable;
  myEnvironment = applicationEnvironment;
  myProject = new MockProject(myEnvironment.getApplication().getPicoContainer(), myParentDisposable);

  preregisterServices();

  myFileIndexFacade = createFileIndexFacade();
  myMessageBus = new MessageBusImpl("CoreProjectEnvironment", null);

  PsiModificationTrackerImpl modificationTracker = new PsiModificationTrackerImpl(myProject);
  myProject.registerService(PsiModificationTracker.class, modificationTracker);
  myProject.registerService(FileIndexFacade.class, myFileIndexFacade);
  myProject.registerService(ResolveCache.class, new ResolveCache(myMessageBus));

  registerProjectExtensionPoint(PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor.class);
  myPsiManager = new PsiManagerImpl(myProject, null, null, myFileIndexFacade, myMessageBus, modificationTracker);
  ((FileManagerImpl) myPsiManager.getFileManager()).markInitialized();
  registerProjectComponent(PsiManager.class, myPsiManager);

  myProject.registerService(ResolveScopeManager.class, createResolveScopeManager(myPsiManager));

  myProject.registerService(PsiFileFactory.class, new PsiFileFactoryImpl(myPsiManager));
  myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager)));
  myProject.registerService(PsiDirectoryFactory.class, new PsiDirectoryFactoryImpl(myPsiManager));
  myProject.registerService(ProjectScopeBuilder.class, createProjectScopeBuilder());
  myProject.registerService(DumbService.class, new MockDumbService(myProject));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:CoreProjectEnvironment.java


示例11: setUp

import com.intellij.mock.MockProject; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    homeDirectory.setParent(rootDirectory);
    studioProjectsDirectory.setParent(homeDirectory);
    projectDirectory.setParent(studioProjectsDirectory);

    project = mock(MockProject.class);
    when(project.getBaseDir()).thenReturn(projectDirectory);
}
 
开发者ID:fioan89,项目名称:sourcesync,代码行数:10,代码来源:UtilsTest.java


示例12: setUp

import com.intellij.mock.MockProject; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  Extensions.registerAreaClass("IDEA_PROJECT", null);

  myProject = new MockProject(null, new Disposable() {
    @Override
    public void dispose() {
    }
  });
}
 
开发者ID:ktisha,项目名称:Crucible4IDEA,代码行数:12,代码来源:ParsingTest.java


示例13: CoreProjectEnvironment

import com.intellij.mock.MockProject; //导入依赖的package包/类
public CoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) {
  myParentDisposable = parentDisposable;
  myEnvironment = applicationEnvironment;
  myProject = new MockProject(myEnvironment.getApplication().getPicoContainer(), myParentDisposable);

  preregisterServices();

  myFileIndexFacade = createFileIndexFacade();
  myMessageBus = (MessageBusImpl)myProject.getMessageBus();

  PsiModificationTrackerImpl modificationTracker = new PsiModificationTrackerImpl(myProject);
  myProject.registerService(PsiModificationTracker.class, modificationTracker);
  myProject.registerService(FileIndexFacade.class, myFileIndexFacade);
  myProject.registerService(ResolveCache.class, new ResolveCache(myMessageBus));

  registerProjectExtensionPoint(PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor.class);
  myPsiManager = new PsiManagerImpl(myProject, null, null, myFileIndexFacade, myMessageBus, modificationTracker);
  ((FileManagerImpl)myPsiManager.getFileManager()).markInitialized();
  registerProjectComponent(PsiManager.class, myPsiManager);

  registerProjectComponent(PsiDocumentManager.class, new CorePsiDocumentManager(myProject, myPsiManager, myMessageBus, new MockDocumentCommitProcessor()));

  myProject.registerService(ResolveScopeManager.class, createResolveScopeManager(myPsiManager));

  myProject.registerService(PsiFileFactory.class, new PsiFileFactoryImpl(myPsiManager));
  myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager)));
  myProject.registerService(ProjectScopeBuilder.class, createProjectScopeBuilder());
  myProject.registerService(DumbService.class, new MockDumbService(myProject));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:CoreProjectEnvironment.java


示例14: testReady

import com.intellij.mock.MockProject; //导入依赖的package包/类
public void testReady() {
  assertReady(null);

  MockProject project1 = new MockProjectEx(getTestRootDisposable());
  assertReady(project1);

  MockProject project2 = new MockProjectEx(getTestRootDisposable());
  assertReady(project2);

  myMonitor.initBusyObjectFor(project1);
  assertTrue(myMonitor.hasObjectFor(project1));

  myMonitor.initBusyObjectFor(project2);
  assertTrue(myMonitor.hasObjectFor(project2));


  myMonitor.addActivity(new UiActivity("global"), ModalityState.any());
  assertBusy(null);
  assertBusy(project1);
  assertBusy(project2);

  myMonitor.addActivity(new UiActivity("global"), ModalityState.any());
  assertBusy(null);
  assertBusy(project1);
  assertBusy(project2);

  myMonitor.removeActivity(new UiActivity("global"));
  assertReady(null);
  assertReady(project1);
  assertReady(project2);


  myMonitor.addActivity(project1, new UiActivity("p1"), ModalityState.any());
  assertReady(null);
  assertBusy(project1);
  assertReady(project2);

  myMonitor.addActivity(new UiActivity("global"), ModalityState.any());
  assertBusy(null);
  assertBusy(project1);
  assertBusy(project2);

  myMonitor.removeActivity(new UiActivity("global"));
  assertReady(null);
  assertBusy(project1);
  assertReady(project2);

  myMonitor.removeActivity(project1, new UiActivity("p1"));
  assertReady(null);
  assertReady(project1);
  assertReady(project2);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:53,代码来源:ActivityMonitorTest.java


示例15: createProject

import com.intellij.mock.MockProject; //导入依赖的package包/类
@SuppressWarnings("MethodMayBeStatic")
@NotNull
protected MockProject createProject(@NotNull PicoContainer parent, @NotNull Disposable parentDisposable) {
  return new MockProject(parent, parentDisposable);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:CoreProjectEnvironment.java


示例16: getProject

import com.intellij.mock.MockProject; //导入依赖的package包/类
@NotNull
public MockProject getProject() {
  return myProject;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:CoreProjectEnvironment.java


示例17: initTest

import com.intellij.mock.MockProject; //导入依赖的package包/类
@Override
protected void initTest(Container applicationServices, Container projectServices) {
  super.initTest(applicationServices, projectServices);

  mockBlazeImportSettings(projectServices);
  applicationServices.register(ExperimentService.class, new MockExperimentService());

  ExtensionPointImpl<TargetFinder> targetFinderEp =
      registerExtensionPoint(TargetFinder.EP_NAME, TargetFinder.class);
  targetFinderEp.registerExtension(new MockTargetFinder());

  ExtensionPoint<ConfigurationType> configurationTypeExtensionPoint =
      registerExtensionPoint(ConfigurationType.CONFIGURATION_TYPE_EP, ConfigurationType.class);
  configurationTypeExtensionPoint.registerExtension(new BlazeCommandRunConfigurationType());

  ExtensionPoint<BlazeCommandRunConfigurationHandlerProvider> handlerProviderExtensionPoint =
      registerExtensionPoint(
          BlazeCommandRunConfigurationHandlerProvider.EP_NAME,
          BlazeCommandRunConfigurationHandlerProvider.class);
  handlerProviderExtensionPoint.registerExtension(
      new MockBlazeAndroidBinaryRunConfigurationHandlerProvider());

  ExtensionPoint<BuildSystemProvider> buildSystemProviderExtensionPoint =
      registerExtensionPoint(BuildSystemProvider.EP_NAME, BuildSystemProvider.class);
  buildSystemProviderExtensionPoint.registerExtension(new MockBuildSystemProvider());

  ExtensionPoint<DeployTargetProvider> deployTargetProviderExtensionPoint =
      registerExtensionPoint(
          ExtensionPointName.create("com.android.run.deployTargetProvider"),
          DeployTargetProvider.class);
  deployTargetProviderExtensionPoint.registerExtension(new ShowChooserTargetProvider());

  ExtensionPoint<AndroidDebugger> androidDebuggerExtensionPoint =
      registerExtensionPoint(AndroidDebugger.EP_NAME, AndroidDebugger.class);
  androidDebuggerExtensionPoint.registerExtension(new AndroidJavaDebugger());

  ExtensionPoint<BeforeRunTaskProvider> beforeRunTaskProviderExtensionPoint =
      registerExtensionPoint(
          ExtensionPointName.create("com.intellij.stepsBeforeRunProvider"),
          BeforeRunTaskProvider.class);
  ((ExtensionsAreaImpl) Extensions.getArea(project))
      .registerExtensionPoint((ExtensionPointImpl) beforeRunTaskProviderExtensionPoint);
  beforeRunTaskProviderExtensionPoint.registerExtension(new BlazeBeforeRunTaskProvider());

  ExtensionPoint<TestRecorderRunConfigurationProxyProvider>
      testRecorderRunConfigurationProxyProviderExtensionPoint =
          registerExtensionPoint(
              ExtensionPointName.create(
                  "com.google.gct.testrecorder.run.testRecorderRunConfigurationProxyProvider"),
              TestRecorderRunConfigurationProxyProvider.class);
  testRecorderRunConfigurationProxyProviderExtensionPoint.registerExtension(
      new TestRecorderBlazeCommandRunConfigurationProxyProvider());

  ((MockProject) project)
      .addComponent(
          RunManager.class, new RunManagerImpl(project, new ProjectPropertiesComponentImpl()));
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:58,代码来源:BlazeConfigurationsTest.java


示例18: getProject

import com.intellij.mock.MockProject; //导入依赖的package包/类
public MockProject getProject() {
  return myProject;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:CoreProjectEnvironment.java



注:本文中的com.intellij.mock.MockProject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DLFileEntryLocalServiceUtil类代码示例发布时间:2022-05-22
下一篇:
Java Action类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap