searchdialog refactoring
authorClaus Gittinger <cg@exept.de>
Thu, 10 Dec 2009 12:12:04 +0100
changeset 9311 ac0f3956c140
parent 9310 504ae2e8ad0e
child 9312 71f84182390a
searchdialog refactoring
Tools_SearchDialog.st
--- a/Tools_SearchDialog.st	Thu Dec 10 12:11:30 2009 +0100
+++ b/Tools_SearchDialog.st	Thu Dec 10 12:12:04 2009 +0100
@@ -19,7 +19,7 @@
 		currentClassCategory currentPackage browser whereRadioGroup
 		currentPanel searchAreas caseHolder matchHolder isMethodHolder
 		codeField selectorHolder defaultOpenHow withTextEntry allowFind
-		allowBuffer allowBrowser isSelector searchClassProtocolHolder
+		allowBuffer allowBrowser searchWhat searchClassProtocolHolder
 		searchInstanceProtocolHolder selectorOrCode listHolder
 		matchProcess'
 	classVariableNames:'LastCodeSearched LastCodeSearchWasMethod LastGlobalSearched
@@ -116,7 +116,7 @@
 !SearchDialog methodsFor:'public'!
 
 addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch 
-    isSelector == #code ifTrue:[
+    searchWhat == #code ifTrue:[
         self addTextEntryFieldForCode.
     ] ifFalse:[
         self addInputFieldForSelectorOrNameOrString.
@@ -151,14 +151,14 @@
     ].
     where := whereRadioGroup value.
     withTextEntry ifTrue:[ 
-        isSelector == #code ifTrue:[
+        searchWhat == #code ifTrue:[
             code := codeField contentsAsString.
             LastCodeSearched := code.
             LastCodeSearchArea := where.
         ] ifFalse:[
             sel := selectorHolder value.
             sel isEmptyOrNil ifTrue:[ 
-                browser warn:(isSelector 
+                browser warn:((searchWhat == #selector) 
                             ifTrue:[ 'No selector entered for search'. ]
                             ifFalse:[ 'Nothing entered for search'. ]).
                 ^ self.
@@ -166,10 +166,10 @@
             sel := sel string.
 
             browser rememberSearchPattern:sel.
-            isSelector == #globalName ifTrue:[ 
+            searchWhat == #globalName ifTrue:[ 
                 LastGlobalSearched := sel.
             ] ifFalse:[
-                isSelector == #string ifTrue:[
+                searchWhat == #string ifTrue:[
                     LastStringSearched := sel.
                     LastStringSearchArea := where.
                 ] ifFalse:[
@@ -244,13 +244,14 @@
     ]
 !
 
-setupToAskForMethodSearchTitle:title forBrowser:brwsrArg isSelector:isSelectorArg searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg 
+setupToAskForMethodSearchTitle:title forBrowser:brwsrArg searchWhat:searchWhatArg searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg 
     |where ns methodNameSpaces methodPackages hPanel leftVerticalPanel rightVerticalPanel l|
 
     allowFind := allowFindArg.
     allowBuffer := allowBufferArg.
     allowBrowser := allowBrowserArg.
-    isSelector := isSelectorArg.
+    searchWhat := searchWhatArg.
+
     withTextEntry := withTextEntryArg.
     browser := brwsrArg.
     resources := browser resources.
@@ -441,9 +442,12 @@
 
     "/ panel has its own idea of indenting
     self addVerticalSpace.
-    "/ self addHorizontalLine.
-    l := self addFilteredListOfMatchingSelectors.
-    self stickAtBottomWithVariableHeight:l.
+    searchWhat == #selector ifTrue:[
+        l := self addFilteredListOfMatchingSelectors.
+        self stickAtBottomWithVariableHeight:l.
+    ] ifFalse:[
+        self addHorizontalLine.
+    ].
     self addButtons.
 
     self label:(resources string:'Search').
@@ -782,13 +786,13 @@
 addInputFieldForSelectorOrNameOrString
     |sel inputField lastSearchPatterns|
 
-    isSelector == true ifTrue:[ 
+    searchWhat == #selector ifTrue:[ 
         sel := browser selectorToSearchFor.
     ] ifFalse:[ 
-        isSelector == #globalName ifTrue:[ 
+        searchWhat == #globalName ifTrue:[ 
             sel := browser globalNameToSearchFor ? LastGlobalSearched.
         ] ifFalse:[ 
-            isSelector == #string ifTrue:[
+            searchWhat == #string ifTrue:[
                 sel := browser stringToSearchFor ? LastStringSearched.
             ] ifFalse:[
                 sel := browser selectorToSearchFor.
@@ -817,7 +821,7 @@
                 withWaitCursorDo:[
                     |best matching|
 
-                    isSelector == #globalName ifFalse:[ 
+                    searchWhat == #globalName ifFalse:[ 
                         what := Smalltalk selectorCompletion:s.
                     ] ifTrue:[ 
                         what := Smalltalk globalNameCompletion:s.
@@ -1090,13 +1094,14 @@
     (p := matchProcess) notNil ifTrue:[
         p terminate.
     ].
+    listHolder isNil ifTrue:[^ self].
 
     matchProcess := 
         [
             |what matching|
 
             [
-                isSelector == #globalName ifFalse:[ 
+                searchWhat == #globalName ifFalse:[ 
                     what := Smalltalk selectorCompletion:s.
                 ] ifTrue:[ 
                     what := Smalltalk globalNameCompletion:s.
@@ -1195,9 +1200,9 @@
 !SearchDialog class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.41 2009-12-09 18:08:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.42 2009-12-10 11:12:04 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.41 2009-12-09 18:08:35 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.42 2009-12-10 11:12:04 cg Exp $'
 ! !