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


Java ProjectManagerEx类代码示例

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


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

示例1: setUpProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
@Override
protected void setUpProject() throws Exception {
  final String root = PathManagerEx.getTestDataPath() + BASE_PATH;

  VirtualFile tempProjectRootDir =
    PsiTestUtil.createTestProjectStructure(getTestName(true), null, FileUtil.toSystemIndependentName(root), myFilesToDelete, false);

  VirtualFile projectFile = tempProjectRootDir.findChild("orderEntry.ipr");

  myProject = ProjectManagerEx.getInstanceEx().loadProject(projectFile.getPath());
  ProjectManagerEx.getInstanceEx().openTestProject(myProject);
  UIUtil.dispatchAllInvocationEvents(); // startup activities

  setUpJdk();
  myModule = ModuleManager.getInstance(getProject()).getModules()[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:OrderEntryTest.java

示例2: createProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
@Nullable
@Override
public Project createProject(String name, final String path) {
  myProjectMode = true;
  unzip(name, path, false);
  return ApplicationManager.getApplication().runWriteAction(new NullableComputable<Project>() {
    @Nullable
    @Override
    public Project compute() {
      try {
        return ProjectManagerEx.getInstanceEx().convertAndLoadProject(path);
      }
      catch (IOException e) {
        LOG.error(e);
        return null;
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:TemplateModuleBuilder.java

示例3: setUpProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
private void setUpProject() throws IOException {
  File tempDirectory = FileUtil.createTempDirectory(myName, "");
  PlatformTestCase.synchronizeTempDirVfs(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDirectory));
  myFilesToDelete.add(tempDirectory);

  String projectPath = FileUtil.toSystemIndependentName(tempDirectory.getPath()) + "/" + myName + ProjectFileType.DOT_DEFAULT_EXTENSION;
  ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  new Throwable(projectPath).printStackTrace(new PrintStream(buffer));
  myProject = PlatformTestCase.createProject(projectPath, buffer.toString());

  EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
    @SuppressWarnings("TestOnlyProblems")
    @Override
    public void run() throws Throwable {
      ProjectManagerEx.getInstanceEx().openTestProject(myProject);

      for (ModuleFixtureBuilder moduleFixtureBuilder : myModuleFixtureBuilders) {
        moduleFixtureBuilder.getFixture().setUp();
      }

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

示例4: canExit

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
private boolean canExit() {
  for (ApplicationListener applicationListener : myDispatcher.getListeners()) {
    if (!applicationListener.canExitApplication()) {
      return false;
    }
  }

  ProjectManagerEx projectManager = (ProjectManagerEx)ProjectManager.getInstance();
  Project[] projects = projectManager.getOpenProjects();
  for (Project project : projects) {
    if (!projectManager.canClose(project)) {
      return false;
    }
  }

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

示例5: 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

示例6: doRender

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
private void doRender(@NotNull File outputRootPath,
                      @NotNull File moduleRootPath,
                      @NotNull Map<String, Object> args,
                      @Nullable Project project,
                      boolean gradleSyncIfNeeded) {
  myFilesToOpen.clear();
  if (project == null) {
    // Project creation: no current project to read code style settings from yet, so use defaults
    project = ProjectManagerEx.getInstanceEx().getDefaultProject();
  }
  myProject = project;

  Map<String, Object> paramMap = createParameterMap(args);
  enforceParameterTypes(getMetadata(), args);
  Configuration freemarker = new FreemarkerConfiguration();
  freemarker.setTemplateLoader(myLoader);

  processFile(freemarker, new File(TEMPLATE_XML_NAME), paramMap, outputRootPath, moduleRootPath, gradleSyncIfNeeded);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:Template.java

示例7: 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

示例8: testJavaModelSerialization

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
@Test @IdeGuiTest
public void testJavaModelSerialization() throws IOException {
  IdeFrameFixture projectFrame = importProjectAndWaitForProjectSyncToFinish("MultipleModuleTypes");
  final File projectPath = projectFrame.getProjectPath();

  projectFrame.requestProjectSync()
              .waitForGradleProjectSyncToFinish();
  projectFrame.closeProject();

  execute(new GuiTask() {
    @Override
    protected void executeInEDT() throws Throwable {
      ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
      projectManager.loadAndOpenProject(projectPath.getPath());
    }
  });

  projectFrame = findIdeFrame(projectPath);
  LibraryTable libraryTable = ProjectLibraryTable.getInstance(projectFrame.getProject());
  // When serialization of Java model fails, libraries are not set up.
  // Here we confirm that serialization works, because the Java module has the dependency declared in its build.gradle file.
  assertThat(libraryTable.getLibraries()).hasSize(1);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GradleSyncTest.java

示例9: performFileOperation

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
private void performFileOperation() {
    project.save();
    FileDocumentManager.getInstance().saveAllDocuments();
    ProjectManagerEx.getInstanceEx().blockReloadingProjectOnExternalChanges();
    ProgressManager.getInstance().run(new Task.Backgroundable(project, MESSAGE_GENERATING_SERVICE, false) {
        public void run(@NotNull ProgressIndicator progressIndicator) {
            getGenerator().makeFilePerformance(progressIndicator);
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    onActionSuccess(GenerateActions.FILE_OPERATION_SUCCESS);
                }
            });
        }
    });
}
 
开发者ID:magnetsystems,项目名称:r2m-plugin-android,代码行数:17,代码来源:AsyncHelper.java

示例10: onGenerateFinished

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
@Override
public void onGenerateFinished(boolean result, File file) {
    SaveAndSyncHandlerImpl.refreshOpenFiles();
    VirtualFileManager.getInstance().refreshWithoutFileWatcher(false);
    ProjectManagerEx.getInstanceEx().unblockReloadingProjectOnExternalChanges();
    project.getBaseDir().refresh(false, true);

    if (null == JavaPsiFacade.getInstance(project).findPackage("com.magnet.android.mms.async")) {
        showMissingDependencies();
    }

    if (!result) {
        showCloseDialog(file);
    } else {
        getThis().setVisible(true);
    }
}
 
开发者ID:magnetsystems,项目名称:r2m-plugin-android,代码行数:18,代码来源:AddControllerForm.java

示例11: setUpProject

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
@Override
protected void setUpProject() throws Exception {
  final String root = PathManagerEx.getTestDataPath() + BASE_PATH;

  VirtualFile tempProjectRootDir =
    PsiTestUtil.createTestProjectStructure(getTestName(true), null, FileUtil.toSystemIndependentName(root), myFilesToDelete, false);

  VirtualFile projectFile = tempProjectRootDir.findChild("orderEntry.ipr");

  myProject = ProjectManagerEx.getInstanceEx().loadProject(projectFile.getPath());
  ProjectManagerEx.getInstanceEx().openTestProject(myProject);
  ModuleManagerImpl mm = (ModuleManagerImpl)ModuleManager.getInstance(myProject);
  mm.projectOpened();
  setUpJdk();
  myModule = ModuleManager.getInstance(getProject()).getModules()[0];
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:OrderEntryTest.java

示例12: saveProjectsAndDocuments

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
public void saveProjectsAndDocuments() {
  if (LOG.isDebugEnabled()) {
    LOG.debug("enter: save()");
  }
  if (ApplicationManager.getApplication().isDisposed()) return;

  if (myBlockSaveOnFrameDeactivationCount.get() == 0 && GeneralSettings.getInstance().isSaveOnFrameDeactivation()) {
    FileDocumentManager.getInstance().saveAllDocuments();

    Project[] openProjects = ProjectManagerEx.getInstanceEx().getOpenProjects();
    for (Project project : openProjects) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("save project: " + project);
      }
      project.save();
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("save application settings");
    }
    ApplicationManagerEx.getApplicationEx().saveSettings();
    if (LOG.isDebugEnabled()) {
      LOG.debug("exit: save()");
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:SaveAndSyncHandlerImpl.java

示例13: mergeTemplate

import com.intellij.openapi.project.ex.ProjectManagerEx; //导入依赖的package包/类
private static String mergeTemplate(String templateContent, final VelocityContext context, boolean useSystemLineSeparators) throws IOException {
  final StringWriter stringWriter = new StringWriter();
  try {
    Velocity.evaluate(context, stringWriter, "", templateContent);
  }
  catch (final VelocityException e) {
    LOG.error("Error evaluating template:\n"+templateContent,e);
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        Messages.showErrorDialog(IdeBundle.message("error.parsing.file.template", e.getMessage()),
                                 IdeBundle.message("title.velocity.error"));
      }
    });
  }
  final String result = stringWriter.toString();

  if (useSystemLineSeparators) {
    final String newSeparator = CodeStyleSettingsManager.getSettings(ProjectManagerEx.getInstanceEx().getDefaultProject()).getLineSeparator();
    if (!"\n".equals(newSeparator)) {
      return StringUtil.convertLineSeparators(result, newSeparator);
    }
  }

  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:FileTemplateUtil.java

示例14: 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

示例15: 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


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