author | Claus Gittinger <cg@exept.de> |
Thu, 16 Mar 2006 09:42:03 +0100 | |
changeset 6700 | 315739e2f34d |
parent 6691 | 06bc56dc7252 |
child 7042 | f543949862d3 |
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 |
" |
|
12 |
||
5592 | 13 |
"{ Package: 'stx:libtool' }" |
5591 | 14 |
|
15 |
"{ NameSpace: Tools }" |
|
16 |
||
17 |
DialogBox subclass:#SearchDialog |
|
18 |
instanceVariableNames:'openHow classes methods selectedClasses selectedCategories |
|
19 |
selectedMethods currentClass currentNamespace |
|
20 |
currentClassCategory browser whereRadioGroup verticalPanel |
|
21 |
searchAreas caseHolder matchHolder isMethodHolder codeField |
|
22 |
selectorHolder defaultOpenHow withTextEntry allowFind allowBuffer |
|
6685 | 23 |
allowBrowser isSelector searchClassProtocolHolder |
24 |
searchInstanceProtocolHolder selectorOrCode' |
|
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 |
6381
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
26 |
LastSearchWasMatch LastSearchWasIgnoringCase LastStringSearchArea |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
27 |
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 |
|
81 |
^ caseHolder value ? false. |
|
82 |
! |
|
83 |
||
84 |
searchWithMatch |
|
85 |
^ matchHolder value ? false. |
|
86 |
! |
|
87 |
||
88 |
selectorToSearch |
|
89 |
^ selectorOrCode. |
|
90 |
! ! |
|
91 |
||
5591 | 92 |
!SearchDialog methodsFor:'private'! |
93 |
||
6685 | 94 |
searchClassProtocolHolder |
95 |
searchClassProtocolHolder isNil ifTrue:[ |
|
96 |
searchClassProtocolHolder := true asValue |
|
97 |
]. |
|
98 |
^ searchClassProtocolHolder |
|
99 |
! |
|
100 |
||
101 |
searchInstanceProtocolHolder |
|
102 |
searchInstanceProtocolHolder isNil ifTrue:[ |
|
103 |
searchInstanceProtocolHolder := true asValue |
|
104 |
]. |
|
105 |
^ searchInstanceProtocolHolder |
|
106 |
! |
|
107 |
||
5591 | 108 |
showHelpOnCodePatterns |
109 |
HTMLDocumentView openFullOnHelpFile:'Browser/RBSearchPatterns.html' |
|
110 |
! ! |
|
111 |
||
112 |
!SearchDialog methodsFor:'public'! |
|
113 |
||
6242 | 114 |
addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch |
115 |
isSelector == #code ifTrue:[ |
|
116 |
self addTextEntryFieldForCode. |
|
117 |
] ifFalse:[ |
|
118 |
self addInputFieldForSelectorOrNameOrString. |
|
119 |
withCaseIgnore ifTrue:[ |
|
6685 | 120 |
self |
121 |
addCheckBox:(resources string:'Ignore case') |
|
6465
b490429fbd16
default search is no longer case-sensitive
Claus Gittinger <cg@exept.de>
parents:
6443
diff
changeset
|
122 |
on:(caseHolder := (LastSearchWasIgnoringCase ? true) asValue). |
6242 | 123 |
]. |
124 |
withMatch ifTrue:[ |
|
6685 | 125 |
self |
126 |
addCheckBox:(resources string:'Match') |
|
6242 | 127 |
on:(matchHolder := (LastSearchWasMatch ? true) asValue). |
128 |
"/ (isSelector and:[ sel notNil. ]) ifTrue:[ |
|
129 |
"/ sel includesMatchCharacters ifTrue:[ |
|
130 |
"/ matchHolder value:false. |
|
131 |
"/ ]. |
|
132 |
"/ ]. |
|
133 |
]. |
|
134 |
] |
|
135 |
! |
|
136 |
||
5591 | 137 |
askThenDo:aBlock |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
138 |
|where code sel matchHolderValue caseHolderValue| |
5591 | 139 |
|
140 |
self open. |
|
141 |
self accepted ifFalse:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
142 |
^ self. |
5591 | 143 |
]. |
144 |
||
145 |
openHow isNil ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
146 |
openHow := defaultOpenHow. |
5591 | 147 |
]. |
148 |
where := whereRadioGroup value. |
|
149 |
withTextEntry ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
150 |
isSelector == #code ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
151 |
code := codeField contentsAsString. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
152 |
LastCodeSearched := code. |
6381
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
153 |
LastCodeSearchArea := where. |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
154 |
] ifFalse:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
155 |
sel := selectorHolder value. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
156 |
sel isEmpty ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
157 |
browser warn:(isSelector |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
158 |
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
|
159 |
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
|
160 |
^ self. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
161 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
162 |
sel := sel string. |
6667 | 163 |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
164 |
browser rememberSearchPattern:sel. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
165 |
isSelector == #globalName ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
166 |
LastGlobalSearched := sel. |
6381
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
167 |
] ifFalse:[ |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
168 |
isSelector == #string ifTrue:[ |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
169 |
LastStringSearchArea := where. |
6667 | 170 |
] ifFalse:[ |
6700 | 171 |
(sel startsWith:'#''') ifTrue:[ |
172 |
sel := sel copyFrom:3. |
|
173 |
(sel endsWith:$') ifTrue:[ |
|
174 |
sel := sel copyWithoutLast:1. |
|
6667 | 175 |
]. |
176 |
]. |
|
6381
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
177 |
] |
f8696b036204
remember last search areas for string and code search
Claus Gittinger <cg@exept.de>
parents:
6379
diff
changeset
|
178 |
] |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
179 |
]. |
5591 | 180 |
]. |
181 |
where isNil ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
182 |
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
|
183 |
^ self. |
5591 | 184 |
]. |
185 |
||
186 |
self getClassesAndMethodsFor:where. |
|
187 |
(#(#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
|
188 |
includes:where) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
189 |
ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
190 |
|toSearch| |
5591 | 191 |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
192 |
toSearch := IdentitySet withAll:classes. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
193 |
classes := IdentitySet withAll:toSearch. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
194 |
[ toSearch notEmpty. ] whileTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
195 |
|cls| |
5591 | 196 |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
197 |
cls := toSearch removeFirst. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
198 |
classes addAll:cls allPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
199 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
200 |
]. |
5591 | 201 |
|
202 |
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
|
203 |
classes := nil. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
204 |
methods size == 0 ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
205 |
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
|
206 |
^ self. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
207 |
]. |
5591 | 208 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
209 |
classes := classes asOrderedCollection. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
210 |
methods size ~~ 0 ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
211 |
browser warn:'oops'. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
212 |
methods := nil. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
213 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
214 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
215 |
|
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
216 |
matchHolderValue := matchHolder value. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
217 |
matchHolderValue notNil ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
218 |
LastSearchWasMatch := matchHolderValue |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
219 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
220 |
caseHolderValue := caseHolder value. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
221 |
caseHolderValue notNil ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
222 |
LastSearchWasIgnoringCase := caseHolderValue |
5591 | 223 |
]. |
224 |
||
6685 | 225 |
selectorOrCode := sel ? code. |
226 |
||
227 |
aBlock numArgs == 7 ifTrue:[ |
|
228 |
"/ old style |
|
229 |
aBlock |
|
230 |
value:classes |
|
231 |
value:(sel ? code) |
|
232 |
value:(caseHolderValue ? false) |
|
233 |
value:openHow |
|
234 |
value:(matchHolderValue ? false) |
|
235 |
value:methods |
|
236 |
value:(isMethodHolder value ? false). |
|
237 |
] ifFalse:[ |
|
238 |
aBlock value. |
|
239 |
] |
|
5591 | 240 |
! |
241 |
||
6242 | 242 |
setupToAskForMethodSearchTitle:title forBrowser:brwsrArg isSelector:isSelectorArg searchArea:whereDefault withCaseIgnore:withCaseIgnore withMatch:withMatch withMethodList:withMethodList allowFind:allowFindArg allowBuffer:allowBufferArg allowBrowser:allowBrowserArg withTextEntry:withTextEntryArg |
6685 | 243 |
|where ns methodNameSpaces hPanel leftVerticalPanel rightVerticalPanel| |
5591 | 244 |
|
245 |
allowFind := allowFindArg. |
|
246 |
allowBuffer := allowBufferArg. |
|
247 |
allowBrowser := allowBrowserArg. |
|
248 |
isSelector := isSelectorArg. |
|
249 |
withTextEntry := withTextEntryArg. |
|
250 |
browser := brwsrArg. |
|
251 |
resources := browser resources. |
|
252 |
||
6351 | 253 |
(self addTextLabel:(resources stringWithCRs:title)) adjust:#left. |
6685 | 254 |
|
5591 | 255 |
selectedClasses := browser selectedClasses value. |
256 |
selectedCategories := browser selectedCategoriesValue. |
|
257 |
selectedMethods := browser selectedMethods value. |
|
258 |
currentClass := browser theSingleSelectedClass. |
|
259 |
currentClassCategory := browser theSingleSelectedCategory. |
|
6242 | 260 |
currentClass isNil ifTrue:[ |
261 |
browser hasMethodSelected ifTrue:[ |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
262 |
currentClass := selectedMethods first mclass. |
6685 | 263 |
selectedClasses := (selectedMethods collect:[:each | each mclass ]) asIdentitySet. |
6242 | 264 |
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
|
265 |
]. |
5591 | 266 |
]. |
6242 | 267 |
currentClass notNil ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
268 |
currentClass := currentClass theNonMetaclass. |
5591 | 269 |
]. |
6242 | 270 |
withTextEntry ifTrue:[ |
271 |
self addTextEntryWithCaseIgnore:withCaseIgnore withMatch:withMatch. |
|
5591 | 272 |
]. |
273 |
searchAreas := OrderedCollection new. |
|
6685 | 274 |
|
5591 | 275 |
self addHorizontalLine. |
276 |
self addVerticalSpace. |
|
6685 | 277 |
|
278 |
hPanel := HorizontalPanelView "SimpleView" new. |
|
279 |
hPanel verticalLayout:#top. |
|
280 |
hPanel horizontalLayout:#left. |
|
281 |
||
282 |
leftVerticalPanel := verticalPanel := VerticalPanelView new. |
|
283 |
leftVerticalPanel verticalLayout:#topSpace. |
|
284 |
leftVerticalPanel horizontalLayout:#fitSpace. |
|
285 |
||
5591 | 286 |
(self addTextLabel:(resources string:'Search in:')) adjust:#left. |
287 |
whereRadioGroup := RadioButtonGroup new. |
|
6242 | 288 |
(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
|
289 |
self addCheckBoxForEverywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
290 |
"/ classMethodListView notNil ifTrue:[ |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
291 |
"/ 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
|
292 |
"/ 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
|
293 |
"/ areas add:#currentMethodList. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
294 |
"/ self makeTabable:b. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
295 |
"/ ]. |
6242 | 296 |
browser isMethodListBrowser ifTrue:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
297 |
methodNameSpaces := (browser selectedMethods value ? #()) |
6242 | 298 |
collect:[:eachMethod | eachMethod mclass topNameSpace ]. |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
299 |
]. |
6242 | 300 |
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
|
301 |
currentNamespace := methodNameSpaces first. |
6242 | 302 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
303 |
currentNamespace := browser currentNamespace. |
6379 | 304 |
selectedClasses size == 0 ifTrue:[ |
305 |
|classesInAllSelectedCategories nameSpacesOfAllClassesInAllSelectedCategories| |
|
306 |
classesInAllSelectedCategories := Smalltalk allClasses select:[:cls | selectedCategories includes:cls category]. |
|
307 |
nameSpacesOfAllClassesInAllSelectedCategories := classesInAllSelectedCategories collect:[:eachClass | eachClass topNameSpace]. |
|
308 |
nameSpacesOfAllClassesInAllSelectedCategories size == 1 ifTrue:[ |
|
309 |
currentNamespace := nameSpacesOfAllClassesInAllSelectedCategories first. |
|
310 |
]. |
|
311 |
]. |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
312 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
313 |
(currentNamespace notNil |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
314 |
and:[ currentNamespace ~= (browser nameListEntryForALL) ]) |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
315 |
ifTrue:[ self addCheckBoxForCurrentNamespace ] |
6242 | 316 |
ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
317 |
(currentClass notNil |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
318 |
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
|
319 |
ifTrue:[ self addCheckBoxForClassesNamespace:ns ]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
320 |
]. |
6242 | 321 |
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
|
322 |
self addCheckBoxForSelectedClassCategory. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
323 |
]. |
6242 | 324 |
(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
|
325 |
self addCheckBoxForSelectedClass. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
326 |
self addCheckBoxForSelectedClassAndSuperclasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
327 |
self addCheckBoxForSelectedClassAndSubclasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
328 |
self addCheckBoxForSelectedClassAndPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
329 |
self addCheckBoxForSelectedClassAndSubclassesAndPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
330 |
self addCheckBoxForOwnerAndItsPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
331 |
self addCheckBoxForOwnerAndItsSubclassesAndItsPrivateClasses. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
332 |
]. |
6242 | 333 |
] ifFalse:[ |
334 |
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
|
335 |
self addCheckBoxForEverywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
336 |
currentNamespace := browser currentNamespace. |
6242 | 337 |
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
|
338 |
self addCheckBoxForCurrentNamespace. |
6242 | 339 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
340 |
(currentClass notNil |
6685 | 341 |
and:[ (ns := currentClass nameSpace) notNil |
342 |
and:[ ns ~~ Smalltalk ] ]) |
|
343 |
ifTrue:[ |
|
344 |
self addCheckBoxForClassesNamespace:ns |
|
345 |
]. |
|
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
346 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
347 |
]. |
5591 | 348 |
]. |
6242 | 349 |
(withMethodList and:[ browser isMethodListBrowser ]) ifTrue:[ |
350 |
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
|
351 |
self addCheckBoxForEverywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
352 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
353 |
self addCheckBoxForMethodList. |
6242 | 354 |
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
|
355 |
self addCheckBoxForSelectedMethods. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
356 |
]. |
5591 | 357 |
]. |
6242 | 358 |
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
|
359 |
whereRadioGroup := #everywhere asValue. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
360 |
self addDummyCheckBoxForEverywhere. |
6242 | 361 |
] ifFalse:[ |
362 |
whereDefault notNil ifTrue:[ |
|
363 |
(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
|
364 |
where := whereDefault asSymbol. |
6242 | 365 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
366 |
where := searchAreas first. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
367 |
]. |
6242 | 368 |
] ifFalse:[ |
5886
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
369 |
where := #everywhere. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
370 |
]. |
a212a4614597
remember last match- and last case-flag setting as default
Claus Gittinger <cg@exept.de>
parents:
5592
diff
changeset
|
371 |
whereRadioGroup value:where. |
5591 | 372 |
]. |
6685 | 373 |
|
374 |
hPanel add:leftVerticalPanel. |
|
375 |
||
376 |
rightVerticalPanel := verticalPanel := VerticalPanelView new. |
|
377 |
rightVerticalPanel verticalLayout:#topSpace. |
|
378 |
rightVerticalPanel horizontalLayout:#fitSpace. |
|
379 |
||
380 |
false ifTrue:[ |
|
381 |
self addCheckBoxForClassMethodSearch. |
|
382 |
self addCheckBoxForInstanceMethodSearch. |
|
383 |
]. |
|
384 |
||
385 |
"/ rightVerticalPanel origin:0.75@0.0 corner:1.0@1.0. |
|
386 |
hPanel |
|
387 |
preferredExtent:(leftVerticalPanel preferredExtent y + rightVerticalPanel preferredExtent y) |
|
388 |
@ |
|
389 |
(leftVerticalPanel preferredExtent y max:rightVerticalPanel preferredExtent y). |
|
390 |
hPanel add:rightVerticalPanel. |
|
391 |
self addComponent:hPanel indent:0. |
|
392 |
||
5591 | 393 |
"/ panel has its own idea of indenting |
394 |
self addVerticalSpace. |
|
395 |
self addHorizontalLine. |
|
396 |
self addButtons. |
|
6685 | 397 |
|
5591 | 398 |
self label:(resources string:'Search'). |
399 |
! ! |
|
400 |
||
401 |
!SearchDialog methodsFor:'setup'! |
|
402 |
||
403 |
addCheckBox:b forSearchArea:area |
|
404 |
verticalPanel add:b. |
|
405 |
whereRadioGroup add:b value:area. |
|
406 |
searchAreas add:area. |
|
407 |
self makeTabable:b. |
|
408 |
! |
|
409 |
||
6685 | 410 |
addCheckBoxForClassMethodSearch |
411 |
|b| |
|
412 |
||
413 |
b := CheckBox label:(resources string:'Class Protocol'). |
|
414 |
b model:(self searchClassProtocolHolder). |
|
415 |
verticalPanel add:b. |
|
416 |
^ b. |
|
417 |
! |
|
418 |
||
5591 | 419 |
addCheckBoxForClassesNamespace:ns |
420 |
|b| |
|
421 |
||
422 |
b := CheckBox |
|
423 |
label:(resources string:'Classes nameSpace (''%1'')' with:ns name). |
|
424 |
self addCheckBox:b forSearchArea:#currentClassesNameSpace. |
|
425 |
^ b. |
|
426 |
! |
|
427 |
||
428 |
addCheckBoxForCurrentNamespace |
|
429 |
|b| |
|
430 |
||
431 |
b := CheckBox label:(resources string:'Current nameSpace (''%1'')' |
|
432 |
with:currentNamespace name). |
|
433 |
self addCheckBox:b forSearchArea:#currentNameSpace. |
|
434 |
^ b. |
|
435 |
! |
|
436 |
||
437 |
addCheckBoxForEverywhere |
|
438 |
|b| |
|
439 |
||
440 |
b := CheckBox label:(resources string:'Everywhere'). |
|
441 |
self addCheckBox:b forSearchArea:#everywhere. |
|
442 |
^ b. |
|
443 |
! |
|
444 |
||
6685 | 445 |
addCheckBoxForInstanceMethodSearch |
446 |
|b| |
|
447 |
||
448 |
b := CheckBox label:(resources string:'Instance Protocol'). |
|
449 |
b model:(self searchInstanceProtocolHolder). |
|
450 |
verticalPanel add:b. |
|
451 |
^ b. |
|
452 |
! |
|
453 |
||
5591 | 454 |
addCheckBoxForMethodList |
455 |
|b| |
|
456 |
||
457 |
b := CheckBox label:(resources string:'Methodlist'). |
|
458 |
self addCheckBox:b forSearchArea:#listOfMethods. |
|
459 |
^ b. |
|
460 |
! |
|
461 |
||
462 |
addCheckBoxForOwnerAndItsPrivateClasses |
|
463 |
|b lbl| |
|
464 |
||
465 |
(currentClass notNil and:[ currentClass isPrivate. ]) ifTrue:[ |
|
466 |
lbl := resources string:'Owner (%1) & all its private classes' |
|
467 |
with:currentClass owningClass name. |
|
468 |
] ifFalse:[ |
|
469 |
lbl := resources string:'Owners & all their private classes'. |
|
470 |
]. |
|
471 |
b := CheckBox label:lbl. |
|
472 |
self addCheckBox:b forSearchArea:#ownersWithPrivateClasses. |
|
473 |
(selectedClasses contains:[ :cls | cls isPrivate. ]) ifFalse:[ |
|
474 |
b disable. |
|
475 |
]. |
|
476 |
^ b. |
|
477 |
! |
|
478 |
||
479 |
addCheckBoxForOwnerAndItsSubclassesAndItsPrivateClasses |
|
480 |
|b lbl| |
|
481 |
||
482 |
(currentClass notNil and:[ currentClass isPrivate. ]) ifTrue:[ |
|
483 |
lbl := resources |
|
484 |
string:'Owner (%1) & its subclasses & all its private classes' |
|
485 |
with:currentClass owningClass name. |
|
486 |
] ifFalse:[ |
|
487 |
lbl := resources |
|
488 |
string:'Owners & their subclasses & all their private classes'. |
|
489 |
]. |
|
490 |
b := CheckBox label:lbl. |
|
491 |
self addCheckBox:b forSearchArea:#ownersHierarchiesWithPrivateClasses. |
|
492 |
(selectedClasses contains:[ :cls | cls isPrivate. ]) ifFalse:[ |
|
493 |
b disable. |
|
494 |
]. |
|
495 |
^ b. |
|
496 |
! |
|
497 |
||
498 |
addCheckBoxForSelectedClass |
|
499 |
|b lbl| |
|
500 |
||
501 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
502 |
selectedClasses size == 1 ifTrue:[ |
|
503 |
lbl := resources string:'Selected class (''%1'')' |
|
504 |
with:selectedClasses first theNonMetaclass name. |
|
505 |
] ifFalse:[ |
|
506 |
lbl := resources string:'Selected classes (%1)' with:selectedClasses size. |
|
507 |
]. |
|
508 |
] ifFalse:[ |
|
509 |
lbl := resources string:'Class (''%1'')' with:currentClass name. |
|
510 |
]. |
|
511 |
b := CheckBox label:lbl. |
|
512 |
self addCheckBox:b forSearchArea:#classes. |
|
513 |
^ b. |
|
514 |
! |
|
515 |
||
516 |
addCheckBoxForSelectedClassAndPrivateClasses |
|
517 |
|b lbl| |
|
518 |
||
519 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
520 |
lbl := 'Selected classes & all private classes'. |
|
521 |
] ifFalse:[ |
|
522 |
lbl := 'Class & private classes'. |
|
523 |
]. |
|
524 |
b := CheckBox label:(resources string:lbl). |
|
525 |
self addCheckBox:b forSearchArea:#classesWithPrivateClasses. |
|
526 |
(selectedClasses |
|
527 |
contains:[ :cls | cls theNonMetaclass privateClasses size > 0. ]) |
|
528 |
ifFalse:[ b disable. ]. |
|
529 |
^ b. |
|
530 |
! |
|
531 |
||
532 |
addCheckBoxForSelectedClassAndSubclasses |
|
533 |
|b lbl| |
|
534 |
||
535 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
536 |
lbl := 'Selected classes & all subclasses'. |
|
537 |
] ifFalse:[ |
|
538 |
lbl := 'Class & subclasses'. |
|
539 |
]. |
|
540 |
b := CheckBox label:(resources string:lbl). |
|
541 |
self addCheckBox:b forSearchArea:#classHierarchies. |
|
542 |
(selectedClasses |
|
543 |
contains:[ :cls | cls theNonMetaclass subclasses size > 0. ]) |
|
544 |
ifFalse:[ b disable. ]. |
|
545 |
^ b. |
|
546 |
! |
|
547 |
||
548 |
addCheckBoxForSelectedClassAndSubclassesAndPrivateClasses |
|
549 |
|b lbl| |
|
550 |
||
551 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
552 |
lbl := 'Selected classes & all subclasses & all private classes'. |
|
553 |
] ifFalse:[ |
|
554 |
lbl := 'Class & subclasses & all private classes'. |
|
555 |
]. |
|
556 |
b := CheckBox label:(resources string:lbl). |
|
557 |
self addCheckBox:b forSearchArea:#classHierarchiesWithPrivateClasses. |
|
558 |
(selectedClasses |
|
559 |
contains:[ :cls | cls theNonMetaclass privateClasses size > 0. ]) |
|
560 |
ifFalse:[ b disable. ]. |
|
561 |
^ b. |
|
562 |
! |
|
563 |
||
564 |
addCheckBoxForSelectedClassAndSuperclasses |
|
565 |
|b lbl| |
|
566 |
||
567 |
(browser isMethodListBrowser or:[ currentClass isNil. ]) ifTrue:[ |
|
568 |
lbl := 'Selected classes & all superclasses'. |
|
569 |
] ifFalse:[ |
|
570 |
lbl := 'Class & superclasses'. |
|
571 |
]. |
|
572 |
b := CheckBox label:(resources string:lbl). |
|
573 |
self addCheckBox:b forSearchArea:#classesAndSuperclasses. |
|
574 |
(selectedClasses |
|
575 |
contains:[ :cls | cls theNonMetaclass superclass notNil. ]) |
|
576 |
ifFalse:[ b disable. ]. |
|
577 |
^ b. |
|
578 |
! |
|
579 |
||
580 |
addCheckBoxForSelectedClassCategory |
|
581 |
|b lbl| |
|
582 |
||
583 |
currentClassCategory notNil ifTrue:[ |
|
584 |
lbl := resources string:'Class category (''%1'')' |
|
585 |
with:currentClassCategory. |
|
586 |
] ifFalse:[ |
|
587 |
lbl := resources string:'Selected classes categories (%1)' |
|
588 |
with:selectedCategories size. |
|
589 |
]. |
|
590 |
b := CheckBox label:lbl. |
|
591 |
self addCheckBox:b forSearchArea:#classCategories. |
|
592 |
^ b. |
|
593 |
! |
|
594 |
||
595 |
addCheckBoxForSelectedMethods |
|
596 |
|b| |
|
597 |
||
598 |
b := CheckBox label:(resources string:'Selected methods (%1)' |
|
599 |
with:browser selectedMethods value size). |
|
600 |
self addCheckBox:b forSearchArea:#listOfSelectedMethods. |
|
601 |
^ b. |
|
602 |
! |
|
603 |
||
604 |
addDummyCheckBoxForEverywhere |
|
605 |
|b| |
|
606 |
||
607 |
b := CheckBox label:(resources string:'Everywhere'). |
|
608 |
b turnOn. |
|
609 |
b disable. |
|
6685 | 610 |
|
5591 | 611 |
verticalPanel add:b. |
612 |
! |
|
613 |
||
614 |
addInputFieldForSelectorOrNameOrString |
|
615 |
|sel inputField lastSearchPatterns| |
|
616 |
||
617 |
isSelector == true ifTrue:[ |
|
5592 | 618 |
sel := browser selectorToSearchFor. |
5591 | 619 |
] ifFalse:[ |
5592 | 620 |
isSelector == #globalName ifTrue:[ |
621 |
sel := browser globalNameToSearchFor ? LastGlobalSearched. |
|
622 |
] ifFalse:[ |
|
623 |
sel := browser stringToSearchFor. |
|
624 |
]. |
|
5591 | 625 |
]. |
626 |
sel size == 0 ifTrue:[ |
|
5592 | 627 |
"/ use last searchString |
628 |
lastSearchPatterns := browser lastSearchPatterns. |
|
629 |
lastSearchPatterns size > 0 ifTrue:[ |
|
630 |
sel := lastSearchPatterns first. |
|
631 |
]. |
|
5591 | 632 |
]. |
633 |
selectorHolder := sel asValue. |
|
634 |
||
635 |
inputField := self addComboBoxOn:selectorHolder tabable:true. |
|
636 |
inputField list:lastSearchPatterns . |
|
637 |
inputField selectAll. |
|
638 |
inputField |
|
5592 | 639 |
entryCompletionBlock:[ :contents | |
640 |
|s what| |
|
5591 | 641 |
|
5592 | 642 |
s := contents withoutSpaces. |
643 |
self topView |
|
644 |
withWaitCursorDo:[ |
|
645 |
isSelector == #globalName ifFalse:[ |
|
646 |
what := Smalltalk selectorCompletion:s. |
|
647 |
] ifTrue:[ |
|
648 |
what := Smalltalk globalNameCompletion:s. |
|
649 |
]. |
|
650 |
inputField contents:what first. |
|
651 |
(what at:2) size ~~ 1 ifTrue:[ |
|
652 |
browser window beep. |
|
653 |
]. |
|
654 |
]. |
|
655 |
]. |
|
5591 | 656 |
! |
657 |
||
658 |
addTextEntryFieldForCode |
|
6608 | 659 |
|initial box panel infoLabel helpButton errMessageField checkCodeAction| |
5591 | 660 |
|
661 |
box := View new. |
|
6443 | 662 |
box extent:(600 @ 200). |
5591 | 663 |
|
6608 | 664 |
panel := VariableHorizontalPanel in:box. |
665 |
panel origin:0.0@0.0 corner:(1.0@1.0). |
|
5591 | 666 |
|
6608 | 667 |
codeField := CodeView in:panel. |
668 |
"/ codeField origin:0.0@0.0 corner:(0.75@1.0). |
|
669 |
||
670 |
infoLabel := Label in:panel. |
|
671 |
"/ infoLabel origin:0.75@0.0 corner:(1.0@1.0). |
|
5591 | 672 |
infoLabel font:(codeField font). |
6608 | 673 |
infoLabel adjust:#left. |
5591 | 674 |
infoLabel label:'MetaPatterns: |
675 |
||
676 |
' , '`' allBold , ' = meta |
|
677 |
||
678 |
' , '@' allBold , ' = list/any |
|
679 |
' , '.' allBold , ' = statement |
|
680 |
' , '`' allBold , ' = recurse |
|
681 |
||
682 |
' , '`#n' allBold , ' any lit |
|
683 |
' , '`v' allBold , ' any var |
|
684 |
' , '`@e' allBold , ' any expr |
|
685 |
'. |
|
686 |
||
6608 | 687 |
panel relativeCorners:#(0.6 1.0). |
688 |
||
689 |
helpButton := Button label:(resources string:'Pattern Help') in:infoLabel. |
|
690 |
helpButton layout:((AlignmentOrigin fractionalFromPoint:0.5@1.0) |
|
6443 | 691 |
leftOffset:2 |
6608 | 692 |
topOffset:helpButton preferredExtent y negated; |
693 |
leftAlignmentFraction:0.5 topAlignmentFraction:0). |
|
5591 | 694 |
helpButton topInset:0.75@1.0. |
695 |
helpButton action:[self showHelpOnCodePatterns]. |
|
696 |
||
6608 | 697 |
|
5591 | 698 |
self addComponent:box tabable:true. |
699 |
errMessageField := (self addTextLabel:'') adjust:#left. |
|
700 |
errMessageField level:-1. |
|
701 |
self addCheckBox:(resources string:'Method') on:self isMethodHolder. |
|
702 |
||
703 |
checkCodeAction := [ self checkCodeIn:codeField notifying:errMessageField. ]. |
|
704 |
||
705 |
codeField modifiedChannel onChangeEvaluate:checkCodeAction. |
|
706 |
||
707 |
initial := browser selectionInCodeView. |
|
708 |
initial isEmptyOrNil ifTrue:[ |
|
6443 | 709 |
initial := LastCodeSearched ? '' |
5591 | 710 |
]. |
711 |
codeField contents:initial. |
|
712 |
checkCodeAction value. |
|
713 |
! |
|
714 |
||
715 |
checkCodeIn:codeField notifying:errMessageField |
|
716 |
|codeString tree errAction| |
|
717 |
||
718 |
codeString := codeField contents asString string. |
|
719 |
errAction := [:str :pos | |
|
6608 | 720 |
|line col badLine| |
5591 | 721 |
|
6608 | 722 |
line := codeField lineOfCharacterPosition:pos. |
723 |
col := (codeField colOfCharacterPosition:pos) max:1. |
|
5591 | 724 |
|
6608 | 725 |
badLine := (codeField listAt:line) ? '' |
5591 | 726 |
. col <= badLine size size ifTrue:[ |
6608 | 727 |
codeField |
728 |
listAt:line |
|
729 |
put:(badLine asText |
|
730 |
emphasisAt:col |
|
731 |
put:(UserPreferences current unknownIdentifierEmphasis)). |
|
732 |
"/ codeField selectFromCharacterPosition:pos to:pos. |
|
733 |
]. |
|
734 |
errMessageField label:('line: ',line printString,' ',str). |
|
735 |
errMessageField backgroundColor:Color red. |
|
736 |
codeField requestFocus. |
|
737 |
nil. |
|
738 |
]. |
|
5591 | 739 |
|
740 |
isMethodHolder value ifTrue:[ |
|
6608 | 741 |
tree := RBParser parseRewriteMethod:codeString onError: errAction. |
5591 | 742 |
] ifFalse:[ |
6608 | 743 |
tree := RBParser parseRewriteExpression:codeString onError: errAction. |
5591 | 744 |
]. |
6608 | 745 |
tree notNil ifTrue:[ |
746 |
errMessageField backgroundColor:View defaultViewBackgroundColor. |
|
747 |
errMessageField label:nil |
|
748 |
]. |
|
5591 | 749 |
codeField modifiedChannel setValue:false. |
750 |
! |
|
751 |
||
752 |
getClassesAndMethodsFor:where |
|
753 |
where == #everywhere ifTrue:[ |
|
754 |
classes := Smalltalk allClasses. |
|
755 |
^ self. |
|
756 |
]. |
|
757 |
where == #currentNameSpace ifTrue:[ |
|
758 |
classes := currentNamespace allClassesWithAllPrivateClasses. |
|
759 |
^ self. |
|
760 |
]. |
|
761 |
where == #currentClassesNameSpace ifTrue:[ |
|
762 |
currentClass isPrivate ifTrue:[ |
|
763 |
classes := currentClass topOwningClass nameSpace |
|
764 |
allClassesWithAllPrivateClasses. |
|
765 |
] ifFalse:[ |
|
766 |
classes := currentClass nameSpace allClassesWithAllPrivateClasses. |
|
767 |
]. |
|
768 |
^ self. |
|
769 |
]. |
|
770 |
where == #classCategories ifTrue:[ |
|
771 |
classes := Smalltalk allClasses |
|
772 |
select:[ :cls | selectedCategories includes:cls category. ]. |
|
773 |
classes := classes collect:[ :each | each theNonMetaclass. ]. |
|
774 |
^ self. |
|
775 |
]. |
|
776 |
(where == #classes or:[ where == #classesWithPrivateClasses. ]) ifTrue:[ |
|
777 |
classes := selectedClasses collect:[ :each | each theNonMetaclass. ]. |
|
778 |
^ self. |
|
779 |
]. |
|
780 |
(where == #classHierarchies |
|
781 |
or:[ where == #classHierarchiesWithPrivateClasses. ]) |
|
782 |
ifTrue:[ |
|
783 |
classes := IdentitySet new. |
|
784 |
selectedClasses do:[ :cls | |
|
785 |
classes addAll:cls theNonMetaclass withAllSubclasses. |
|
786 |
]. |
|
787 |
^ self. |
|
788 |
]. |
|
789 |
where == #ownersWithPrivateClasses ifTrue:[ |
|
790 |
classes := IdentitySet new. |
|
791 |
selectedClasses do:[ :cls | |
|
792 |
|c| |
|
793 |
||
794 |
c := cls theNonMetaclass. |
|
795 |
classes add:(c owningClass ? c). |
|
796 |
]. |
|
797 |
^ self. |
|
798 |
]. |
|
799 |
where == #ownersHierarchiesWithPrivateClasses ifTrue:[ |
|
800 |
classes := IdentitySet new. |
|
801 |
selectedClasses do:[ :cls | |
|
802 |
|c| |
|
803 |
||
804 |
c := cls theNonMetaclass. |
|
805 |
classes addAll:(c owningClass ? c) withAllSubclasses. |
|
806 |
]. |
|
807 |
^ self. |
|
808 |
]. |
|
809 |
(where == #classesAndSuperclasses) ifTrue:[ |
|
810 |
classes := IdentitySet new. |
|
811 |
selectedClasses do:[ :cls | |
|
812 |
classes addAll:cls theNonMetaclass withAllSuperclasses. |
|
813 |
]. |
|
814 |
^ self. |
|
815 |
]. |
|
816 |
(where == #listOfMethods) ifTrue:[ |
|
817 |
classes := nil. |
|
818 |
methods := browser methodListApp methodList value. |
|
819 |
^ self. |
|
820 |
]. |
|
821 |
(where == #listOfSelectedMethods) ifTrue:[ |
|
822 |
classes := nil. |
|
823 |
methods := browser selectedMethods value. |
|
824 |
^ self. |
|
825 |
]. |
|
826 |
! |
|
827 |
||
828 |
isMethodHolder |
|
829 |
isMethodHolder isNil ifTrue:[isMethodHolder := (LastCodeSearchWasMethod ? false) asValue]. |
|
830 |
^ isMethodHolder |
|
831 |
! ! |
|
832 |
||
833 |
!SearchDialog methodsFor:'setup-buttons'! |
|
834 |
||
835 |
addBrowseButton |
|
836 |
|b| |
|
837 |
||
838 |
b := Button label:(resources string:'Browse'). |
|
839 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
840 |
self addButton:b before:nil. |
|
841 |
] ifFalse:[ |
|
842 |
self addButton:b after:nil. |
|
843 |
]. |
|
844 |
b |
|
845 |
action:[ |
|
846 |
openHow := #newBrowser. |
|
847 |
self doAccept. |
|
848 |
self okPressed. |
|
849 |
]. |
|
850 |
^ b. |
|
851 |
! |
|
852 |
||
853 |
addBufferButton |
|
854 |
|b| |
|
855 |
||
856 |
b := Button label:(resources string:'Add Buffer'). |
|
857 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
858 |
self addButton:b before:nil. |
|
859 |
] ifFalse:[ |
|
860 |
self addButton:b after:nil. |
|
861 |
]. |
|
862 |
b |
|
863 |
action:[ |
|
864 |
openHow := #newBuffer. |
|
865 |
self doAccept. |
|
866 |
self okPressed. |
|
867 |
]. |
|
868 |
^ b. |
|
869 |
! |
|
870 |
||
871 |
addButtons |
|
6685 | 872 |
"add find/newBrowser/newBuffer buttons" |
873 |
||
5591 | 874 |
|prevButton| |
875 |
||
876 |
allowFind ifTrue:[ |
|
6685 | 877 |
defaultOpenHow := #showHere. |
878 |
prevButton := self addFindButton. |
|
5591 | 879 |
]. |
880 |
allowBrowser ifTrue:[ |
|
6685 | 881 |
defaultOpenHow := #newBrowser. |
882 |
prevButton := self addBrowseButton. |
|
5591 | 883 |
]. |
884 |
allowBuffer ifTrue:[ |
|
6685 | 885 |
defaultOpenHow := #newBuffer. |
886 |
prevButton := self addBufferButton. |
|
5591 | 887 |
]. |
888 |
prevButton notNil ifTrue:[ |
|
6685 | 889 |
prevButton isReturnButton:true. |
5591 | 890 |
]. |
891 |
self addAbortButton. |
|
892 |
! |
|
893 |
||
894 |
addFindButton |
|
895 |
|b| |
|
896 |
||
897 |
b := Button label:(resources string:'Find'). |
|
898 |
(DialogBox defaultOKButtonAtLeft) ifTrue:[ |
|
899 |
self addButton:b before:nil. |
|
900 |
] ifFalse:[ |
|
901 |
self addButton:b after:nil. |
|
902 |
]. |
|
903 |
b |
|
904 |
action:[ |
|
905 |
openHow := #showHere. |
|
906 |
self doAccept. |
|
907 |
self okPressed. |
|
908 |
]. |
|
909 |
^ b. |
|
910 |
! ! |
|
911 |
||
912 |
!SearchDialog class methodsFor:'documentation'! |
|
913 |
||
914 |
version |
|
6700 | 915 |
^ '$Header: /cvs/stx/stx/libtool/Tools_SearchDialog.st,v 1.14 2006-03-16 08:42:03 cg Exp $' |
5591 | 916 |
! ! |