import popup fixed
authorAlexey Kudravtsev <cdr@intellij.com>
Tue, 14 Sep 2010 14:26:10 +0000 (18:26 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Wed, 15 Sep 2010 11:53:27 +0000 (15:53 +0400)
platform/lang-impl/src/com/intellij/codeInsight/intention/impl/ShowIntentionActionsHandler.java
platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java

index 338ab328be874503204a3b6c2ac17676be5117d8..5ac1156b1e8826bb33cdb10813299077667d0953 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.CodeInsightActionHandler;
 import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
 import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl;
 import com.intellij.codeInsight.daemon.impl.ShowIntentionsPass;
+import com.intellij.codeInsight.hint.HintManagerImpl;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
 import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
@@ -50,6 +51,8 @@ public class ShowIntentionActionsHandler implements CodeInsightActionHandler {
   public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
     PsiDocumentManager.getInstance(project).commitAllDocuments();
 
+    if (HintManagerImpl.getInstanceImpl().performCurrentQuestionAction()) return;
+
     //intentions check isWritable before modification: if (!file.isWritable()) return;
     if (file instanceof PsiCodeFragment) return;
 
index 14fd16515f317935369b3fe4aa1d08e207129a92..78d3f8491f38044bd763f489a63fd5506286e0c9 100644 (file)
@@ -162,6 +162,28 @@ public class HintManagerImpl extends HintManager implements Disposable {
     };
   }
 
+  public boolean performCurrentQuestionAction() {
+    if (myQuestionAction != null && myQuestionHint != null) {
+      if (myQuestionHint.isVisible()) {
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("performing an action:" + myQuestionAction);
+        }
+        if (myQuestionAction.execute()) {
+          if (myQuestionHint != null) {
+            myQuestionHint.hide();
+          }
+        }
+        return true;
+      }
+
+      myQuestionAction = null;
+      myQuestionHint = null;
+    }
+
+    return false;
+  }
+
+
   private void updateScrollableHints(VisibleAreaEvent e) {
     LOG.assertTrue(SwingUtilities.isEventDispatchThread());
     for (HintInfo info : myHintsStack) {