mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
Don't invoke setDone on rejected callback
GitOrigin-RevId: c48b66ff0172429dcd03b7d848384e094890049f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
78d15b5cdf
commit
6340d5ed29
@@ -94,6 +94,9 @@ public class ActionCallback implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* You need to avoid calling #setDone() later on otherwise the rejection will be ignored
|
||||
*/
|
||||
public @NotNull ActionCallback reject(@NonNls String error) {
|
||||
myError = error;
|
||||
setRejected();
|
||||
|
||||
@@ -68,7 +68,10 @@ public final class ShowAltEnter extends AbstractCommand implements Disposable {
|
||||
span.setAttribute("number", combined.size());
|
||||
Optional<IntentionActionWithTextCaching>
|
||||
singleIntention = combined.stream().filter(s -> s.getAction().getText().startsWith(actionName)).findFirst();
|
||||
if (singleIntention.isEmpty()) actionCallback.reject(actionName + " is not found among " + combined);
|
||||
if (singleIntention.isEmpty()) {
|
||||
actionCallback.reject(actionName + " is not found among " + combined);
|
||||
return;
|
||||
}
|
||||
if (invoke) {
|
||||
singleIntention.ifPresent(
|
||||
c -> ShowIntentionActionsHandler.chooseActionAndInvoke(psiFile, editor, c.getAction(), c.getAction().getText()));
|
||||
@@ -78,7 +81,9 @@ public final class ShowAltEnter extends AbstractCommand implements Disposable {
|
||||
IntentionHintComponent.showIntentionHint(project, psiFile, editor, true, intentions);
|
||||
}
|
||||
});
|
||||
actionCallback.setDone();
|
||||
if(!actionCallback.isRejected()){
|
||||
actionCallback.setDone();
|
||||
}
|
||||
}
|
||||
else {
|
||||
actionCallback.reject("PSI File is null");
|
||||
|
||||
Reference in New Issue
Block a user