mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't wrap automatic QuestionAction invocation into a command with meaningless name
This commit is contained in:
+21
@@ -20,6 +20,12 @@ import com.intellij.codeInsight.CodeInsightActionHandler;
|
||||
import com.intellij.codeInsight.actions.BaseCodeInsightAction;
|
||||
import com.intellij.codeInsight.hint.HintManagerImpl;
|
||||
import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -30,6 +36,21 @@ public class ShowIntentionActionsAction extends BaseCodeInsightAction implements
|
||||
setEnabledInModalContext(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
|
||||
Editor editor = getEditor(e.getDataContext(), project, false);
|
||||
if (editor == null) return;
|
||||
|
||||
final PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project);
|
||||
if (psiFile == null) return;
|
||||
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode() && !editor.getContentComponent().isShowing()) return;
|
||||
getHandler().invoke(project, editor, psiFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidForLookup() {
|
||||
return true;
|
||||
|
||||
+5
-1
@@ -70,7 +70,7 @@ public class ShowIntentionActionsHandler implements CodeInsightActionHandler {
|
||||
}
|
||||
|
||||
final DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(project);
|
||||
codeAnalyzer.autoImportReferenceAtCursor(editor, file); //let autoimport complete
|
||||
letAutoImportComplete(editor, file, codeAnalyzer);
|
||||
|
||||
ShowIntentionsPass.IntentionsInfo intentions = new ShowIntentionsPass.IntentionsInfo();
|
||||
ShowIntentionsPass.getActionsToShow(editor, file, intentions, -1);
|
||||
@@ -98,6 +98,10 @@ public class ShowIntentionActionsHandler implements CodeInsightActionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static void letAutoImportComplete(@NotNull Editor editor, @NotNull PsiFile file, DaemonCodeAnalyzerImpl codeAnalyzer) {
|
||||
CommandProcessor.getInstance().runUndoTransparentAction(() -> codeAnalyzer.autoImportReferenceAtCursor(editor, file));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user