PopupStep (final ProjectPopupItem projectPopupItem, final boolean finalChoice) { return new BaseListPopupStep<>(ExternalSystemBundle.message("popup.title.choose.activation.phase"), Phase.values()) { @Override public PopupStep onChosen(final Phase selectedPhase, boolean finalChoice) { final Map<String, TaskActivationState> activationMap = ExternalProjectsManagerImpl.getInstance(myProject).getStateProvider().getProjectsTasksActivationMap(myProjectSystemId); final String projectPath = projectPopupItem.myModuleData.getLinkedExternalProjectPath(); final List<String> tasks = activationMap.get(projectPath).getTasks(selectedPhase); final List<String> tasksToSuggest = new ArrayList<>(projectPopupItem.myTasks); tasksToSuggest.removeAll(tasks); return new BaseListPopupStep<>(ExternalSystemBundle.message("popup.title.choose.task"), tasksToSuggest) { @Override public PopupStep onChosen(final String taskName, boolean finalChoice) { return doFinalStep(() -> { myTaskActivator.addTask(new TaskActivationEntry(myProjectSystemId, selectedPhase, projectPath, taskName)); updateTree(myRootNode); }); } }; } @Override public boolean hasSubstep(Phase phase) { return true; } }; }