author | Claus Gittinger <cg@exept.de> |
Fri, 01 Nov 1996 17:21:34 +0100 | |
changeset 825 | 42afde0ee738 |
parent 820 | 2a412afad51d |
child 929 | a2275f1b4c94 |
permissions | -rw-r--r-- |
36 | 1 |
" |
2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
45 | 3 |
All Rights Reserved |
36 | 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 |
||
85 | 13 |
ApplicationModel subclass:#SystemBrowser |
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
14 |
instanceVariableNames:'currentClass currentMethodCategory currentMethod currentSelector |
270 | 15 |
showInstance actualClasslastMethodCategory aspect lockUpdates |
16 |
autoSearch myLabel acceptClass' |
|
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
17 |
classVariableNames:'CheckForInstancesWhenRemovingClasses' |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
18 |
poolDictionaries:'' |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
19 |
category:'Interface-Browsers' |
36 | 20 |
! |
21 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
22 |
!SystemBrowser class methodsFor:'documentation'! |
203 | 23 |
|
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
this class implements all kinds of class browsers. |
|
41 |
Typically, it is started with 'SystemBrowser open', but there are many other |
|
42 |
startup messages, to launch special browsers. |
|
43 |
See the categories 'startup' and 'special search startup' in the classes |
|
44 |
protocol. |
|
45 |
||
46 |
Alse, see the extra document 'doc/misc/sbrowser.doc' or the HTML online doc |
|
47 |
for how to use the browser. |
|
48 |
||
49 |
written winter 89 by claus. |
|
50 |
||
51 |
Notice: SystemBrowser is currently being rewritten to be an instance |
|
52 |
of ApplicationModel - this transition is not yet complete and you see |
|
53 |
here an intermediate version. The instance variables defined here are NOT |
|
54 |
currently used - instead, everything is really done in the BrowserView |
|
55 |
which (currently) keeps the real state of the browser. |
|
56 |
This will certainly change ... |
|
508 | 57 |
|
58 |
[author:] |
|
59 |
Claus Gittinger |
|
60 |
||
203 | 61 |
" |
62 |
! ! |
|
63 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
64 |
!SystemBrowser class methodsFor:'initialization'! |
75 | 65 |
|
66 |
initialize |
|
67 |
"Browser configuration; |
|
68 |
(values can be changed from your private startup file)" |
|
45 | 69 |
|
254 | 70 |
"/ self classResources. |
85 | 71 |
|
75 | 72 |
" |
73 |
setting this to false, the removeClass function will remove |
|
74 |
classes WITHOUT checking for instances. Otherwise, |
|
75 |
it will check and let you confirm in case there are instances. |
|
76 |
Checking for instances may be a bit time consuming, though. |
|
77 |
The default is true - therefore, it will check |
|
78 |
" |
|
79 |
CheckForInstancesWhenRemovingClasses := true |
|
80 |
||
81 |
" |
|
82 |
CheckForInstancesWhenRemovingClasses := true |
|
83 |
CheckForInstancesWhenRemovingClasses := false |
|
84 |
||
85 | 85 |
SystemBrowser initialize |
75 | 86 |
" |
87 |
! ! |
|
36 | 88 |
|
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
89 |
!SystemBrowser class methodsFor:'instance creation'! |
52 | 90 |
|
75 | 91 |
open |
92 |
"launch a standard browser" |
|
93 |
||
105 | 94 |
^ self openOnDevice:(Screen current) |
75 | 95 |
|
93 | 96 |
" |
97 |
SystemBrowser open |
|
98 |
" |
|
194 | 99 |
! |
100 |
||
523 | 101 |
openInClass:aClass |
102 |
"launch a standard browser which immediately switches |
|
103 |
to aClass" |
|
104 |
||
105 |
^ self openInClass:aClass selector:nil |
|
106 |
||
107 |
" |
|
108 |
SystemBrowser openInClass:Object |
|
109 |
" |
|
110 |
||
111 |
"Created: 30.4.1996 / 14:43:45 / cg" |
|
112 |
! |
|
113 |
||
194 | 114 |
openInClass:aClass selector:aSelector |
115 |
"launch a standard browser which immediately switches |
|
116 |
to aClass>>aSelector." |
|
117 |
||
118 |
|brwsr cls| |
|
119 |
||
120 |
brwsr := self openOnDevice:(Screen current). |
|
121 |
brwsr waitUntilVisible. |
|
122 |
cls := aClass. |
|
123 |
cls notNil ifTrue:[ |
|
124 |
cls isMeta ifTrue:[ |
|
125 |
cls := aClass soleInstance |
|
126 |
]. |
|
127 |
brwsr switchToClassNamed:cls name. |
|
128 |
brwsr updateClassCategoryList. |
|
129 |
aClass isMeta ifTrue:[ |
|
130 |
brwsr instanceProtocol:false |
|
131 |
]. |
|
132 |
brwsr updateMethodCategoryList. |
|
133 |
aSelector notNil ifTrue:[ |
|
134 |
brwsr switchToMethodNamed:aSelector. |
|
135 |
] |
|
136 |
]. |
|
137 |
^ brwsr |
|
138 |
||
139 |
" |
|
140 |
SystemBrowser openInClass:Object selector:#at:put: |
|
141 |
SystemBrowser openInClass:Object selector:nil |
|
142 |
SystemBrowser openInClass:nil selector:nil |
|
143 |
" |
|
144 |
||
145 |
"Created: 22.11.1995 / 21:04:50 / cg" |
|
203 | 146 |
! |
147 |
||
148 |
openOnDevice:aDisplay |
|
149 |
"launch a standard browser on another display." |
|
150 |
||
151 |
^ self newWithLabel:(self classResources string:'System Browser') |
|
152 |
setupBlock:[:browser | browser setupForAll] |
|
153 |
onDevice:aDisplay |
|
154 |
||
155 |
"|d| |
|
156 |
||
157 |
d := XWorkstation new initializeFor:'porty:0'. |
|
158 |
d startDispatch. |
|
159 |
SystemBrowser openOnDevice:d |
|
160 |
" |
|
36 | 161 |
! ! |
162 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
163 |
!SystemBrowser class methodsFor:'private helpers'! |
36 | 164 |
|
203 | 165 |
showNoneFound |
215
244f3a9b2a60
check for existing class in rename; avoid warnbox if no refs are found after rename
Claus Gittinger <cg@exept.de>
parents:
204
diff
changeset
|
166 |
super warn:(self classResources string:'None found'). |
203 | 167 |
! |
36 | 168 |
|
203 | 169 |
showNoneFound:what |
215
244f3a9b2a60
check for existing class in rename; avoid warnbox if no refs are found after rename
Claus Gittinger <cg@exept.de>
parents:
204
diff
changeset
|
170 |
super warn:(self classResources string:(what , '...\\... none found') withCRs). |
203 | 171 |
! ! |
36 | 172 |
|
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
173 |
!SystemBrowser class methodsFor:'private instance creation'! |
203 | 174 |
|
175 |
newWithLabel:aString setupBlock:aBlock |
|
176 |
"common helper method for all creation methods" |
|
177 |
||
178 |
^ self newWithLabel:aString setupBlock:aBlock onDevice:Screen current |
|
36 | 179 |
! |
180 |
||
203 | 181 |
newWithLabel:aString setupBlock:aBlock onDevice:aWorkstation |
182 |
"common helper method for all creation methods" |
|
36 | 183 |
|
203 | 184 |
|newBrowser| |
45 | 185 |
|
203 | 186 |
newBrowser := BrowserView onDevice:aWorkstation. |
187 |
newBrowser title:aString. |
|
188 |
aBlock value:newBrowser. |
|
45 | 189 |
|
203 | 190 |
newBrowser open. |
191 |
^ newBrowser |
|
192 |
! |
|
45 | 193 |
|
203 | 194 |
newWithLabel:aString setupSelector:aSymbol arg:arg |
195 |
"common helper method for all creation methods" |
|
36 | 196 |
|
203 | 197 |
^ self newWithLabel:aString setupSelector:aSymbol arg:arg onDevice:Screen current |
36 | 198 |
! |
199 |
||
203 | 200 |
newWithLabel:aString setupSelector:aSymbol arg:arg onDevice:aWorkstation |
201 |
"common helper method for all creation methods" |
|
202 |
||
203 |
|newBrowser| |
|
52 | 204 |
|
203 | 205 |
newBrowser := BrowserView onDevice:aWorkstation. |
206 |
newBrowser title:aString. |
|
207 |
newBrowser perform:aSymbol with:arg. |
|
208 |
newBrowser open. |
|
209 |
^ newBrowser |
|
210 |
! ! |
|
211 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
212 |
!SystemBrowser class methodsFor:'special search startup'! |
203 | 213 |
|
214 |
aproposSearch:aString |
|
215 |
"browse all methods, which have aString in their selector or |
|
216 |
in the methods comment. |
|
217 |
This is relatively slow, since all source must be processed." |
|
218 |
||
219 |
^ self aproposSearch:aString in:(Smalltalk allClasses) |
|
75 | 220 |
|
52 | 221 |
! |
222 |
||
203 | 223 |
aproposSearch:aString in:aCollectionOfClasses |
224 |
"browse all methods, which have aString in their selector or |
|
225 |
in the methods comment. |
|
226 |
This is relatively slow, since all source must be processed." |
|
52 | 227 |
|
203 | 228 |
|matchString list s searchBlock browser| |
52 | 229 |
|
203 | 230 |
matchString := '*' , aString , '*'. |
52 | 231 |
|
203 | 232 |
list := OrderedCollection new. |
52 | 233 |
|
203 | 234 |
(aString includesMatchCharacters) ifTrue:[ |
256 | 235 |
s := '*' , aString , '*'. |
236 |
"a matchString" |
|
237 |
searchBlock := [:text | (text asCollectionOfLinesfindFirst:[:line | s match:line]) ~~ 0]. |
|
203 | 238 |
] ifFalse:[ |
256 | 239 |
searchBlock := [:source | (source findString:aString) ~~ 0] |
203 | 240 |
]. |
52 | 241 |
|
203 | 242 |
browser := self browseMethodsIn:aCollectionOfClasses |
256 | 243 |
where:[:class :method :sel | |
244 |
|comment| |
|
52 | 245 |
|
256 | 246 |
Processor yield. |
247 |
(searchBlock value:sel) ifTrue:[ |
|
248 |
true |
|
249 |
] ifFalse:[ |
|
250 |
comment := method comment. |
|
251 |
comment notNil |
|
252 |
and:[searchBlock value:method comment] |
|
253 |
]. |
|
254 |
] |
|
255 |
title:(ClassResources string:'apropos: %1' with:aString). |
|
52 | 256 |
|
203 | 257 |
browser notNil ifTrue:[ |
256 | 258 |
browser autoSearch:aString |
203 | 259 |
]. |
260 |
^ browser |
|
52 | 261 |
|
262 |
" |
|
203 | 263 |
SystemBrowser aproposSearch:'append' in:(Collection withAllSubclasses) |
264 |
SystemBrowser aproposSearch:'add' in:(Collection withAllSubclasses) |
|
265 |
SystemBrowser aproposSearch:'sort' in:(Collection withAllSubclasses) |
|
266 |
SystemBrowser aproposSearch:'[Aa]bsent' in:(Collection withAllSubclasses) |
|
52 | 267 |
" |
203 | 268 |
|
256 | 269 |
"Created: 9.12.1995 / 18:02:36 / cg" |
204
6f4460d5a09d
added supersend searches; offer comparing the current version with the
Claus Gittinger <cg@exept.de>
parents:
203
diff
changeset
|
270 |
! |
6f4460d5a09d
added supersend searches; offer comparing the current version with the
Claus Gittinger <cg@exept.de>
parents:
203
diff
changeset
|
271 |
|
203 | 272 |
browseAllCallsOn:aSelectorString |
273 |
"launch a browser for all senders of aSelector" |
|
52 | 274 |
|
666 | 275 |
^ self browseAllCallsOn:aSelectorString in:(Smalltalk allClasses) |
52 | 276 |
|
277 |
" |
|
203 | 278 |
SystemBrowser browseAllCallsOn:#+ |
52 | 279 |
" |
256 | 280 |
|
281 |
"Created: 9.12.1995 / 18:00:41 / cg" |
|
666 | 282 |
"Modified: 10.7.1996 / 10:26:15 / cg" |
283 |
! |
|
284 |
||
285 |
browseAllCallsOn:aSelectorString in:aSetOfClasses |
|
286 |
"launch a browser for all senders of aSelector" |
|
287 |
||
288 |
^ self browseAllCallsOn:aSelectorString |
|
289 |
in:aSetOfClasses |
|
290 |
title:(self classResources string:'senders of: %1' with:aSelectorString) |
|
291 |
||
292 |
" |
|
293 |
SystemBrowser browseAllCallsOn:#+ in:(Number withAllSubclasses) |
|
294 |
" |
|
295 |
||
256 | 296 |
"Modified: 9.12.1995 / 18:10:57 / cg" |
666 | 297 |
"Created: 10.7.1996 / 10:25:49 / cg" |
52 | 298 |
! |
299 |
||
300 |
browseAllCallsOn:aSelectorString in:aCollectionOfClasses title:title |
|
301 |
"launch a browser for all senders of aSelector in aCollectionOfClasses" |
|
302 |
||
303 |
|sel browser searchBlock| |
|
304 |
||
305 |
((aSelectorString ~= '*') and:[aSelectorString includesMatchCharacters]) ifTrue:[ |
|
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
306 |
"a matchString" |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
307 |
searchBlock := [:class :method :s | |
653
c89148d005d5
fixed calls to literalsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
308 |
(method literalsDetect:[:aLiteral| |
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
309 |
(aLiteral isMemberOf:Symbol) |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
310 |
and:[aSelectorString match:aLiteral] |
653
c89148d005d5
fixed calls to literalsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
311 |
] ifNone:nil) notNil |
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
312 |
]. |
52 | 313 |
] ifFalse:[ |
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
314 |
sel := aSelectorString asSymbolIfInterned. |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
315 |
sel isNil ifTrue:[ |
52 | 316 |
" |
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
317 |
Transcript showCR:'none found.'. |
52 | 318 |
" |
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
319 |
self showNoneFound:title. |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
320 |
^ nil |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
321 |
]. |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
322 |
searchBlock := [:class :method :s | method sends:sel]. |
52 | 323 |
]. |
93 | 324 |
browser := self browseMethodsIn:aCollectionOfClasses |
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
325 |
where:searchBlock |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
326 |
title:title. |
52 | 327 |
|
328 |
browser notNil ifTrue:[ |
|
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
329 |
|s| |
52 | 330 |
|
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
331 |
" |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
332 |
kludge for now, if its a multipart selector, |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
333 |
no easy search is (as yet) possible |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
334 |
" |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
335 |
s := aSelectorString. |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
336 |
(s includes:$:) ifTrue:[ |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
337 |
s := s copyTo:(s indexOf:$:) |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
338 |
]. |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
339 |
browser autoSearch:s |
52 | 340 |
]. |
341 |
^ browser |
|
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
342 |
|
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
343 |
"Modified: 24.6.1996 / 14:35:01 / stefan" |
653
c89148d005d5
fixed calls to literalsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
344 |
"Modified: 30.6.1996 / 16:45:57 / cg" |
52 | 345 |
! |
346 |
||
203 | 347 |
browseCallsOn:aSelectorString under:aClass |
348 |
"launch a browser for all senders of aSelector in aClass and subclasses" |
|
349 |
||
350 |
^ self browseAllCallsOn:aSelectorString |
|
256 | 351 |
in:(aClass withAllSubclasses) |
352 |
title:(self classResources string:'senders of: %1 (in and below %2)' |
|
353 |
with:aSelectorString |
|
354 |
with:aClass name) |
|
203 | 355 |
|
356 |
" |
|
256 | 357 |
SystemBrowser browseCallsOn:#+ under:Number |
203 | 358 |
" |
256 | 359 |
|
360 |
"Created: 9.12.1995 / 17:59:57 / cg" |
|
361 |
"Modified: 9.12.1995 / 18:11:10 / cg" |
|
203 | 362 |
! |
363 |
||
364 |
browseClassRefsTo:aString in:aCollectionOfClasses modificationsOnly:modsOnly |
|
365 |
"launch a browser for all methods in aClass where the classVar named |
|
366 |
aString is referenced; if modsOnly is true, browse only methods where the |
|
367 |
classvar is modified" |
|
368 |
||
369 |
^ self browseRefsTo:aString classVars:true in:aCollectionOfClasses modificationsOnly:modsOnly |
|
370 |
! |
|
371 |
||
372 |
browseClassRefsTo:varName in:aCollectionOfClasses modificationsOnly:modsOnly title:title |
|
373 |
"launch a browser for all methods in aCollectionOfClasses, |
|
374 |
where the classVar named aString is referenced; |
|
375 |
if modsOnly is true, browse only methods where the classvar is modified" |
|
376 |
||
377 |
^ self browseRefsTo:varName classVars:true in:aCollectionOfClasses modificationsOnly:modsOnly title:title |
|
378 |
! |
|
379 |
||
380 |
browseClassRefsTo:aString under:aClass modificationsOnly:modsOnly |
|
381 |
"launch a browser for all methods in aClass and subclasses |
|
382 |
where the classVar named aString is referenced; |
|
383 |
if modsOnly is true, browse only methods where the classvar is modified" |
|
384 |
||
385 |
^ self browseClassRefsTo:aString in:(aClass withAllSubclasses) modificationsOnly:modsOnly |
|
386 |
||
387 |
! |
|
388 |
||
573
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
389 |
browseForResource:aResourceSymbol in:aCollectionOfClasses title:title |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
390 |
"launch a browser for all methods which ahve a particular (or any, ifNil) |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
391 |
resource in aCollectionOfClasses" |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
392 |
|
742
2ef5e22d8983
code cleanup (unused vars eliminated)
Claus Gittinger <cg@exept.de>
parents:
675
diff
changeset
|
393 |
|browser searchBlock| |
573
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
394 |
|
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
395 |
searchBlock := [:class :method :s | |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
396 |
|src parser rsrc| |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
397 |
|
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
398 |
method hasResource ifTrue:[ |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
399 |
aResourceSymbol isNil ifTrue:[ |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
400 |
true |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
401 |
] ifFalse:[ |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
402 |
src := method source. |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
403 |
src isNil ifTrue:[ |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
404 |
true |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
405 |
] ifFalse:[ |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
406 |
parser := Parser |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
407 |
parseMethod:src |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
408 |
in:class |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
409 |
ignoreErrors:true |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
410 |
ignoreWarnings:true. |
588 | 411 |
rsrc := parser primitiveResources. |
412 |
rsrc notNil ifTrue:[ |
|
413 |
rsrc includesKey:aResourceSymbol |
|
573
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
414 |
] ifFalse:[ |
588 | 415 |
false |
573
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
416 |
] |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
417 |
] |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
418 |
] |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
419 |
] ifFalse:[ |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
420 |
false |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
421 |
] |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
422 |
]. |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
423 |
|
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
424 |
browser := self browseMethodsIn:aCollectionOfClasses |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
425 |
where:searchBlock |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
426 |
title:title. |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
427 |
browser notNil ifTrue:[ |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
428 |
browser autoSearch:'resource:' |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
429 |
]. |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
430 |
^ browser |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
431 |
|
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
432 |
" |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
433 |
SystemBrowser |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
434 |
browseForResource:#style |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
435 |
in:Smalltalk allClasses |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
436 |
title:'methods with a #style resource' |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
437 |
" |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
438 |
" |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
439 |
SystemBrowser |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
440 |
browseForResource:nil |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
441 |
in:Smalltalk allClasses |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
442 |
title:'methods with a resource' |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
443 |
" |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
444 |
|
588 | 445 |
"Modified: 29.5.1996 / 17:28:53 / cg" |
573
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
446 |
! |
e32bd3e46a72
added startup for searching resourceSpecs
Claus Gittinger <cg@exept.de>
parents:
553
diff
changeset
|
447 |
|
203 | 448 |
browseForString:aString |
449 |
"launch a browser for all methods containing a string in their source. |
|
450 |
This may be slow, since source-code has to be scanned." |
|
451 |
||
452 |
^ self browseForString:aString in:(Smalltalk allClasses) |
|
453 |
! |
|
454 |
||
455 |
browseForString:aString in:aCollectionOfClasses |
|
456 |
"launch a browser for all methods in aCollectionOfClasses |
|
457 |
containing a string in their source. |
|
458 |
This may be slow, since source-code has to be scanned." |
|
459 |
||
460 |
|browser searchBlock title s| |
|
461 |
||
256 | 462 |
title := self classResources string:'methods containing: %1' with:aString displayString. |
203 | 463 |
|
464 |
(aString includesMatchCharacters) ifTrue:[ |
|
256 | 465 |
s := '*' , aString , '*'. |
466 |
"a matchString" |
|
475
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
467 |
searchBlock := [:c :m :sel | |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
468 |
|src| |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
469 |
src := m source. |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
470 |
src isNil ifTrue:['no source' printNL. false] |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
471 |
ifFalse:[s match:m source] |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
472 |
] |
203 | 473 |
] ifFalse:[ |
475
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
474 |
searchBlock := [:c :m :sel | |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
475 |
|src| |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
476 |
|
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
477 |
src := m source. |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
478 |
src isNil ifTrue:['no source' printNL. false] |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
479 |
ifFalse:[ (m source findString:aString) ~~ 0 ] |
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
480 |
] |
203 | 481 |
]. |
482 |
browser := self browseMethodsIn:aCollectionOfClasses where:searchBlock title:title. |
|
483 |
||
484 |
browser notNil ifTrue:[ |
|
256 | 485 |
browser autoSearch:aString |
203 | 486 |
]. |
487 |
^ browser |
|
488 |
||
489 |
" |
|
490 |
SystemBrowser browseForString:'all' in:(Array with:Object) |
|
491 |
SystemBrowser browseForString:'should' in:(Array with:Object) |
|
492 |
SystemBrowser browseForString:'[eE]rror' in:(Array with:Object) |
|
493 |
" |
|
494 |
||
256 | 495 |
"Created: 9.12.1995 / 18:03:12 / cg" |
475
b14b3ab39af6
dont crash if searching a string in a method which has no accessable source
Claus Gittinger <cg@exept.de>
parents:
436
diff
changeset
|
496 |
"Modified: 12.4.1996 / 19:03:29 / cg" |
203 | 497 |
! |
498 |
||
499 |
browseForSymbol:aSymbol |
|
500 |
"launch a browser for all methods referencing aSymbol" |
|
501 |
||
666 | 502 |
^ self |
503 |
browseForSymbol:aSymbol |
|
504 |
title:(self classResources string:'users of: %1' with:aSymbol) |
|
505 |
warnIfNone:true |
|
256 | 506 |
|
507 |
"Created: 9.12.1995 / 18:04:34 / cg" |
|
666 | 508 |
"Modified: 10.7.1996 / 10:35:34 / cg" |
509 |
! |
|
510 |
||
511 |
browseForSymbol:aSymbol in:aSetOfClasses title:title warnIfNone:doWarn |
|
512 |
"launch a browser for all methods referencing aSymbol" |
|
513 |
||
514 |
|browser searchBlock sym| |
|
515 |
||
516 |
(aSymbol includesMatchCharacters) ifTrue:[ |
|
517 |
"a matchString" |
|
518 |
searchBlock := [:c :m :s | |
|
519 |
(m literalsDetect:[:aLiteral| |
|
520 |
(aLiteral isMemberOf:Symbol) |
|
521 |
and:[aSymbol match:aLiteral] |
|
522 |
] ifNone:nil) notNil |
|
523 |
]. |
|
524 |
] ifFalse:[ |
|
525 |
" |
|
526 |
can do a faster search |
|
527 |
" |
|
528 |
sym := aSymbol asSymbolIfInterned. |
|
529 |
sym isNil ifTrue:[ |
|
530 |
self showNoneFound:title. |
|
531 |
^ nil |
|
532 |
]. |
|
533 |
||
534 |
searchBlock := [:c :m :s | |
|
535 |
(m literalsDetect:[:aLiteral| |
|
536 |
(sym == aLiteral) |
|
537 |
] ifNone:nil) notNil |
|
538 |
]. |
|
539 |
]. |
|
540 |
doWarn ifFalse:[ |
|
541 |
WarningSignal ignoreIn:[ |
|
542 |
browser := self browseMethodsIn:aSetOfClasses where:searchBlock title:title. |
|
543 |
] |
|
544 |
] ifTrue:[ |
|
545 |
browser := self browseMethodsIn:aSetOfClasses where:searchBlock title:title. |
|
546 |
]. |
|
547 |
browser notNil ifTrue:[ |
|
548 |
browser autoSearch:aSymbol |
|
549 |
]. |
|
550 |
^ browser |
|
551 |
||
552 |
"Modified: 24.6.1996 / 14:39:07 / stefan" |
|
553 |
"Modified: 30.6.1996 / 16:45:25 / cg" |
|
554 |
"Created: 10.7.1996 / 10:36:36 / cg" |
|
203 | 555 |
! |
556 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
557 |
browseForSymbol:aSymbol in:aSetOfClasses title:title warnIfNone:doWarn searchFor:searchString |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
558 |
"launch a browser for all methods referencing aSymbol" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
559 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
560 |
|browser searchBlock sym| |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
561 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
562 |
(aSymbol includesMatchCharacters) ifTrue:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
563 |
"a matchString" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
564 |
searchBlock := [:c :m :s | |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
565 |
(m literalsDetect:[:aLiteral| |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
566 |
(aLiteral isMemberOf:Symbol) |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
567 |
and:[aSymbol match:aLiteral] |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
568 |
] ifNone:nil) notNil |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
569 |
]. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
570 |
] ifFalse:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
571 |
" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
572 |
can do a faster search |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
573 |
" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
574 |
sym := aSymbol asSymbolIfInterned. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
575 |
sym isNil ifTrue:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
576 |
self showNoneFound:title. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
577 |
^ nil |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
578 |
]. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
579 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
580 |
searchBlock := [:c :m :s | |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
581 |
(m literalsDetect:[:aLiteral| |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
582 |
(sym == aLiteral) |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
583 |
] ifNone:nil) notNil |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
584 |
]. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
585 |
]. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
586 |
doWarn ifFalse:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
587 |
WarningSignal ignoreIn:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
588 |
browser := self browseMethodsIn:aSetOfClasses where:searchBlock title:title. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
589 |
] |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
590 |
] ifTrue:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
591 |
browser := self browseMethodsIn:aSetOfClasses where:searchBlock title:title. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
592 |
]. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
593 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
594 |
(browser notNil |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
595 |
and:[searchString notNil]) ifTrue:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
596 |
browser autoSearch:searchString |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
597 |
]. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
598 |
^ browser |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
599 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
600 |
"Modified: 24.6.1996 / 14:39:07 / stefan" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
601 |
"Modified: 30.6.1996 / 16:45:25 / cg" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
602 |
"Created: 31.10.1996 / 14:57:30 / cg" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
603 |
! |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
604 |
|
203 | 605 |
browseForSymbol:aSymbol title:title warnIfNone:doWarn |
606 |
"launch a browser for all methods referencing aSymbol" |
|
607 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
608 |
^ self |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
609 |
browseForSymbol:aSymbol |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
610 |
title:title |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
611 |
warnIfNone:doWarn |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
612 |
searchFor:aSymbol |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
613 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
614 |
"Modified: 31.10.1996 / 14:45:38 / cg" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
615 |
! |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
616 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
617 |
browseForSymbol:aSymbol title:title warnIfNone:doWarn searchFor:searchString |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
618 |
"launch a browser for all methods referencing aSymbol" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
619 |
|
203 | 620 |
|browser searchBlock sym| |
621 |
||
622 |
(aSymbol includesMatchCharacters) ifTrue:[ |
|
375 | 623 |
"a matchString" |
624 |
searchBlock := [:c :m :s | |
|
653
c89148d005d5
fixed calls to literalsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
625 |
(m literalsDetect:[:aLiteral| |
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
626 |
(aLiteral isMemberOf:Symbol) |
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
627 |
and:[aSymbol match:aLiteral] |
653
c89148d005d5
fixed calls to literalsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
628 |
] ifNone:nil) notNil |
375 | 629 |
]. |
203 | 630 |
] ifFalse:[ |
375 | 631 |
" |
632 |
can do a faster search |
|
633 |
" |
|
634 |
sym := aSymbol asSymbolIfInterned. |
|
635 |
sym isNil ifTrue:[ |
|
636 |
self showNoneFound:title. |
|
637 |
^ nil |
|
638 |
]. |
|
203 | 639 |
|
375 | 640 |
searchBlock := [:c :m :s | |
653
c89148d005d5
fixed calls to literalsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
641 |
(m literalsDetect:[:aLiteral| |
c89148d005d5
fixed calls to literalsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
642 |
(sym == aLiteral) |
c89148d005d5
fixed calls to literalsDetect:ifNone:
Claus Gittinger <cg@exept.de>
parents:
648
diff
changeset
|
643 |
] ifNone:nil) notNil |
375 | 644 |
]. |
203 | 645 |
]. |
215
244f3a9b2a60
check for existing class in rename; avoid warnbox if no refs are found after rename
Claus Gittinger <cg@exept.de>
parents:
204
diff
changeset
|
646 |
doWarn ifFalse:[ |
375 | 647 |
WarningSignal ignoreIn:[ |
648 |
browser := self browseMethodsWhere:searchBlock title:title. |
|
649 |
] |
|
215
244f3a9b2a60
check for existing class in rename; avoid warnbox if no refs are found after rename
Claus Gittinger <cg@exept.de>
parents:
204
diff
changeset
|
650 |
] ifTrue:[ |
375 | 651 |
browser := self browseMethodsWhere:searchBlock title:title. |
215
244f3a9b2a60
check for existing class in rename; avoid warnbox if no refs are found after rename
Claus Gittinger <cg@exept.de>
parents:
204
diff
changeset
|
652 |
]. |
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
653 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
654 |
(browser notNil |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
655 |
and:[searchString notNil]) ifTrue:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
656 |
browser autoSearch:searchString |
203 | 657 |
]. |
658 |
^ browser |
|
375 | 659 |
|
648
6ec086b7972c
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
634
diff
changeset
|
660 |
"Modified: 24.6.1996 / 14:39:07 / stefan" |
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
661 |
"Created: 31.10.1996 / 14:45:08 / cg" |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
662 |
"Modified: 31.10.1996 / 14:46:07 / cg" |
203 | 663 |
! |
664 |
||
52 | 665 |
browseImplementorsOf:aSelectorString |
666 |
"launch a browser for all implementors of aSelector" |
|
667 |
||
666 | 668 |
^ self browseImplementorsOf:aSelectorString in:(Smalltalk allClasses) |
52 | 669 |
|
670 |
" |
|
671 |
SystemBrowser browseImplementorsOf:#+ |
|
672 |
" |
|
256 | 673 |
|
674 |
"Created: 9.12.1995 / 18:01:18 / cg" |
|
666 | 675 |
"Modified: 10.7.1996 / 10:21:26 / cg" |
676 |
! |
|
677 |
||
678 |
browseImplementorsOf:aSelectorString in:aSetOfClasses |
|
679 |
"launch a browser for all implementors of aSelector" |
|
680 |
||
681 |
^ self browseImplementorsOf:aSelectorString |
|
682 |
in:aSetOfClasses |
|
683 |
title:(self classResources string:'implementors of: %1' with:aSelectorString) |
|
684 |
||
685 |
" |
|
686 |
SystemBrowser browseImplementorsOf:#+ in:(Number withAllSubclasses) |
|
687 |
" |
|
688 |
||
689 |
"Created: 10.7.1996 / 10:20:59 / cg" |
|
690 |
"Modified: 10.7.1996 / 10:21:49 / cg" |
|
52 | 691 |
! |
692 |
||
36 | 693 |
browseImplementorsOf:aSelectorString in:aCollectionOfClasses title:title |
694 |
"launch a browser for all implementors of aSelector in |
|
695 |
the classes contained in aCollectionOfClasses and its metaclasses" |
|
696 |
||
697 |
|list sel| |
|
698 |
||
270 | 699 |
list := Set new. |
36 | 700 |
|
701 |
((aSelectorString ~= '*') and:[aSelectorString includesMatchCharacters]) ifTrue:[ |
|
270 | 702 |
"a matchString" |
703 |
||
704 |
aCollectionOfClasses do:[:aClass | |
|
705 |
|nm| |
|
45 | 706 |
|
270 | 707 |
nm := aClass name. |
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
708 |
aClass methodDictionary keysAndValuesDo:[:aSelector :aMethod | |
270 | 709 |
(aSelectorString match:aSelector) ifTrue:[ |
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
710 |
list add:aMethod "/ (nm , ' ' , (aMethod printStringForBrowserWithSelector:aSelector)) |
270 | 711 |
] |
712 |
]. |
|
713 |
aClass isMeta ifFalse:[ |
|
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
714 |
aClass class methodDictionary keysAndValuesDo:[:aSelector :aMethod | |
270 | 715 |
(aSelectorString match:aSelector) ifTrue:[ |
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
716 |
list add:aMethod "/ (nm , ' class ' , (aMethod printStringForBrowserWithSelector:aSelector)) |
270 | 717 |
] |
718 |
] |
|
719 |
] |
|
720 |
] |
|
36 | 721 |
] ifFalse:[ |
270 | 722 |
"can do a faster search" |
45 | 723 |
|
270 | 724 |
sel := aSelectorString asSymbolIfInterned. |
725 |
sel isNil ifTrue:[ |
|
726 |
self showNoneFound:title. |
|
727 |
^ nil |
|
728 |
]. |
|
729 |
||
730 |
aCollectionOfClasses do:[:aClass | |
|
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
731 |
|nm mthd| |
45 | 732 |
|
270 | 733 |
nm := aClass name. |
734 |
(aClass implements:sel) ifTrue:[ |
|
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
735 |
mthd := aClass compiledMethodAt:sel. |
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
736 |
list add:mthd "/ (nm , ' ' , (mthd printStringForBrowserWithSelector:sel)) |
270 | 737 |
]. |
738 |
aClass isMeta ifFalse:[ |
|
739 |
(aClass class implements:sel) ifTrue:[ |
|
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
740 |
mthd := aClass class compiledMethodAt:sel. |
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
741 |
list add:mthd "/ (nm , ' class ' , (mthd printStringForBrowserWithSelector:sel)) |
270 | 742 |
] |
743 |
] |
|
744 |
] |
|
36 | 745 |
]. |
270 | 746 |
^ self browseMethods:list asOrderedCollection title:title |
36 | 747 |
|
748 |
" |
|
749 |
SystemBrowser browseImplementorsOf:#+ |
|
270 | 750 |
in:(Array with:Number |
751 |
with:Float |
|
752 |
with:SmallInteger) |
|
753 |
title:'some implementors of +' |
|
36 | 754 |
" |
132 | 755 |
|
756 |
"Modified: 4.9.1995 / 17:33:39 / claus" |
|
634
24a678f81829
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
620
diff
changeset
|
757 |
"Modified: 19.6.1996 / 14:19:02 / stefan" |
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
758 |
"Modified: 15.7.1996 / 11:49:35 / cg" |
36 | 759 |
! |
760 |
||
52 | 761 |
browseImplementorsOf:aSelectorString under:aClass |
762 |
"launch a browser for all implementors of aSelector in aClass |
|
763 |
and its subclasses" |
|
764 |
||
765 |
^ self browseImplementorsOf:aSelectorString |
|
256 | 766 |
in:(aClass withAllSubclasses) |
767 |
title:(self classResources string:'implementors of: %1 (in and below %2)' |
|
768 |
with:aSelectorString |
|
769 |
with:aClass name) |
|
52 | 770 |
|
771 |
" |
|
772 |
SystemBrowser browseImplementorsOf:#+ under:Integer |
|
773 |
" |
|
256 | 774 |
|
775 |
"Created: 9.12.1995 / 18:06:09 / cg" |
|
776 |
"Modified: 9.12.1995 / 18:11:38 / cg" |
|
52 | 777 |
! |
778 |
||
203 | 779 |
browseInstRefsTo:aString in:aCollectionOfClasses modificationsOnly:modsOnly |
780 |
"launch a browser for all methods in aClass where the instVar named |
|
781 |
aString is referenced; if modsOnly is true, browse only methods where the |
|
782 |
instvar is modified" |
|
45 | 783 |
|
203 | 784 |
^ self browseRefsTo:aString classVars:false in:aCollectionOfClasses modificationsOnly:modsOnly |
36 | 785 |
! |
786 |
||
203 | 787 |
browseInstRefsTo:varName in:aCollectionOfClasses modificationsOnly:modsOnly title:title |
788 |
"launch a browser for all methods in aClass where the instVar named |
|
789 |
varName is referenced; if modsOnly is true, browse only methods where the |
|
790 |
instvar is modified" |
|
52 | 791 |
|
203 | 792 |
^ self browseRefsTo:varName classVars:false in:aCollectionOfClasses modificationsOnly:modsOnly title:title |
52 | 793 |
! |
794 |
||
203 | 795 |
browseInstRefsTo:aString under:aClass modificationsOnly:modsOnly |
796 |
"launch a browser for all methods in aClass and subclasses |
|
797 |
where the instVar named aString is referenced; |
|
798 |
if modsOnly is true, browse only methods where the instvar is modified" |
|
36 | 799 |
|
203 | 800 |
^ self browseInstRefsTo:aString in:(aClass withAllSubclasses) modificationsOnly:modsOnly |
36 | 801 |
! |
802 |
||
803 |
browseReferendsOf:aGlobalName |
|
804 |
"launch a browser for all methods referencing a global |
|
805 |
named aGlobalName. |
|
806 |
" |
|
807 |
||
808 |
^ self browseReferendsOf:aGlobalName warnIfNone:true |
|
809 |
||
810 |
" |
|
811 |
Browser browseReferendsOf:#Transcript |
|
812 |
" |
|
75 | 813 |
|
36 | 814 |
! |
815 |
||
666 | 816 |
browseReferendsOf:aGlobalName in:aSetOfClasses |
817 |
"launch a browser for all methods referencing a global |
|
818 |
named aGlobalName. |
|
819 |
" |
|
820 |
||
821 |
^ self browseReferendsOf:aGlobalName in:aSetOfClasses warnIfNone:true |
|
822 |
||
823 |
" |
|
824 |
Browser browseReferendsOf:#Transcript |
|
825 |
" |
|
826 |
||
827 |
"Created: 10.7.1996 / 10:37:30 / cg" |
|
828 |
! |
|
829 |
||
830 |
browseReferendsOf:aGlobalName in:aSetOfClasses warnIfNone:doWarn |
|
831 |
"launch a browser for all methods referencing a global |
|
832 |
named aGlobalName. |
|
833 |
" |
|
834 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
835 |
|globalsPlainName idx| |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
836 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
837 |
globalsPlainName := aGlobalName. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
838 |
(idx := globalsPlainName lastIndexOf:$:) ~~ 0 ifTrue:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
839 |
globalsPlainName := globalsPlainName copyFrom:idx+1 |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
840 |
]. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
841 |
|
666 | 842 |
^ self browseForSymbol:aGlobalName |
843 |
in:aSetOfClasses |
|
844 |
title:(self classResources string:'users of: %1' with:aGlobalName) |
|
845 |
warnIfNone:doWarn |
|
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
846 |
searchFor:globalsPlainName |
666 | 847 |
|
848 |
"Created: 10.7.1996 / 10:37:02 / cg" |
|
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
849 |
"Modified: 31.10.1996 / 14:56:38 / cg" |
666 | 850 |
! |
851 |
||
203 | 852 |
browseReferendsOf:aGlobalName warnIfNone:doWarn |
853 |
"launch a browser for all methods referencing a global |
|
854 |
named aGlobalName. |
|
855 |
" |
|
856 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
857 |
|globalsPlainName idx| |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
858 |
|
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
859 |
globalsPlainName := aGlobalName. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
860 |
(idx := globalsPlainName lastIndexOf:$:) ~~ 0 ifTrue:[ |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
861 |
globalsPlainName := globalsPlainName copyFrom:idx+1 |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
862 |
]. |
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
863 |
|
666 | 864 |
^ self browseForSymbol:aGlobalName |
865 |
title:(self classResources string:'users of: %1' with:aGlobalName) |
|
866 |
warnIfNone:doWarn |
|
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
867 |
searchFor:globalsPlainName |
203 | 868 |
|
256 | 869 |
"Created: 9.12.1995 / 18:06:34 / cg" |
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
870 |
"Modified: 31.10.1996 / 14:47:48 / cg" |
203 | 871 |
! |
872 |
||
873 |
browseRefsTo:aString classVars:classVars in:aCollectionOfClasses modificationsOnly:modsOnly |
|
874 |
"launch a browser for all methods in aClass where the instVar/classVar named |
|
875 |
aString is referenced; if modsOnly is true, browse only methods where the |
|
876 |
instvar is modified" |
|
877 |
||
878 |
|title| |
|
879 |
||
880 |
modsOnly ifTrue:[ |
|
256 | 881 |
title := 'modifications of: %1' |
203 | 882 |
] ifFalse:[ |
256 | 883 |
title := 'references to: %1 ' |
203 | 884 |
]. |
885 |
^ self |
|
256 | 886 |
browseRefsTo:aString |
887 |
classVars:classVars |
|
888 |
in:aCollectionOfClasses |
|
889 |
modificationsOnly:modsOnly |
|
890 |
title:(self classResources string:title with:aString) |
|
891 |
||
892 |
"Created: 9.12.1995 / 18:07:05 / cg" |
|
893 |
"Modified: 9.12.1995 / 18:11:49 / cg" |
|
203 | 894 |
! |
895 |
||
896 |
browseRefsTo:varName classVars:classVars in:aCollectionOfClasses modificationsOnly:modsOnly title:title |
|
897 |
"launch a browser for all methods in aClass where the instVar/classVar named |
|
898 |
varName is referenced; if modsOnly is true, browse only methods where the |
|
899 |
instvar is modified" |
|
900 |
||
901 |
|filter browser pattern| |
|
902 |
||
903 |
filter := self filterToSearchRefsTo:varName classVars:classVars modificationsOnly:modsOnly. |
|
904 |
browser := self browseMethodsIn:aCollectionOfClasses |
|
905 |
inst:true class:classVars where:filter title:title. |
|
906 |
||
907 |
browser notNil ifTrue:[ |
|
908 |
modsOnly ifTrue:[ |
|
909 |
pattern := varName , ' :=' |
|
910 |
] ifFalse:[ |
|
911 |
pattern := varName |
|
912 |
]. |
|
913 |
browser autoSearch:pattern |
|
914 |
]. |
|
915 |
^ browser |
|
916 |
! |
|
917 |
||
256 | 918 |
browseSuperCallsIn:aCollectionOfClasses title:title |
919 |
"launch a browser for all super sends in aCollectionOfClasses" |
|
920 |
||
742
2ef5e22d8983
code cleanup (unused vars eliminated)
Claus Gittinger <cg@exept.de>
parents:
675
diff
changeset
|
921 |
|browser searchBlock| |
256 | 922 |
|
923 |
searchBlock := [:class :method :s | |
|
504 | 924 |
|src parser| |
256 | 925 |
|
504 | 926 |
src := method source. |
927 |
(src findString:'super') ~~ 0 ifTrue:[ |
|
928 |
parser := Parser |
|
929 |
parseMethod:method source |
|
930 |
in:class |
|
931 |
ignoreErrors:true |
|
932 |
ignoreWarnings:true. |
|
933 |
||
934 |
parser notNil and:[parser usesSuper] |
|
935 |
] ifFalse:[ |
|
936 |
false |
|
937 |
] |
|
256 | 938 |
]. |
939 |
||
940 |
browser := self browseMethodsIn:aCollectionOfClasses |
|
504 | 941 |
where:searchBlock |
942 |
title:title. |
|
256 | 943 |
|
944 |
browser notNil ifTrue:[ |
|
504 | 945 |
browser autoSearch:'super' |
256 | 946 |
]. |
947 |
^ browser |
|
948 |
||
504 | 949 |
" |
950 |
SystemBrowser |
|
951 |
browseSuperCallsIn:(Array with:SortedCollection) |
|
952 |
title:'superSends in SortedCollection' |
|
953 |
" |
|
954 |
||
256 | 955 |
"Created: 23.11.1995 / 14:08:55 / cg" |
504 | 956 |
"Modified: 24.4.1996 / 13:25:31 / cg" |
256 | 957 |
! |
958 |
||
959 |
browseSuperCallsUnder:aClass |
|
960 |
"launch a browser for all supersends in aClass and subclasses" |
|
961 |
||
962 |
^ self browseSuperCallsIn:(aClass withAllSubclasses) |
|
963 |
title:(self classResources string:'supersends (in and below %1)' with:aClass name) |
|
964 |
||
965 |
" |
|
966 |
SystemBrowser browseSuperCallsUnder:Number |
|
967 |
" |
|
968 |
||
969 |
"Created: 23.11.1995 / 12:06:06 / cg" |
|
970 |
"Modified: 9.12.1995 / 18:11:59 / cg" |
|
971 |
! |
|
972 |
||
52 | 973 |
browseUsesOf:aClass |
974 |
|dict owners offsets |
|
975 |
sz "{ Class: SmallInteger }" |
|
976 |
n "{ Class: SmallInteger }" |
|
977 |
removeSet newDict| |
|
978 |
||
979 |
owners := ObjectMemory whoReferencesInstancesOf:aClass. |
|
980 |
||
981 |
" |
|
982 |
collect set of offsets in dict; key is class |
|
983 |
" |
|
984 |
dict := IdentityDictionary new. |
|
985 |
owners do:[:someObject | |
|
986 |
|cls create| |
|
987 |
||
988 |
someObject isContext ifFalse:[ |
|
989 |
" |
|
990 |
someObject refers to an instance of aClass; |
|
991 |
find out, which instVar(s) |
|
992 |
" |
|
993 |
cls := someObject class. |
|
994 |
cls ~~ Array ifTrue:[ |
|
995 |
n := cls instSize. |
|
996 |
create := [|s| s := Set new. dict at:cls put:s. s]. |
|
997 |
||
998 |
1 to:n do:[:i | |
|
999 |
|ref| |
|
1000 |
||
1001 |
ref := someObject instVarAt:i. |
|
1002 |
(ref isMemberOf:aClass) ifTrue:[ |
|
1003 |
offsets := dict at:cls ifAbsent:create. |
|
1004 |
offsets add:i. |
|
1005 |
] |
|
1006 |
]. |
|
1007 |
cls isVariable ifTrue:[ |
|
1008 |
cls isPointers ifTrue:[ |
|
1009 |
| idx "{ Class: SmallInteger }" | |
|
1010 |
||
1011 |
sz := someObject basicSize. |
|
1012 |
idx := 1. |
|
1013 |
[idx <= sz] whileTrue:[ |
|
1014 |
|ref| |
|
1015 |
||
1016 |
ref := someObject basicAt:idx. |
|
1017 |
(ref isMemberOf:aClass) ifTrue:[ |
|
1018 |
offsets := dict at:cls ifAbsent:create. |
|
1019 |
offsets add:0. |
|
1020 |
idx := sz |
|
1021 |
]. |
|
1022 |
idx := idx + 1 |
|
1023 |
] |
|
1024 |
] |
|
1025 |
] |
|
1026 |
] |
|
1027 |
] |
|
1028 |
]. |
|
1029 |
||
1030 |
" |
|
1031 |
merge with superclass refs |
|
1032 |
" |
|
1033 |
dict keysAndValuesDo:[:cls :set | |
|
1034 |
cls allSuperclasses do:[:aSuperclass | |
|
1035 |
|superSet| |
|
1036 |
||
1037 |
superSet := dict at:aSuperclass ifAbsent:[]. |
|
1038 |
superSet notNil ifTrue:[ |
|
1039 |
|removeSet| |
|
1040 |
||
1041 |
superSet := dict at:aSuperclass. |
|
1042 |
removeSet := Set new. |
|
1043 |
set do:[:offset | |
|
1044 |
(superSet includes:offset) ifTrue:[ |
|
1045 |
removeSet add:offset |
|
1046 |
] |
|
1047 |
]. |
|
1048 |
set removeAll:removeSet |
|
1049 |
] |
|
1050 |
] |
|
1051 |
]. |
|
1052 |
||
1053 |
" |
|
1054 |
remove empty ones |
|
1055 |
" |
|
1056 |
removeSet := Set new. |
|
1057 |
dict keysAndValuesDo:[:cls :set | |
|
1058 |
set isEmpty ifTrue:[ |
|
1059 |
removeSet add:cls |
|
1060 |
] |
|
1061 |
]. |
|
1062 |
removeSet do:[:cls | |
|
1063 |
dict removeKey:cls |
|
1064 |
]. |
|
1065 |
||
1066 |
" |
|
1067 |
replace the indices by real names |
|
1068 |
" |
|
1069 |
newDict := IdentityDictionary new. |
|
1070 |
dict keysAndValuesDo:[:cls :set | |
|
1071 |
|newSet names| |
|
1072 |
||
1073 |
names := cls allInstVarNames. |
|
1074 |
newSet := set collect:[:index | |
|
1075 |
index == 0 ifTrue:['*indexed*'] ifFalse:[names at:index]. |
|
1076 |
]. |
|
1077 |
newDict at:cls put:newSet |
|
1078 |
]. |
|
1079 |
||
1080 |
newDict inspect |
|
1081 |
||
75 | 1082 |
|
52 | 1083 |
! |
1084 |
||
203 | 1085 |
filterToSearchRefsTo:varName classVars:classVars modificationsOnly:modsOnly |
1086 |
"return a searchblock for variable references" |
|
1087 |
||
1088 |
|searchBlock| |
|
53 | 1089 |
|
203 | 1090 |
searchBlock := [:c :m :s | |
504 | 1091 |
|src result parser vars needMatch| |
1092 |
||
1093 |
needMatch := varName includesMatchCharacters. |
|
36 | 1094 |
|
504 | 1095 |
src := m source. |
1096 |
src isNil ifTrue:[ |
|
1097 |
result := false |
|
1098 |
] ifFalse:[ |
|
1099 |
needMatch ifFalse:[ |
|
1100 |
" |
|
1101 |
before doing a slow parse, quickly scan the |
|
1102 |
methods source for the variables name ... |
|
1103 |
" |
|
1104 |
result := (src findString:varName) ~~ 0. |
|
1105 |
] ifTrue:[ |
|
1106 |
result := true. |
|
1107 |
]. |
|
1108 |
result ifTrue:[ |
|
1109 |
result := false. |
|
1110 |
parser := Parser |
|
1111 |
parseMethod:src |
|
1112 |
in:c |
|
1113 |
ignoreErrors:true |
|
1114 |
ignoreWarnings:true. |
|
36 | 1115 |
|
504 | 1116 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
1117 |
classVars ifFalse:[ |
|
1118 |
modsOnly ifTrue:[ |
|
1119 |
vars := parser modifiedInstVars |
|
1120 |
] ifFalse:[ |
|
1121 |
vars := parser usedInstVars |
|
1122 |
]. |
|
1123 |
] ifTrue:[ |
|
1124 |
modsOnly ifTrue:[ |
|
1125 |
vars := parser modifiedClassVars |
|
1126 |
] ifFalse:[ |
|
1127 |
vars := parser usedClassVars |
|
1128 |
]. |
|
1129 |
]. |
|
1130 |
vars notNil ifTrue:[ |
|
1131 |
needMatch ifTrue:[ |
|
1132 |
vars do:[:cv | |
|
1133 |
(varName match:cv) ifTrue:[result := true] |
|
1134 |
] |
|
1135 |
] ifFalse:[ |
|
1136 |
result := vars includes:varName |
|
1137 |
] |
|
1138 |
] |
|
1139 |
]. |
|
1140 |
]. |
|
1141 |
]. |
|
1142 |
Processor yield. |
|
1143 |
result |
|
36 | 1144 |
]. |
203 | 1145 |
^ searchBlock |
504 | 1146 |
|
1147 |
"Modified: 24.4.1996 / 13:21:12 / cg" |
|
203 | 1148 |
! ! |
1149 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
1150 |
!SystemBrowser class methodsFor:'startup'! |
36 | 1151 |
|
203 | 1152 |
browseAllSelect:aBlock |
1153 |
"launch a browser for all methods where aBlock returns true. |
|
1154 |
The block is called with 3 arguments, class, method and seelctor." |
|
1155 |
||
1156 |
^ self browseMethodsWhere:aBlock title:'selected messages' |
|
36 | 1157 |
|
53 | 1158 |
" |
203 | 1159 |
SystemBrowser browseAllSelect:[:aClass :aMethod :selector | selector numArgs == 3] |
53 | 1160 |
" |
203 | 1161 |
! |
75 | 1162 |
|
203 | 1163 |
browseClass:aClass |
1164 |
"launch a browser for aClass" |
|
1165 |
||
1166 |
^ self |
|
1167 |
newWithLabel:aClass name |
|
1168 |
setupSelector:#setupForClass: |
|
1169 |
arg:aClass |
|
1170 |
||
1171 |
"SystemBrowser browseClass:Object" |
|
1172 |
! |
|
1173 |
||
1174 |
browseClass:aClass methodCategory:aCategory |
|
1175 |
"launch a browser for all methods under aCategory in aClass" |
|
1176 |
||
1177 |
^ self newWithLabel:(aClass name , ' ' , aCategory) |
|
1178 |
setupBlock:[:browser | browser setupForClass:aClass methodCategory:aCategory] |
|
1179 |
||
1180 |
"SystemBrowser browseClass:String methodCategory:'copying'" |
|
1181 |
! |
|
1182 |
||
1183 |
browseClass:aClass selector:selector |
|
1184 |
"launch a browser for the method at selector in aClass" |
|
1185 |
||
1186 |
^ self |
|
1187 |
newWithLabel:(aClass name , ' ' , selector , ' ' , selector) |
|
1188 |
setupBlock:[:newBrowser | newBrowser setupForClass:aClass selector:selector] |
|
1189 |
||
1190 |
" |
|
1191 |
SystemBrowser browseClass:Object selector:#printString |
|
1192 |
" |
|
36 | 1193 |
! |
1194 |
||
203 | 1195 |
browseClassCategory:aClassCategory |
1196 |
"launch a browser for all classes under aCategory" |
|
1197 |
||
1198 |
^ self |
|
1199 |
newWithLabel:aClassCategory |
|
1200 |
setupSelector:#setupForClassCategory: |
|
1201 |
arg:aClassCategory |
|
1202 |
||
1203 |
"SystemBrowser browseClassCategory:'Kernel-Objects'" |
|
1204 |
! |
|
1205 |
||
1206 |
browseClassHierarchy:aClass |
|
1207 |
"launch a browser for aClass and all its superclasses. |
|
1208 |
this is different from the fullProtocol browser." |
|
36 | 1209 |
|
203 | 1210 |
^ self |
1211 |
newWithLabel:(aClass name , '-' , 'hierarchy') |
|
1212 |
setupSelector:#setupForClassHierarchy: |
|
1213 |
arg:aClass |
|
1214 |
||
1215 |
" |
|
1216 |
SystemBrowser browseClassHierarchy:Number |
|
1217 |
" |
|
1218 |
! |
|
1219 |
||
1220 |
browseClasses:aList title:title |
|
1221 |
"launch a browser for all classes in aList" |
|
1222 |
||
1223 |
^ self |
|
576
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1224 |
newWithLabel:title |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1225 |
setupBlock:[:b | b setupForClassList:aList sort:true] |
203 | 1226 |
|
1227 |
" |
|
1228 |
SystemBrowser browseClasses:(Array with:Object |
|
576
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1229 |
with:Float) |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1230 |
title:'two classes' |
203 | 1231 |
" |
576
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1232 |
|
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1233 |
"Modified: 28.5.1996 / 13:52:25 / cg" |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1234 |
! |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1235 |
|
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1236 |
browseClasses:aList title:title sort:doSort |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1237 |
"launch a browser for all classes in aList" |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1238 |
|
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1239 |
^ self |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1240 |
newWithLabel:title |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1241 |
setupBlock:[:b | b setupForClassList:aList sort:doSort] |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1242 |
|
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1243 |
" |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1244 |
SystemBrowser browseClasses:(Array with:Object |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1245 |
with:Float) |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1246 |
title:'two classes' |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1247 |
" |
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1248 |
|
62dc6c67d71c
show subclasses hierarchical (spawn subclasses)
Claus Gittinger <cg@exept.de>
parents:
573
diff
changeset
|
1249 |
"Created: 28.5.1996 / 13:52:09 / cg" |
52 | 1250 |
! |
1251 |
||
203 | 1252 |
browseFullClassProtocol:aClass |
1253 |
"launch a browser for aClasses full protocol. |
|
1254 |
This is different from hierarchy browsing." |
|
1255 |
||
1256 |
^ self |
|
1257 |
newWithLabel:(aClass name , '-' , 'full protocol') |
|
1258 |
setupSelector:#setupForFullClassProtocol: |
|
1259 |
arg:aClass |
|
1260 |
||
1261 |
" |
|
1262 |
SystemBrowser browseFullClassProtocol:Number |
|
1263 |
" |
|
1264 |
! |
|
36 | 1265 |
|
203 | 1266 |
browseFullClasses |
1267 |
"launch a browser showing all methods at once" |
|
1268 |
||
1269 |
^ self |
|
1270 |
newWithLabel:'Full Class Browser' |
|
1271 |
setupBlock:[:newBrowser | newBrowser setupForFullClass] |
|
36 | 1272 |
|
203 | 1273 |
"SystemBrowser browseFullClasses" |
1274 |
! |
|
1275 |
||
1276 |
browseInstMethodsFrom:aClass where:aBlock title:title |
|
1277 |
"launch a browser for all instance methods in aClass and all subclasses |
|
1278 |
where aBlock evaluates to true" |
|
36 | 1279 |
|
203 | 1280 |
^ self browseMethodsIn:(aClass withAllSubclasses) inst:true class:false where:aBlock title:title |
1281 |
! |
|
1282 |
||
1283 |
browseInstMethodsIn:aCollectionOfClasses where:aBlock title:title |
|
1284 |
"launch a browser for all instance methods of all classes in |
|
1285 |
aCollectionOfClasses where aBlock evaluates to true" |
|
1286 |
||
1287 |
^ self browseMethodsIn:aCollectionOfClasses inst:true class:false |
|
1288 |
where:aBlock title:title |
|
1289 |
! |
|
36 | 1290 |
|
203 | 1291 |
browseInstMethodsOf:aClass where:aBlock title:title |
1292 |
"launch a browser for all instance methods in aClass |
|
1293 |
where aBlock evaluates to true" |
|
1294 |
||
1295 |
^ self browseMethodsIn:(Array with:aClass) inst:true class:false where:aBlock title:title |
|
1296 |
! |
|
1297 |
||
1298 |
browseMethodCategory:aCategory |
|
1299 |
"launch a browser for all methods where category = aCategory" |
|
1300 |
||
1301 |
|searchBlock| |
|
1302 |
||
1303 |
aCategory includesMatchCharacters ifTrue:[ |
|
1304 |
searchBlock := [:c :m :s | aCategory match:m category]. |
|
53 | 1305 |
] ifFalse:[ |
203 | 1306 |
searchBlock := [:c :m :s | m category = aCategory] |
53 | 1307 |
]. |
1308 |
||
203 | 1309 |
self browseMethodsWhere:searchBlock title:('all methods with category of ' , aCategory) |
1310 |
||
1311 |
" |
|
1312 |
SystemBrowser browseMethodCategory:'printing & storing' |
|
1313 |
SystemBrowser browseMethodCategory:'print*' |
|
1314 |
" |
|
1315 |
! |
|
1316 |
||
1317 |
browseMethods:aList title:aString |
|
1318 |
"launch a browser for an explicit list of class/selectors. |
|
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1319 |
Each entry in the list can be either a method, or a string |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1320 |
consisting of the classes name and the selector, separated by spaces. |
634
24a678f81829
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
620
diff
changeset
|
1321 |
For class methods, the string ' class' must be appended to the classname." |
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1322 |
|
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1323 |
|l| |
203 | 1324 |
|
1325 |
(aList size == 0) ifTrue:[ |
|
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1326 |
self showNoneFound:aString. |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1327 |
^ nil |
203 | 1328 |
]. |
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1329 |
l := aList asOrderedCollection. |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1330 |
l := l collect:[:entry | |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1331 |
|who| |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1332 |
|
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1333 |
entry isString ifTrue:[ |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1334 |
entry |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1335 |
] ifFalse:[ |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1336 |
who := entry who. |
825
42afde0ee738
use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents:
820
diff
changeset
|
1337 |
(who methodClass) name |
42afde0ee738
use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents:
820
diff
changeset
|
1338 |
, ' ' |
42afde0ee738
use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents:
820
diff
changeset
|
1339 |
, (entry printStringForBrowserWithSelector:(who methodSelector)) |
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1340 |
] |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1341 |
]. |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1342 |
|
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1343 |
l sort. |
203 | 1344 |
^ self |
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1345 |
newWithLabel:aString |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1346 |
setupSelector:#setupForList: |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1347 |
arg:l |
53 | 1348 |
|
203 | 1349 |
" |
1350 |
SystemBrowser |
|
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1351 |
browseMethods:#('Object printOn:' 'Collection add:') |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1352 |
title:'some methods' |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1353 |
|
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1354 |
SystemBrowser |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1355 |
browseMethods:#('Behavior new:' 'Setclass new:') |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1356 |
title:'some new: methods' |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1357 |
|
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1358 |
SystemBrowser |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1359 |
browseMethods:(Array with:(Object compiledMethodAt:#printOn:) |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1360 |
with:(Collection compiledMethodAt:#add:) |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1361 |
with:(Object class compiledMethodAt:#initialize)) |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1362 |
title:'some methods' |
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1363 |
|
203 | 1364 |
" |
279
062022b53f22
allow browseMethods to be passed a collection of methodObjects (in addition to strings)
Claus Gittinger <cg@exept.de>
parents:
270
diff
changeset
|
1365 |
|
634
24a678f81829
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
620
diff
changeset
|
1366 |
"Modified: 17.6.1996 / 17:07:46 / stefan" |
825
42afde0ee738
use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents:
820
diff
changeset
|
1367 |
"Modified: 1.11.1996 / 16:30:17 / cg" |
203 | 1368 |
! |
53 | 1369 |
|
203 | 1370 |
browseMethodsFrom:aClass where:aBlock title:title |
1371 |
"launch a browser for all instance- and classmethods in aClass |
|
1372 |
and all its subclasses where aBlock evaluates to true. |
|
1373 |
The block is called with 3 arguments, class, method and seelctor." |
|
1374 |
||
1375 |
^ self browseMethodsIn:(aClass withAllSubclasses) where:aBlock title:title |
|
1376 |
! |
|
1377 |
||
1378 |
browseMethodsIn:aCollectionOfClasses inst:wantInst class:wantClass where:aBlock title:title |
|
1379 |
"launch a browser for all instance- (if wantInst is true) and/or |
|
1380 |
classmethods (if wantClass is true) from classes in aCollectionOfClasses, |
|
1381 |
where aBlock evaluates to true. |
|
270 | 1382 |
The block is called with 3 arguments, class, method and selector." |
203 | 1383 |
|
1384 |
|list| |
|
53 | 1385 |
|
1386 |
" |
|
203 | 1387 |
since this may take a long time, lower my priority ... |
53 | 1388 |
" |
203 | 1389 |
Processor activeProcess withLowerPriorityDo:[ |
270 | 1390 |
|checkedClasses checkBlock| |
75 | 1391 |
|
270 | 1392 |
checkedClasses := IdentitySet new. |
1393 |
list := OrderedCollection new. |
|
203 | 1394 |
|
270 | 1395 |
checkBlock := [:cls | |
1396 |
(checkedClasses includes:cls) ifFalse:[ |
|
435 | 1397 |
cls isObsolete ifTrue:[ |
550 | 1398 |
Transcript showCR:'skipping obsolete class: ' , cls displayString |
435 | 1399 |
] ifFalse:[ |
620
3ce270dbff3b
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
588
diff
changeset
|
1400 |
cls methodDictionary keysAndValuesDo:[:sel :method | |
436 | 1401 |
(aBlock value:cls value:method value:sel) ifTrue:[ |
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
1402 |
list add:method "/ (cls name , ' ' , sel) |
435 | 1403 |
] |
1404 |
]. |
|
1405 |
checkedClasses add:cls. |
|
1406 |
] |
|
270 | 1407 |
] |
1408 |
]. |
|
203 | 1409 |
|
270 | 1410 |
aCollectionOfClasses do:[:aClass | |
1411 |
" |
|
1412 |
output disabled - it slows down things too much (when searching for |
|
1413 |
implementors or senders) |
|
1414 |
" |
|
1415 |
wantInst ifTrue:[ |
|
550 | 1416 |
"/ Transcript show:'searching '; show:aClass name; showCR:' ...'; endEntry. |
270 | 1417 |
checkBlock value:aClass |
1418 |
]. |
|
1419 |
wantClass ifTrue:[ |
|
550 | 1420 |
"/ Transcript show:'searching '; show:aClass class name; showCR:' ...'; endEntry. |
270 | 1421 |
checkBlock value:(aClass class) |
1422 |
]. |
|
1423 |
Processor yield |
|
1424 |
] |
|
203 | 1425 |
]. |
1426 |
^ self browseMethods:list title:title |
|
270 | 1427 |
|
1428 |
"Created: 10.12.1995 / 15:34:57 / cg" |
|
620
3ce270dbff3b
Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
588
diff
changeset
|
1429 |
"Modified: 7.6.1996 / 08:47:54 / stefan" |
675
57cc7dc74d67
show privacy in senders/implementors list;
Claus Gittinger <cg@exept.de>
parents:
666
diff
changeset
|
1430 |
"Modified: 15.7.1996 / 11:48:10 / cg" |
53 | 1431 |
! |
1432 |
||
203 | 1433 |
browseMethodsIn:aCollectionOfClasses where:aBlock title:title |
1434 |
"launch a browser for all instance- and classmethods from |
|
1435 |
all classes in aCollectionOfClasses where aBlock evaluates to true. |
|
1436 |
The block is called with 3 arguments, class, method and seelctor." |
|
53 | 1437 |
|
203 | 1438 |
^ self browseMethodsIn:aCollectionOfClasses inst:true class:true where:aBlock title:title |
75 | 1439 |
|
36 | 1440 |
! |
1441 |
||
203 | 1442 |
browseMethodsOf:aClass where:aBlock title:title |
1443 |
"launch a browser for all instance- and classmethods in aClass |
|
1444 |
where aBlock evaluates to true. |
|
1445 |
The block is called with 3 arguments, class, method and seelctor." |
|
93 | 1446 |
|
203 | 1447 |
^ self browseMethodsIn:(Array with:aClass) where:aBlock title:title |
93 | 1448 |
! |
1449 |
||
203 | 1450 |
browseMethodsWhere:aBlock title:title |
1451 |
"launch a browser for all methods where aBlock returns true. |
|
1452 |
The block is called with 3 arguments, class, method and seelctor." |
|
1453 |
||
1454 |
^ self browseMethodsIn:(Smalltalk allClasses) where:aBlock title:title |
|
1455 |
! ! |
|
93 | 1456 |
|
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
1457 |
!SystemBrowser class methodsFor:'startup with query'! |
203 | 1458 |
|
1459 |
askThenBrowseClass |
|
1460 |
self getClassThenPerform:#browseClass: |
|
1461 |
||
1462 |
" |
|
1463 |
SystemBrowser askThenBrowseClass |
|
1464 |
" |
|
93 | 1465 |
! |
1466 |
||
203 | 1467 |
askThenBrowseClassHierarchy |
1468 |
self getClassThenPerform:#browseClassHierarchy: |
|
36 | 1469 |
|
203 | 1470 |
" |
1471 |
SystemBrowser askThenBrowseClassHierarchy |
|
1472 |
" |
|
36 | 1473 |
! |
1474 |
||
203 | 1475 |
askThenBrowseFullClassProtocol |
1476 |
self getClassThenPerform:#browseFullClassProtocol: |
|
36 | 1477 |
|
203 | 1478 |
" |
1479 |
SystemBrowser askThenBrowseFullClassProtocol |
|
1480 |
" |
|
52 | 1481 |
! |
1482 |
||
203 | 1483 |
getClassThenPerform:aSelector |
1484 |
|enterBox| |
|
52 | 1485 |
|
203 | 1486 |
enterBox := EnterBox title:(self classResources at:'Browse which class:') withCRs. |
254 | 1487 |
enterBox okText:(ClassResources at:'browse'). |
203 | 1488 |
enterBox entryCompletionBlock:[:contents | |
1489 |
|s what m| |
|
52 | 1490 |
|
203 | 1491 |
s := contents withoutSpaces. |
1492 |
what := Smalltalk classnameCompletion:s. |
|
1493 |
enterBox contents:what first. |
|
1494 |
]. |
|
1495 |
enterBox action:[:className | |
|
1496 |
|cls| |
|
52 | 1497 |
|
203 | 1498 |
cls := Smalltalk classNamed:className. |
1499 |
cls isNil ifTrue:[ |
|
254 | 1500 |
self warn:(ClassResources at:'no such class'). |
203 | 1501 |
] ifFalse:[ |
1502 |
self perform:aSelector with:cls |
|
1503 |
] |
|
1504 |
]. |
|
1505 |
enterBox showAtPointer |
|
75 | 1506 |
|
203 | 1507 |
" |
1508 |
SystemBrowser getClassThenPerform:#browseClass: |
|
1509 |
" |
|
36 | 1510 |
! ! |
1511 |
||
820
2a412afad51d
fixed autoSearch, when searching for a private-classes name
Claus Gittinger <cg@exept.de>
parents:
742
diff
changeset
|
1512 |
!SystemBrowser class methodsFor:'documentation'! |
93 | 1513 |
|
203 | 1514 |
version |
825
42afde0ee738
use new Method>>who interface
Claus Gittinger <cg@exept.de>
parents:
820
diff
changeset
|
1515 |
^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.70 1996-11-01 16:21:34 cg Exp $' |
36 | 1516 |
! ! |
203 | 1517 |
SystemBrowser initialize! |