List<ExecutionTarget> (@Nullable RunConfiguration configuration) { if (configuration == null) { return Collections.emptyList(); } List<ExecutionTargetProvider> providers = ExecutionTargetProvider.EXTENSION_NAME.getExtensionList(); LinkedHashSet<ExecutionTarget> result = new LinkedHashSet<>(); Set<ExecutionTarget> specifiedTargets = new HashSet<>(); doWithEachNonCompoundWithSpecifiedTarget(configuration, (subConfiguration, executionTarget) -> { for (ExecutionTargetProvider eachTargetProvider : providers) { List<ExecutionTarget> supportedTargets = eachTargetProvider.getTargets(myProject, subConfiguration); if (executionTarget == null) { result.addAll(supportedTargets); } else if (supportedTargets.contains(executionTarget)) { result.add(executionTarget); specifiedTargets.add(executionTarget); break; } } return true; }); if (!result.isEmpty()) { specifiedTargets.forEach(it -> result.retainAll(Collections.singleton(it))); if (result.isEmpty()) { result.add(MULTIPLE_TARGETS); } } return ContainerUtil.filter(result, it -> doCanRun(configuration, it)); }