mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
go to action: compare actions with each other earlier
This commit is contained in:
@@ -187,11 +187,16 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
|
||||
public int compareTo(@NotNull MatchedValue o) {
|
||||
boolean edt = ApplicationManager.getApplication().isDispatchThread();
|
||||
|
||||
if (value instanceof ActionWrapper && o.value instanceof ActionWrapper && edt) {
|
||||
boolean p1Enable = ((ActionWrapper)value).isAvailable();
|
||||
boolean p2enable = ((ActionWrapper)o.value).isAvailable();
|
||||
if (p1Enable && !p2enable) return -1;
|
||||
if (!p1Enable && p2enable) return 1;
|
||||
if (value instanceof ActionWrapper && o.value instanceof ActionWrapper) {
|
||||
if (edt) {
|
||||
boolean p1Enable = ((ActionWrapper)value).isAvailable();
|
||||
boolean p2enable = ((ActionWrapper)o.value).isAvailable();
|
||||
if (p1Enable && !p2enable) return -1;
|
||||
if (!p1Enable && p2enable) return 1;
|
||||
}
|
||||
//noinspection unchecked
|
||||
int compared = value.compareTo(o.value);
|
||||
if (compared != 0) return compared;
|
||||
}
|
||||
|
||||
if (value instanceof ActionWrapper && o.value instanceof BooleanOptionDescription) {
|
||||
@@ -563,14 +568,14 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
|
||||
return myMatcher.get();
|
||||
}
|
||||
|
||||
public static class ActionWrapper implements Comparable<ActionWrapper>{
|
||||
public static class ActionWrapper implements Comparable<ActionWrapper> {
|
||||
@NotNull private final AnAction myAction;
|
||||
@NotNull private final MatchMode myMode;
|
||||
@Nullable private final String myGroupName;
|
||||
private final DataContext myDataContext;
|
||||
private Presentation myPresentation;
|
||||
|
||||
public ActionWrapper(@NotNull AnAction action, @Nullable String groupName, @NotNull MatchMode mode, DataContext dataContext) {
|
||||
public ActionWrapper(@NotNull AnAction action, @Nullable String groupName, @NotNull MatchMode mode, DataContext dataContext) {
|
||||
myAction = action;
|
||||
myMode = mode;
|
||||
myGroupName = groupName;
|
||||
|
||||
Reference in New Issue
Block a user