reduce '*' using by user

This commit is contained in:
Konstantin Bulenkov
2010-11-19 15:30:41 +03:00
parent 518fc6791c
commit ba88233f55
2 changed files with 14 additions and 0 deletions
@@ -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)) {
@@ -81,6 +81,7 @@ public abstract class ChooseByNameBase {
protected final String myInitialText;
private boolean myPreselectInitialText;
private final Reference<PsiElement> 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;