com.intellij.ide.impl.ProjectUtil Java Examples
The following examples show how to use
com.intellij.ide.impl.ProjectUtil.
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: DesktopIdeFrameImpl.java From consulo with Apache License 2.0 | 6 votes |
private void setupCloseAction() { myJFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); myJFrame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(@Nonnull final WindowEvent e) { if (isTemporaryDisposed()) return; final Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); if (openProjects.length > 1 || openProjects.length == 1 && TopApplicationMenuUtil.isMacSystemMenu) { if (myProject != null && myProject.isOpen()) { ProjectUtil.closeAndDispose(myProject); } ApplicationManager.getApplication().getMessageBus().syncPublisher(AppLifecycleListener.TOPIC).projectFrameClosed(); WelcomeFrame.showIfNoProjectOpened(); } else { Application.get().exit(); } } }); }
Example #2
Source File: ProjectImporterCheckoutListener.java From consulo with Apache License 2.0 | 6 votes |
@Override public boolean processCheckedOutDirectory(Project project, File directory) { final File[] files = directory.listFiles(); if (files != null) { final LocalFileSystem localFileSystem = LocalFileSystem.getInstance(); for (File file : files) { if (file.isDirectory()) continue; final VirtualFile virtualFile = localFileSystem.findFileByIoFile(file); if (virtualFile != null) { final ProjectOpenProcessor openProcessor = ProjectOpenProcessors.getInstance().findProcessor(file); if (openProcessor != null) { int rc = Messages.showYesNoDialog(project, VcsBundle .message("checkout.open.project.prompt", files[0].getPath()), VcsBundle.message("checkout.title"), Messages.getQuestionIcon()); if (rc == Messages.YES) { ProjectUtil.openAsync(virtualFile.getPath(), project, false, UIAccess.current()); } return true; } } } } return false; }
Example #3
Source File: OpenFileAction.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess private static void doOpenFile(@Nullable final Project project, @Nonnull final VirtualFile[] result) { for (final VirtualFile file : result) { if (file.isDirectory()) { ProjectUtil.openAsync(file.getPath(), project, false, UIAccess.current()).doWhenDone(openedProject -> FileChooserUtil.setLastOpenedFile(openedProject, file)); return; } if (OpenProjectFileChooserDescriptor.canOpen(file)) { int answer = Messages.showYesNoDialog(project, IdeBundle.message("message.open.file.is.project", file.getName()), IdeBundle.message("title.open.project"), Messages.getQuestionIcon()); if (answer == 0) { ProjectUtil.openAsync(file.getPath(), project, false, UIAccess.current()).doWhenDone(openedProject -> FileChooserUtil.setLastOpenedFile(openedProject, file)); return; } } FileType type = FileTypeChooser.getKnownFileTypeOrAssociate(file, project); if (type == null) return; if (project != null) { openFile(file, project); } } }
Example #4
Source File: RecentProjectsManagerBase.java From consulo with Apache License 2.0 | 6 votes |
public void doReopenLastProject() { GeneralSettings generalSettings = GeneralSettings.getInstance(); if (generalSettings.isReopenLastProject()) { Set<String> openPaths; boolean forceNewFrame = true; synchronized (myStateLock) { openPaths = ContainerUtil.newLinkedHashSet(myState.openPaths); if (openPaths.isEmpty()) { openPaths = ContainerUtil.createMaybeSingletonSet(myState.lastPath); forceNewFrame = false; } } for (String openPath : openPaths) { if (isValidProjectPath(openPath)) { ProjectUtil.openAsync(openPath, null, forceNewFrame, UIAccess.current()); } } } }
Example #5
Source File: ReopenProjectAction.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { //Force move focus to IdeFrame IdeEventQueue.getInstance().getPopupManager().closeAllPopups(); final int modifiers = e.getModifiers(); final boolean forceOpenInNewFrame = BitUtil.isSet(modifiers, InputEvent.CTRL_MASK) || BitUtil.isSet(modifiers, InputEvent.SHIFT_MASK) || e.getPlace() == ActionPlaces.WELCOME_SCREEN; Project project = e.getData(CommonDataKeys.PROJECT); if (!new File(myProjectPath).exists()) { if (Messages.showDialog(project, "The path " + FileUtil.toSystemDependentName(myProjectPath) + " does not exist.\n" + "If it is on a removable or network drive, please make sure that the drive is connected.", "Reopen Project", new String[]{"OK", "&Remove From List"}, 0, Messages.getErrorIcon()) == 1) { myIsRemoved = true; RecentProjectsManager.getInstance().removePath(myProjectPath); } return; } ProjectUtil.openAsync(myProjectPath, project, forceOpenInNewFrame, UIAccess.current()); }
Example #6
Source File: FlutterUtils.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Return the project located at the <code>path</code> or containing it. * * @param path The path to a project or one of its files * @return The Project located at the path */ @Nullable public static Project findProject(@NotNull String path) { for (Project project : ProjectManager.getInstance().getOpenProjects()) { if (ProjectUtil.isSameProject(path, project)) { return project; } } return null; }
Example #7
Source File: XDebugSessionTab.java From consulo with Apache License 2.0 | 5 votes |
public void toFront(boolean focus, @Nullable final Runnable onShowCallback) { if (ApplicationManager.getApplication().isUnitTestMode()) return; ApplicationManager.getApplication().invokeLater(() -> { if (myRunContentDescriptor != null) { RunContentManager manager = ExecutionManager.getInstance(myProject).getContentManager(); ToolWindow toolWindow = manager.getToolWindowByDescriptor(myRunContentDescriptor); if (toolWindow != null) { if (!toolWindow.isVisible()) { toolWindow.show(() -> { if (onShowCallback != null) { onShowCallback.run(); } myRebuildWatchesRunnable.run(); }); } manager.selectRunContent(myRunContentDescriptor); } } }); if (focus) { ApplicationManager.getApplication().invokeLater(() -> { boolean focusWnd = XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isMayBringFrameToFrontOnBreakpoint(); ProjectUtil.focusProjectWindow(myProject, focusWnd); if (!focusWnd) { AppIcon.getInstance().requestAttention(myProject, true); } }); } }
Example #8
Source File: ProjectManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
private void tryInitProjectByPath(ConversionResult conversionResult, AsyncResult<Project> projectAsyncResult, VirtualFile path, UIAccess uiAccess) { final ProjectImpl project = createProject(null, toCanonicalName(path.getPath()), false, false, true); for (Project p : getOpenProjects()) { if (ProjectUtil.isSameProject(path.getPath(), p)) { uiAccess.give(() -> ProjectUtil.focusProjectWindow(p, false)); closeAndDisposeAsync(project, uiAccess).doWhenProcessed(() -> projectAsyncResult.reject("Already opened project")); return; } } loadProjectAsync(project, projectAsyncResult, true, conversionResult, uiAccess); }
Example #9
Source File: ProjectManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
private void doReloadProjectAsync(@Nonnull Project project, @Nonnull UIAccess uiAccess) { ProjectReloadState.getInstance(project).onBeforeAutomaticProjectReload(); if(project.isDisposed()) { return; } String basePath = project.getBasePath(); closeAndDisposeAsync(project, uiAccess).doWhenDone(() -> ProjectUtil.openAsync(basePath, null, true, uiAccess)); }
Example #10
Source File: FloobitsApplication.java From floobits-intellij with Apache License 2.0 | 5 votes |
private Project getProject(String path) { ProjectManager pm = ProjectManager.getInstance(); Project[] openProjects = pm.getOpenProjects(); for (Project project : openProjects) { if (path.equals(project.getBasePath())) { return project; } } VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(path)); Project openedProject; if (ProjectAttachProcessor.canAttachToProject() && file != null) { openedProject = PlatformProjectOpenProcessor.doOpenProject(file, null, false, -1, null, false); } else { openedProject = ProjectUtil.openOrImport(path, null, false); } if (openedProject == null) { try { String projectFilePath = ".idea/misc.xml"; if (path.endsWith(projectFilePath)) { Flog.error("Attempted to open the project misc.xml file instead of the directory."); path = path.replace(projectFilePath, ""); } openedProject = ProjectManager.getInstance().loadAndOpenProject(path); } catch (Throwable e) { Flog.error(e); API.uploadCrash(null, null, e); return null; } } // This is something Intellij does when a user opens a project from the menu: FileChooserUtil.setLastOpenedFile(openedProject, file); return openedProject; }
Example #11
Source File: PantsOpenProjectTest.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
public void testOpenHello() { Path importPath = getPath("examples/src/scala/org/pantsbuild/example/hello/BUILD"); Project project = ProjectUtil.openOrImport(importPath, new OpenProjectTask()); assertNotNull(project); Path rootPath = rootPath(importPath); assertEquals(rootPath, Paths.get(project.getBasePath())); assertOpened(project); }
Example #12
Source File: PantsOpenProjectTest.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
public void testOpenDirectory() { Path path = getPath("examples/src/scala/org/pantsbuild/example/hello/"); Project project = ProjectUtil.openOrImport(path, new OpenProjectTask()); assertNotNull(project); Path rootPath = rootPath(path); assertEquals(rootPath, Paths.get(project.getBasePath())); assertOpened(project); }
Example #13
Source File: PantsToBspProjectAction.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(AnActionEvent e) { Project project = e.getProject(); if (project == null) { Messages.showInfoMessage("Project not found.", "Error"); return; } dependingOnBspProjectExistence( project, () -> createBspProject(project), linkedBspProject -> ProjectUtil.openOrImport(Paths.get(linkedBspProject), new OpenProjectTask()) ); }
Example #14
Source File: ProjectOpener.java From tmc-intellij with MIT License | 5 votes |
public void openProject(Project project, String path) { logger.info("Opening project from {}. @ProjectOpener", path); if (Files.isDirectory(Paths.get(path))) { if (project == null || !path.equals(project.getBasePath())) { try { if (project != null) { new ActivateSnapshotsListeners(project).removeListeners(); } ExerciseImport.importExercise(path); ProjectUtil.openOrImport(path, project, true); if (project != null) { ProjectManager.getInstance().closeProject(project); } String[] split = PathResolver.getCourseAndExerciseName(path); Course course = new ObjectFinder().findCourse(split[split.length - 2], "name"); TmcSettingsManager.get().setCourse(Optional.of(course)); } catch (Exception exception) { logger.warn( "Could not open project from path. @ProjectOpener", exception, exception.getStackTrace()); new ErrorMessageService() .showErrorMessageWithExceptionDetails( exception, "Could not open project from path. " + path, true); } } } else { logger.warn("Directory no longer exists. @ProjectOpener"); Messages.showErrorDialog( new ObjectFinder().findCurrentProject(), "Directory no longer exists", "File not found"); ProjectListManagerHolder.get().refreshAllCourses(); } }
Example #15
Source File: FlutterUtils.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Return the project located at the <code>path</code> or containing it. * * @param path The path to a project or one of its files * @return The Project located at the path */ @Nullable public static Project findProject(@NotNull String path) { for (Project project : ProjectManager.getInstance().getOpenProjects()) { if (ProjectUtil.isSameProject(path, project)) { return project; } } return null; }
Example #16
Source File: OSSPantsIdeaPluginGoalIntegrationTest.java From intellij-pants-plugin with Apache License 2.0 | 4 votes |
public void testPantsIdeaPluginGoal() throws Throwable { assertEmpty(ModuleManager.getInstance(myProject).getModules()); /** * Check whether Pants supports `idea-plugin` goal. */ final GeneralCommandLine commandLinePantsGoals = PantsUtil.defaultCommandLine(getProjectFolder().getPath()); commandLinePantsGoals.addParameter("goals"); final ProcessOutput cmdOutputGoals = PantsUtil.getCmdOutput(commandLinePantsGoals.withWorkDirectory(getProjectFolder()), null); assertEquals(commandLinePantsGoals.toString() + " failed", 0, cmdOutputGoals.getExitCode()); if (!cmdOutputGoals.getStdout().contains("idea-plugin")) { return; } /** * Generate idea project via `idea-plugin` goal. */ final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectFolder().getPath()); final File outputFile = FileUtil.createTempFile("project_dir_location", ".out"); String targetToImport = "testprojects/tests/java/org/pantsbuild/testproject/matcher:matcher"; commandLine.addParameters( "idea-plugin", "--no-open", "--output-file=" + outputFile.getPath(), targetToImport ); final ProcessOutput cmdOutput = PantsUtil.getCmdOutput(commandLine.withWorkDirectory(getProjectFolder()), null); assertEquals(commandLine.toString() + " failed", 0, cmdOutput.getExitCode()); // `outputFile` contains the path to the project directory. String projectDir = FileUtil.loadFile(outputFile); // Search the directory for ipr file. File[] files = new File(projectDir).listFiles(); assertNotNull(files); Optional<String> iprFile = Arrays.stream(files) .map(File::getPath) .filter(s -> s.endsWith(ProjectFileType.DOT_DEFAULT_EXTENSION)) .findFirst(); assertTrue(iprFile.isPresent()); myProject = ProjectUtil.openProject(iprFile.get(), myProject, false); // Invoke post startup activities. UIUtil.dispatchAllInvocationEvents(); /** * Under unit test mode, {@link com.intellij.ide.impl.ProjectUtil#openProject} will force open a project in a new window, * so Project SDK has to be reset. In practice, this is not needed. */ ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { final JavaSdk javaSdk = JavaSdk.getInstance(); ProjectRootManager.getInstance(myProject).setProjectSdk(ProjectJdkTable.getInstance().getSdksOfType(javaSdk).iterator().next()); } }); assertSuccessfulTest(PantsUtil.getCanonicalModuleName(targetToImport), "org.pantsbuild.testproject.matcher.MatcherTest"); assertTrue(ProjectUtil.closeAndDispose(myProject)); }
Example #17
Source File: ProjectManagerImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override @RequiredUIAccess public boolean openProject(@Nonnull final Project project, @Nonnull UIAccess uiAccess) { if (isLight(project)) { ((ProjectImpl)project).setTemporarilyDisposed(false); boolean isInitialized = StartupManagerEx.getInstanceEx(project).startupActivityPassed(); if (isInitialized) { addToOpened(project); // events already fired return true; } } for (Project p : getOpenProjects()) { if (ProjectUtil.isSameProject(project.getProjectFilePath(), p)) { GuiUtils.invokeLaterIfNeeded(() -> ProjectUtil.focusProjectWindow(p, false), ModalityState.NON_MODAL); return false; } } if (!addToOpened(project)) { return false; } Runnable process = () -> { TransactionGuard.getInstance().submitTransactionAndWait(() -> myApplication.getMessageBus().syncPublisher(TOPIC).projectOpened(project, uiAccess)); final StartupManagerImpl startupManager = (StartupManagerImpl)StartupManager.getInstance(project); startupManager.runStartupActivities(uiAccess); startupManager.runPostStartupActivitiesFromExtensions(uiAccess); GuiUtils.invokeLaterIfNeeded(() -> { if (!project.isDisposed()) { startupManager.runPostStartupActivities(uiAccess); if (!myApplication.isHeadlessEnvironment() && !myApplication.isUnitTestMode()) { final TrackingPathMacroSubstitutor macroSubstitutor = ((ProjectEx)project).getStateStore().getStateStorageManager().getMacroSubstitutor(); if (macroSubstitutor != null) { StorageUtil.notifyUnknownMacros(macroSubstitutor, project, null); } } if (myApplication.isActive()) { Window projectFrame = TargetAWT.to(WindowManager.getInstance().getWindow(project)); if (projectFrame != null) { IdeFocusManager.getInstance(project).requestFocus(projectFrame, true); } } } }, ModalityState.NON_MODAL); }; ProgressIndicator indicator = myProgressManager.getProgressIndicator(); if (indicator != null) { indicator.setText("Preparing workspace..."); process.run(); return true; } boolean ok = myProgressManager.runProcessWithProgressSynchronously(process, "Preparing workspace...", canCancelProjectLoading(), project); if (!ok) { closeProject(project, false, false, true); notifyProjectOpenFailed(); return false; } return true; }
Example #18
Source File: PantsOpenProjectTest.java From intellij-pants-plugin with Apache License 2.0 | 4 votes |
private void assertOpened(Project project) { assertContain(Arrays.asList(ProjectUtil.getOpenProjects()), project); }
Example #19
Source File: PantsToBspProjectAction.java From intellij-pants-plugin with Apache License 2.0 | 4 votes |
private void registerNewBspProjectAndOpen(Path projectPath, Project project) { PropertiesComponent.getInstance(project).setValue(BSP_LINKED_PROJECT_PATH, projectPath.toString()); ApplicationManager.getApplication() .invokeLater(() -> ProjectUtil.openOrImport(projectPath, new OpenProjectTask())); }
Example #20
Source File: CommandLineProcessor.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public static AsyncResult<Project> processExternalCommandLine(@Nonnull CommandLineArgs commandLineArgs, @Nullable String currentDirectory) { String file = commandLineArgs.getFile(); if (file == null) { return AsyncResult.rejected(); } int line = commandLineArgs.getLine(); if (StringUtil.isQuotedString(file)) { file = StringUtil.stripQuotesAroundValue(file); } if (!new File(file).isAbsolute()) { file = currentDirectory != null ? new File(currentDirectory, file).getAbsolutePath() : new File(file).getAbsolutePath(); } File projectFile = findProjectDirectoryOrFile(file); File targetFile = new File(file); UIAccess uiAccess = Application.get().getLastUIAccess(); if (projectFile != null) { return ProjectUtil.openAsync(projectFile.getPath(), null, true, uiAccess).doWhenDone(project -> { if (!FileUtil.filesEqual(projectFile, targetFile) && !targetFile.isDirectory()) { final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetFile); if (virtualFile != null) { openFile(uiAccess, project, virtualFile, line); } } }); } else { final VirtualFile targetVFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetFile); if (targetVFile == null) { Messages.showErrorDialog("Cannot find file '" + file + "'", "Cannot find file"); return AsyncResult.rejected(); } Project bestProject = findBestProject(targetVFile); openFile(uiAccess, bestProject, targetVFile, line); return AsyncResult.resolved(bestProject); } }
Example #21
Source File: BlazeProjectCreator.java From intellij with Apache License 2.0 | 4 votes |
private void doCreate() throws IOException { String projectFilePath = wizardContext.getProjectFileDirectory(); File projectDir = new File(projectFilePath).getParentFile(); logger.assertTrue( projectDir != null, "Cannot create project in '" + projectFilePath + "': no parent file exists"); FileUtil.ensureExists(projectDir); if (wizardContext.getProjectStorageFormat() == StorageScheme.DIRECTORY_BASED) { final File ideaDir = new File(projectFilePath, Project.DIRECTORY_STORE_FOLDER); FileUtil.ensureExists(ideaDir); } String name = wizardContext.getProjectName(); Project newProject = projectBuilder.createProject(name, projectFilePath); if (newProject == null) { return; } if (!ApplicationManager.getApplication().isUnitTestMode()) { newProject.save(); } if (!projectBuilder.validate(null, newProject)) { return; } projectBuilder.commit(newProject, null, ModulesProvider.EMPTY_MODULES_PROVIDER); StartupManager.getInstance(newProject) .registerPostStartupActivity( () -> { // ensure the dialog is shown after all startup activities are done //noinspection SSBasedInspection SwingUtilities.invokeLater( () -> { if (newProject.isDisposed() || ApplicationManager.getApplication().isUnitTestMode()) { return; } ApplicationManager.getApplication() .invokeLater( () -> { if (newProject.isDisposed()) { return; } final ToolWindow toolWindow = ToolWindowManager.getInstance(newProject) .getToolWindow(ToolWindowId.PROJECT_VIEW); if (toolWindow != null) { toolWindow.activate(null); } }, ModalityState.NON_MODAL); }); }); ProjectUtil.updateLastProjectLocation(projectFilePath); if (WindowManager.getInstance().isFullScreenSupportedInCurrentOS()) { IdeFocusManager instance = IdeFocusManager.findInstance(); IdeFrame lastFocusedFrame = instance.getLastFocusedFrame(); if (lastFocusedFrame instanceof IdeFrameEx) { boolean fullScreen = ((IdeFrameEx) lastFocusedFrame).isInFullScreen(); if (fullScreen) { newProject.putUserData(IdeFrameImpl.SHOULD_OPEN_IN_FULL_SCREEN, Boolean.TRUE); } } } BaseSdkCompat.openProject(newProject, Paths.get(projectFilePath)); if (!ApplicationManager.getApplication().isUnitTestMode()) { SaveAndSyncHandler.getInstance().scheduleProjectSave(newProject); } }
Example #22
Source File: ImportProjectOpenProcessor.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public AsyncResult<Project> doOpenProjectAsync(@Nonnull VirtualFile virtualFile, @Nonnull UIAccess uiAccess) { File ioPath = VfsUtil.virtualToIoFile(virtualFile); List<ModuleImportProvider> targetProviders = ContainerUtil.filter(myProviders, moduleImportProvider -> moduleImportProvider.canImport(ioPath)); if (targetProviders.size() == 0) { throw new IllegalArgumentException("must be not empty"); } String expectedProjectPath = ModuleImportProvider.getDefaultPath(virtualFile); AsyncResult<ThreeState> askDialogResult = AsyncResult.undefined(); if (!uiAccess.isHeadless() && DefaultProjectOpenProcessor.getInstance().canOpenProject(new File(expectedProjectPath))) { Alert<ThreeState> alert = Alert.create(); alert.title(IdeBundle.message("title.open.project")); alert.text(IdeBundle.message("project.import.open.existing", "an existing project", FileUtil.toSystemDependentName(ioPath.getPath()), virtualFile.getName())); alert.asQuestion(); alert.button(IdeBundle.message("project.import.open.existing.openExisting"), ThreeState.YES); alert.asDefaultButton(); alert.button(IdeBundle.message("project.import.open.existing.reimport"), ThreeState.NO); alert.button(Alert.CANCEL, ThreeState.UNSURE); alert.asExitButton(); uiAccess.give(() -> alert.showAsync().notify(askDialogResult)); } else { askDialogResult.setDone(ThreeState.NO); } AsyncResult<Project> projectResult = AsyncResult.undefined(); askDialogResult.doWhenDone(threeState -> { switch (threeState) { case YES: ProjectManager.getInstance().openProjectAsync(virtualFile, uiAccess).notify(projectResult); break; case NO: uiAccess.give(() -> { AsyncResult<Pair<ModuleImportContext, ModuleImportProvider<ModuleImportContext>>> result = AsyncResult.undefined(); ModuleImportProcessor.showImportChooser(null, virtualFile, targetProviders, result); result.doWhenDone(pair -> { ModuleImportContext context = pair.getFirst(); ModuleImportProvider<ModuleImportContext> provider = pair.getSecond(); AsyncResult<Project> importProjectAsync = NewOrImportModuleUtil.importProject(context, provider); importProjectAsync.doWhenDone((newProject) -> { ProjectUtil.updateLastProjectLocation(expectedProjectPath); ProjectManager.getInstance().openProjectAsync(newProject, uiAccess).notify(projectResult); }); importProjectAsync.doWhenRejected((Runnable)projectResult::setRejected); }); result.doWhenRejected((pair, error) -> { pair.getFirst().dispose(); projectResult.setRejected(); }); }); break; case UNSURE: projectResult.setRejected(); break; } }); return projectResult; }