Java Code Examples for com.intellij.openapi.project.ex.ProjectManagerEx#getInstanceEx()
The following examples show how to use
com.intellij.openapi.project.ex.ProjectManagerEx#getInstanceEx() .
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 File: DesktopApplicationImpl.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess 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(() -> consulo.disposer.Disposer.dispose(DesktopApplicationImpl.this)); consulo.disposer.Disposer.assertIsEmpty(); return true; }
Example 2
Source File: NewOrImportModuleUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @RequiredUIAccess public static <T extends ModuleImportContext> AsyncResult<Project> importProject(@Nonnull T context, @Nonnull ModuleImportProvider<T> importProvider) { final ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx(); final String projectFilePath = context.getPath(); String projectName = context.getName(); try { File projectDir = new File(projectFilePath); FileUtil.ensureExists(projectDir); File projectConfigDir = new File(projectDir, Project.DIRECTORY_STORE_FOLDER); FileUtil.ensureExists(projectConfigDir); final Project newProject = projectManager.createProject(projectName, projectFilePath); if (newProject == null) return AsyncResult.rejected(); newProject.save(); ModifiableModuleModel modifiableModel = ModuleManager.getInstance(newProject).getModifiableModel(); importProvider.process(context, newProject, modifiableModel, module -> { }); WriteAction.runAndWait(modifiableModel::commit); newProject.save(); context.dispose(); return AsyncResult.resolved(newProject); } catch (Exception e) { context.dispose(); return AsyncResult.<Project>undefined().rejectWithThrowable(e); } }
Example 3
Source File: PlatformTestCase.java From consulo with Apache License 2.0 | 4 votes |
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(); }