Tools__SearchDialog.st
branchjv
changeset 16348 10a6bb733b5d
parent 16213 f667b5b42a11
parent 16342 0712815bf61d
child 16369 1090224cc0db
--- a/Tools__SearchDialog.st	Thu Apr 28 06:55:28 2016 +0200
+++ b/Tools__SearchDialog.st	Fri Apr 29 06:55:29 2016 +0200
@@ -267,6 +267,7 @@
         openHow := defaultOpenHow.
     ].
     where := whereRadioGroup value.
+
     withTextEntry ifTrue:[ 
         searchWhat == #code ifTrue:[
             code := codeField contentsAsString.
@@ -306,7 +307,10 @@
                 ]
             ]
         ].
+    ] ifFalse:[
+        sel := initialText
     ].
+    
     where isNil ifTrue:[ 
         (browser ? Dialog) warn:'No class(es) for search'.
         ^ self.
@@ -378,7 +382,7 @@
     "searchWhat:
         one of:#selector 
      searchArea:
-        one of: #everywhere
+        one of: #everywhere #currentNameSpace
     "
 
     |where ns methodNameSpaces methodPackages hPanel 
@@ -390,11 +394,9 @@
     searchWhat := searchWhatArg.
 
     withTextEntry := withTextEntryArg.
+    resources := NewSystemBrowser classResources.
 
-    (browser := brwsrArg) isNil ifTrue:[
-        resources := NewSystemBrowser classResources.
-    ] ifFalse:[
-        resources := browser resources.
+    (browser := brwsrArg) notNil ifTrue:[
         selectedClasses := browser selectedClasses value.
         selectedCategories := browser selectedCategoriesValue.
         selectedCategories := selectedCategories reject:[:cat | NavigatorModel isPseudoCategory:cat].
@@ -535,6 +537,15 @@
                 ].
             ].
         ].
+        (currentPackage notNil and:[ currentPackage ~= (browser nameListEntryForALL) ]) 
+        ifTrue:[ 
+            self addCheckBoxForCurrentPackage.
+            self addCheckBoxForCurrentPackageAndSubPackages.
+        ] ifFalse:[
+            (currentClass notNil) ifTrue:[ 
+                self addCheckBoxForClassesPackage:(currentClass package) 
+            ].
+        ].
     ].
     searchAreas isEmptyOrNil ifTrue:[
         self addCheckBoxForEverywhere.
@@ -1061,36 +1072,38 @@
     inputField selectAllInitially.
     inputField immediateAccept:true.
     inputField takeFocus.
-    inputField 
-        entryCompletionBlock:[ :contents | 
-            |s what|
+
+    searchWhat == #string ifFalse:[
+        inputField 
+            entryCompletionBlock:[ :contents | 
+                |s what|
+
+                s := contents withoutSpaces.
+                self topView 
+                    withWaitCursorDo:[
+                        |best matching|
 
-            s := contents withoutSpaces.
-            self topView 
-                withWaitCursorDo:[
-                    |best matching|
-
-                    searchWhat == #resource ifTrue:[
-                        what := DoWhatIMeanSupport resourceCompletion:s inEnvironment:Smalltalk match:true ignoreCase:false.
-                    ] ifFalse:[
-                        searchWhat == #globalName ifFalse:[ 
-                            what := DoWhatIMeanSupport selectorCompletion:s inEnvironment:Smalltalk.
-                        ] ifTrue:[ 
-                            what := DoWhatIMeanSupport globalNameCompletion:s inEnvironment:Smalltalk match:true.
+                        searchWhat == #resource ifTrue:[
+                            what := DoWhatIMeanSupport resourceCompletion:s inEnvironment:Smalltalk match:true ignoreCase:false.
+                        ] ifFalse:[
+                            searchWhat == #globalName ifFalse:[ 
+                                what := DoWhatIMeanSupport selectorCompletion:s inEnvironment:Smalltalk.
+                            ] ifTrue:[ 
+                                what := DoWhatIMeanSupport globalNameCompletion:s inEnvironment:Smalltalk match:true.
+                            ].
+                        ].
+                        best := what first.
+                        matching := what second.
+                        inputField contents:best.
+                        "/ listHolder contents:matching.
+                        matching size ~~ 1 ifTrue:[ 
+                            (browser ? self) window beep.
                         ].
                     ].
-                    best := what first.
-                    matching := what second.
-                    inputField contents:best.
-                    "/ listHolder contents:matching.
-                    matching size ~~ 1 ifTrue:[ 
-                        (browser ? self) window beep.
-                    ].
-                ].
-        ].
+            ].
 
-    selectorHolder onChangeEvaluate:[ self updateListOfMatchingSelectorsFor:inputField contents ].
-
+        selectorHolder onChangeEvaluate:[ self updateListOfMatchingSelectorsFor:inputField contents ].
+    ].
     "Modified: / 14-02-2012 / 14:13:52 / cg"
 !