From ba88233f5530cf00bf1e7fd9edd29cbbd8b80800 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 19 Nov 2010 15:27:48 +0300 Subject: [PATCH] reduce '*' using by user --- .../codeInspection/actions/RunInspectionAction.java | 1 + .../ide/util/gotoByName/ChooseByNameBase.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionAction.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionAction.java index e96e48d6db03..cacec609a9a9 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionAction.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionAction.java @@ -66,6 +66,7 @@ public class RunInspectionAction extends GotoActionBase { FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.goto.inspection"); final ChooseByNamePopup popup = ChooseByNamePopup.createPopup(project, new GotoInspectionModel(project), getPsiContext(e)); + popup.setSearchInAnyPlace(true); popup.invoke(new ChooseByNamePopupComponent.Callback() { public void onClose() { if (RunInspectionAction.class.equals(myInAction)) { diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java index 11a5f9aa547c..5da50d327f80 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java @@ -81,6 +81,7 @@ public abstract class ChooseByNameBase { protected final String myInitialText; private boolean myPreselectInitialText; private final Reference myContext; + private boolean mySearchInAnyPlace = false; protected Component myPreviouslyFocusedComponent; @@ -166,6 +167,14 @@ public abstract class ChooseByNameBase { myShowListAfterCompletionKeyStroke = showListAfterCompletionKeyStroke; } + public boolean isSearchInAnyPlace() { + return mySearchInAnyPlace; + } + + public void setSearchInAnyPlace(boolean searchInAnyPlace) { + mySearchInAnyPlace = searchInAnyPlace; + } + /** * Set tool area. The method may be called only before invoke. * @@ -1196,6 +1205,10 @@ public abstract class ChooseByNameBase { String namePattern = getNamePattern(pattern); String qualifierPattern = getQualifierPattern(pattern); + if (isSearchInAnyPlace() && namePattern.trim().length() > 0) { + namePattern = "*" + namePattern + "*"; + } + boolean empty = namePattern.length() == 0 || namePattern.equals("@"); // TODO[yole]: remove implicit dependency if (empty && !canShowListForEmptyPattern()) return;