author | Claus Gittinger <cg@exept.de> |
Mon, 14 Dec 2009 17:57:25 +0100 | |
changeset 9320 | 74ef9e3ad53c |
parent 9315 | 1ad087feb185 |
child 9327 | 2af9de3d71b7 |
permissions | -rw-r--r-- |
5591 | 1 |
" |
2 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5592 | 12 |
"{ Package: 'stx:libtool' }" |
5591 | 13 |
|
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
DialogBox subclass:#SearchDialog |
|
17 |
instanceVariableNames:'openHow classes methods selectedClasses selectedCategories |
|
7042 | 18 |
selectedMethods selectedPackages currentClass currentNamespace |
19 |
currentClassCategory currentPackage browser whereRadioGroup |
|
8782 | 20 |
currentPanel searchAreas caseHolder matchHolder isMethodHolder |
7042 | 21 |
codeField selectorHolder defaultOpenHow withTextEntry allowFind |
9311 | 22 |
allowBuffer allowBrowser searchWhat searchClassProtocolHolder |
9309 | 23 |
searchInstanceProtocolHolder selectorOrCode listHolder |
9315 | 24 |
matchProcess inputField' |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
25 |
classVariableNames:'LastCodeSearched LastCodeSearchWasMethod LastGlobalSearched |
9001
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
26 |
LastStringSearched LastSearchWasMatch LastSearchWasCaseSensitive |
8123 | 27 |
LastStringSearchArea LastCodeSearchArea' |
5591 | 28 |
poolDictionaries:'' |
29 |
category:'Interface-Browsers-New' |
|
30 |
! |
|
31 |
||
32 |
!SearchDialog class methodsFor:'documentation'! |
|
33 |
||
34 |
copyright |
|
35 |
" |
|
36 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
37 |
All Rights Reserved |
|
38 |
||
39 |
This software is furnished under a license and may be used |
|
40 |
only in accordance with the terms of that license and with the |
|
41 |
inclusion of the above copyright notice. This software may not |
|
42 |
be provided or otherwise made available to, or used by, any |
|
43 |
other person. No title to or ownership of the software is |
|
44 |
hereby transferred. |
|
45 |
" |
|
46 |
! ! |
|
47 |
||
6381
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
48 |
!SearchDialog class methodsFor:'queries'! |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
49 |
|
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
50 |
lastCodeSearchArea |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
51 |
^ LastCodeSearchArea |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
52 |
! |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
53 |
|
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
54 |
lastStringSearchArea |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
55 |
^ LastStringSearchArea |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
56 |
! ! |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
57 |
|
6685 | 58 |
!SearchDialog methodsFor:'accessing-entered values'! |
59 |
||
60 |
classesToSearch |
|
61 |
^ classes. |
|
62 |
! |
|
63 |
||
64 |
codeToSearch |
|
65 |
^ selectorOrCode. |
|
66 |
! |
|
67 |
||
68 |
matchMethods |
|
69 |
^ isMethodHolder value ? false. |
|
70 |
! |
|
71 |
||
72 |
methodsToSearch |
|
73 |
^ methods. |
|
74 |
! |
|
75 |
||
76 |
openHow |
|
77 |
^ openHow. |
|
78 |
! |
|
79 |
||
80 |
searchIgnoringCase |
|
9001
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
81 |
^ self searchIsCaseSensitive not |
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
82 |
! |
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
83 |
|
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
84 |
searchIsCaseSensitive |
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
85 |
^ (caseHolder value ? false) |
6685 | 86 |
! |
87 |
||
88 |
searchWithMatch |
|
89 |
^ matchHolder value ? false. |
|
90 |
! |
|
91 |
||
92 |
selectorToSearch |
|
93 |
^ selectorOrCode. |
|
94 |
! ! |
|
95 |
||
5591 | 96 |
!SearchDialog methodsFor:'private'! |
97 |
||
6685 | 98 |
searchClassProtocolHolder |
99 |
searchClassProtocolHolder isNil ifTrue:[ |
|
100 |
searchClassProtocolHolder := true asValue |
|
101 |
]. |
|
102 |
^ searchClassProtocolHolder |
|
103 |
! |
|
104 |
||
105 |
searchInstanceProtocolHolder |
|
106 |
searchInstanceProtocolHolder isNil ifTrue:[ |
|
107 |
searchInstanceProtocolHolder := true asValue |
|
108 |
]. |
|
109 |
^ searchInstanceProtocolHolder |
|
110 |
! |
|
111 |
||
5591 | 112 |
showHelpOnCodePatterns |
113 |
HTMLDocumentView openFullOnHelpFile:'Browser/RBSearchPatterns.html' |
|
9315 | 114 |
! |
115 |
||
116 |
updateListOfMatchingSelectorsFor:s |
|
117 |
|p| |
|
118 |
||
119 |
(p := matchProcess) notNil ifTrue:[ |
|
120 |
p terminate. |
|
121 |
]. |
|
122 |
listHolder isNil ifTrue:[^ self]. |
|
123 |
||
124 |
matchProcess := |
|
125 |
[ |
|
126 |
|what matching| |
|
127 |
||
128 |
[ |
|
129 |
searchWhat == #globalName ifFalse:[ |
|
130 |
what := DoWhatIMeanSupport selectorCompletion:s inEnvironment:Smalltalk match:(matchHolder value) |
|
131 |
] ifTrue:[ |
|
132 |
what := DoWhatIMeanSupport globalNameCompletion:s inEnvironment:Smalltalk match:(matchHolder value). |
|
133 |
]. |
|
134 |
"/ best := what first. |
|
135 |
matching := what second. |
|
136 |
self sensor pushAction:[ listHolder contents:matching ]. |
|
137 |
] ensure:[ |
|
138 |
matchProcess := nil. |
|
139 |
]. |
|
140 |
] fork. |
|
141 |
||
142 |
||
143 |
||
5591 | 144 |
! ! |
145 |
||
146 |
!SearchDialog methodsFor:'public'! |
|
147 |
||
6242 | 148 |
addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch |
9311 | 149 |
searchWhat == #code ifTrue:[ |
6242 | 150 |
self addTextEntryFieldForCode. |
151 |
] ifFalse:[ |
|
152 |
self addInputFieldForSelectorOrNameOrString. |
|
153 |
withCaseIgnore ifTrue:[ |
|
6685 | 154 |
self |
9001
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
155 |
addCheckBox:(resources string:'Case Sensitive') |
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
156 |
on:(caseHolder := (LastSearchWasCaseSensitive ? false) asValue). |
6242 | 157 |
]. |
158 |
withMatch ifTrue:[ |
|
6685 | 159 |
self |
160 |
addCheckBox:(resources string:'Match') |
|
6242 | 161 |
on:(matchHolder := (LastSearchWasMatch ? true) asValue). |
162 |
"/ (isSelector and:[ sel notNil. ]) ifTrue:[ |
|
163 |
"/ sel includesMatchCharacters ifTrue:[ |
|
164 |
"/ matchHolder value:false. |
|
165 |
"/ ]. |
|
166 |
"/ ]. |
|
167 |
]. |
|
168 |
] |
|
169 |
! |
|
170 |
||
5591 | 171 |
askThenDo:aBlock |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
172 |
|where code sel matchHolderValue caseHolderValue| |
5591 | 173 |
|
174 |
self open. |
|
175 |
self accepted ifFalse:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
176 |
^ self. |
5591 | 177 |
]. |
178 |
||
179 |
openHow isNil ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
180 |
openHow := defaultOpenHow. |
5591 | 181 |
]. |
182 |
where := whereRadioGroup value. |
|
183 |
withTextEntry ifTrue:[ |
|
9311 | 184 |
searchWhat == #code ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
185 |
code := codeField contentsAsString. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
186 |
LastCodeSearched := code. |
6381
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
187 |
LastCodeSearchArea := where. |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
188 |
] ifFalse:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
189 |
sel := selectorHolder value. |
8304
3e556502d05e
changed #askThenDo: check selection for isEmptyOrNil (not only isEmpty)
ca
parents:
8282
diff
changeset
|
190 |
sel isEmptyOrNil ifTrue:[ |
9311 | 191 |
browser warn:((searchWhat == #selector) |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
192 |
ifTrue:[ 'No selector entered for search'. ] |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
193 |
ifFalse:[ 'Nothing entered for search'. ]). |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
194 |
^ self. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
195 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
196 |
sel := sel string. |
6667 | 197 |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
198 |
browser rememberSearchPattern:sel. |
9311 | 199 |
searchWhat == #globalName ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
200 |
LastGlobalSearched := sel. |
6381
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
201 |
] ifFalse:[ |
9311 | 202 |
searchWhat == #string ifTrue:[ |
8123 | 203 |
LastStringSearched := sel. |
6381
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
204 |
LastStringSearchArea := where. |
6667 | 205 |
] ifFalse:[ |
6700 | 206 |
(sel startsWith:'#''') ifTrue:[ |
207 |
sel := sel copyFrom:3. |
|
208 |
(sel endsWith:$') ifTrue:[ |
|
209 |
sel := sel copyWithoutLast:1. |
|
6667 | 210 |
]. |
211 |
]. |
|
6381
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
212 |
] |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
213 |
] |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
214 |
]. |
5591 | 215 |
]. |
216 |
where isNil ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
217 |
browser warn:'No class(es) for search'. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
218 |
^ self. |
5591 | 219 |
]. |
220 |
||
221 |
self getClassesAndMethodsFor:where. |
|
222 |
(#(#classesWithPrivateClasses #classHierarchiesWithPrivateClasses #ownersWithPrivateClasses #ownersHierarchiesWithPrivateClasses) |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
223 |
includes:where) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
224 |
ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
225 |
|toSearch| |
5591 | 226 |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
227 |
toSearch := IdentitySet withAll:classes. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
228 |
classes := IdentitySet withAll:toSearch. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
229 |
[ toSearch notEmpty. ] whileTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
230 |
|cls| |
5591 | 231 |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
232 |
cls := toSearch removeFirst. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
233 |
classes addAll:cls allPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
234 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
235 |
]. |
5591 | 236 |
|
237 |
classes size == 0 ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
238 |
classes := nil. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
239 |
methods size == 0 ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
240 |
browser warn:'No class(es) given for search.'. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
241 |
^ self. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
242 |
]. |
5591 | 243 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
244 |
classes := classes asOrderedCollection. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
245 |
methods size ~~ 0 ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
246 |
browser warn:'oops'. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
247 |
methods := nil. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
248 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
249 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
250 |
|
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
251 |
matchHolderValue := matchHolder value. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
252 |
matchHolderValue notNil ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
253 |
LastSearchWasMatch := matchHolderValue |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
254 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
255 |
caseHolderValue := caseHolder value. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
256 |
caseHolderValue notNil ifTrue:[ |
9001
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
257 |
LastSearchWasCaseSensitive := caseHolderValue |
5591 | 258 |
]. |
259 |
||
6685 | 260 |
selectorOrCode := sel ? code. |
261 |
||
262 |
aBlock numArgs == 7 ifTrue:[ |
|
263 |
"/ old style |
|
264 |
aBlock |
|
265 |
value:classes |
|
266 |
value:(sel ? code) |
|
9001
22e3a719e91a
inverted the check-box meaning: \"Ignore case\" vs. \"Case Sensitive\"
Claus Gittinger <cg@exept.de>
parents:
8833
diff
changeset
|
267 |
value:(self searchIgnoringCase) |
6685 | 268 |
value:openHow |
269 |
value:(matchHolderValue ? false) |
|
270 |
value:methods |
|
271 |
value:(isMethodHolder value ? false). |
|
272 |
] ifFalse:[ |
|
273 |
aBlock value. |
|
274 |
] |
|
5591 | 275 |
! |
276 |
||
9311 | 277 |
setupToAskForMethodSearchTitle:title forBrowser:brwsrArg searchWhat:searchWhatArg searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg |
9309 | 278 |
|where ns methodNameSpaces methodPackages hPanel leftVerticalPanel rightVerticalPanel l| |
5591 | 279 |
|
280 |
allowFind := allowFindArg. |
|
281 |
allowBuffer := allowBufferArg. |
|
282 |
allowBrowser := allowBrowserArg. |
|
9311 | 283 |
searchWhat := searchWhatArg. |
284 |
||
5591 | 285 |
withTextEntry := withTextEntryArg. |
286 |
browser := brwsrArg. |
|
287 |
resources := browser resources. |
|
288 |
||
6351 | 289 |
(self addTextLabel:(resources stringWithCRs:title)) adjust:#left. |
6685 | 290 |
|
5591 | 291 |
selectedClasses := browser selectedClasses value. |
292 |
selectedCategories := browser selectedCategoriesValue. |
|
8756 | 293 |
selectedCategories := selectedCategories reject:[:cat | NavigatorModel isPseudoCategory:cat]. |
5591 | 294 |
selectedMethods := browser selectedMethods value. |
295 |
currentClass := browser theSingleSelectedClass. |
|
296 |
currentClassCategory := browser theSingleSelectedCategory. |
|
7042 | 297 |
currentPackage := browser theSingleSelectedProject. |
6242 | 298 |
currentClass isNil ifTrue:[ |
299 |
browser hasMethodSelected ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
300 |
currentClass := selectedMethods first mclass. |
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
301 |
"/ selectedClasses := (selectedMethods collect:[:each | each mclass ]) asIdentitySet. |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
302 |
"/ selectedClasses := selectedClasses select:[:each | each notNil ]. |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
303 |
]. |
5591 | 304 |
]. |
6242 | 305 |
currentClass notNil ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
306 |
currentClass := currentClass theNonMetaclass. |
5591 | 307 |
]. |
6242 | 308 |
withTextEntry ifTrue:[ |
309 |
self addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch. |
|
5591 | 310 |
]. |
311 |
searchAreas := OrderedCollection new. |
|
6685 | 312 |
|
5591 | 313 |
self addHorizontalLine. |
314 |
self addVerticalSpace. |
|
6685 | 315 |
|
316 |
hPanel := HorizontalPanelView "SimpleView" new. |
|
317 |
hPanel verticalLayout:#top. |
|
318 |
hPanel horizontalLayout:#left. |
|
319 |
||
8782 | 320 |
leftVerticalPanel := currentPanel := VerticalPanelView new. |
6685 | 321 |
leftVerticalPanel verticalLayout:#topSpace. |
322 |
leftVerticalPanel horizontalLayout:#fitSpace. |
|
323 |
||
5591 | 324 |
(self addTextLabel:(resources string:'Search in:')) adjust:#left. |
325 |
whereRadioGroup := RadioButtonGroup new. |
|
7042 | 326 |
|
6242 | 327 |
(selectedCategories size > 0 or:[ selectedClasses size > 0 ]) ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
328 |
self addCheckBoxForEverywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
329 |
"/ classMethodListView notNil ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
330 |
"/ b := CheckBox label:(resources string:'Shown Methods'). |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
331 |
"/ panel add:b. whereChannel add:b value:#currentMethodList. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
332 |
"/ areas add:#currentMethodList. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
333 |
"/ self makeTabable:b. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
334 |
"/ ]. |
6242 | 335 |
browser isMethodListBrowser ifTrue:[ |
7374 | 336 |
methods := browser selectedMethods value ? #(). |
337 |
methodNameSpaces := methods |
|
338 |
select:[:eachMethod | eachMethod mclass notNil] |
|
339 |
thenCollect:[:eachMethod | eachMethod mclass topNameSpace ]. |
|
340 |
methodPackages := methods |
|
7042 | 341 |
collect:[:eachMethod | eachMethod package ]. |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
342 |
]. |
6242 | 343 |
methodNameSpaces size == 1 ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
344 |
currentNamespace := methodNameSpaces first. |
6242 | 345 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
346 |
currentNamespace := browser currentNamespace. |
6379 | 347 |
selectedClasses size == 0 ifTrue:[ |
348 |
|classesInAllSelectedCategories nameSpacesOfAllClassesInAllSelectedCategories| |
|
349 |
classesInAllSelectedCategories := Smalltalk allClasses select:[:cls | selectedCategories includes:cls category]. |
|
350 |
nameSpacesOfAllClassesInAllSelectedCategories := classesInAllSelectedCategories collect:[:eachClass | eachClass topNameSpace]. |
|
351 |
nameSpacesOfAllClassesInAllSelectedCategories size == 1 ifTrue:[ |
|
352 |
currentNamespace := nameSpacesOfAllClassesInAllSelectedCategories first. |
|
353 |
]. |
|
354 |
]. |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
355 |
]. |
7042 | 356 |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
357 |
(currentNamespace notNil |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
358 |
and:[ currentNamespace ~= (browser nameListEntryForALL) ]) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
359 |
ifTrue:[ self addCheckBoxForCurrentNamespace ] |
6242 | 360 |
ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
361 |
(currentClass notNil |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
362 |
and:[ (ns := currentClass nameSpace) notNil and:[ ns ~~ Smalltalk ] ]) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
363 |
ifTrue:[ self addCheckBoxForClassesNamespace:ns ]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
364 |
]. |
7042 | 365 |
|
366 |
methodPackages size == 1 ifTrue:[ |
|
367 |
currentPackage := methodPackages first. |
|
368 |
] ifFalse:[ |
|
369 |
currentPackage := browser currentProject. |
|
7384 | 370 |
"/ selectedClasses size == 0 ifTrue:[ |
371 |
"/ |classesInAllSelectedCategories packagesOfAllClassesInAllSelectedCategories| |
|
372 |
"/ classesInAllSelectedCategories := Smalltalk allClasses select:[:cls | selectedCategories includes:cls category]. |
|
373 |
"/ packagesOfAllClassesInAllSelectedCategories := classesInAllSelectedCategories collect:[:eachClass | eachClass package]. |
|
374 |
"/ packagesOfAllClassesInAllSelectedCategories size == 1 ifTrue:[ |
|
375 |
"/ currentPackage := packagesOfAllClassesInAllSelectedCategories first. |
|
376 |
"/ ]. |
|
377 |
"/ ]. |
|
7042 | 378 |
]. |
379 |
||
380 |
(currentPackage notNil |
|
381 |
and:[ currentPackage ~= (browser nameListEntryForALL) ]) |
|
382 |
ifTrue:[ self addCheckBoxForCurrentPackage ] |
|
383 |
ifFalse:[ |
|
384 |
(currentClass notNil) ifTrue:[ |
|
385 |
self addCheckBoxForClassesPackage:(currentClass package) |
|
386 |
]. |
|
387 |
]. |
|
388 |
||
6242 | 389 |
selectedCategories size > 0 ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
390 |
self addCheckBoxForSelectedClassCategory. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
391 |
]. |
6242 | 392 |
(selectedClasses size > 0 or:[ selectedMethods size > 0 ]) ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
393 |
self addCheckBoxForSelectedClass. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
394 |
self addCheckBoxForSelectedClassAndSuperclasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
395 |
self addCheckBoxForSelectedClassAndSubclasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
396 |
self addCheckBoxForSelectedClassAndPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
397 |
self addCheckBoxForSelectedClassAndSubclassesAndPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
398 |
self addCheckBoxForOwnerAndItsPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
399 |
self addCheckBoxForOwnerAndItsSubclassesAndItsPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
400 |
]. |
6242 | 401 |
] ifFalse:[ |
402 |
browser currentNamespace ~~ Smalltalk ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
403 |
self addCheckBoxForEverywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
404 |
currentNamespace := browser currentNamespace. |
6242 | 405 |
currentNamespace ~= (browser nameListEntryForALL) ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
406 |
self addCheckBoxForCurrentNamespace. |
6242 | 407 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
408 |
(currentClass notNil |
6685 | 409 |
and:[ (ns := currentClass nameSpace) notNil |
410 |
and:[ ns ~~ Smalltalk ] ]) |
|
411 |
ifTrue:[ |
|
412 |
self addCheckBoxForClassesNamespace:ns |
|
413 |
]. |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
414 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
415 |
]. |
5591 | 416 |
]. |
8083
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
417 |
searchAreas size == 0 ifTrue:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
418 |
self addCheckBoxForEverywhere. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
419 |
]. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
420 |
self addCheckBoxForChangedClassesList. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
421 |
|
6242 | 422 |
(withMethodList and:[ browser isMethodListBrowser ]) ifTrue:[ |
423 |
searchAreas size == 0 ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
424 |
self addCheckBoxForEverywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
425 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
426 |
self addCheckBoxForMethodList. |
6242 | 427 |
browser selectedMethods value size > 1 ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
428 |
self addCheckBoxForSelectedMethods. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
429 |
]. |
8566 | 430 |
self addCheckBoxForSelectedMethodClasses. |
8083
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
431 |
] ifFalse:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
432 |
searchAreas size == 0 ifTrue:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
433 |
self addCheckBoxForEverywhere. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
434 |
]. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
435 |
self addCheckBoxForChangedMethodList. |
5591 | 436 |
]. |
7042 | 437 |
|
6242 | 438 |
searchAreas size == 0 ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
439 |
whereRadioGroup := #everywhere asValue. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
440 |
self addDummyCheckBoxForEverywhere. |
6242 | 441 |
] ifFalse:[ |
442 |
whereDefault notNil ifTrue:[ |
|
443 |
(searchAreas includes:whereDefault) ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
444 |
where := whereDefault asSymbol. |
6242 | 445 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
446 |
where := searchAreas first. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
447 |
]. |
6242 | 448 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
449 |
where := #everywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
450 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
451 |
whereRadioGroup value:where. |
5591 | 452 |
]. |
6685 | 453 |
|
454 |
hPanel add:leftVerticalPanel. |
|
455 |
||
8782 | 456 |
rightVerticalPanel := currentPanel := VerticalPanelView new. |
6685 | 457 |
rightVerticalPanel verticalLayout:#topSpace. |
458 |
rightVerticalPanel horizontalLayout:#fitSpace. |
|
459 |
||
460 |
false ifTrue:[ |
|
461 |
self addCheckBoxForClassMethodSearch. |
|
462 |
self addCheckBoxForInstanceMethodSearch. |
|
463 |
]. |
|
464 |
||
465 |
"/ rightVerticalPanel origin:0.75@0.0 corner:1.0@1.0. |
|
466 |
hPanel |
|
8165
d7d59fbdcd2b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
8124
diff
changeset
|
467 |
preferredExtent:(leftVerticalPanel preferredHeight + rightVerticalPanel preferredHeight) |
6685 | 468 |
@ |
8165
d7d59fbdcd2b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
8124
diff
changeset
|
469 |
(leftVerticalPanel preferredHeight max:rightVerticalPanel preferredHeight). |
6685 | 470 |
hPanel add:rightVerticalPanel. |
471 |
self addComponent:hPanel indent:0. |
|
472 |
||
5591 | 473 |
"/ panel has its own idea of indenting |
474 |
self addVerticalSpace. |
|
9311 | 475 |
searchWhat == #selector ifTrue:[ |
476 |
l := self addFilteredListOfMatchingSelectors. |
|
477 |
self stickAtBottomWithVariableHeight:l. |
|
9315 | 478 |
matchHolder notNil ifTrue:[ |
479 |
matchHolder onChangeEvaluate:[ self updateListOfMatchingSelectorsFor:inputField contents ] |
|
480 |
]. |
|
481 |
self updateListOfMatchingSelectorsFor:inputField contents. |
|
9311 | 482 |
] ifFalse:[ |
483 |
self addHorizontalLine. |
|
484 |
]. |
|
5591 | 485 |
self addButtons. |
6685 | 486 |
|
5591 | 487 |
self label:(resources string:'Search'). |
7374 | 488 |
|
7384 | 489 |
"Modified: / 10-10-2006 / 15:30:52 / cg" |
5591 | 490 |
! ! |
491 |
||
492 |
!SearchDialog methodsFor:'setup'! |
|
493 |
||
494 |
addCheckBox:b forSearchArea:area |
|
8782 | 495 |
currentPanel add:b. |
5591 | 496 |
whereRadioGroup add:b value:area. |
497 |
searchAreas add:area. |
|
498 |
self makeTabable:b. |
|
499 |
! |
|
500 |
||
8083
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
501 |
addCheckBoxForChangedClassesList |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
502 |
|b| |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
503 |
|
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
504 |
b := CheckBox label:(resources string:'Changed Classes'). |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
505 |
self addCheckBox:b forSearchArea:#listOfChangedClasses. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
506 |
ChangeSet current changedClasses isEmpty ifTrue:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
507 |
b disable |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
508 |
]. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
509 |
^ b. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
510 |
! |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
511 |
|
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
512 |
addCheckBoxForChangedMethodList |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
513 |
|b| |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
514 |
|
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
515 |
b := CheckBox label:(resources string:'Changed Methods'). |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
516 |
self addCheckBox:b forSearchArea:#listOfChangedMethods. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
517 |
ChangeSet current changeSelectors isEmpty ifTrue:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
518 |
b disable |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
519 |
]. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
520 |
^ b. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
521 |
! |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
522 |
|
6685 | 523 |
addCheckBoxForClassMethodSearch |
524 |
|b| |
|
525 |
||
526 |
b := CheckBox label:(resources string:'Class Protocol'). |
|
527 |
b model:(self searchClassProtocolHolder). |
|
8782 | 528 |
currentPanel add:b. |
6685 | 529 |
^ b. |
530 |
! |
|
531 |
||
5591 | 532 |
addCheckBoxForClassesNamespace:ns |
533 |
|b| |
|
534 |
||
535 |
b := CheckBox |
|
8124 | 536 |
label:(resources string:'Classes'' nameSpace ("%1")' with:ns name). |
5591 | 537 |
self addCheckBox:b forSearchArea:#currentClassesNameSpace. |
538 |
^ b. |
|
539 |
! |
|
540 |
||
7333 | 541 |
addCheckBoxForClassesPackage:pkg |
542 |
|b| |
|
543 |
||
544 |
b := CheckBox |
|
8124 | 545 |
label:(resources string:'Classes'' package ("%1")' with:pkg). |
7333 | 546 |
self addCheckBox:b forSearchArea:#currentClassesPackage. |
547 |
^ b. |
|
548 |
||
549 |
"Created: / 21-09-2006 / 17:39:55 / cg" |
|
550 |
! |
|
551 |
||
5591 | 552 |
addCheckBoxForCurrentNamespace |
553 |
|b| |
|
554 |
||
7384 | 555 |
b := CheckBox |
8124 | 556 |
label:(resources string:'Current nameSpace ("%1")' with:currentNamespace name). |
5591 | 557 |
self addCheckBox:b forSearchArea:#currentNameSpace. |
558 |
^ b. |
|
7384 | 559 |
|
560 |
"Modified: / 10-10-2006 / 15:28:47 / cg" |
|
5591 | 561 |
! |
562 |
||
7042 | 563 |
addCheckBoxForCurrentPackage |
564 |
|b| |
|
565 |
||
7384 | 566 |
b := CheckBox |
8124 | 567 |
label:(resources string:'Current package ("%1")' with:currentPackage). |
7042 | 568 |
self addCheckBox:b forSearchArea:#currentPackage. |
569 |
^ b. |
|
7384 | 570 |
|
571 |
"Modified: / 10-10-2006 / 15:28:51 / cg" |
|
7042 | 572 |
! |
573 |
||
574 |
addCheckBoxForCurrentPackage:pkg |
|
575 |
|b| |
|
576 |
||
577 |
b := CheckBox |
|
8124 | 578 |
label:(resources string:'Classes'' package ("%1")' with:pkg). |
7042 | 579 |
self addCheckBox:b forSearchArea:#currentClassesPackage. |
580 |
^ b. |
|
7384 | 581 |
|
582 |
"Modified: / 10-10-2006 / 15:29:06 / cg" |
|
7042 | 583 |
! |
584 |
||
5591 | 585 |
addCheckBoxForEverywhere |
586 |
|b| |
|
587 |
||
588 |
b := CheckBox label:(resources string:'Everywhere'). |
|
589 |
self addCheckBox:b forSearchArea:#everywhere. |
|
590 |
^ b. |
|
591 |
! |
|
592 |
||
6685 | 593 |
addCheckBoxForInstanceMethodSearch |
594 |
|b| |
|
595 |
||
596 |
b := CheckBox label:(resources string:'Instance Protocol'). |
|
597 |
b model:(self searchInstanceProtocolHolder). |
|
8782 | 598 |
currentPanel add:b. |
6685 | 599 |
^ b. |
600 |
! |
|
601 |
||
5591 | 602 |
addCheckBoxForMethodList |
603 |
|b| |
|
604 |
||
605 |
b := CheckBox label:(resources string:'Methodlist'). |
|
606 |
self addCheckBox:b forSearchArea:#listOfMethods. |
|
607 |
^ b. |
|
608 |
! |
|
609 |
||
610 |
addCheckBoxForOwnerAndItsPrivateClasses |
|
8124 | 611 |
|b lbl arg| |
5591 | 612 |
|
613 |
(currentClass notNil and:[ currentClass isPrivate. ]) ifTrue:[ |
|
8124 | 614 |
lbl := 'Owner (%1) & all its private classes'. |
615 |
arg := currentClass owningClass name. |
|
5591 | 616 |
] ifFalse:[ |
8124 | 617 |
lbl := 'Owners & all their private classes'. |
5591 | 618 |
]. |
8124 | 619 |
b := CheckBox label:(resources string:lbl with:arg). |
5591 | 620 |
self addCheckBox:b forSearchArea:#ownersWithPrivateClasses. |
621 |
(selectedClasses contains:[ :cls | cls isPrivate. ]) ifFalse:[ |
|
8124 | 622 |
b disable. |
5591 | 623 |
]. |
624 |
^ b. |
|
625 |
! |
|
626 |
||
627 |
addCheckBoxForOwnerAndItsSubclassesAndItsPrivateClasses |
|
8124 | 628 |
|b lbl arg| |
5591 | 629 |
|
630 |
(currentClass notNil and:[ currentClass isPrivate. ]) ifTrue:[ |
|
8124 | 631 |
lbl := 'Owner (%1) & its subclasses & all its private classes'. |
632 |
arg := currentClass owningClass name. |
|
5591 | 633 |
] ifFalse:[ |
8124 | 634 |
lbl := 'Owners & their subclasses & all their private classes'. |
5591 | 635 |
]. |
8124 | 636 |
b := CheckBox label:(resources string:lbl with:arg). |
5591 | 637 |
self addCheckBox:b forSearchArea:#ownersHierarchiesWithPrivateClasses. |
638 |
(selectedClasses contains:[ :cls | cls isPrivate. ]) ifFalse:[ |
|
8124 | 639 |
b disable. |
5591 | 640 |
]. |
641 |
^ b. |
|
642 |
! |
|
643 |
||
644 |
addCheckBoxForSelectedClass |
|
8124 | 645 |
|b lbl arg| |
5591 | 646 |
|
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
647 |
(browser isMethodListBrowser |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
648 |
or:[ currentClass isNil |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
649 |
or:[ selectedClasses size > 1] ]) ifTrue:[ |
8124 | 650 |
selectedClasses size == 1 ifTrue:[ |
651 |
lbl := 'Selected class ("%1")'. |
|
652 |
arg := selectedClasses first theNonMetaclass name. |
|
653 |
] ifFalse:[ |
|
654 |
lbl := 'Selected classes (%1)'. |
|
655 |
arg := selectedClasses size. |
|
656 |
]. |
|
5591 | 657 |
] ifFalse:[ |
8124 | 658 |
lbl := 'Class ("%1")'. |
659 |
arg := currentClass name. |
|
5591 | 660 |
]. |
8124 | 661 |
b := CheckBox label:(resources string:lbl with:arg). |
5591 | 662 |
self addCheckBox:b forSearchArea:#classes. |
663 |
^ b. |
|
664 |
! |
|
665 |
||
666 |
addCheckBoxForSelectedClassAndPrivateClasses |
|
667 |
|b lbl| |
|
668 |
||
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
669 |
(browser isMethodListBrowser |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
670 |
or:[ currentClass isNil |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
671 |
or:[ selectedClasses size > 1] ]) ifTrue:[ |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
672 |
lbl := 'Selected classes & all private classes'. |
5591 | 673 |
] ifFalse:[ |
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
674 |
lbl := 'Class & private classes'. |
5591 | 675 |
]. |
676 |
b := CheckBox label:(resources string:lbl). |
|
677 |
self addCheckBox:b forSearchArea:#classesWithPrivateClasses. |
|
678 |
(selectedClasses |
|
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
679 |
contains:[ :cls | cls theNonMetaclass privateClasses size > 0. ]) |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
680 |
ifFalse:[ b disable. ]. |
5591 | 681 |
^ b. |
682 |
! |
|
683 |
||
684 |
addCheckBoxForSelectedClassAndSubclasses |
|
685 |
|b lbl| |
|
686 |
||
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
687 |
(browser isMethodListBrowser |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
688 |
or:[ currentClass isNil |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
689 |
or:[ selectedClasses size > 1] ]) ifTrue:[ |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
690 |
lbl := 'Selected classes & all subclasses'. |
5591 | 691 |
] ifFalse:[ |
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
692 |
lbl := 'Class & subclasses'. |
5591 | 693 |
]. |
694 |
b := CheckBox label:(resources string:lbl). |
|
695 |
self addCheckBox:b forSearchArea:#classHierarchies. |
|
696 |
(selectedClasses |
|
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
697 |
contains:[ :cls | cls theNonMetaclass subclasses size > 0. ]) |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
698 |
ifFalse:[ b disable. ]. |
5591 | 699 |
^ b. |
700 |
! |
|
701 |
||
702 |
addCheckBoxForSelectedClassAndSubclassesAndPrivateClasses |
|
703 |
|b lbl| |
|
704 |
||
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
705 |
(browser isMethodListBrowser |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
706 |
or:[ currentClass isNil |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
707 |
or:[ selectedClasses size > 1] ]) ifTrue:[ |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
708 |
lbl := 'Selected classes & all subclasses & all private classes'. |
5591 | 709 |
] ifFalse:[ |
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
710 |
lbl := 'Class & subclasses & all private classes'. |
5591 | 711 |
]. |
712 |
b := CheckBox label:(resources string:lbl). |
|
713 |
self addCheckBox:b forSearchArea:#classHierarchiesWithPrivateClasses. |
|
714 |
(selectedClasses |
|
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
715 |
contains:[ :cls | cls theNonMetaclass privateClasses size > 0. ]) |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
716 |
ifFalse:[ b disable. ]. |
5591 | 717 |
^ b. |
718 |
! |
|
719 |
||
720 |
addCheckBoxForSelectedClassAndSuperclasses |
|
721 |
|b lbl| |
|
722 |
||
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
723 |
(browser isMethodListBrowser |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
724 |
or:[ currentClass isNil |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
725 |
or:[ selectedClasses size > 1] ]) ifTrue:[ |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
726 |
lbl := 'Selected classes & all superclasses'. |
5591 | 727 |
] ifFalse:[ |
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
728 |
lbl := 'Class & superclasses'. |
5591 | 729 |
]. |
730 |
b := CheckBox label:(resources string:lbl). |
|
731 |
self addCheckBox:b forSearchArea:#classesAndSuperclasses. |
|
732 |
(selectedClasses |
|
8269
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
733 |
contains:[ :cls | cls theNonMetaclass superclass notNil. ]) |
eb414f5f7bf1
multiple seleted class search also when an inheritance classList is shown
Claus Gittinger <cg@exept.de>
parents:
8165
diff
changeset
|
734 |
ifFalse:[ b disable. ]. |
5591 | 735 |
^ b. |
736 |
! |
|
737 |
||
738 |
addCheckBoxForSelectedClassCategory |
|
8124 | 739 |
|b lbl arg| |
5591 | 740 |
|
741 |
currentClassCategory notNil ifTrue:[ |
|
8124 | 742 |
lbl := 'Class category ("%1")'. |
743 |
arg := currentClassCategory. |
|
5591 | 744 |
] ifFalse:[ |
8124 | 745 |
lbl := 'Selected classes categories (%1)'. |
746 |
arg := selectedCategories size. |
|
5591 | 747 |
]. |
8124 | 748 |
b := CheckBox label:(resources string:lbl with:arg). |
5591 | 749 |
self addCheckBox:b forSearchArea:#classCategories. |
750 |
^ b. |
|
751 |
! |
|
752 |
||
8566 | 753 |
addCheckBoxForSelectedMethodClasses |
754 |
|b classes| |
|
755 |
||
8569
41fb489a3cf3
changed #addCheckBoxForSelectedMethodClasses
Claus Gittinger <cg@exept.de>
parents:
8566
diff
changeset
|
756 |
classes := ((browser selectedMethods value ? #()) collect:[:m | m mclass theNonMetaclass]) asSet. |
8566 | 757 |
classes size == 1 ifTrue:[ |
9271
4fc80f22048c
changed: #addCheckBoxForSelectedMethodClasses
Claus Gittinger <cg@exept.de>
parents:
9245
diff
changeset
|
758 |
b := CheckBox label:(resources string:'Selected method''s class (%1)' |
8566 | 759 |
with:classes first name). |
760 |
] ifFalse:[ |
|
9271
4fc80f22048c
changed: #addCheckBoxForSelectedMethodClasses
Claus Gittinger <cg@exept.de>
parents:
9245
diff
changeset
|
761 |
b := CheckBox label:(resources string:'Selected methods'' classes (%1)' |
8566 | 762 |
with:classes size). |
763 |
]. |
|
764 |
self addCheckBox:b forSearchArea:#listOfSelectedMethodClasses. |
|
765 |
^ b. |
|
766 |
! |
|
767 |
||
5591 | 768 |
addCheckBoxForSelectedMethods |
769 |
|b| |
|
770 |
||
771 |
b := CheckBox label:(resources string:'Selected methods (%1)' |
|
772 |
with:browser selectedMethods value size). |
|
773 |
self addCheckBox:b forSearchArea:#listOfSelectedMethods. |
|
774 |
^ b. |
|
775 |
! |
|
776 |
||
7042 | 777 |
addCheckBoxForSelectedPackage |
8124 | 778 |
|b lbl arg| |
7042 | 779 |
|
780 |
currentClassCategory notNil ifTrue:[ |
|
8124 | 781 |
lbl := 'Class category ("%1")'. |
782 |
arg := currentClassCategory. |
|
7042 | 783 |
] ifFalse:[ |
8124 | 784 |
lbl := 'Selected classes categories (%1)'. |
785 |
arg := selectedCategories size. |
|
7042 | 786 |
]. |
8124 | 787 |
b := CheckBox label:(resources string:lbl with:arg). |
7042 | 788 |
self addCheckBox:b forSearchArea:#classCategories. |
789 |
^ b. |
|
790 |
! |
|
791 |
||
5591 | 792 |
addDummyCheckBoxForEverywhere |
793 |
|b| |
|
794 |
||
795 |
b := CheckBox label:(resources string:'Everywhere'). |
|
796 |
b turnOn. |
|
797 |
b disable. |
|
6685 | 798 |
|
8782 | 799 |
currentPanel add:b. |
5591 | 800 |
! |
801 |
||
9309 | 802 |
addFilteredListOfMatchingSelectors |
803 |
|l| |
|
804 |
||
805 |
listHolder := List new. |
|
806 |
||
807 |
l := HVScrollableView for:SelectionInListView. |
|
808 |
l listHolder:listHolder. |
|
809 |
self addComponent:l. |
|
810 |
l doubleClickAction:[ |
|
811 |
selectorHolder value:(l selectionValue). |
|
812 |
matchHolder value:false. |
|
813 |
caseHolder value:false. |
|
814 |
self doAccept. |
|
815 |
self okPressed. |
|
816 |
]. |
|
817 |
^ l. |
|
818 |
! |
|
819 |
||
5591 | 820 |
addInputFieldForSelectorOrNameOrString |
9315 | 821 |
|sel lastSearchPatterns| |
5591 | 822 |
|
9311 | 823 |
searchWhat == #selector ifTrue:[ |
8123 | 824 |
sel := browser selectorToSearchFor. |
5591 | 825 |
] ifFalse:[ |
9311 | 826 |
searchWhat == #globalName ifTrue:[ |
8123 | 827 |
sel := browser globalNameToSearchFor ? LastGlobalSearched. |
828 |
] ifFalse:[ |
|
9311 | 829 |
searchWhat == #string ifTrue:[ |
8123 | 830 |
sel := browser stringToSearchFor ? LastStringSearched. |
831 |
] ifFalse:[ |
|
832 |
sel := browser selectorToSearchFor. |
|
833 |
] |
|
834 |
]. |
|
5591 | 835 |
]. |
9315 | 836 |
lastSearchPatterns := browser lastSearchPatterns. |
8123 | 837 |
sel isEmptyOrNil ifTrue:[ |
838 |
"/ use last searchString |
|
839 |
lastSearchPatterns size > 0 ifTrue:[ |
|
840 |
sel := lastSearchPatterns first. |
|
841 |
]. |
|
5591 | 842 |
]. |
843 |
selectorHolder := sel asValue. |
|
844 |
||
845 |
inputField := self addComboBoxOn:selectorHolder tabable:true. |
|
9309 | 846 |
inputField list:lastSearchPatterns. |
9245
1f903a58f92c
changed: #addInputFieldForSelectorOrNameOrString
Claus Gittinger <cg@exept.de>
parents:
9001
diff
changeset
|
847 |
inputField selectAllInitially. |
9309 | 848 |
inputField immediateAccept:true. |
5591 | 849 |
inputField |
8123 | 850 |
entryCompletionBlock:[ :contents | |
851 |
|s what| |
|
5591 | 852 |
|
8123 | 853 |
s := contents withoutSpaces. |
854 |
self topView |
|
9309 | 855 |
withWaitCursorDo:[ |
856 |
|best matching| |
|
857 |
||
9311 | 858 |
searchWhat == #globalName ifFalse:[ |
8123 | 859 |
what := Smalltalk selectorCompletion:s. |
860 |
] ifTrue:[ |
|
861 |
what := Smalltalk globalNameCompletion:s. |
|
862 |
]. |
|
9309 | 863 |
best := what first. |
864 |
matching := what second. |
|
865 |
inputField contents:best. |
|
866 |
"/ listHolder contents:matching. |
|
867 |
matching size ~~ 1 ifTrue:[ |
|
8123 | 868 |
browser window beep. |
869 |
]. |
|
870 |
]. |
|
871 |
]. |
|
9309 | 872 |
|
873 |
selectorHolder onChangeEvaluate:[ self updateListOfMatchingSelectorsFor:inputField contents ]. |
|
5591 | 874 |
! |
875 |
||
876 |
addTextEntryFieldForCode |
|
7170 | 877 |
|initial box panel infoLabel helpButton errMessageField checkCodeAction |
878 |
metaBox b| |
|
5591 | 879 |
|
880 |
box := View new. |
|
6443 | 881 |
box extent:(600 @ 200). |
5591 | 882 |
|
6608 | 883 |
panel := VariableHorizontalPanel in:box. |
884 |
panel origin:0.0@0.0 corner:(1.0@1.0). |
|
5591 | 885 |
|
6608 | 886 |
codeField := CodeView in:panel. |
7748 | 887 |
codeField canTab:true. |
6608 | 888 |
"/ codeField origin:0.0@0.0 corner:(0.75@1.0). |
889 |
||
890 |
infoLabel := Label in:panel. |
|
891 |
"/ infoLabel origin:0.75@0.0 corner:(1.0@1.0). |
|
8786
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
892 |
infoLabel font:(codeField font asSize:(codeField font size - 2)). |
6608 | 893 |
infoLabel adjust:#left. |
8786
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
894 |
infoLabel label:(self helpTextForMetaPatterns). |
5591 | 895 |
|
6608 | 896 |
panel relativeCorners:#(0.6 1.0). |
897 |
||
898 |
helpButton := Button label:(resources string:'Pattern Help') in:infoLabel. |
|
899 |
helpButton layout:((AlignmentOrigin fractionalFromPoint:0.5@1.0) |
|
6443 | 900 |
leftOffset:2 |
8165
d7d59fbdcd2b
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
8124
diff
changeset
|
901 |
topOffset:helpButton preferredHeight negated; |
6608 | 902 |
leftAlignmentFraction:0.5 topAlignmentFraction:0). |
5591 | 903 |
helpButton topInset:0.75@1.0. |
904 |
helpButton action:[self showHelpOnCodePatterns]. |
|
905 |
||
6608 | 906 |
|
5591 | 907 |
self addComponent:box tabable:true. |
7170 | 908 |
|
909 |
metaBox := HorizontalPanelView new. |
|
910 |
metaBox horizontalLayout:#leftMax. |
|
8786
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
911 |
b := Button label:'+Lit' action:[ codeField paste:'`#n' ] in:metaBox. |
8833
fa0f28ab2b85
changed: #addTextEntryFieldForCode
Claus Gittinger <cg@exept.de>
parents:
8786
diff
changeset
|
912 |
b helpKey:#matchAnyLiteral. |
8786
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
913 |
b := Button label:'+Var' action:[ codeField paste:'`v' ] in:metaBox. |
8833
fa0f28ab2b85
changed: #addTextEntryFieldForCode
Claus Gittinger <cg@exept.de>
parents:
8786
diff
changeset
|
914 |
b helpKey:#matchAnyVariable. |
8786
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
915 |
b := Button label:'+Expr' action:[ codeField paste:'`@e' ] in:metaBox. |
8833
fa0f28ab2b85
changed: #addTextEntryFieldForCode
Claus Gittinger <cg@exept.de>
parents:
8786
diff
changeset
|
916 |
b helpKey:#matchAnyExpression. |
8786
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
917 |
b := Button label:'+Msg' action:[ codeField paste:'`@m:' ] in:metaBox. |
8833
fa0f28ab2b85
changed: #addTextEntryFieldForCode
Claus Gittinger <cg@exept.de>
parents:
8786
diff
changeset
|
918 |
b helpKey:#matchAnyMessage. |
7170 | 919 |
self addComponent:metaBox. |
920 |
||
5591 | 921 |
errMessageField := (self addTextLabel:'') adjust:#left. |
922 |
errMessageField level:-1. |
|
923 |
self addCheckBox:(resources string:'Method') on:self isMethodHolder. |
|
924 |
||
925 |
checkCodeAction := [ self checkCodeIn:codeField notifying:errMessageField. ]. |
|
926 |
||
927 |
codeField modifiedChannel onChangeEvaluate:checkCodeAction. |
|
8282
9b4068f2dd30
method-code search fixed: correctly pass the isMethod argument
Claus Gittinger <cg@exept.de>
parents:
8269
diff
changeset
|
928 |
self isMethodHolder onChangeEvaluate:checkCodeAction. |
5591 | 929 |
|
930 |
initial := browser selectionInCodeView. |
|
931 |
initial isEmptyOrNil ifTrue:[ |
|
6443 | 932 |
initial := LastCodeSearched ? '' |
5591 | 933 |
]. |
934 |
codeField contents:initial. |
|
935 |
checkCodeAction value. |
|
7748 | 936 |
|
937 |
"Modified: / 15-03-2007 / 16:27:11 / cg" |
|
5591 | 938 |
! |
939 |
||
940 |
checkCodeIn:codeField notifying:errMessageField |
|
941 |
|codeString tree errAction| |
|
942 |
||
943 |
codeString := codeField contents asString string. |
|
944 |
errAction := [:str :pos | |
|
6608 | 945 |
|line col badLine| |
5591 | 946 |
|
6608 | 947 |
line := codeField lineOfCharacterPosition:pos. |
948 |
col := (codeField colOfCharacterPosition:pos) max:1. |
|
5591 | 949 |
|
8282
9b4068f2dd30
method-code search fixed: correctly pass the isMethod argument
Claus Gittinger <cg@exept.de>
parents:
8269
diff
changeset
|
950 |
badLine := (codeField listAt:line) ? ''. |
9b4068f2dd30
method-code search fixed: correctly pass the isMethod argument
Claus Gittinger <cg@exept.de>
parents:
8269
diff
changeset
|
951 |
col <= badLine size size ifTrue:[ |
6608 | 952 |
codeField |
953 |
listAt:line |
|
954 |
put:(badLine asText |
|
955 |
emphasisAt:col |
|
956 |
put:(UserPreferences current unknownIdentifierEmphasis)). |
|
957 |
"/ codeField selectFromCharacterPosition:pos to:pos. |
|
958 |
]. |
|
959 |
errMessageField label:('line: ',line printString,' ',str). |
|
960 |
errMessageField backgroundColor:Color red. |
|
961 |
codeField requestFocus. |
|
962 |
nil. |
|
963 |
]. |
|
5591 | 964 |
|
965 |
isMethodHolder value ifTrue:[ |
|
6608 | 966 |
tree := RBParser parseRewriteMethod:codeString onError: errAction. |
5591 | 967 |
] ifFalse:[ |
6608 | 968 |
tree := RBParser parseRewriteExpression:codeString onError: errAction. |
5591 | 969 |
]. |
6608 | 970 |
tree notNil ifTrue:[ |
971 |
errMessageField backgroundColor:View defaultViewBackgroundColor. |
|
972 |
errMessageField label:nil |
|
973 |
]. |
|
5591 | 974 |
codeField modifiedChannel setValue:false. |
975 |
! |
|
976 |
||
977 |
getClassesAndMethodsFor:where |
|
978 |
where == #everywhere ifTrue:[ |
|
7042 | 979 |
classes := Smalltalk allClasses. |
7378 | 980 |
methods := nil. |
7042 | 981 |
^ self. |
5591 | 982 |
]. |
983 |
where == #currentNameSpace ifTrue:[ |
|
7042 | 984 |
classes := currentNamespace allClassesWithAllPrivateClasses. |
7378 | 985 |
methods := nil. |
7042 | 986 |
^ self. |
5591 | 987 |
]. |
988 |
where == #currentClassesNameSpace ifTrue:[ |
|
7042 | 989 |
currentClass isPrivate ifTrue:[ |
990 |
classes := currentClass topOwningClass nameSpace |
|
991 |
allClassesWithAllPrivateClasses. |
|
992 |
] ifFalse:[ |
|
993 |
classes := currentClass nameSpace allClassesWithAllPrivateClasses. |
|
994 |
]. |
|
7378 | 995 |
methods := nil. |
7042 | 996 |
^ self. |
997 |
]. |
|
998 |
where == #currentPackage ifTrue:[ |
|
999 |
classes := Smalltalk allClassesInPackage:currentPackage. |
|
7378 | 1000 |
methods := nil. |
7042 | 1001 |
^ self. |
1002 |
]. |
|
1003 |
where == #currentClassesPackage ifTrue:[ |
|
1004 |
classes := Smalltalk allClassesInPackage:currentClass package. |
|
7378 | 1005 |
methods := nil. |
7042 | 1006 |
^ self. |
5591 | 1007 |
]. |
1008 |
where == #classCategories ifTrue:[ |
|
7042 | 1009 |
classes := Smalltalk allClasses |
1010 |
select:[ :cls | selectedCategories includes:cls category. ]. |
|
1011 |
classes := classes collect:[ :each | each theNonMetaclass. ]. |
|
7378 | 1012 |
methods := nil. |
7042 | 1013 |
^ self. |
5591 | 1014 |
]. |
1015 |
(where == #classes or:[ where == #classesWithPrivateClasses. ]) ifTrue:[ |
|
7042 | 1016 |
classes := selectedClasses collect:[ :each | each theNonMetaclass. ]. |
7378 | 1017 |
methods := nil. |
7042 | 1018 |
^ self. |
5591 | 1019 |
]. |
7378 | 1020 |
(where == #classHierarchies or:[ where == #classHierarchiesWithPrivateClasses. ]) |
1021 |
ifTrue:[ |
|
1022 |
classes := IdentitySet new. |
|
1023 |
selectedClasses do:[ :cls | |
|
1024 |
classes addAll:cls theNonMetaclass withAllSubclasses. |
|
1025 |
]. |
|
1026 |
methods := nil. |
|
1027 |
^ self. |
|
1028 |
]. |
|
5591 | 1029 |
where == #ownersWithPrivateClasses ifTrue:[ |
7042 | 1030 |
classes := IdentitySet new. |
1031 |
selectedClasses do:[ :cls | |
|
1032 |
|c| |
|
5591 | 1033 |
|
7042 | 1034 |
c := cls theNonMetaclass. |
1035 |
classes add:(c owningClass ? c). |
|
1036 |
]. |
|
7378 | 1037 |
methods := nil. |
7042 | 1038 |
^ self. |
5591 | 1039 |
]. |
1040 |
where == #ownersHierarchiesWithPrivateClasses ifTrue:[ |
|
7042 | 1041 |
classes := IdentitySet new. |
1042 |
selectedClasses do:[ :cls | |
|
1043 |
|c| |
|
5591 | 1044 |
|
7042 | 1045 |
c := cls theNonMetaclass. |
1046 |
classes addAll:(c owningClass ? c) withAllSubclasses. |
|
1047 |
]. |
|
7378 | 1048 |
methods := nil. |
7042 | 1049 |
^ self. |
5591 | 1050 |
]. |
1051 |
(where == #classesAndSuperclasses) ifTrue:[ |
|
7042 | 1052 |
classes := IdentitySet new. |
1053 |
selectedClasses do:[ :cls | |
|
1054 |
classes addAll:cls theNonMetaclass withAllSuperclasses. |
|
1055 |
]. |
|
7378 | 1056 |
methods := nil. |
7042 | 1057 |
^ self. |
5591 | 1058 |
]. |
1059 |
(where == #listOfMethods) ifTrue:[ |
|
7042 | 1060 |
classes := nil. |
1061 |
methods := browser methodListApp methodList value. |
|
1062 |
^ self. |
|
5591 | 1063 |
]. |
1064 |
(where == #listOfSelectedMethods) ifTrue:[ |
|
7042 | 1065 |
classes := nil. |
1066 |
methods := browser selectedMethods value. |
|
1067 |
^ self. |
|
5591 | 1068 |
]. |
8566 | 1069 |
(where == #listOfSelectedMethodClasses) ifTrue:[ |
1070 |
classes := (browser selectedMethods value collect:[:m | m mclass theNonMetaclass]) asSet asOrderedCollection. |
|
1071 |
methods := nil. |
|
1072 |
^ self. |
|
1073 |
]. |
|
8083
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1074 |
(where == #listOfChangedClasses) ifTrue:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1075 |
classes := ChangeSet current changedClasses. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1076 |
methods := nil. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1077 |
^ self. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1078 |
]. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1079 |
(where == #listOfChangedMethods) ifTrue:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1080 |
classes := nil. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1081 |
methods := Set new. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1082 |
ChangeSet current do:[:chg | |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1083 |
|mthd| |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1084 |
|
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1085 |
chg notNil ifTrue:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1086 |
chg isMethodChange ifTrue:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1087 |
mthd := chg changeMethod. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1088 |
mthd notNil ifTrue:[ |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1089 |
methods add:mthd |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1090 |
] |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1091 |
] |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1092 |
] |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1093 |
]. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1094 |
methods := methods asOrderedCollection. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1095 |
^ self. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1096 |
]. |
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1097 |
|
53aba2c722ad
+search in changed methods & changed classes
Claus Gittinger <cg@exept.de>
parents:
8067
diff
changeset
|
1098 |
self halt:'inumplemented search'. |
7378 | 1099 |
|
1100 |
"Modified: / 09-10-2006 / 12:34:40 / cg" |
|
5591 | 1101 |
! |
1102 |
||
8786
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1103 |
helpTextForMetaPatterns |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1104 |
^ 'MetaPatterns: |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1105 |
' , '`' allBold , ' = meta |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1106 |
|
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1107 |
' , '@' allBold , ' = list/any |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1108 |
' , '.' allBold , ' = statement |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1109 |
' , '`' allBold , ' = recurse |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1110 |
|
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1111 |
' , '`#n' allBold , ' any lit |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1112 |
' , '`v' allBold , ' any var |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1113 |
' , '`@e' allBold , ' any expr |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1114 |
' , '`m' allBold , ' any unary message |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1115 |
' , '`@m:' allBold , ' any message |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1116 |
'. |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1117 |
! |
caa3e9c06b2d
added: #helpTextForMetaPatterns
Claus Gittinger <cg@exept.de>
parents:
8782
diff
changeset
|
1118 |
|
5591 | 1119 |
isMethodHolder |
1120 |
isMethodHolder isNil ifTrue:[isMethodHolder := (LastCodeSearchWasMethod ? false) asValue]. |
|
1121 |
^ isMethodHolder |
|
1122 |
! ! |
|
1123 |
||
1124 |
!SearchDialog methodsFor:'setup-buttons'! |
|
1125 |
||
1126 |
addBrowseButton |
|
1127 |
|b| |
|
1128 |
||
1129 |
b := Button label:(resources string:'Browse'). |
|
1130 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
1131 |
self addButton:b before:nil. |
|
1132 |
] ifFalse:[ |
|
1133 |
self addButton:b after:nil. |
|
1134 |
]. |
|
1135 |
b |
|
1136 |
action:[ |
|
1137 |
openHow := #newBrowser. |
|
1138 |
self doAccept. |
|
1139 |
self okPressed. |
|
1140 |
]. |
|
1141 |
^ b. |
|
1142 |
! |
|
1143 |
||
1144 |
addBufferButton |
|
1145 |
|b| |
|
1146 |
||
1147 |
b := Button label:(resources string:'Add Buffer'). |
|
1148 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
1149 |
self addButton:b before:nil. |
|
1150 |
] ifFalse:[ |
|
1151 |
self addButton:b after:nil. |
|
1152 |
]. |
|
1153 |
b |
|
1154 |
action:[ |
|
1155 |
openHow := #newBuffer. |
|
1156 |
self doAccept. |
|
1157 |
self okPressed. |
|
1158 |
]. |
|
1159 |
^ b. |
|
1160 |
! |
|
1161 |
||
1162 |
addButtons |
|
6685 | 1163 |
"add find/newBrowser/newBuffer buttons" |
1164 |
||
5591 | 1165 |
|prevButton| |
1166 |
||
1167 |
allowFind ifTrue:[ |
|
6685 | 1168 |
defaultOpenHow := #showHere. |
1169 |
prevButton := self addFindButton. |
|
5591 | 1170 |
]. |
1171 |
allowBrowser ifTrue:[ |
|
6685 | 1172 |
defaultOpenHow := #newBrowser. |
1173 |
prevButton := self addBrowseButton. |
|
5591 | 1174 |
]. |
1175 |
allowBuffer ifTrue:[ |
|
6685 | 1176 |
defaultOpenHow := #newBuffer. |
1177 |
prevButton := self addBufferButton. |
|
5591 | 1178 |
]. |
1179 |
prevButton notNil ifTrue:[ |
|
6685 | 1180 |
prevButton isReturnButton:true. |
5591 | 1181 |
]. |
1182 |
self addAbortButton. |
|
1183 |
! |
|
1184 |
||
1185 |
addFindButton |
|
1186 |
|b| |
|
1187 |
||
1188 |
b := Button label:(resources string:'Find'). |
|
1189 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
1190 |
self addButton:b before:nil. |
|
1191 |
] ifFalse:[ |
|
1192 |
self addButton:b after:nil. |
|
1193 |
]. |
|
1194 |
b |
|
1195 |
action:[ |
|
1196 |
openHow := #showHere. |
|
1197 |
self doAccept. |
|
1198 |
self okPressed. |
|
1199 |
]. |
|
1200 |
^ b. |
|
1201 |
! ! |
|
1202 |
||
1203 |
!SearchDialog class methodsFor:'documentation'! |
|
1204 |
||
1205 |
version |
|
9320
74ef9e3ad53c
changed: #addInputFieldForSelectorOrNameOrString
Claus Gittinger <cg@exept.de>
parents:
9315
diff
changeset
|
1206 |
^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.44 2009-12-14 16:57:25 cg Exp $' |
8833
fa0f28ab2b85
changed: #addTextEntryFieldForCode
Claus Gittinger <cg@exept.de>
parents:
8786
diff
changeset
|
1207 |
! |
fa0f28ab2b85
changed: #addTextEntryFieldForCode
Claus Gittinger <cg@exept.de>
parents:
8786
diff
changeset
|
1208 |
|
fa0f28ab2b85
changed: #addTextEntryFieldForCode
Claus Gittinger <cg@exept.de>
parents:
8786
diff
changeset
|
1209 |
version_CVS |
9320
74ef9e3ad53c
changed: #addInputFieldForSelectorOrNameOrString
Claus Gittinger <cg@exept.de>
parents:
9315
diff
changeset
|
1210 |
^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.44 2009-12-14 16:57:25 cg Exp $' |
5591 | 1211 |
! ! |