20 currentPanel searchAreas caseHolder matchHolder isMethodHolder |
20 currentPanel searchAreas caseHolder matchHolder isMethodHolder |
21 codeField selectorHolder defaultOpenHow withTextEntry allowFind |
21 codeField selectorHolder defaultOpenHow withTextEntry allowFind |
22 allowBuffer allowBrowser searchWhat searchClassProtocolHolder |
22 allowBuffer allowBrowser searchWhat searchClassProtocolHolder |
23 searchInstanceProtocolHolder selectorOrCode selectionList |
23 searchInstanceProtocolHolder selectorOrCode selectionList |
24 listHolder matchProcess inputField showMetaFilter |
24 listHolder matchProcess inputField showMetaFilter |
25 metaclassesOnlyHolder classesOnlyHolder initialText' |
25 metaclassesOnlyHolder classesOnlyHolder initialText |
|
26 withSearchStringInLiterals searchStringInLiteralsHolder' |
26 classVariableNames:'LastCodeSearched LastCodeSearchWasMethod LastGlobalSearched |
27 classVariableNames:'LastCodeSearched LastCodeSearchWasMethod LastGlobalSearched |
27 LastStringSearched LastSearchWasMatch LastSearchWasCaseSensitive |
28 LastStringSearched LastSearchWasMatch LastSearchWasCaseSensitive |
28 LastStringSearchArea LastCodeSearchArea AREA_LISTOFMETHODS |
29 LastStringSearchArea LastCodeSearchArea AREA_LISTOFMETHODS |
29 LastResourceSearched' |
30 LastResourceSearched' |
30 poolDictionaries:'' |
31 poolDictionaries:'' |
61 ^ AREA_LISTOFMETHODS |
62 ^ AREA_LISTOFMETHODS |
62 |
63 |
63 "Created: / 19-11-2010 / 12:11:50 / cg" |
64 "Created: / 19-11-2010 / 12:11:50 / cg" |
64 ! ! |
65 ! ! |
65 |
66 |
|
67 !SearchDialog class methodsFor:'help'! |
|
68 |
|
69 helpSpec |
|
70 ^ Dictionary new addPairsFrom:#( |
|
71 #listOfChangedClasses |
|
72 'Search only in changed classes' |
|
73 |
|
74 #listOfChangedMethods |
|
75 'Search only in changed methods' |
|
76 |
|
77 #currentClassesNameSpace |
|
78 'Search in the namespace(s) of the selected class(es)' |
|
79 |
|
80 #currentClassesPackage |
|
81 'Search in the package(s) of the selected class(es)' |
|
82 |
|
83 #currentNameSpace |
|
84 'Search in the current selected or selected classes namespace' |
|
85 |
|
86 #currentPackage |
|
87 'Search in the current selected or selected classes package' |
|
88 |
|
89 #currentClassesPackage |
|
90 'Search in the current selected classes package' |
|
91 |
|
92 #currentPackageAndSubPackages |
|
93 'Search in the current (selected) package and subpackages.\(disabled if there are no subpackages)' |
|
94 |
|
95 #everywhere |
|
96 'Search everywhere (all loaded classes)' |
|
97 |
|
98 #listOfMethods |
|
99 'Search only in the list of (shown) methods' |
|
100 |
|
101 #ownersWithPrivateClasses |
|
102 'Search in class and the owning and private classes.\(disabled if there are none)' |
|
103 |
|
104 #ownersHierarchiesWithPrivateClasses |
|
105 'Search in class, owners, private classes and all subclasses.\(disabled if there are none)' |
|
106 |
|
107 #classes |
|
108 'Search in selected class(es) only' |
|
109 |
|
110 #classesWithPrivateClasses |
|
111 'Search in selected class(es) and any private classes.\(disabled if there are no private classes)' |
|
112 |
|
113 #classHierarchies |
|
114 'Search in selected class(es) and down all subclasses.\(disabled if there are no subclasses)' |
|
115 |
|
116 #classHierarchiesWithPrivateClasses |
|
117 'Search in selected class(es), down all subclasses and all of their private classes.\(disabled if there are none)' |
|
118 |
|
119 #classesAndSuperclasses |
|
120 'Search in selected class(es) and up all super classes.\(disabled if there are none)' |
|
121 |
|
122 #classCategories |
|
123 'Search in selected class category(s)' |
|
124 |
|
125 #listOfSelectedMethodClasses |
|
126 'Search in class(es) of selected method(s)' |
|
127 |
|
128 #listOfSelectedMethodPackages |
|
129 'Search in package(es) of selected method(s)' |
|
130 |
|
131 #listOfSelectedMethods |
|
132 'Search in selected method(s)' |
|
133 |
|
134 #selectedPackages |
|
135 'Search in selected package(s)' |
|
136 |
|
137 #searchPatternField |
|
138 'The searched string or name. Does completion on TAB-key' |
|
139 |
|
140 #codeEntryField |
|
141 'Code fragment to match against in the search.\Press "pattern-help" to learn more about code searches' |
|
142 |
|
143 #nonMetaClassesOnly |
|
144 'Search only in instance methods (non-meta classes)' |
|
145 |
|
146 #metaClassesOnly |
|
147 'Search only in class methods (meta classes)' |
|
148 |
|
149 #searchStringInLiterals |
|
150 'Search string in literal constants; not in source code' |
|
151 |
|
152 #match |
|
153 'Perform a pattern match search, as oposed to an exact string search.\Pattern is a simple GLOB pattern (as in filenames)' |
|
154 |
|
155 #caseSensitive |
|
156 'Perform a case sensitive search (default is to ignore case differences)' |
|
157 ) |
|
158 ! ! |
|
159 |
66 !SearchDialog class methodsFor:'queries'! |
160 !SearchDialog class methodsFor:'queries'! |
67 |
161 |
68 lastCodeSearchArea |
162 lastCodeSearchArea |
69 ^ LastCodeSearchArea |
163 ^ LastCodeSearchArea |
70 ! |
164 ! |
85 |
179 |
86 initialText:aString |
180 initialText:aString |
87 initialText := aString. |
181 initialText := aString. |
88 ! |
182 ! |
89 |
183 |
90 showMetaFilter:something |
184 showMetaFilter:aBoolean |
91 showMetaFilter := something. |
185 "enable another checkbox, to allow searching in meta/non-meta" |
|
186 |
|
187 showMetaFilter := aBoolean. |
|
188 ! |
|
189 |
|
190 withSearchStringInLiterals:aBoolean |
|
191 "enable another checkbox, to allow searching for a string |
|
192 in the literals only" |
|
193 |
|
194 withSearchStringInLiterals := aBoolean. |
92 ! ! |
195 ! ! |
93 |
196 |
94 !SearchDialog methodsFor:'accessing-entered values'! |
197 !SearchDialog methodsFor:'accessing-entered values'! |
95 |
198 |
96 classesOnly |
199 classesOnly |
|
200 "the value of the corresponding check toggle; |
|
201 if on, only search in non-metaclasses" |
|
202 |
97 ^ (classesOnlyHolder ? false) value |
203 ^ (classesOnlyHolder ? false) value |
98 |
204 |
99 "Created: / 20-08-2012 / 13:25:26 / cg" |
205 "Created: / 20-08-2012 / 13:25:26 / cg" |
100 ! |
206 ! |
101 |
207 |
110 matchMethods |
216 matchMethods |
111 ^ isMethodHolder value ? false. |
217 ^ isMethodHolder value ? false. |
112 ! |
218 ! |
113 |
219 |
114 metaclassesOnly |
220 metaclassesOnly |
|
221 "the value of the corresponding check toggle; |
|
222 if on, only search in metaclasses" |
|
223 |
115 ^ (metaclassesOnlyHolder ? false) value |
224 ^ (metaclassesOnlyHolder ? false) value |
116 |
225 |
117 "Created: / 20-08-2012 / 13:17:12 / cg" |
226 "Created: / 20-08-2012 / 13:17:12 / cg" |
118 ! |
227 ! |
119 |
228 |
120 methodsToSearch |
229 methodsToSearch |
121 ^ methods. |
230 ^ methods. |
122 ! |
231 ! |
123 |
232 |
124 openHow |
233 openHow |
|
234 "the value of the corresponding button pressed to close the dialog; |
|
235 a symbol describing what to do (newBrowser/newBuffer/find)" |
|
236 |
125 ^ openHow. |
237 ^ openHow. |
126 ! |
238 ! |
127 |
239 |
128 searchAreaSelected |
240 searchAreaSelected |
|
241 "the value of the corresponding radio button; |
|
242 a symbol describing where to search" |
|
243 |
129 ^ whereRadioGroup value. |
244 ^ whereRadioGroup value. |
130 ! |
245 ! |
131 |
246 |
132 searchIgnoringCase |
247 searchIgnoringCase |
133 ^ self searchIsCaseSensitive not |
248 ^ self searchIsCaseSensitive not |
134 ! |
249 ! |
135 |
250 |
136 searchIsCaseSensitive |
251 searchIsCaseSensitive |
|
252 "the value of the corresponding check toggle; |
|
253 if on, search is case sensitive; otherwise ignore case" |
|
254 |
137 ^ (caseHolder value ? false) |
255 ^ (caseHolder value ? false) |
138 ! |
256 ! |
139 |
257 |
|
258 searchStringInLiterals |
|
259 "the value of the corresponding check toggle; |
|
260 if on, only literal strings should be searched; |
|
261 otherwise, the sourcecode is searched" |
|
262 |
|
263 ^ searchStringInLiteralsHolder value ? false. |
|
264 ! |
|
265 |
140 searchWithMatch |
266 searchWithMatch |
|
267 "the value of the corresponding check toggle; |
|
268 if on, do a GLOB match; otherwise an exact search" |
|
269 |
141 ^ matchHolder value ? false. |
270 ^ matchHolder value ? false. |
142 ! |
271 ! |
143 |
272 |
144 selectorToSearch |
273 selectorToSearch |
145 ^ selectorOrCode. |
274 ^ selectorOrCode. |
|
275 ! ! |
|
276 |
|
277 !SearchDialog methodsFor:'help'! |
|
278 |
|
279 flyByHelpTextFor:aComponent |
|
280 |symbolicHelpKey text| |
|
281 |
|
282 (symbolicHelpKey := aComponent helpKey) notNil ifTrue:[ |
|
283 Transcript showCR:symbolicHelpKey. |
|
284 text := self class helpSpec at:symbolicHelpKey ifAbsent:[ nil ]. |
|
285 text notNil ifTrue:[ |
|
286 ^ NewSystemBrowser classResources stringWithCRs:text. |
|
287 ]. |
|
288 ]. |
|
289 ^ nil |
146 ! ! |
290 ! ! |
147 |
291 |
148 !SearchDialog methodsFor:'obsolete'! |
292 !SearchDialog methodsFor:'obsolete'! |
149 |
293 |
150 addCheckBoxForClassMethodSearch |
294 addCheckBoxForClassMethodSearch |
230 withCaseIgnore ifTrue:[ |
374 withCaseIgnore ifTrue:[ |
231 initialCaseSensitive := false. |
375 initialCaseSensitive := false. |
232 (searchWhat ~~ #resource) ifTrue:[ |
376 (searchWhat ~~ #resource) ifTrue:[ |
233 initialCaseSensitive := (LastSearchWasCaseSensitive ? false) |
377 initialCaseSensitive := (LastSearchWasCaseSensitive ? false) |
234 ]. |
378 ]. |
235 self |
379 (self |
236 addCheckBox:(resources string:'Case Sensitive') |
380 addCheckBox:(resources string:'Case Sensitive') |
237 on:(caseHolder := initialCaseSensitive asValue). |
381 on:(caseHolder := initialCaseSensitive asValue)) |
|
382 helpKey:#caseSensitive. |
238 ]. |
383 ]. |
239 withMatch ifTrue:[ |
384 withMatch ifTrue:[ |
240 initialMatch := true. |
385 initialMatch := true. |
241 (searchWhat ~~ #resource) ifTrue:[ |
386 (searchWhat ~~ #resource) ifTrue:[ |
242 initialMatch := (LastSearchWasMatch ? true) |
387 initialMatch := (LastSearchWasMatch ? true) |
243 ]. |
388 ]. |
244 self |
389 (self |
245 addCheckBox:(resources string:'Match') |
390 addCheckBox:(resources string:'Match') |
246 on:(matchHolder := initialMatch asValue). |
391 on:(matchHolder := initialMatch asValue)) |
|
392 helpKey:#match. |
247 "/ (isSelector and:[ sel notNil. ]) ifTrue:[ |
393 "/ (isSelector and:[ sel notNil. ]) ifTrue:[ |
248 "/ sel includesMatchCharacters ifTrue:[ |
394 "/ sel includesMatchCharacters ifTrue:[ |
249 "/ matchHolder value:false. |
395 "/ matchHolder value:false. |
250 "/ ]. |
396 "/ ]. |
251 "/ ]. |
397 "/ ]. |
377 setupToAskForMethodSearchTitle:title forBrowser:brwsrArg searchWhat:searchWhatArg |
523 setupToAskForMethodSearchTitle:title forBrowser:brwsrArg searchWhat:searchWhatArg |
378 searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch |
524 searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch |
379 withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg |
525 withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg |
380 allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg |
526 allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg |
381 |
527 |
|
528 "the real construction of the box is done here. |
|
529 Any additional parameters (metaOnly, searchLiterals etc. must have been done |
|
530 already." |
|
531 |
382 "searchWhat: |
532 "searchWhat: |
383 one of:#selector |
533 one of:#selector |
384 searchArea: |
534 searchArea: |
385 one of: #everywhere #currentNameSpace |
535 one of: #everywhere #currentNameSpace |
386 " |
536 " |
420 ]. |
570 ]. |
421 withTextEntry ifTrue:[ |
571 withTextEntry ifTrue:[ |
422 self addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch. |
572 self addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch. |
423 ]. |
573 ]. |
424 |
574 |
425 searchAreas := OrderedCollection new. |
|
426 |
|
427 self addHorizontalLine. |
|
428 "/ self addVerticalSpace. |
|
429 |
|
430 (showMetaFilter ? false) ifTrue:[ |
575 (showMetaFilter ? false) ifTrue:[ |
431 currentPanel := self. |
576 currentPanel := self. |
432 self addCheckBoxForMetaClassesOnly. |
577 self addCheckBoxForMetaClassesOnly. |
433 ]. |
578 ]. |
434 |
579 (withSearchStringInLiterals ? false) ifTrue:[ |
|
580 currentPanel := self. |
|
581 self addCheckBoxForSearchInLiteralsOnly |
|
582 ]. |
|
583 |
|
584 self addHorizontalLine. |
435 |
585 |
436 hPanel := HorizontalPanelView "SimpleView" new. |
586 hPanel := HorizontalPanelView "SimpleView" new. |
437 hPanel verticalLayout:#top. |
587 hPanel verticalLayout:#top. |
438 hPanel horizontalLayout:#left. |
588 hPanel horizontalLayout:#left. |
439 |
589 |
441 leftVerticalPanel verticalLayout:#topSpace. |
591 leftVerticalPanel verticalLayout:#topSpace. |
442 leftVerticalPanel horizontalLayout:#fitSpace. |
592 leftVerticalPanel horizontalLayout:#fitSpace. |
443 |
593 |
444 (self addTextLabel:(resources string:'Search in:')) adjust:#left. |
594 (self addTextLabel:(resources string:'Search in:')) adjust:#left. |
445 |
595 |
|
596 searchAreas := OrderedCollection new. |
446 whereRadioGroup := RadioButtonGroup new. |
597 whereRadioGroup := RadioButtonGroup new. |
447 |
598 |
448 self addCheckBoxForEverywhere. |
599 self addCheckBoxForEverywhere. |
449 (selectedCategories notEmptyOrNil or:[ selectedClasses notEmptyOrNil ]) ifTrue:[ |
600 (selectedCategories notEmptyOrNil or:[ selectedClasses notEmptyOrNil ]) ifTrue:[ |
450 "/ classMethodListView notNil ifTrue:[ |
601 "/ classMethodListView notNil ifTrue:[ |
634 ! ! |
785 ! ! |
635 |
786 |
636 !SearchDialog methodsFor:'setup'! |
787 !SearchDialog methodsFor:'setup'! |
637 |
788 |
638 addCheckBox:b forSearchArea:area |
789 addCheckBox:b forSearchArea:area |
|
790 self addCheckBox:b forSearchArea:area helpKey:area |
|
791 ! |
|
792 |
|
793 addCheckBox:b forSearchArea:area helpKey:symbolicHelpKey |
639 currentPanel add:b. |
794 currentPanel add:b. |
640 whereRadioGroup add:b value:area. |
795 whereRadioGroup add:b value:area. |
641 searchAreas add:area. |
796 searchAreas add:area. |
642 self makeTabable:b. |
797 self makeTabable:b. |
|
798 symbolicHelpKey notNil ifTrue:[ b helpKey:symbolicHelpKey ]. |
643 ! |
799 ! |
644 |
800 |
645 addCheckBoxForChangedClassesList |
801 addCheckBoxForChangedClassesList |
646 |b| |
802 |b| |
647 |
803 |
648 b := RadioButton "CheckBox" label:(resources string:'Changed Classes'). |
804 b := RadioButton "CheckBox" label:(resources string:'Changed Classes'). |
|
805 |
649 self addCheckBox:b forSearchArea:#listOfChangedClasses. |
806 self addCheckBox:b forSearchArea:#listOfChangedClasses. |
650 ChangeSet current changedClasses isEmpty ifTrue:[ |
807 ChangeSet current changedClasses isEmpty ifTrue:[ |
651 b disable |
808 b disable |
652 ]. |
809 ]. |
653 ^ b. |
810 ^ b. |
737 |
895 |
738 p := View new. |
896 p := View new. |
739 |
897 |
740 b := CheckBox label:(resources string:'Metaclasses Only') in:p. |
898 b := CheckBox label:(resources string:'Metaclasses Only') in:p. |
741 b model:(metaclassesOnlyHolder := false asValue). |
899 b model:(metaclassesOnlyHolder := false asValue). |
|
900 b helpKey:#metaClassesOnly. |
742 metaclassesOnlyHolder onChangeEvaluate:[metaclassesOnlyHolder value ifTrue:[classesOnlyHolder value:false]]. |
901 metaclassesOnlyHolder onChangeEvaluate:[metaclassesOnlyHolder value ifTrue:[classesOnlyHolder value:false]]. |
743 self makeTabable:b. |
902 self makeTabable:b. |
744 |
903 |
745 b := CheckBox label:(resources string:'Classes Only') in:p. |
904 b := CheckBox label:(resources string:'Classes Only') in:p. |
746 b left:0.5. |
905 b left:0.5. |
747 b model:(classesOnlyHolder := false asValue). |
906 b model:(classesOnlyHolder := false asValue). |
|
907 b helpKey:#nonMetaClassesOnly. |
748 classesOnlyHolder onChangeEvaluate:[classesOnlyHolder value ifTrue:[metaclassesOnlyHolder value:false]]. |
908 classesOnlyHolder onChangeEvaluate:[classesOnlyHolder value ifTrue:[metaclassesOnlyHolder value:false]]. |
749 self makeTabable:b. |
909 self makeTabable:b. |
750 |
910 |
751 currentPanel add:p. |
911 currentPanel add:p. |
752 ^ nil. |
912 ^ nil. |
971 ! |
1145 ! |
972 |
1146 |
973 addCheckBoxForSelectedPackage |
1147 addCheckBoxForSelectedPackage |
974 |b lbl arg| |
1148 |b lbl arg| |
975 |
1149 |
976 currentClassCategory notNil ifTrue:[ |
1150 currentPackage notNil ifTrue:[ |
977 lbl := 'Class category ("%1")'. |
1151 lbl := 'Class package ("%1")'. |
978 arg := currentClassCategory. |
1152 arg := currentPackage. |
979 ] ifFalse:[ |
1153 ] ifFalse:[ |
980 lbl := 'Selected classes categories (%1)'. |
1154 lbl := 'Selected classes packages (%1)'. |
981 arg := selectedCategories size. |
1155 arg := selectedPackages size. |
982 ]. |
1156 ]. |
983 b := RadioButton "CheckBox" label:(resources string:lbl with:arg). |
1157 b := RadioButton "CheckBox" label:(resources string:lbl with:arg). |
984 self addCheckBox:b forSearchArea:#classCategories. |
1158 self addCheckBox:b forSearchArea:#selectedPackages. |
985 ^ b. |
1159 ^ b. |
986 ! |
1160 ! |
987 |
1161 |
988 addCheckBoxesForClassAndMetaSearch |
1162 addCheckBoxesForClassAndMetaSearch |
989 |y b1 b2| |
1163 |y b1 b2| |
990 |
1164 |
991 y := self yPosition. |
1165 y := self yPosition. |
992 b1 := self addCheckBox:(resources string:'Instance Protocol') on:(self searchInstanceProtocolHolder). |
1166 b1 := self addCheckBox:(resources string:'Instance Protocol') on:(self searchInstanceProtocolHolder). |
|
1167 b1 helpKey:#classesOnly. |
993 "/ b1 width:0.5. |
1168 "/ b1 width:0.5. |
994 |
1169 |
995 "/ self yPosition:y. |
1170 "/ self yPosition:y. |
996 b2 := self addCheckBox:(resources string:'Class Protocol') on:(self searchClassProtocolHolder). |
1171 b2 := self addCheckBox:(resources string:'Class Protocol') on:(self searchClassProtocolHolder). |
|
1172 b2 helpKey:#metaClassesOnly. |
997 "/ b2 left:0.5; width:0.5. |
1173 "/ b2 left:0.5; width:0.5. |
998 |
1174 |
999 "Created: / 06-12-2011 / 11:24:11 / cg" |
1175 "Created: / 06-12-2011 / 11:24:11 / cg" |
1000 ! |
1176 ! |
1001 |
1177 |
1070 inputField := self addComboBoxOn:selectorHolder tabable:true. |
1246 inputField := self addComboBoxOn:selectorHolder tabable:true. |
1071 inputField list:lastSearchPatterns. |
1247 inputField list:lastSearchPatterns. |
1072 inputField selectAllInitially. |
1248 inputField selectAllInitially. |
1073 inputField immediateAccept:true. |
1249 inputField immediateAccept:true. |
1074 inputField takeFocus. |
1250 inputField takeFocus. |
|
1251 inputField helpKey:#searchPatternField. |
1075 |
1252 |
1076 searchWhat == #string ifFalse:[ |
1253 searchWhat == #string ifFalse:[ |
1077 inputField |
1254 inputField |
1078 entryCompletionBlock:[ :contents | |
1255 entryCompletionBlock:[ :contents | |
1079 |s what| |
1256 |s what| |
1111 |initial box panel patternInfoBox infoLabel helpButton errMessageField checkCodeAction |
1288 |initial box panel patternInfoBox infoLabel helpButton errMessageField checkCodeAction |
1112 metaBox buttonBox helpButtonBox b| |
1289 metaBox buttonBox helpButtonBox b| |
1113 |
1290 |
1114 box := View new. |
1291 box := View new. |
1115 box extent:(600 @ 200). |
1292 box extent:(600 @ 200). |
|
1293 box helpKey:#codeEntryField. |
1116 |
1294 |
1117 panel := VariableHorizontalPanel in:box. |
1295 panel := VariableHorizontalPanel in:box. |
1118 panel origin:0.0@0.0 corner:(1.0@1.0). |
1296 panel origin:0.0@0.0 corner:(1.0@1.0). |
1119 |
1297 |
1120 codeField := CodeView in:panel. |
1298 codeField := CodeView in:panel. |