当前位置: 首页>>代码示例>>Java>>正文


Java ProjectManagerEx.getInstanceEx方法代码示例

本文整理汇总了Java中com.intellij.openapi.project.ex.ProjectManagerEx.getInstanceEx方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectManagerEx.getInstanceEx方法的具体用法?Java ProjectManagerEx.getInstanceEx怎么用?Java ProjectManagerEx.getInstanceEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.project.ex.ProjectManagerEx的用法示例。


在下文中一共展示了ProjectManagerEx.getInstanceEx方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareToReportChangedProjectFiles

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
@Nullable
public static Runnable prepareToReportChangedProjectFiles(@NotNull final Project project, @NotNull Collection<VirtualFile> files) {
  final Set<VirtualFile> vfs = new THashSet<VirtualFile>();
  for (VirtualFile file : files) {
    if (file != null && !file.isDirectory()) {
      if (ProjectCoreUtil.isProjectOrWorkspaceFile(file) || isProjectFile(file)) {
        vfs.add(file);
      }
    }
  }
  return vfs.isEmpty() ? null : new Runnable() {
    @Override
    public void run() {
      ProjectManagerEx ex = ProjectManagerEx.getInstanceEx();
      for (VirtualFile vf : vfs) {
        ex.saveChangedProjectFile(vf, project);
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MergeVersion.java

示例2: testRightProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
/**
 * Tests that the theme editor works with the right virtual file
 * when there are several projects with the same name open.
 */
public void testRightProject() throws IOException {
  ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
  Project otherProject = projectManager.newProject(getProject().getName(), FileUtilRt.generateRandomTemporaryPath().getPath(), true, true);
  try {
    assertNotNull(otherProject);
    projectManager.openProject(otherProject);

    ThemeEditorVirtualFile themeEditorVirtualFile = ThemeEditorVirtualFile.getThemeEditorFile(myModule.getProject());
    VirtualFile virtualFile = themeEditorVirtualFile.getFileSystem().findFileByPath(themeEditorVirtualFile.getPath());

    assertEquals(themeEditorVirtualFile, virtualFile);
  }
  finally {
    if (otherProject != null) {
      ((ProjectManagerImpl)projectManager).closeProject(otherProject, false, true, false);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ThemeEditorVirtualFileTest.java

示例3: getProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
private Project getProject() {
  String path = "R:/_github.com/consulo/mssdw";

  try {
    final Project project;
    ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
    Project[] openProjects = projectManager.getOpenProjects();
    if (openProjects.length > 0) {
      project = openProjects[0];
    }
    else {
      project = projectManager.loadProject(path);
      projectManager.openTestProject(project);
      final StartupManagerImpl startupManager = (StartupManagerImpl)StartupManager.getInstance(project);
      startupManager.runStartupActivities();
      startupManager.startCacheUpdate();
    }
    return project;
  }
  catch (Exception e) {
    e.getMessage();
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:GwtTransportServiceImpl.java

示例4: disposeSelf

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
@RequiredDispatchThread
private boolean disposeSelf(final boolean checkCanCloseProject) {
  final ProjectManagerImpl manager = (ProjectManagerImpl)ProjectManagerEx.getInstanceEx();
  if (manager != null) {
    final boolean[] canClose = {true};
    for (final Project project : manager.getOpenProjects()) {
      try {
        CommandProcessor.getInstance().executeCommand(project, () -> {
          if (!manager.closeProject(project, true, true, checkCanCloseProject)) {
            canClose[0] = false;
          }
        }, ApplicationBundle.message("command.exit"), null);
      }
      catch (Throwable e) {
        LOG.error(e);
      }
      if (!canClose[0]) {
        return false;
      }
    }
  }
  runWriteAction(() -> Disposer.dispose(ApplicationImpl.this));

  Disposer.assertIsEmpty();
  return true;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ApplicationImpl.java

示例5: setUpProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
@Override
protected void setUpProject() throws Exception {
  myProjectManager = ProjectManagerEx.getInstanceEx();
  LOG.assertTrue(myProjectManager != null, "Cannot instantiate ProjectManager component");

  File projectFile = getIprFile();
  loadAndSetupProject(projectFile.getPath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:UpdateCacheTest.java

示例6: disposeSelf

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
private boolean disposeSelf(final boolean checkCanCloseProject) {
  final ProjectManagerImpl manager = (ProjectManagerImpl)ProjectManagerEx.getInstanceEx();
  if (manager != null) {
    final boolean[] canClose = {true};
    for (final Project project : manager.getOpenProjects()) {
      try {
        CommandProcessor.getInstance().executeCommand(project, new Runnable() {
          @Override
          public void run() {
            if (!manager.closeProject(project, true, true, checkCanCloseProject)) {
              canClose[0] = false;
            }
          }
        }, ApplicationBundle.message("command.exit"), null);
      }
      catch (Throwable e) {
        LOG.error(e);
      }
      if (!canClose[0]) {
        return false;
      }
    }
  }
  runWriteAction(new Runnable() {
    @Override
    public void run() {
      Disposer.dispose(ApplicationImpl.this);
    }
  });

  Disposer.assertIsEmpty();
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ApplicationImpl.java

示例7: doCreate

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
private static void doCreate(@NotNull AddModuleWizard wizard) throws IOException {
  // TODO: Now we need to add as module if file does not exist
  ProjectBuilder projectBuilder = wizard.getProjectBuilder();

  try {
    File projectFilePath = new File(wizard.getNewProjectFilePath());
    File projectDirPath = projectFilePath.isDirectory() ? projectFilePath : projectFilePath.getParentFile();
    LOG.assertTrue(projectDirPath != null, "Cannot create project in '" + projectFilePath + "': no parent file exists");
    ensureExists(projectDirPath);

    if (StorageScheme.DIRECTORY_BASED == wizard.getStorageScheme()) {
      File ideaDirPath = new File(projectDirPath, DIRECTORY_STORE_FOLDER);
      ensureExists(ideaDirPath);
    }

    boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode();
    ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
    Project project = projectManager.newProject(wizard.getProjectName(), projectDirPath.getPath(), true, false);
    if (project == null) {
      return;
    }
    if (!unitTestMode) {
      project.save();
    }
    if (projectBuilder != null) {
      if (!projectBuilder.validate(null, project)) {
        return;
      }
      projectBuilder.commit(project, null, EMPTY_MODULES_PROVIDER);
    }
    if (!unitTestMode) {
      project.save();
    }
  }
  finally {
    if (projectBuilder != null) {
      projectBuilder.cleanup();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:AndroidImportProjectAction.java

示例8: setUpProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
@Override
protected void setUpProject() throws Exception {
  myProjectManager = ProjectManagerEx.getInstanceEx();
  LOGGER.assertTrue(myProjectManager != null, "Cannot instantiate ProjectManager component");

  //File projectFile = getIprFile();
  //loadAndSetupProject(projectFile.getPath());
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:UpdateCacheTest.java

示例9: doSetup

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
public static void doSetup(@NotNull LightProjectDescriptor descriptor,
                           @NotNull LocalInspectionTool[] localInspectionTools,
                           @NotNull Disposable parentDisposable) throws Exception {
  assertNull("Previous test " + ourTestCase + " hasn't called tearDown(). Probably overridden without super call.", ourTestCase);
  IdeaLogger.ourErrorsOccurred = null;
  ApplicationManager.getApplication().assertIsDispatchThread();
  boolean reusedProject = true;
  if (ourProject == null || ourProjectDescriptor == null || !ourProjectDescriptor.equals(descriptor)) {
    initProject(descriptor);
    reusedProject = false;
  }

  ProjectManagerEx projectManagerEx = ProjectManagerEx.getInstanceEx();
  projectManagerEx.openTestProject(ourProject);
  if (reusedProject) {
    DumbService.getInstance(ourProject).queueTask(new UnindexedFilesUpdater(ourProject, false));
  }

  MessageBusConnection connection = ourProject.getMessageBus().connect(parentDisposable);
  connection.subscribe(ProjectTopics.MODULES, new ModuleAdapter() {
    @Override
    public void moduleAdded(@NotNull Project project, @NotNull Module module) {
      fail("Adding modules is not permitted in LightIdeaTestCase.");
    }
  });

  clearUncommittedDocuments(getProject());

  CodeInsightTestFixtureImpl.configureInspections(localInspectionTools, getProject(),
                                                  Collections.<String>emptyList(), parentDisposable);

  assertFalse(getPsiManager().isDisposed());
  Boolean passed = null;
  try {
    passed = StartupManagerEx.getInstanceEx(getProject()).startupActivityPassed();
  }
  catch (Exception ignored) {

  }
  assertTrue("open: " + getProject().isOpen() +
             "; disposed:" + getProject().isDisposed() +
             "; startup passed:" + passed +
             "; all open projects: " + Arrays.asList(ProjectManager.getInstance().getOpenProjects()), getProject().isInitialized());

  CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(new CodeStyleSettings());

  final FileDocumentManager manager = FileDocumentManager.getInstance();
  if (manager instanceof FileDocumentManagerImpl) {
    Document[] unsavedDocuments = manager.getUnsavedDocuments();
    manager.saveAllDocuments();
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      @Override
      public void run() {
        ((FileDocumentManagerImpl)manager).dropAllUnsavedDocuments();
      }
    });

    assertEmpty("There are unsaved documents", Arrays.asList(unsavedDocuments));
  }
  UIUtil.dispatchAllInvocationEvents(); // startup activities

  ((FileTypeManagerImpl)FileTypeManager.getInstance()).drainReDetectQueue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:64,代码来源:LightPlatformTestCase.java

示例10: setUpProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
protected void setUpProject() throws Exception {
  myProjectManager = ProjectManagerEx.getInstanceEx();
  assertNotNull("Cannot instantiate ProjectManager component", myProjectManager);

  File projectFile = getIprFile();

  myProject = doCreateProject(projectFile);
  myProjectManager.openTestProject(myProject);
  LocalFileSystem.getInstance().refreshIoFiles(myFilesToDelete);

  setUpModule();

  setUpJdk();

  LightPlatformTestCase.clearUncommittedDocuments(getProject());

  runStartupActivities();
  ((FileTypeManagerImpl)FileTypeManager.getInstance()).drainReDetectQueue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PlatformTestCase.java

示例11: actionPerformed

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
  final ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
  Project project = projectManager.newProject("dummy", PathManager.getConfigPath() + "/dummy.ipr", true, false);
  if (project == null) return;
  projectManager.openProject(project);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:NewDummyProjectAction.java

示例12: getProjectManager

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
@NotNull
@Override
public ProjectManagerEx getProjectManager() {
  return ProjectManagerEx.getInstanceEx();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:DvcsPlatformFacadeImpl.java

示例13: tearDown

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
@Override
protected void tearDown() throws Exception {
  try {
    if (myFixture != null) {
      try {
        if (CAN_SYNC_PROJECTS) {
          Project project = myFixture.getProject();
          // Since we don't really open the project, but we manually register listeners in the gradle importer
          // by explicitly calling AndroidGradleProjectComponent#configureGradleProject, we need to counteract
          // that here, otherwise the testsuite will leak
          if (Projects.isGradleProject(project)) {
            AndroidGradleProjectComponent projectComponent = ServiceManager.getService(project, AndroidGradleProjectComponent.class);
            projectComponent.projectClosed();
          }
        }
      }
      finally {
        myFixture.tearDown();
        myFixture = null;
      }
    }

    if (CAN_SYNC_PROJECTS) {
      GradleProjectImporter.ourSkipSetupFromTest = false;
    }

    ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
    Project[] openProjects = projectManager.getOpenProjects();
    if (openProjects.length > 0) {
      PlatformTestCase.closeAndDisposeProjectAndCheckThatNoOpenProjects(openProjects[0]);
    }
  }
  finally {
    try {
      assertEquals(0, ProjectManager.getInstance().getOpenProjects().length);
    }
    finally {
      super.tearDown();
    }

    // In case other test cases rely on the builtin (incomplete) SDK, restore
    if (ourPreviousSdkData != null) {
      setSdkData(ourPreviousSdkData);
      ourPreviousSdkData = null;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:AndroidGradleTestCase.java

示例14: setUpProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
protected void setUpProject() throws Exception {
  myProjectManager = ProjectManagerEx.getInstanceEx();
  assertNotNull("Cannot instantiate ProjectManager component", myProjectManager);

  File projectFile = getIprFile();

  myProject = doCreateProject(projectFile);
  myProjectManager.openTestProject(myProject);
  LocalFileSystem.getInstance().refreshIoFiles(myFilesToDelete);

  setUpModule();

  setUpJdk();

  LightPlatformTestCase.clearUncommittedDocuments(getProject());

  runStartupActivities();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:PlatformTestCase.java

示例15: setUpProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入方法依赖的package包/类
protected void setUpProject() throws Exception {
  myProjectManager = ProjectManagerEx.getInstanceEx();
  assertNotNull("Cannot instantiate ProjectManager component", myProjectManager);

  File tempProjectDir = getTempProjectDir();

  myProject = doCreateProject(tempProjectDir);
  myProjectManager.openTestProject(myProject);
  LocalFileSystem.getInstance().refreshIoFiles(myFilesToDelete);

  setUpModule();

  LightPlatformTestCase.clearUncommittedDocuments(getProject());

  runStartupActivities();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:PlatformTestCase.java


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