mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
restore comparable quick fixes and intention actions sorting
This commit is contained in:
+15
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -143,7 +143,7 @@ public class IntentionActionWithTextCaching implements Comparable<IntentionActio
|
||||
}
|
||||
|
||||
// IntentionAction which wraps the original action and then marks it as executed to hide it from the popup to avoid invoking it twice accidentally
|
||||
private class MyIntentionAction implements IntentionAction,IntentionActionDelegate {
|
||||
private class MyIntentionAction implements IntentionAction, IntentionActionDelegate, Comparable<MyIntentionAction> {
|
||||
private final IntentionAction myAction;
|
||||
private final BiConsumer<IntentionActionWithTextCaching, IntentionAction> myMarkInvoked;
|
||||
|
||||
@@ -204,5 +204,18 @@ public class IntentionActionWithTextCaching implements Comparable<IntentionActio
|
||||
public PsiElement getElementToMakeWritable(@NotNull PsiFile currentFile) {
|
||||
return myAction.getElementToMakeWritable(currentFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull final MyIntentionAction other) {
|
||||
if (myAction instanceof Comparable) {
|
||||
//noinspection unchecked
|
||||
return ((Comparable)myAction).compareTo(other.getDelegate());
|
||||
}
|
||||
if (other.getDelegate() instanceof Comparable) {
|
||||
//noinspection unchecked
|
||||
return ((Comparable)other.getDelegate()).compareTo(myAction);
|
||||
}
|
||||
return Comparing.compare(getText(), other.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user