IDEA-155319 "Run inspection by name" should not reuse "Find Action" search pattern
authorpeter <peter@jetbrains.com>
Tue, 3 May 2016 08:38:43 +0000 (10:38 +0200)
committerpeter <peter@jetbrains.com>
Tue, 3 May 2016 08:40:31 +0000 (10:40 +0200)
platform/lang-impl/src/com/intellij/ide/actions/GotoActionAction.java
platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNamePopup.java

index cf6aa20e585ac345d85e6e2f0187fd124f8e3f38..896f104fe070a7eeacce1e6956be086333263eb1 100644 (file)
@@ -26,7 +26,6 @@ import com.intellij.ide.util.gotoByName.GotoActionModel;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.actionSystem.ex.ActionUtil;
-import com.intellij.openapi.actionSystem.ex.QuickList;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.application.TransactionGuard;
@@ -46,7 +45,6 @@ import com.intellij.openapi.ui.popup.ListPopup;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.Pair;
 import com.intellij.psi.PsiFile;
-import com.intellij.util.ArrayUtil;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -75,6 +73,10 @@ public class GotoActionAction extends GotoActionBase implements DumbAware {
     GotoActionCallback<Object> callback = new GotoActionCallback<Object>() {
       @Override
       public void elementChosen(@NotNull ChooseByNamePopup popup, @NotNull Object element) {
+        if (project != null) {
+          // if the chosen action displays another popup, don't populate it automatically with the text from this popup
+          project.putUserData(ChooseByNamePopup.CHOOSE_BY_NAME_POPUP_IN_PROJECT_KEY, null);
+        }
         String enteredText = popup.getTrimmedText();
         openOptionOrPerformAction(((GotoActionModel.MatchedValue)element).value, enteredText, project, component, e);
       }
index af1427484b11dee9571b54b0601c4c899ec00664..258f0ac816956349cf4b7f7899df51ade509869d 100644 (file)
@@ -210,6 +210,10 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
       return;
     }
 
+    if (myActionListener != null && !ApplicationManager.getApplication().isUnitTestMode()) {
+      myActionListener.onClose();
+    }
+
     if (isOk) {
       myModel.saveInitialCheckBoxState(myCheckBox.isSelected());
 
@@ -261,10 +265,6 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
     }
 
     cleanupUI(isOk);
-    if (ApplicationManager.getApplication().isUnitTestMode()) return;
-    if (myActionListener != null) {
-      myActionListener.onClose();
-    }
   }
 
   private void cleanupUI(boolean ok) {