author | Claus Gittinger <cg@exept.de> |
Fri, 01 May 2009 19:37:13 +0200 | |
changeset 8596 | 731b9e2442d9 |
parent 8474 | 301be082b20d |
child 8637 | 089fe695d11e |
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 |
"{ Package: 'stx:libtool' }" |
|
13 |
||
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
BrowserList subclass:#MethodList |
|
17 |
instanceVariableNames:'classes selectedMethodNameIndices methodList lastSelectedMethods |
|
18 |
browserNameList variableFilter filterClassVars updateProcess |
|
19 |
lastShowClass lastShowCategory lastShowClassFirst |
|
20 |
showMethodInheritance lastMethodClass lastMethodClassesSubclasses |
|
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
21 |
classAndSelectorsRedefinedBySubclassesOfClass showClass |
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
22 |
showMethodComplexity showMethodTypeIcon |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
23 |
showImageResourceMethodsImages' |
6271 | 24 |
classVariableNames:'ShowComplexityValue' |
5591 | 25 |
poolDictionaries:'' |
26 |
category:'Interface-Browsers-New' |
|
27 |
! |
|
28 |
||
29 |
!MethodList class methodsFor:'documentation'! |
|
30 |
||
31 |
copyright |
|
32 |
" |
|
33 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
34 |
All Rights Reserved |
|
35 |
||
36 |
This software is furnished under a license and may be used |
|
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! ! |
|
44 |
||
45 |
!MethodList class methodsFor:'interface specs'! |
|
46 |
||
47 |
singleMethodWindowSpec |
|
48 |
"This resource specification was automatically generated |
|
49 |
by the UIPainter of ST/X." |
|
50 |
||
51 |
"Do not manually edit this!! If it is corrupted, |
|
52 |
the UIPainter may not be able to read the specification." |
|
53 |
||
54 |
" |
|
55 |
UIPainter new openOnClass:MethodList andSelector:#singleMethodWindowSpec |
|
56 |
MethodList new openInterface:#singleMethodWindowSpec |
|
57 |
" |
|
58 |
||
59 |
<resource: #canvas> |
|
60 |
||
61 |
^ |
|
62 |
#(#FullSpec |
|
63 |
#name: #singleMethodWindowSpec |
|
64 |
#window: |
|
65 |
#(#WindowSpec |
|
66 |
#label: 'SingleSelectorList' |
|
67 |
#name: 'SingleSelectorList' |
|
68 |
#min: #(#Point 0 0) |
|
69 |
#max: #(#Point 1024 721) |
|
70 |
#bounds: #(#Rectangle 12 22 312 322) |
|
71 |
) |
|
72 |
#component: |
|
73 |
#(#SpecCollection |
|
74 |
#collection: #( |
|
75 |
#(#LabelSpec |
|
76 |
#label: 'MethodName' |
|
77 |
#name: 'MethodLabel' |
|
78 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0) |
|
79 |
#translateLabel: true |
|
80 |
#labelChannel: #methodLabelHolder |
|
81 |
#menu: #menuHolder |
|
82 |
) |
|
83 |
) |
|
84 |
||
85 |
) |
|
86 |
) |
|
87 |
||
88 |
"Modified: / 1.3.2000 / 20:50:15 / cg" |
|
89 |
! |
|
90 |
||
91 |
windowSpec |
|
92 |
"This resource specification was automatically generated |
|
93 |
by the UIPainter of ST/X." |
|
94 |
||
95 |
"Do not manually edit this!! If it is corrupted, |
|
96 |
the UIPainter may not be able to read the specification." |
|
97 |
||
98 |
" |
|
99 |
UIPainter new openOnClass:MethodList andSelector:#windowSpec |
|
100 |
MethodList new openInterface:#windowSpec |
|
101 |
MethodList open |
|
102 |
" |
|
103 |
||
104 |
<resource: #canvas> |
|
105 |
||
106 |
^ |
|
107 |
#(#FullSpec |
|
108 |
#name: #windowSpec |
|
109 |
#window: |
|
110 |
#(#WindowSpec |
|
111 |
#label: 'SelectorList' |
|
112 |
#name: 'SelectorList' |
|
113 |
#min: #(#Point 0 0) |
|
114 |
#max: #(#Point 1024 721) |
|
115 |
#bounds: #(#Rectangle 12 22 312 322) |
|
116 |
) |
|
117 |
#component: |
|
118 |
#(#SpecCollection |
|
119 |
#collection: #( |
|
120 |
#(#SequenceViewSpec |
|
121 |
#name: 'List' |
|
122 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
123 |
#tabable: true |
|
124 |
#model: #selectedMethodNameIndices |
|
125 |
#menu: #menuHolder |
|
126 |
#hasHorizontalScrollBar: true |
|
127 |
#hasVerticalScrollBar: true |
|
128 |
#miniScrollerHorizontal: true |
|
129 |
#isMultiSelect: true |
|
130 |
#valueChangeSelector: #selectionChangedByClick |
|
131 |
#useIndex: true |
|
132 |
#sequenceList: #browserNameList |
|
133 |
#doubleClickChannel: #doubleClickChannel |
|
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
134 |
#properties: |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
135 |
#(#PropertyListDictionary |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
136 |
#dragArgument: nil |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
137 |
#dropArgument: nil |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
138 |
#canDropSelector: #canDropContext: |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
139 |
#dropSelector: #doDropContext: |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
140 |
) |
5591 | 141 |
) |
142 |
) |
|
143 |
||
144 |
) |
|
145 |
) |
|
146 |
! ! |
|
147 |
||
148 |
!MethodList class methodsFor:'plugIn spec'! |
|
149 |
||
150 |
aspectSelectors |
|
151 |
"This resource specification was automatically generated |
|
152 |
by the UIPainter of ST/X." |
|
153 |
||
154 |
"Do not manually edit this. If it is corrupted, |
|
155 |
the UIPainter may not be able to read the specification." |
|
156 |
||
157 |
"Return a description of exported aspects; |
|
158 |
these can be connected to aspects of an embedding application |
|
159 |
(if this app is embedded in a subCanvas)." |
|
160 |
||
161 |
^ #( |
|
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
162 |
#classHolder |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
163 |
#(#doubleClickChannel #action ) |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
164 |
#forceGeneratorTrigger |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
165 |
#immediateUpdate |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
166 |
#inGeneratorHolder |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
167 |
#menuHolder |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
168 |
#methodCategoryHolder |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
169 |
#packageFilter |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
170 |
#selectedMethods |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
171 |
#selectionChangeCondition |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
172 |
#updateTrigger |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
173 |
#variableFilter |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
174 |
#filterClassVars |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
175 |
#showMethodInheritance |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
176 |
#showMethodComplexity |
6268 | 177 |
#showMethodTypeIcon |
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
178 |
#showImageResourceMethodsImages |
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
179 |
#sortBy |
5591 | 180 |
). |
181 |
! ! |
|
182 |
||
183 |
!MethodList methodsFor:'aspects'! |
|
184 |
||
185 |
browserNameList |
|
186 |
browserNameList isNil ifTrue:[ |
|
187 |
browserNameList := List new. |
|
188 |
]. |
|
189 |
^ browserNameList. |
|
190 |
||
191 |
"Modified: / 31.1.2000 / 00:42:44 / cg" |
|
192 |
"Created: / 5.2.2000 / 22:38:32 / cg" |
|
193 |
! |
|
194 |
||
195 |
defaultSlaveModeValue |
|
196 |
^ false. |
|
197 |
! |
|
198 |
||
199 |
filterClassVars |
|
200 |
filterClassVars isNil ifTrue:[ |
|
201 |
filterClassVars := false asValue. |
|
202 |
filterClassVars addDependent:self |
|
203 |
]. |
|
204 |
^ filterClassVars |
|
205 |
! |
|
206 |
||
207 |
filterClassVars:aValueHolder |
|
208 |
filterClassVars notNil ifTrue:[ |
|
209 |
filterClassVars removeDependent:self |
|
210 |
]. |
|
211 |
filterClassVars := aValueHolder. |
|
212 |
filterClassVars notNil ifTrue:[ |
|
213 |
filterClassVars addDependent:self |
|
214 |
]. |
|
215 |
! |
|
216 |
||
217 |
methodLabelHolder |
|
218 |
^ self pseudoListLabelHolder |
|
219 |
||
220 |
"Created: / 1.3.2000 / 20:50:07 / cg" |
|
221 |
! |
|
222 |
||
223 |
methodList |
|
224 |
^ methodList |
|
225 |
! |
|
226 |
||
227 |
selectedMethodNameIndices |
|
228 |
selectedMethodNameIndices isNil ifTrue:[ |
|
229 |
selectedMethodNameIndices := ValueHolder new. |
|
230 |
selectedMethodNameIndices addDependent:self |
|
231 |
]. |
|
232 |
^ selectedMethodNameIndices. |
|
233 |
||
234 |
"Modified: / 5.2.2000 / 00:31:48 / cg" |
|
235 |
"Created: / 5.2.2000 / 22:59:31 / cg" |
|
236 |
! |
|
237 |
||
238 |
selectedMethods |
|
239 |
^ self selectionHolder |
|
240 |
! |
|
241 |
||
242 |
selectedMethods:aValueHolder |
|
243 |
^ self selectionHolder:aValueHolder |
|
244 |
! |
|
245 |
||
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
246 |
showImageResourceMethodsImages |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
247 |
showImageResourceMethodsImages isNil ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
248 |
showImageResourceMethodsImages := false asValue. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
249 |
showImageResourceMethodsImages addDependent:self |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
250 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
251 |
^ showImageResourceMethodsImages |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
252 |
! |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
253 |
|
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
254 |
showImageResourceMethodsImages:aValueHolder |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
255 |
showImageResourceMethodsImages notNil ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
256 |
showImageResourceMethodsImages removeDependent:self |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
257 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
258 |
showImageResourceMethodsImages := aValueHolder. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
259 |
showImageResourceMethodsImages notNil ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
260 |
showImageResourceMethodsImages addDependent:self |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
261 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
262 |
! |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
263 |
|
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
264 |
showMethodComplexity |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
265 |
showMethodComplexity isNil ifTrue:[ |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
266 |
showMethodComplexity := false asValue. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
267 |
showMethodComplexity addDependent:self |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
268 |
]. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
269 |
^ showMethodComplexity |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
270 |
! |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
271 |
|
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
272 |
showMethodComplexity:aValueHolder |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
273 |
showMethodComplexity notNil ifTrue:[ |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
274 |
showMethodComplexity removeDependent:self |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
275 |
]. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
276 |
showMethodComplexity := aValueHolder. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
277 |
showMethodComplexity notNil ifTrue:[ |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
278 |
showMethodComplexity addDependent:self |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
279 |
]. |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
280 |
! |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
281 |
|
5591 | 282 |
showMethodInheritance |
283 |
showMethodInheritance isNil ifTrue:[ |
|
284 |
showMethodInheritance := false asValue. |
|
285 |
showMethodInheritance addDependent:self |
|
286 |
]. |
|
287 |
^ showMethodInheritance |
|
288 |
! |
|
289 |
||
290 |
showMethodInheritance:aValueHolder |
|
291 |
showMethodInheritance notNil ifTrue:[ |
|
292 |
showMethodInheritance removeDependent:self |
|
293 |
]. |
|
294 |
showMethodInheritance := aValueHolder. |
|
295 |
showMethodInheritance notNil ifTrue:[ |
|
296 |
showMethodInheritance addDependent:self |
|
297 |
]. |
|
298 |
! |
|
299 |
||
6268 | 300 |
showMethodTypeIcon |
301 |
showMethodTypeIcon isNil ifTrue:[ |
|
302 |
showMethodTypeIcon := true asValue. |
|
303 |
showMethodTypeIcon addDependent:self |
|
304 |
]. |
|
305 |
^ showMethodTypeIcon |
|
306 |
! |
|
307 |
||
308 |
showMethodTypeIcon:aValueHolder |
|
309 |
showMethodTypeIcon notNil ifTrue:[ |
|
310 |
showMethodTypeIcon removeDependent:self |
|
311 |
]. |
|
312 |
showMethodTypeIcon := aValueHolder. |
|
313 |
showMethodTypeIcon notNil ifTrue:[ |
|
314 |
showMethodTypeIcon addDependent:self |
|
315 |
]. |
|
316 |
! |
|
317 |
||
5591 | 318 |
variableFilter |
319 |
variableFilter isNil ifTrue:[ |
|
320 |
variableFilter := nil asValue. |
|
321 |
variableFilter addDependent:self |
|
322 |
]. |
|
323 |
^ variableFilter |
|
324 |
! |
|
325 |
||
326 |
variableFilter:aValueHolder |
|
327 |
variableFilter notNil ifTrue:[ |
|
328 |
variableFilter removeDependent:self |
|
329 |
]. |
|
330 |
variableFilter := aValueHolder. |
|
331 |
variableFilter notNil ifTrue:[ |
|
332 |
variableFilter addDependent:self |
|
333 |
]. |
|
334 |
! ! |
|
335 |
||
336 |
!MethodList methodsFor:'change & update'! |
|
337 |
||
338 |
delayedUpdate:something with:aParameter from:changedObject |
|
339 |
|cls sel oldMethod newMethod methods newSelection |
|
340 |
selectionHolder selection needSelectionChange| |
|
341 |
||
342 |
selectionHolder := self selectedMethods. |
|
343 |
selection := selectionHolder value. |
|
344 |
||
345 |
changedObject == Smalltalk ifTrue:[ |
|
5998 | 346 |
classes notNil ifTrue:[ |
347 |
something == #methodCategory ifTrue:[ |
|
348 |
"/ ignore here - methodCategoryList will tell me if required |
|
349 |
^ self |
|
350 |
]. |
|
6663
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
351 |
(something == #classOrganization |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
352 |
or:[ something == #methodCategoryAdded |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
353 |
or:[ something == #methodCategoryRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
354 |
or:[ something == #methodCategoriesRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
355 |
or:[ something == #methodCategoryRenamed ]]]]) ifTrue:[ |
5998 | 356 |
"/ ignore here - methodCategoryList will tell me if required |
357 |
^ self |
|
358 |
]. |
|
5591 | 359 |
|
5998 | 360 |
something == #methodInClass ifTrue:[ |
361 |
"/ a method has been added/changed |
|
362 |
cls := aParameter at:1. |
|
363 |
(classes includesIdentical:cls) ifTrue:[ |
|
364 |
sel := aParameter at:2. |
|
365 |
oldMethod := aParameter at:3. |
|
366 |
newMethod := cls compiledMethodAt:sel. |
|
367 |
(oldMethod notNil and:[newMethod notNil]) ifTrue:[ |
|
368 |
"a method was changed & acccepted; |
|
369 |
No need for a rescan of the methodDictionary; |
|
370 |
however, ensure that the refs to the old method are updated |
|
371 |
" |
|
372 |
methods := selection. |
|
373 |
methods size > 0 ifTrue:[ |
|
374 |
(methods includesIdentical:oldMethod) ifTrue:[ |
|
375 |
needSelectionChange := true. |
|
376 |
] |
|
377 |
]. |
|
378 |
methodList replaceAllIdentical:oldMethod with:newMethod. |
|
379 |
lastSelectedMethods notNil ifTrue:[ |
|
380 |
lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
381 |
]. |
|
382 |
methods size > 0 ifTrue:[ |
|
383 |
methods := methods asOrderedCollection. |
|
384 |
methods replaceAllIdentical:oldMethod with:newMethod. |
|
385 |
]. |
|
5591 | 386 |
|
5998 | 387 |
needSelectionChange == true ifTrue:[ |
388 |
selectionHolder setValue:methods. |
|
6575
94f336bcb07b
update notifiaction from other browsers (refix)
Claus Gittinger <cg@exept.de>
parents:
6490
diff
changeset
|
389 |
"/ self enqueueDelayedMethodsSelectionChanged. |
94f336bcb07b
update notifiaction from other browsers (refix)
Claus Gittinger <cg@exept.de>
parents:
6490
diff
changeset
|
390 |
"/ need this to inform my browser that method was changed |
94f336bcb07b
update notifiaction from other browsers (refix)
Claus Gittinger <cg@exept.de>
parents:
6490
diff
changeset
|
391 |
"/ by someone else. |
94f336bcb07b
update notifiaction from other browsers (refix)
Claus Gittinger <cg@exept.de>
parents:
6490
diff
changeset
|
392 |
selectionHolder changed. |
5998 | 393 |
]. |
394 |
(variableFilter value size > 0 |
|
395 |
or:[oldMethod package ~= newMethod package |
|
6260 | 396 |
or:[oldMethod resources ~= newMethod resources |
6694 | 397 |
or:[showMethodComplexity value == true]]]) ifTrue:[ |
5998 | 398 |
"/ only update that methods entry |
399 |
self updateListEntryFor:newMethod. |
|
400 |
"/ sigh - must invalidate |
|
401 |
"/ self invalidateList. |
|
402 |
]. |
|
403 |
^ self. |
|
404 |
]. |
|
405 |
"/ method was added - update the methodList |
|
406 |
"/ Q: is this needed (methodCategoryList should send me a new inGenerator) |
|
407 |
self invalidateList. |
|
408 |
]. |
|
409 |
^ self. |
|
410 |
]. |
|
411 |
||
412 |
something == #methodInClassRemoved ifTrue:[ |
|
413 |
cls := aParameter at:1. |
|
414 |
(classes includesIdentical:cls) ifTrue:[ |
|
415 |
sel := aParameter at:2. |
|
416 |
"/ method was removed - update the methodList |
|
417 |
"/ Q: is this needed (methodCategoryList should send me a new inGenerator) |
|
418 |
self invalidateList. |
|
419 |
]. |
|
420 |
^ self. |
|
421 |
]. |
|
5591 | 422 |
|
5998 | 423 |
(something == #methodTrap |
424 |
or:[ something == #privacyOfMethod ]) ifTrue:[ |
|
425 |
cls := aParameter at:1. |
|
426 |
sel := aParameter at:2. |
|
427 |
(classes includesIdentical:cls) ifFalse:[ ^ self]. |
|
428 |
newMethod := cls compiledMethodAt:sel. |
|
429 |
newMethod isNil ifTrue:[ |
|
430 |
self invalidateList. |
|
431 |
^ self |
|
432 |
]. |
|
5591 | 433 |
|
5998 | 434 |
(something == #privacyOfMethod) ifTrue:[ |
435 |
self updateListEntryFor:newMethod. |
|
436 |
]. |
|
437 |
||
438 |
(something == #methodTrap) ifTrue:[ |
|
439 |
newMethod isWrapped ifTrue:[ |
|
440 |
oldMethod := newMethod originalMethod |
|
441 |
] ifFalse:[ |
|
442 |
selection size > 0 ifTrue:[ |
|
443 |
oldMethod := selection detect:[:each | each isWrapped and:[each originalMethod == newMethod]] ifNone:nil. |
|
444 |
] |
|
445 |
]. |
|
5591 | 446 |
|
5998 | 447 |
selection size > 0 ifTrue:[ |
448 |
(selection includesIdentical:oldMethod) ifTrue:[ |
|
449 |
needSelectionChange := true. |
|
450 |
] |
|
451 |
]. |
|
452 |
methodList replaceAllIdentical:oldMethod with:newMethod. |
|
453 |
lastSelectedMethods notNil ifTrue:[ |
|
454 |
lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
455 |
]. |
|
456 |
selection size > 0 ifTrue:[ |
|
457 |
selection := selection asOrderedCollection. |
|
458 |
selection replaceAllIdentical:oldMethod with:newMethod. |
|
459 |
]. |
|
460 |
needSelectionChange == true ifTrue:[ |
|
461 |
selectionHolder changed. |
|
462 |
]. |
|
5591 | 463 |
|
5998 | 464 |
"/ actually, could just change that single item ... |
465 |
"/ ... might be cheaper, if list is huge. |
|
466 |
"/ only update that methods entry |
|
467 |
self updateListEntryFor:newMethod. |
|
468 |
"/ self invalidateList. |
|
469 |
]. |
|
470 |
^ self |
|
471 |
]. |
|
5591 | 472 |
|
6846 | 473 |
(something == #projectOrganization |
474 |
or:[something == #lastTestRunResult]) ifTrue:[ |
|
5998 | 475 |
aParameter notNil ifTrue:[ |
476 |
cls := aParameter at:1. |
|
477 |
cls notNil ifTrue:[ |
|
478 |
((classes includesIdentical:cls theNonMetaclass) |
|
479 |
or:[(classes includesIdentical:cls theMetaclass)]) ifTrue:[ |
|
480 |
self invalidateList. |
|
481 |
]. |
|
482 |
]. |
|
483 |
] ifFalse:[ |
|
484 |
self invalidateList. |
|
485 |
]. |
|
486 |
^ self |
|
487 |
]. |
|
6846 | 488 |
|
5998 | 489 |
"/ everything else is ignored |
490 |
"/ self halt. |
|
491 |
]. |
|
492 |
^ self |
|
5591 | 493 |
]. |
494 |
||
495 |
"/ something == #organization ifTrue:[ |
|
496 |
"/self halt:'no longer'. |
|
497 |
"/^ self. |
|
498 |
"/ "/ a methods cateory has changed |
|
499 |
"/ (classes includesIdentical:changedObject) ifTrue:[ |
|
500 |
"/ aParameter isSymbol ifTrue:[ |
|
501 |
"/ "/ a method with a new category |
|
502 |
"/ (self methodList includesIdentical:(changedObject compiledMethodAt:aParameter)) ifTrue:[ |
|
503 |
"/ self invalidateList. |
|
504 |
"/ ]. |
|
505 |
"/ ^ self. |
|
506 |
"/ ]. |
|
507 |
"/ "/ a new category (no method yet) |
|
508 |
"/ self invalidateList |
|
509 |
"/ ]. |
|
510 |
"/ ^ self |
|
511 |
"/ ]. |
|
512 |
||
513 |
"/ something == #methodDictionary ifTrue:[ |
|
514 |
"/self halt:'no longer'. |
|
515 |
"/^ self. |
|
516 |
"/ "/ a method has been added/removed |
|
517 |
"/ (classes includesIdentical:changedObject) ifTrue:[ |
|
518 |
"/ aParameter isArray ifTrue:[ |
|
519 |
"/ sel := aParameter at:1. |
|
520 |
"/ oldMethod := aParameter at:2. |
|
521 |
"/ newMethod := changedObject compiledMethodAt:sel. |
|
522 |
"/ oldMethod notNil ifTrue:[ |
|
523 |
"/ "a method was changed & acccepted; |
|
524 |
"/ No need for a rescan of the methodDictionary; |
|
525 |
"/ however, ensure that the refs to the old method are updated |
|
526 |
"/ " |
|
527 |
"/ methods := selection. |
|
528 |
"/ methods size > 0 ifTrue:[ |
|
529 |
"/ (methods includesIdentical:oldMethod) ifTrue:[ |
|
530 |
"/ needSelectionChange := true. |
|
531 |
"/ ] |
|
532 |
"/ ]. |
|
533 |
"/ methodList replaceAllIdentical:oldMethod with:newMethod. |
|
534 |
"/ lastSelectedMethods notNil ifTrue:[ |
|
535 |
"/ lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
536 |
"/ ]. |
|
537 |
"/ methods size > 0 ifTrue:[ |
|
538 |
"/ methods := methods asOrderedCollection. |
|
539 |
"/ methods replaceAllIdentical:oldMethod with:newMethod. |
|
540 |
"/ ]. |
|
541 |
"/ needSelectionChange == true ifTrue:[ |
|
542 |
"/ selectionHolder setValue:methods. |
|
543 |
"/ selectionHolder changed. |
|
544 |
"/ ]. |
|
545 |
"/ ^ self. |
|
546 |
"/ ] |
|
547 |
"/ ]. |
|
548 |
"/ "/ class has changed must update the methodList |
|
549 |
"/ self invalidateList. |
|
550 |
"/ ]. |
|
551 |
"/ ^ self. |
|
552 |
"/ ]. |
|
553 |
||
554 |
"/ something == #projectOrganization ifTrue:[ |
|
555 |
"/ ((classes includesIdentical:changedObject theNonMetaclass) |
|
556 |
"/ or:[(classes includesIdentical:changedObject theMetaclass)]) ifTrue:[ |
|
557 |
"/ self invalidateList. |
|
558 |
"/ ]. |
|
559 |
"/ ^ self |
|
560 |
"/ ]. |
|
561 |
||
562 |
changedObject == sortBy ifTrue:[ |
|
5998 | 563 |
listValid ~~ true ifTrue:[ "/ could be nil |
564 |
inGeneratorHolder value isNil ifTrue:[ |
|
565 |
"/ ok, no need to react on that one |
|
566 |
"/ (will invalidate anyway, once I have more info at hand) |
|
567 |
^ self |
|
568 |
]. |
|
569 |
]. |
|
570 |
self invalidateList. |
|
571 |
^ self |
|
5591 | 572 |
]. |
573 |
||
574 |
(changedObject == variableFilter |
|
575 |
or:[changedObject == filterClassVars |
|
6259
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
576 |
or:[changedObject == showMethodInheritance |
e440c14b02aa
experimental display of method complexity
Claus Gittinger <cg@exept.de>
parents:
5998
diff
changeset
|
577 |
or:[changedObject == showMethodComplexity]]]) ifTrue:[ |
5998 | 578 |
self invalidateList. |
579 |
^ self |
|
5591 | 580 |
]. |
581 |
||
582 |
changedObject == selectedMethodNameIndices ifTrue:[ |
|
5998 | 583 |
newSelection := self selectedMethodNameIndices value collect:[:idx | methodList at:idx]. |
584 |
newSelection ~= selection ifTrue:[ |
|
585 |
selectionHolder value:newSelection. |
|
586 |
lastSelectedMethods := newSelection. |
|
587 |
lastSelectedMethods notNil ifTrue:[ |
|
588 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection |
|
589 |
]. |
|
590 |
] ifFalse:[ |
|
591 |
"/ a reselect - force update |
|
5591 | 592 |
"/ selection size == 1 ifTrue:[ |
5998 | 593 |
selectionHolder setValue:newSelection. |
594 |
selectionHolder changed:#value. |
|
5591 | 595 |
"/ ]. |
5998 | 596 |
]. |
597 |
^ self |
|
5591 | 598 |
]. |
599 |
changedObject == selectionHolder ifTrue:[ |
|
5998 | 600 |
self selectedMethodsChanged. |
601 |
lastSelectedMethods := selectionHolder value. |
|
602 |
lastSelectedMethods notNil ifTrue:[ |
|
603 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection |
|
604 |
]. |
|
605 |
^ self |
|
5591 | 606 |
]. |
607 |
"/ something == #methodTrap ifTrue:[ |
|
608 |
"/self halt:'no longer'. |
|
609 |
"/^ self. |
|
610 |
"/ (classes includesIdentical:changedObject) ifTrue:[ |
|
611 |
"/ newMethod := changedObject compiledMethodAt:aParameter. |
|
612 |
"/ newMethod isNil ifTrue:[ |
|
613 |
"/ self invalidateList. |
|
614 |
"/ ^ self |
|
615 |
"/ ]. |
|
616 |
"/ newMethod isWrapped ifTrue:[ |
|
617 |
"/ oldMethod := newMethod originalMethod |
|
618 |
"/ ] ifFalse:[ |
|
619 |
"/ selection size > 0 ifTrue:[ |
|
620 |
"/ oldMethod := selection detect:[:each | each isWrapped and:[each originalMethod == newMethod]] ifNone:nil. |
|
621 |
"/ ] |
|
622 |
"/ ]. |
|
623 |
"/ |
|
624 |
"/ selection size > 0 ifTrue:[ |
|
625 |
"/ (selection includesIdentical:oldMethod) ifTrue:[ |
|
626 |
"/ needSelectionChange := true. |
|
627 |
"/ ] |
|
628 |
"/ ]. |
|
629 |
"/"/ methodList replaceAllIdentical:oldMethod with:newMethod. |
|
630 |
"/ lastSelectedMethods notNil ifTrue:[ |
|
631 |
"/ lastSelectedMethods replaceAllIdentical:oldMethod with:newMethod |
|
632 |
"/ ]. |
|
633 |
"/ selection size > 0 ifTrue:[ |
|
634 |
"/ selection := selection asOrderedCollection. |
|
635 |
"/ selection replaceAllIdentical:oldMethod with:newMethod. |
|
636 |
"/ ]. |
|
637 |
"/ needSelectionChange == true ifTrue:[ |
|
638 |
"/ selectionHolder changed. |
|
639 |
"/ ]. |
|
640 |
"/ self invalidateList. |
|
641 |
"/ ^ self |
|
642 |
"/ ]. |
|
643 |
"/ ^ self |
|
644 |
"/ ]. |
|
645 |
super delayedUpdate:something with:aParameter from:changedObject |
|
646 |
||
6846 | 647 |
"Created: / 05-02-2000 / 13:42:14 / cg" |
648 |
"Modified: / 06-08-2006 / 10:36:49 / cg" |
|
5591 | 649 |
! |
650 |
||
651 |
selectedMethodsChanged |
|
652 |
"the set of selected methods has changed; |
|
653 |
update the selection-index collection (for the selectionInListView)" |
|
654 |
||
655 |
|indices methods reverseMap |
|
656 |
selectedMethodsHolder selectedMethods selectedMethodNameIndicesHolder| |
|
657 |
||
658 |
methods := methodList ? #(). |
|
659 |
methods size == 0 ifTrue:[ |
|
660 |
"/ this may happen during early startup, |
|
661 |
"/ when invoked with a preset methodSelection, |
|
662 |
"/ and the methodGenerator has not yet been setup |
|
663 |
"/ to not clobber the selection, defer the update |
|
664 |
"/ until the methodList arrives ... |
|
665 |
^ self |
|
666 |
]. |
|
667 |
||
668 |
selectedMethodsHolder := self selectedMethods. |
|
669 |
selectedMethods := selectedMethodsHolder value. |
|
670 |
||
671 |
"/ check if all is selected (likely) |
|
672 |
((selectedMethods size == methodList size) |
|
673 |
and:[selectedMethods = methodList]) ifTrue:[ |
|
674 |
indices := (1 to:selectedMethods size) |
|
675 |
] ifFalse:[ |
|
676 |
selectedMethods size > 100 ifTrue:[ |
|
677 |
"/ check if all is selected (likely) |
|
678 |
((selectedMethods size == methodList size) |
|
679 |
and:[selectedMethods = methodList]) ifTrue:[ |
|
680 |
indices := (1 to:selectedMethods size) |
|
681 |
] ifFalse:[ |
|
682 |
"/ for big collections, generate a reverse map |
|
683 |
reverseMap := IdentityDictionary new. |
|
684 |
methods keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
|
685 |
indices := selectedMethods collect:[:eachSelectedMethod | |
|
686 |
reverseMap at:eachSelectedMethod ifAbsent:0 |
|
687 |
] |
|
688 |
] |
|
689 |
] ifFalse:[ |
|
690 |
indices := (selectedMethods ? #()) collect:[:eachSelectedMethod | |
|
691 |
methods identityIndexOf:eachSelectedMethod. |
|
692 |
] |
|
693 |
]. |
|
694 |
indices := indices select:[:idx | idx ~= 0]. |
|
695 |
]. |
|
696 |
||
697 |
selectedMethodNameIndicesHolder := self selectedMethodNameIndices. |
|
698 |
selectedMethodNameIndicesHolder value ~= indices ifTrue:[ |
|
699 |
selectedMethodNameIndicesHolder value:indices. |
|
700 |
] |
|
701 |
! |
|
702 |
||
703 |
selectionChanged |
|
704 |
|methods| |
|
705 |
||
706 |
methods := ((self selectedMethodNameIndices value) ? #()) collect:[:idx | methodList at:idx]. |
|
707 |
methods notEmpty ifTrue:[ |
|
708 |
lastSelectedMethods := methods asOrderedCollection. |
|
709 |
]. |
|
710 |
"/ to allow reselect, change my valueHolder, even if the same collection |
|
711 |
"/ self selectedMethods value ~= methods ifTrue:[ |
|
712 |
self selectedMethods value:methods |
|
713 |
"/ ] |
|
714 |
||
715 |
"Created: / 5.2.2000 / 13:42:14 / cg" |
|
716 |
"Modified: / 5.2.2000 / 23:32:20 / cg" |
|
717 |
! |
|
718 |
||
719 |
selectionChangedByClick |
|
720 |
"we are not interested in that - get another notification |
|
721 |
via the changed valueHolder" |
|
722 |
||
723 |
! |
|
724 |
||
725 |
update:something with:aParameter from:changedObject |
|
726 |
|cls| |
|
727 |
||
728 |
"/ some can be ignored immediately |
|
729 |
changedObject == Smalltalk ifTrue:[ |
|
730 |
classes isNil ifTrue:[ |
|
731 |
^ self. |
|
732 |
]. |
|
733 |
something isNil ifTrue:[ |
|
734 |
"/ self halt "/ huh - Smalltalk changed - so what ? |
|
735 |
^ self. |
|
736 |
]. |
|
5998 | 737 |
|
5591 | 738 |
something == #classComment ifTrue:[ |
739 |
^ self. |
|
740 |
]. |
|
741 |
something == #classVariables ifTrue:[ |
|
742 |
^ self. |
|
743 |
]. |
|
744 |
something == #organization ifTrue:[ |
|
745 |
^ self. |
|
746 |
]. |
|
747 |
something == #methodCategory ifTrue:[ |
|
748 |
"/ ignore here - methodCategoryList will tell me if required |
|
749 |
^ self |
|
750 |
]. |
|
6663
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
751 |
(something == #classOrganization |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
752 |
or:[ something == #methodCategoryAdded |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
753 |
or:[ something == #methodCategoryRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
754 |
or:[ something == #methodCategoriesRemoved |
1453d4f33815
changed change-update aspect when changing some method category
Claus Gittinger <cg@exept.de>
parents:
6575
diff
changeset
|
755 |
or:[ something == #methodCategoryRenamed ]]]]) ifTrue:[ |
5591 | 756 |
"/ ignore here - methodCategoryList will tell me if required |
757 |
^ self |
|
758 |
]. |
|
5998 | 759 |
(something == #methodTrap |
6846 | 760 |
or:[ something == #methodPrivacy |
761 |
or:[ something == #lastTestRunResult] ]) ifTrue:[ |
|
5998 | 762 |
self window shown ifFalse:[ |
763 |
changedObject removeDependent:self. "/ ????? |
|
764 |
^ self |
|
765 |
]. |
|
5591 | 766 |
cls := aParameter at:1. |
767 |
(classes includesIdentical:cls) ifFalse:[ |
|
5998 | 768 |
^ self "/ I dont care for that class |
5591 | 769 |
]. |
770 |
]. |
|
771 |
||
6846 | 772 |
"/ as the organisation changes, flush my remembered redefinition-cache-info |
5591 | 773 |
classAndSelectorsRedefinedBySubclassesOfClass := nil. |
774 |
||
775 |
something == #classDefinition ifTrue:[ |
|
776 |
cls := aParameter. |
|
777 |
(classes contains:[:aClass | aClass name == cls name]) ifFalse:[ |
|
778 |
^ self "/ I dont care for that class |
|
779 |
]. |
|
780 |
classes := classes collect:[:eachClass | eachClass isMeta ifTrue:[ |
|
781 |
(Smalltalk at:eachClass theNonMetaclass name) class |
|
782 |
] ifFalse:[ |
|
783 |
Smalltalk at:eachClass name |
|
784 |
] |
|
785 |
]. |
|
786 |
self updateList. |
|
787 |
^ self. |
|
788 |
]. |
|
789 |
something == #newClass ifTrue:[ |
|
790 |
^ self. |
|
791 |
]. |
|
792 |
something == #classRemove ifTrue:[ |
|
793 |
^ self. |
|
794 |
]. |
|
795 |
something == #classRename ifTrue:[ |
|
796 |
^ self. |
|
797 |
]. |
|
798 |
]. |
|
799 |
||
800 |
"/ these must lead to immediate update of the selectedMethods collection |
|
801 |
"/ (otherwise, that collection might be updated too late, leading to |
|
802 |
"/ an obsolete methods code being shown by the codeView. |
|
803 |
something == #methodInClass ifTrue:[ |
|
6846 | 804 |
"/ as the organisation changes, flush my remembered redefinition-cache-info |
5591 | 805 |
classAndSelectorsRedefinedBySubclassesOfClass := nil. |
806 |
cls := aParameter at:1. |
|
807 |
(classes includesIdentical:cls) ifFalse:[ |
|
808 |
^ self "/ I dont care for that class |
|
809 |
]. |
|
810 |
self enqueueDelayedUpdate:something with:aParameter from:changedObject. |
|
811 |
^ self |
|
812 |
]. |
|
813 |
||
814 |
something == #methodInClassRemoved ifTrue:[ |
|
815 |
cls := aParameter at:1. |
|
816 |
(classes includesIdentical:cls) ifFalse:[ |
|
817 |
^ self "/ I dont care for that class |
|
818 |
]. |
|
819 |
]. |
|
820 |
||
821 |
super update:something with:aParameter from:changedObject |
|
6846 | 822 |
|
7702 | 823 |
"Modified: / 05-03-2007 / 16:08:28 / cg" |
5591 | 824 |
! ! |
825 |
||
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
826 |
!MethodList methodsFor:'drag & drop'! |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
827 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
828 |
canDropContext:aDropContext |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
829 |
|methods| |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
830 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
831 |
aDropContext sourceWidget == aDropContext targetWidget ifTrue:[^ false]. |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
832 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
833 |
methods := aDropContext dropObjects collect:[:obj | obj theObject]. |
7122 | 834 |
(methods conform:[:aMethod | aMethod isMethod]) ifFalse:[^ false]. |
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
835 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
836 |
self masterApplication theSingleSelectedClass isNil ifTrue:[^ false]. |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
837 |
^ true |
7122 | 838 |
|
839 |
"Modified: / 13-09-2006 / 11:43:54 / cg" |
|
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
840 |
! |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
841 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
842 |
doDropContext:aDropContext |
8596 | 843 |
|methods browser| |
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
844 |
|
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
845 |
methods := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject]. |
7122 | 846 |
(methods conform:[:something | something isMethod]) ifFalse:[^ self]. |
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
847 |
|
8596 | 848 |
browser := self masterApplication. |
849 |
aDropContext dragType == DropContext dragTypeCopy ifTrue:[ |
|
850 |
browser |
|
851 |
copyMethods:methods |
|
852 |
toClass:(browser theSingleSelectedClass). |
|
853 |
] ifFalse:[ |
|
854 |
browser |
|
855 |
moveMethods:methods |
|
856 |
toClass:(browser theSingleSelectedClass). |
|
857 |
]. |
|
7122 | 858 |
|
859 |
"Modified: / 13-09-2006 / 11:43:44 / cg" |
|
6774
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
860 |
! ! |
ae9ed5b0b548
move method via drag and drop
Claus Gittinger <cg@exept.de>
parents:
6697
diff
changeset
|
861 |
|
5591 | 862 |
!MethodList methodsFor:'private'! |
863 |
||
864 |
listOfMethodNames |
|
865 |
|methods entries selectorBag newNameList |
|
866 |
allClasses newClasses allCategories "allSelectors" generator |
|
867 |
doShowClass doShowClassFirst doShowCategory |
|
868 |
enforceClassAndProtocolInList theMethod sortByClass anyMethodToWatch mclass| |
|
869 |
||
870 |
generator := inGeneratorHolder value. |
|
871 |
generator isNil ifTrue:[^ #() ]. |
|
872 |
||
873 |
allClasses := IdentitySet new. |
|
874 |
allCategories := IdentitySet new. "/ not needed - all I need to know is if there is more than 1 category |
|
875 |
"/ allSelectors := Set new. |
|
876 |
newClasses := IdentitySet new. |
|
877 |
selectorBag := Bag new. |
|
878 |
entries := OrderedCollection new. |
|
879 |
enforceClassAndProtocolInList := false. |
|
880 |
anyMethodToWatch := false. |
|
881 |
||
882 |
"/ generator generates nil-selector entries |
|
883 |
"/ to pass multiple-class and multiple-protocol info |
|
884 |
generator do:[:cls :cat :sel :mthd | |
|
885 |
(cls isNil and:[cat isNil and:[sel isNil]]) |
|
886 |
ifTrue:[ |
|
887 |
enforceClassAndProtocolInList := true |
|
888 |
] ifFalse:[ |
|
889 |
cls notNil ifTrue:[ |
|
890 |
allClasses add:cls. |
|
891 |
]. |
|
892 |
cat notNil ifTrue:[ |
|
893 |
allCategories add:cat. |
|
894 |
]. |
|
895 |
sel notNil ifTrue:[ |
|
896 |
entries add:(Array with:cls with:sel with:mthd). |
|
897 |
selectorBag add:sel. |
|
898 |
newClasses add:cls. |
|
899 |
"/ allSelectors add:sel. |
|
900 |
] |
|
901 |
]. |
|
902 |
(mthd notNil and:[mthd isWrapped]) ifTrue:[ |
|
903 |
(mthd isTiming |
|
904 |
or:[mthd isCounting |
|
905 |
or:[mthd isCountingMemoryUsage]]) |
|
906 |
ifTrue:[ |
|
907 |
anyMethodToWatch := true |
|
908 |
] |
|
909 |
]. |
|
910 |
]. |
|
911 |
||
912 |
showMethodInheritance value ~~ false ifTrue:[ |
|
913 |
"/ collect redefinition information once (big speedup for #methodIsRedefinedbelow) |
|
914 |
classAndSelectorsRedefinedBySubclassesOfClass isNil ifTrue:[ |
|
915 |
classAndSelectorsRedefinedBySubclassesOfClass := IdentityDictionary new. |
|
916 |
]. |
|
917 |
allClasses do:[:cls | |d| |
|
918 |
d := classAndSelectorsRedefinedBySubclassesOfClass. |
|
919 |
(d notNil and:[ (d includesKey:cls) not ]) ifTrue:[ |
|
8206 | 920 |
cls isLoaded ifTrue:[ |
921 |
d at:cls put:(self setOfAllSelectorsImplementedBelow:cls) |
|
922 |
] |
|
5591 | 923 |
] |
924 |
]. |
|
925 |
]. |
|
926 |
||
927 |
"/ multiple classes must: add the className for some |
|
928 |
doShowClass := enforceClassAndProtocolInList or:[allClasses size > 1]. |
|
929 |
"/ multiple categories: must add the categorie for some |
|
930 |
doShowCategory := enforceClassAndProtocolInList or:[allCategories size > 1]. |
|
931 |
||
932 |
doShowClassFirst := doShowClass. "/ (doShowClass and:[allSelectors size == 1]). |
|
933 |
doShowClassFirst := doShowClass and:[ sortBy value == #class ]. |
|
934 |
||
935 |
sortBy value == false ifTrue:[ |
|
936 |
"/ do not sort |
|
937 |
] ifFalse:[ |
|
938 |
(doShowClass not and:[ sortBy value == #class ]) ifTrue:[ |
|
939 |
"/ multiple classes must add the className for some |
|
940 |
"/ check, if doShowClass must be enforced |
|
941 |
entries do:[:entry | |
|
942 |
|cls sel mthd s needClass| |
|
943 |
||
944 |
cls := entry at:1. |
|
945 |
sel := entry at:2. |
|
946 |
mthd := entry at:3. |
|
947 |
doShowClass ifFalse:[ |
|
948 |
doShowClass := (selectorBag occurrencesOf:sel) > 1 |
|
949 |
]. |
|
950 |
]. |
|
951 |
]. |
|
952 |
||
953 |
sortByClass := doShowClass and:[ sortBy value == #class ]. |
|
954 |
||
955 |
sortByClass ifTrue:[ |
|
956 |
entries sort:[:a :b | |nmA nmB clsNmA clsNmB| |
|
957 |
clsNmA := (a at:1) name. |
|
958 |
clsNmB := (b at:1) name. |
|
959 |
clsNmA = clsNmB ifTrue:[ |
|
960 |
nmA := (a at:2). |
|
961 |
nmB := (b at:2). |
|
962 |
nmA < nmB |
|
963 |
] ifFalse:[ |
|
964 |
clsNmA < clsNmB |
|
965 |
] |
|
966 |
]. |
|
967 |
] ifFalse:[ |
|
7610 | 968 |
sortBy value == #category ifTrue:[ |
969 |
entries sort:[:a :b | |nmA nmB catA catB clsNmA clsNmB| |
|
970 |
catA := (a at:3) category. |
|
971 |
catB := (b at:3) category. |
|
972 |
catA = catB ifTrue:[ |
|
973 |
nmA := (a at:2). |
|
974 |
nmB := (b at:2). |
|
975 |
nmA = nmB ifTrue:[ |
|
976 |
clsNmA := (a at:1) name. |
|
977 |
clsNmB := (b at:1) name. |
|
978 |
clsNmA < clsNmB |
|
979 |
] ifFalse:[ |
|
980 |
nmA < nmB |
|
981 |
] |
|
982 |
] ifFalse:[ |
|
983 |
catA < catB |
|
984 |
] |
|
985 |
]. |
|
986 |
] ifFalse:[ |
|
987 |
entries sort:[:a :b | |nmA nmB clsNmA clsNmB| |
|
988 |
nmA := (a at:2). |
|
989 |
nmB := (b at:2). |
|
990 |
nmA = nmB ifTrue:[ |
|
991 |
clsNmA := (a at:1) name. |
|
992 |
clsNmB := (b at:1) name. |
|
993 |
clsNmA < clsNmB |
|
994 |
] ifFalse:[ |
|
995 |
nmA < nmB |
|
996 |
] |
|
997 |
]. |
|
998 |
]. |
|
5591 | 999 |
]. |
1000 |
]. |
|
1001 |
||
1002 |
methods := OrderedCollection new:(entries size). |
|
1003 |
||
1004 |
"/ first generate the new methodList, and see if it is different ... |
|
1005 |
entries do:[:entry | |
|
1006 |
|sel mthd| |
|
1007 |
||
1008 |
mthd := entry at:3. |
|
1009 |
methods add:mthd. |
|
1010 |
]. |
|
1011 |
||
1012 |
false "methodList = methods" "does not care for changed icons" ifTrue:[ |
|
1013 |
"/ same list |
|
1014 |
newNameList := self browserNameList. |
|
1015 |
] ifFalse:[ |
|
1016 |
newNameList := OrderedCollection new:(entries size). |
|
1017 |
||
1018 |
"/ multiple classes must add the className for some |
|
1019 |
entries do:[:entry | |
|
1020 |
|cls sel mthd s needClass| |
|
1021 |
||
1022 |
cls := entry at:1. |
|
1023 |
sel := entry at:2. |
|
1024 |
mthd := entry at:3. |
|
1025 |
needClass := doShowClass. |
|
1026 |
"/ needClass ifFalse:[ |
|
1027 |
"/ needClass := (selectorBag occurrencesOf:sel) > 1 |
|
1028 |
"/ ]. |
|
1029 |
s := self |
|
1030 |
listEntryForMethod:mthd |
|
1031 |
selector:sel |
|
1032 |
class:cls |
|
1033 |
showClass:needClass |
|
1034 |
showCategory:doShowCategory |
|
1035 |
classFirst:doShowClassFirst. |
|
1036 |
||
1037 |
"/ s := mthd printStringForBrowserWithSelector:sel inClass:cls. |
|
1038 |
"/ needClass ifTrue:[ |
|
1039 |
"/ s := s , ' [' , cls name , ']'. |
|
1040 |
"/ ]. |
|
1041 |
"/ doShowCategory ifTrue:[ |
|
1042 |
"/ s := s , ' {' , mthd category "asText allItalic" , '}' |
|
1043 |
"/ ]. |
|
1044 |
newNameList add:s. |
|
1045 |
]. |
|
1046 |
]. |
|
1047 |
||
1048 |
self makeIndependent. |
|
1049 |
classes := newClasses. |
|
1050 |
self makeDependent. |
|
1051 |
||
1052 |
methodList := methods. |
|
1053 |
methods size == 1 ifTrue:[ |
|
1054 |
theMethod := methods first. |
|
1055 |
mclass := theMethod mclass. |
|
1056 |
mclass isNil ifTrue:[ |
|
1057 |
theMethod isWrapped ifTrue:[ |
|
1058 |
theMethod := theMethod originalMethod. |
|
1059 |
mclass := theMethod mclass. |
|
1060 |
]. |
|
1061 |
]. |
|
6697 | 1062 |
self methodLabelHolder value:( |
1063 |
mclass isNil |
|
1064 |
ifTrue:[('???' , ' ' , '???')] |
|
1065 |
ifFalse:[(mclass name , ' ' , theMethod selector)]) |
|
5591 | 1066 |
]. |
1067 |
||
1068 |
anyMethodToWatch ifTrue:[ |
|
1069 |
self startWatchProcess. |
|
1070 |
] ifFalse:[ |
|
1071 |
self stopWatchProcess. |
|
1072 |
]. |
|
1073 |
||
1074 |
"/ remember these, in case of an incremental (single method only) |
|
1075 |
"/ update in the future. |
|
1076 |
lastShowClass := doShowClass. |
|
1077 |
lastShowClassFirst := doShowClassFirst. |
|
1078 |
lastShowCategory := doShowCategory. |
|
1079 |
||
1080 |
^ newNameList. |
|
1081 |
||
7610 | 1082 |
"Created: / 05-02-2000 / 22:43:40 / cg" |
1083 |
"Modified: / 26-01-2007 / 14:58:59 / cg" |
|
5591 | 1084 |
! |
1085 |
||
1086 |
makeDependent |
|
1087 |
Smalltalk addDependent:self. |
|
7502 | 1088 |
"/ ChangeSet addDependent:self. |
1089 |
||
1090 |
"Modified: / 10-11-2006 / 17:57:01 / cg" |
|
5591 | 1091 |
! |
1092 |
||
1093 |
makeIndependent |
|
1094 |
Smalltalk removeDependent:self. |
|
8218 | 1095 |
"/ ChangeSet removeDependent:self. |
5591 | 1096 |
! |
1097 |
||
1098 |
method:mthd includesModsOfClassVariable:variablesToHighLight |
|
1099 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#modifiedClassVars |
|
1100 |
! |
|
1101 |
||
1102 |
method:mthd includesModsOfInstanceVariable:variablesToHighLight |
|
1103 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#modifiedInstVars |
|
1104 |
! |
|
1105 |
||
1106 |
method:mthd includesRefsToClassVariable:variablesToHighLight |
|
1107 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#usedClassVars |
|
1108 |
! |
|
1109 |
||
1110 |
method:mthd includesRefsToInstanceVariable:variablesToHighLight |
|
1111 |
^ self method:mthd includesRefsToVariable:variablesToHighLight askParserWith:#usedInstVars |
|
1112 |
! |
|
1113 |
||
1114 |
method:mthd includesRefsToVariable:variablesToHighLight askParserWith:querySelector |
|
1115 |
|cls src parser usedVars anyVarNameAccessable| |
|
1116 |
||
1117 |
cls := mthd mclass. |
|
5885 | 1118 |
cls isNil ifTrue:[^ false]. |
1119 |
||
5591 | 1120 |
anyVarNameAccessable := cls allInstVarNames includesAny:variablesToHighLight. |
1121 |
anyVarNameAccessable ifFalse:[ |
|
5885 | 1122 |
anyVarNameAccessable := cls theNonMetaclass allClassVarNames includesAny:variablesToHighLight. |
5591 | 1123 |
]. |
1124 |
anyVarNameAccessable ifFalse:[ |
|
5885 | 1125 |
"/ no need to parse |
1126 |
^ false |
|
5591 | 1127 |
]. |
1128 |
||
1129 |
src := mthd source. |
|
1130 |
src notNil ifTrue:[ |
|
5885 | 1131 |
" |
1132 |
before doing a slow parse, quickly scan the |
|
1133 |
methods source for the variables name ... |
|
1134 |
" |
|
1135 |
(variablesToHighLight contains:[:varName | (src findString:varName) ~~ 0]) ifTrue:[ |
|
1136 |
parser := Parser |
|
1137 |
parseMethod:src |
|
1138 |
in:cls |
|
1139 |
ignoreErrors:true |
|
1140 |
ignoreWarnings:true. |
|
1141 |
(parser notNil and:[parser ~~ #Error]) ifTrue:[ |
|
1142 |
usedVars := parser perform:querySelector. |
|
1143 |
(usedVars includesAny:variablesToHighLight) |
|
1144 |
ifTrue:[ |
|
1145 |
^ true |
|
1146 |
] |
|
1147 |
] |
|
1148 |
] |
|
5591 | 1149 |
]. |
1150 |
^ false |
|
1151 |
! |
|
1152 |
||
1153 |
methodIsInheritedFromAbove:aMethod |
|
1154 |
|mClass| |
|
1155 |
||
1156 |
mClass := aMethod mclass. |
|
1157 |
(mClass notNil and:[mClass superclass notNil]) ifTrue:[ |
|
6789 | 1158 |
^ (mClass superclass whichClassIncludesSelector:aMethod selector) notNil. |
5591 | 1159 |
]. |
1160 |
^ false |
|
1161 |
! |
|
1162 |
||
1163 |
methodIsRedefinedBelow:aMethod |
|
1164 |
|mclass subClasses setOfRedefinedSelectors| |
|
1165 |
||
1166 |
mclass := aMethod mclass. |
|
1167 |
mclass isNil ifTrue:[^ false]. |
|
1168 |
||
1169 |
"/ if possible, make use of info prepared by listOfMethodNames |
|
1170 |
classAndSelectorsRedefinedBySubclassesOfClass notNil |
|
1171 |
ifTrue:[ |
|
1172 |
setOfRedefinedSelectors := classAndSelectorsRedefinedBySubclassesOfClass at:mclass ifAbsent:nil. |
|
1173 |
setOfRedefinedSelectors notNil ifTrue:[ |
|
1174 |
^ setOfRedefinedSelectors includes:aMethod selector |
|
1175 |
] |
|
1176 |
]. |
|
1177 |
||
1178 |
lastMethodClass == mclass ifTrue:[ |
|
1179 |
subClasses := lastMethodClassesSubclasses |
|
1180 |
] ifFalse:[ |
|
1181 |
subClasses := aMethod mclass allSubclasses. |
|
1182 |
lastMethodClassesSubclasses := subClasses. |
|
1183 |
lastMethodClass := mclass. |
|
1184 |
]. |
|
1185 |
^ subClasses contains:[:cls | cls implements:aMethod selector]. |
|
1186 |
! |
|
1187 |
||
1188 |
redefinedOrInheritedIconFor:aMethod |
|
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1189 |
|inherited redefined subclassResponsibility| |
5591 | 1190 |
|
1191 |
inherited := self methodIsInheritedFromAbove:aMethod. |
|
1192 |
redefined := self methodIsRedefinedBelow:aMethod. |
|
1193 |
||
1194 |
inherited ifTrue:[ |
|
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1195 |
redefined ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1196 |
^ self methodInheritedFromAboveAndRedefinedBelowIcon. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1197 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1198 |
^ self methodInheritedFromAboveIcon. |
5591 | 1199 |
]. |
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1200 |
|
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1201 |
subclassResponsibility := aMethod sends:#subclassResponsibility. |
5591 | 1202 |
redefined ifTrue:[ |
5761
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1203 |
subclassResponsibility ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1204 |
^ self methodIsSubclassResponsibilityAndRedefinedBelowIcon. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1205 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1206 |
^ self methodRedefinedBelowIcon. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1207 |
]. |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1208 |
subclassResponsibility ifTrue:[ |
b350e042dc9f
Icons for subclassResponsibility and deprecated methods
Stefan Vogel <sv@exept.de>
parents:
5591
diff
changeset
|
1209 |
^ self methodIsSubclassResponsibilityIcon. |
5591 | 1210 |
]. |
1211 |
||
1212 |
^ self methodEmptyInheritedIcon |
|
1213 |
! |
|
1214 |
||
1215 |
release |
|
1216 |
super release. |
|
1217 |
||
1218 |
filterClassVars removeDependent:self. |
|
1219 |
selectedMethodNameIndices removeDependent:self. |
|
1220 |
showMethodInheritance removeDependent:self. |
|
1221 |
variableFilter removeDependent:self. |
|
1222 |
! |
|
1223 |
||
1224 |
resourceIconForMethod:aMethod |
|
6903 | 1225 |
^ SystemBrowser resourceIconForMethod:aMethod |
5591 | 1226 |
|
6903 | 1227 |
"Modified: / 17-08-2006 / 09:09:01 / cg" |
5591 | 1228 |
! |
1229 |
||
1230 |
setOfAllSelectorsImplementedBelow:aClass |
|
1231 |
|set| |
|
1232 |
||
1233 |
set := IdentitySet new. |
|
1234 |
aClass allSubclassesDo:[:eachSubclass | |
|
1235 |
set addAll:(eachSubclass methodDictionary keys). |
|
1236 |
]. |
|
1237 |
^ set |
|
1238 |
! |
|
1239 |
||
1240 |
updateList |
|
1241 |
|prevSelection newList newSelection newSelIdx reverseMap sameContents newListSize oldListSize |
|
1242 |
prevClasses methodSet selectedMethodsHolder| |
|
1243 |
||
1244 |
selectedMethodsHolder := self selectedMethods. |
|
1245 |
prevSelection := selectedMethodsHolder value ? #(). |
|
1246 |
||
1247 |
prevClasses := classes ifNil:[ #() ] ifNotNil:[ classes copy ]. |
|
1248 |
||
1249 |
oldListSize := self browserNameList size. |
|
1250 |
||
1251 |
"/ self topApplication withWaitCursorDo:[ |
|
7702 | 1252 |
newList := self listOfMethodNames. |
1253 |
newListSize := newList size. |
|
1254 |
sameContents := self updateListFor:newList. |
|
5591 | 1255 |
|
7702 | 1256 |
sameContents ifFalse:[ |
5591 | 1257 |
"/ self browserNameList value:newList. |
1258 |
||
7702 | 1259 |
(prevSelection size == 0 |
1260 |
and:[selectedMethodsHolder value size ~~ 0]) ifTrue:[ |
|
1261 |
"/ this happens during early startup time, |
|
1262 |
"/ when the selection is already (pre-)set, |
|
1263 |
"/ and the methodList is generated the first time |
|
1264 |
"/ (i.e. when opened with preset selection |
|
5591 | 1265 |
|
7702 | 1266 |
"/ do not clobber the selection in this case. |
1267 |
prevSelection := selectedMethodsHolder value. |
|
1268 |
]. |
|
5591 | 1269 |
|
7702 | 1270 |
(methodList size == 0 or:[prevSelection size == 0]) ifTrue:[ |
1271 |
newSelection := #() |
|
1272 |
] ifFalse:[ |
|
1273 |
methodSet := methodList. |
|
5591 | 1274 |
|
7702 | 1275 |
"/ inclusion test is much faster with sets, if the number of items is large |
1276 |
methodList size > 30 ifTrue:[ |
|
1277 |
"/ however, only if its worth building the set ... |
|
1278 |
prevSelection size > 5 ifTrue:[ |
|
1279 |
methodSet := methodSet asIdentitySet. |
|
1280 |
] |
|
1281 |
]. |
|
1282 |
newSelection := prevSelection select:[:item | methodSet includesIdentical:item]. |
|
1283 |
]. |
|
1284 |
newSelection size > 0 ifTrue:[ |
|
1285 |
newSelection size > 100 ifTrue:[ |
|
1286 |
"/ need selection indices - might be expensive if done straight forward... |
|
1287 |
reverseMap := IdentityDictionary new. |
|
1288 |
methodList keysAndValuesDo:[:idx :mthd | reverseMap at:mthd put:idx]. |
|
1289 |
newSelIdx := newSelection collect:[:mthd | reverseMap at:mthd]. |
|
1290 |
] ifFalse:[ |
|
1291 |
newSelIdx := newSelection collect:[:mthd | methodList identityIndexOf:mthd] |
|
1292 |
]. |
|
5591 | 1293 |
"/ self halt. |
7702 | 1294 |
"/ force change (for dependents) |
1295 |
newSelIdx ~= selectedMethodNameIndices value ifTrue:[ |
|
1296 |
selectedMethodNameIndices value:newSelIdx. |
|
1297 |
]. |
|
1298 |
] ifFalse:[ |
|
1299 |
lastSelectedMethods := selectedMethodsHolder value. |
|
1300 |
lastSelectedMethods notNil ifTrue:[ |
|
1301 |
lastSelectedMethods := lastSelectedMethods asOrderedCollection |
|
1302 |
]. |
|
1303 |
selectedMethodNameIndices value size > 0 ifTrue:[ |
|
1304 |
selectedMethodNameIndices value:#(). |
|
1305 |
] |
|
1306 |
]. |
|
5591 | 1307 |
|
7702 | 1308 |
newSelection ~= prevSelection ifTrue:[ |
1309 |
self selectionChanged. |
|
1310 |
] |
|
1311 |
] ifTrue:[ |
|
1312 |
"/ same list - but classes might have changed |
|
1313 |
"/ that is the case, if the class selection has been changed, |
|
1314 |
"/ to another class which has the same categories. |
|
5591 | 1315 |
|
7702 | 1316 |
(prevClasses size ~= classes size |
1317 |
or:[prevClasses asOrderedCollection ~= (classes ? #()) asOrderedCollection ]) ifTrue:[ |
|
1318 |
(newListSize > 0 or:[oldListSize > 0]) ifTrue:[ |
|
1319 |
self selectionChanged. |
|
1320 |
] |
|
1321 |
] |
|
1322 |
] |
|
5591 | 1323 |
"/ ]. |
1324 |
||
7702 | 1325 |
"Modified: / 05-03-2007 / 16:07:24 / cg" |
5591 | 1326 |
! |
1327 |
||
1328 |
updateListEntryFor:aMethod |
|
1329 |
"update my list for a single method. |
|
1330 |
(used when a single methods package, code or whatever changes, and a full udpate |
|
1331 |
would be too slow)" |
|
1332 |
||
1333 |
|s idx| |
|
1334 |
||
1335 |
s := self |
|
6268 | 1336 |
listEntryForMethod:aMethod |
1337 |
selector:aMethod selector |
|
1338 |
class:aMethod mclass |
|
1339 |
showClass:lastShowClass |
|
1340 |
showCategory:lastShowCategory |
|
1341 |
classFirst:lastShowClassFirst. |
|
5591 | 1342 |
|
1343 |
idx := methodList identityIndexOf:aMethod. |
|
1344 |
idx == 0 ifTrue:[ |
|
6268 | 1345 |
aMethod isWrapped ifTrue:[ |
1346 |
idx := methodList identityIndexOf:aMethod originalMethod. |
|
1347 |
] |
|
5591 | 1348 |
]. |
1349 |
idx == 0 ifTrue:[ |
|
6268 | 1350 |
self invalidateList |
5591 | 1351 |
] ifFalse:[ |
6268 | 1352 |
self browserNameList at:idx put:s. |
5591 | 1353 |
] |
1354 |
! ! |
|
1355 |
||
6271 | 1356 |
!MethodList methodsFor:'private-presentation'! |
1357 |
||
1358 |
listEntryForMethod:aMethod selector:selector class:cls showClass:showClass showCategory:showCategory classFirst:showClassFirst |
|
1359 |
"answer a method list entry |
|
1360 |
gimmics: |
|
1361 |
adding a little image to breakPointed methods, |
|
1362 |
inheritance indicators, |
|
1363 |
highlight accessors of variable" |
|
1364 |
||
1365 |
|clsName s icn variablesToHighlight classVarsToHighLight |
|
6278 | 1366 |
doHighLight doHighLightRed emp cat l redefIcon |
7502 | 1367 |
metrics complexity complexityString complexityIcon mark| |
6271 | 1368 |
|
1369 |
aMethod isAssociation ifTrue:[ |
|
1370 |
self halt:'should not happen'. |
|
1371 |
]. |
|
1372 |
||
1373 |
s := aMethod printStringForBrowserWithSelector:selector inClass:cls. |
|
1374 |
showClassFirst ifTrue:[ |
|
1375 |
clsName := cls nameInBrowser. |
|
1376 |
s := clsName , ' ' , s allBold |
|
1377 |
]. |
|
1378 |
||
1379 |
"/ |
|
1380 |
"/ wrap icons (i.e. break- or trace points) |
|
1381 |
"/ have higher prio ... |
|
1382 |
"/ |
|
1383 |
aMethod isWrapped ifTrue:[ |
|
1384 |
(s endsWith:' !!') ifTrue:[ |
|
1385 |
s := s copyWithoutLast:2 |
|
1386 |
]. |
|
1387 |
aMethod isBreakpointed ifTrue:[ |
|
1388 |
icn := self stopIcon |
|
1389 |
] ifFalse:[ |
|
1390 |
aMethod isTimed ifTrue:[ |
|
1391 |
icn := self timeIcon |
|
1392 |
] ifFalse:[ |
|
1393 |
icn := self traceIcon |
|
1394 |
] |
|
1395 |
]. |
|
1396 |
]. |
|
7994 | 1397 |
InstrumentingCompiler notNil ifTrue:[ |
1398 |
(InstrumentingCompiler isInstrumented:aMethod) ifTrue:[ |
|
1399 |
icn := self instrumentationIcon |
|
1400 |
] |
|
1401 |
]. |
|
6271 | 1402 |
|
1403 |
icn isNil ifTrue:[ |
|
8198 | 1404 |
self showImageResourceMethodsImages value ~~ false ifTrue:[ |
8474 | 1405 |
(aMethod hasResource:#image) ifTrue:[ |
1406 |
aMethod mclass isMeta ifTrue:[ |
|
1407 |
icn := aMethod valueWithReceiver:nil arguments:nil . |
|
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1408 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1409 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1410 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1411 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1412 |
|
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1413 |
icn isNil ifTrue:[ |
6271 | 1414 |
showMethodTypeIcon value ~~ false ifTrue:[ |
1415 |
icn := self resourceIconForMethod:aMethod. |
|
1416 |
]. |
|
1417 |
icn isNil ifTrue:[ |
|
1418 |
aMethod isProtected ifTrue:[ |
|
1419 |
icn := self protectedMethodIcon |
|
1420 |
] ifFalse:[ |
|
1421 |
aMethod isPrivate ifTrue:[ |
|
1422 |
icn := self privateMethodIcon |
|
1423 |
] ifFalse:[ |
|
1424 |
(aMethod isIgnored) ifTrue:[ |
|
1425 |
icn := self ignoredMethodIcon |
|
1426 |
] ifFalse:[ |
|
1427 |
(aMethod isJavaMethod and:[aMethod isAbstract]) ifTrue:[ |
|
1428 |
icn := self abstractMethodIcon |
|
1429 |
] |
|
1430 |
] |
|
1431 |
] |
|
1432 |
]. |
|
1433 |
]. |
|
1434 |
]. |
|
1435 |
icn isNil ifTrue:[ |
|
1436 |
(selector startsWith:'test') ifTrue:[ |
|
1437 |
((cls isSubclassOf:TestCase) |
|
1438 |
and:[cls isAbstract not]) ifTrue:[ |
|
1439 |
cls lastTestRunResultOrNil == false ifTrue:[ |
|
1440 |
(cls testSelectorFailed:selector) ifTrue:[ |
|
1441 |
icn := SystemBrowser testCaseFailedIcon |
|
1442 |
] ifFalse:[ |
|
1443 |
"/ icn := SystemBrowser testCasePassedIcon |
|
1444 |
]. |
|
1445 |
] |
|
1446 |
]. |
|
1447 |
] |
|
1448 |
]. |
|
1449 |
||
1450 |
showClass ifTrue:[ |
|
1451 |
showClassFirst ifFalse:[ |
|
1452 |
s := s , ' [' , cls name allBold , ']'. |
|
1453 |
] |
|
1454 |
]. |
|
1455 |
showCategory ifTrue:[ |
|
1456 |
cat := aMethod category. |
|
1457 |
cat notNil ifTrue:[ |
|
1458 |
s := s , ' {' , cat "asText allItalic" , '}' |
|
1459 |
] |
|
1460 |
]. |
|
6841
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1461 |
(ChangeSet current includesChangeForClass:cls selector:selector) ifTrue:[ |
7502 | 1462 |
mark := self class markForBeingInChangeList. |
1463 |
mark := self colorizeForChangedCode:mark. |
|
1464 |
s := s , mark. |
|
1465 |
"/ s := self colorizeForChangedCode:s. |
|
1466 |
]. |
|
1467 |
||
1468 |
(SmallTeam notNil and:[SmallTeam includesChangeForClass:cls selector:selector]) ifTrue:[ |
|
1469 |
s := (self colorizeForChangedCodeInSmallTeam:'!! '),s |
|
6841
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1470 |
]. |
6271 | 1471 |
|
1472 |
variablesToHighlight := variableFilter value. |
|
1473 |
variablesToHighlight size > 0 ifTrue:[ |
|
1474 |
classVarsToHighLight := filterClassVars value. |
|
1475 |
classVarsToHighLight ifTrue:[ |
|
1476 |
doHighLight := self method:aMethod includesRefsToClassVariable:variablesToHighlight. |
|
1477 |
doHighLight ifTrue:[ |
|
1478 |
doHighLightRed := self method:aMethod includesModsOfClassVariable:variablesToHighlight. |
|
1479 |
]. |
|
1480 |
] ifFalse:[ |
|
1481 |
doHighLight := self method:aMethod includesRefsToInstanceVariable:variablesToHighlight. |
|
1482 |
doHighLight ifTrue:[ |
|
1483 |
doHighLightRed := self method:aMethod includesModsOfInstanceVariable:variablesToHighlight |
|
1484 |
] |
|
1485 |
]. |
|
1486 |
doHighLight ifTrue:[ |
|
1487 |
s := s allBold. |
|
1488 |
doHighLightRed ifTrue:[ |
|
1489 |
emp := (UserPreferences current emphasisForWrittenVariable) |
|
1490 |
] ifFalse:[ |
|
1491 |
emp := (UserPreferences current emphasisForReadVariable) |
|
1492 |
]. |
|
1493 |
s := s emphasisAllAdd:emp |
|
1494 |
] |
|
1495 |
]. |
|
1496 |
||
6694 | 1497 |
(showMethodComplexity value == true |
6271 | 1498 |
and:[ OOM::MethodMetrics notNil ]) ifTrue:[ |
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1499 |
icn isNil ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1500 |
metrics := OOM::MethodMetrics forMethod:aMethod. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1501 |
complexity := metrics complexity ? 0. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1502 |
complexityIcon := OOM::MethodMetrics iconForComplexity:complexity. |
6271 | 1503 |
|
8197
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1504 |
ShowComplexityValue == true ifTrue:[ |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1505 |
complexityString := '{' , complexity printString , '}'. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1506 |
s := complexityString , ' ' , s. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1507 |
]. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1508 |
"/ icn := icn ? complexityIcon. |
3b1c5bd94fdd
preps for showResourceImages
Claus Gittinger <cg@exept.de>
parents:
7994
diff
changeset
|
1509 |
s := LabelAndIcon icon:complexityIcon string:s. |
6271 | 1510 |
]. |
1511 |
]. |
|
1512 |
||
1513 |
showMethodInheritance value ~~ false ifTrue:[ |
|
1514 |
redefIcon := self redefinedOrInheritedIconFor:aMethod. |
|
1515 |
]. |
|
1516 |
||
1517 |
(icn notNil or:[redefIcon notNil]) ifTrue:[ |
|
1518 |
l := LabelAndIcon icon:redefIcon string:s. |
|
1519 |
l image:icn. |
|
1520 |
l gap:2. |
|
1521 |
^ l |
|
1522 |
]. |
|
1523 |
^ s |
|
1524 |
||
6841
6d72f92ed6cd
mark changed methods with a '*'
Claus Gittinger <cg@exept.de>
parents:
6789
diff
changeset
|
1525 |
"Created: / 22-10-1996 / 19:51:00 / cg" |
7502 | 1526 |
"Modified: / 10-11-2006 / 17:51:30 / cg" |
6271 | 1527 |
! ! |
1528 |
||
5591 | 1529 |
!MethodList methodsFor:'private-watching'! |
1530 |
||
1531 |
startWatchProcess |
|
1532 |
updateProcess notNil ifTrue:[ |
|
1533 |
^ self |
|
1534 |
]. |
|
1535 |
updateProcess := [ |
|
1536 |
[true] whileTrue:[ |
|
1537 |
Delay waitForSeconds:1. |
|
1538 |
self enqueueDelayedUpdateList |
|
1539 |
] |
|
1540 |
] fork. |
|
1541 |
! |
|
1542 |
||
1543 |
stopWatchProcess |
|
1544 |
|p| |
|
1545 |
||
1546 |
(p := updateProcess) notNil ifTrue:[ |
|
1547 |
updateProcess := nil. |
|
1548 |
p terminate |
|
1549 |
]. |
|
1550 |
! ! |
|
1551 |
||
1552 |
!MethodList methodsFor:'setup'! |
|
1553 |
||
1554 |
postBuildWith:aBuilder |
|
1555 |
|methodListView| |
|
1556 |
||
1557 |
super postBuildWith:aBuilder. |
|
1558 |
||
1559 |
methodListView := aBuilder componentAt:'List'. |
|
1560 |
methodListView notNil ifTrue:[ |
|
6277 | 1561 |
methodListView allowDrag:true. |
1562 |
methodListView dragObjectConverter:[:obj | |
|
1563 |
|nm method idx| |
|
5591 | 1564 |
|
6277 | 1565 |
nm := obj theObject asString string string. |
1566 |
idx := browserNameList value findFirst:[:item | item string string = nm]. |
|
1567 |
method := methodList value at:idx. |
|
1568 |
DropObject newMethod:method. |
|
1569 |
]. |
|
5591 | 1570 |
] |
1571 |
! ! |
|
1572 |
||
1573 |
!MethodList class methodsFor:'documentation'! |
|
1574 |
||
1575 |
version |
|
8596 | 1576 |
^ '$Header: /cvs/stx/stx/libtool/Tools_MethodList.st,v 1.34 2009-05-01 17:37:13 cg Exp $' |
5591 | 1577 |
! ! |