fixed [RUBY-5133] Keep last rake search
authorRoman Chernyatchik <roman.chernyatchik@jetbrains.com>
Tue, 9 Feb 2010 12:59:56 +0000 (9 15:59 +0300)
committerRoman Chernyatchik <roman.chernyatchik@jetbrains.com>
Fri, 12 Feb 2010 14:04:17 +0000 (12 17:04 +0300)
platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNamePopup.java

index 6f19f34..7549872 100644 (file)
@@ -39,12 +39,16 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
 
   private ChooseByNamePopup(final Project project, final ChooseByNameModel model, final ChooseByNamePopup oldPopup,
                             final PsiElement context, @Nullable final String predefinedText) {
-    super(project, model, oldPopup != null ? oldPopup.myTextField.getText() : predefinedText, context);
+    super(project, model, oldPopup != null ? oldPopup.getEnteredText() : predefinedText, context);
     if (oldPopup != null) { //inherit old focus owner
       myOldFocusOwner = oldPopup.myPreviouslyFocusedComponent;
     }
   }
 
+  public String getEnteredText() {
+    return myTextField.getText();
+  }
+
   protected void initUI(final Callback callback, final ModalityState modalityState, boolean allowMultipleSelection) {
     super.initUI(callback, modalityState, allowMultipleSelection);
     //LaterInvocator.enterModal(myTextFieldPanel);
@@ -130,7 +134,7 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
       }
 
       if (!chosenElements.isEmpty()){
-        final String enteredText = myTextField.getText();
+        final String enteredText = getEnteredText();
         if (enteredText.indexOf('*') >= 0) {
           FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.wildcards");
         }
@@ -235,7 +239,7 @@ public class ChooseByNamePopup extends ChooseByNameBase implements ChooseByNameP
   }
 
   private int getLineOrColumn(final boolean line) {
-    final Matcher matcher = patternToDetectLinesAndColumns.matcher(myTextField.getText());
+    final Matcher matcher = patternToDetectLinesAndColumns.matcher(getEnteredText());
     if (matcher.matches()) {
       final int groupNumber = line ? 2:3;
       try {