mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'sdombrovsky/OC-4458'
This commit is contained in:
@@ -55,6 +55,14 @@ public abstract class ExecutionTarget {
|
||||
*/
|
||||
public abstract boolean canRun(@NotNull RunnerAndConfigurationSettings configuration);
|
||||
|
||||
/**
|
||||
* Checks if the target is ready to be selected as a default choice in the Run Configurations popup
|
||||
* @return true if the target is ready, false otherwise
|
||||
*/
|
||||
public boolean isReady() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj == this || (getClass().isInstance(obj) && getId().equals(((ExecutionTarget)obj).getId()));
|
||||
|
||||
@@ -125,7 +125,7 @@ public class ExecutionTargetManagerImpl extends ExecutionTargetManager implement
|
||||
}
|
||||
}
|
||||
toNotify =
|
||||
doSetActiveTarget(index >= 0 ? suitable.get(index) : ContainerUtil.getFirstItem(suitable, DefaultExecutionTarget.INSTANCE));
|
||||
doSetActiveTarget(index >= 0 ? suitable.get(index) : getDefaultTarget(suitable));
|
||||
}
|
||||
|
||||
if (toNotify != null) {
|
||||
@@ -133,6 +133,11 @@ public class ExecutionTargetManagerImpl extends ExecutionTargetManager implement
|
||||
}
|
||||
}
|
||||
|
||||
private static ExecutionTarget getDefaultTarget(List<ExecutionTarget> suitable){
|
||||
ExecutionTarget result = ContainerUtil.find(suitable, ExecutionTarget::isReady);
|
||||
return result != null ? result : DefaultExecutionTarget.INSTANCE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ExecutionTarget doSetActiveTarget(@NotNull ExecutionTarget newTarget) {
|
||||
mySavedActiveTargetId = null;
|
||||
|
||||
Reference in New Issue
Block a user