author | Claus Gittinger <cg@exept.de> |
Mon, 08 Aug 2011 18:28:30 +0200 | |
changeset 10550 | a57b8a71a061 |
parent 10495 | 756e95b937cb |
child 10871 | f3a06b214071 |
permissions | -rw-r--r-- |
5591 | 1 |
" |
2 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5592 | 12 |
"{ Package: 'stx:libtool' }" |
5591 | 13 |
|
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
BrowserList subclass:#VariableList |
|
10255 | 17 |
instanceVariableNames:'variableList classHolder showClassVars sortVariablesByName |
18 |
selectedVariableEntries showWarningAboutMissingEntryInXmlSpec' |
|
5591 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'Interface-Browsers-New' |
|
22 |
! |
|
23 |
||
10255 | 24 |
Object subclass:#VariableEntry |
25 |
instanceVariableNames:'application class name icon' |
|
26 |
classVariableNames:'' |
|
27 |
poolDictionaries:'' |
|
28 |
privateIn:VariableList |
|
29 |
! |
|
30 |
||
5591 | 31 |
!VariableList class methodsFor:'documentation'! |
32 |
||
33 |
copyright |
|
34 |
" |
|
35 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
36 |
All Rights Reserved |
|
37 |
||
38 |
This software is furnished under a license and may be used |
|
39 |
only in accordance with the terms of that license and with the |
|
40 |
inclusion of the above copyright notice. This software may not |
|
41 |
be provided or otherwise made available to, or used by, any |
|
42 |
other person. No title to or ownership of the software is |
|
43 |
hereby transferred. |
|
44 |
" |
|
45 |
! ! |
|
46 |
||
47 |
!VariableList class methodsFor:'interface specs'! |
|
48 |
||
49 |
windowSpec |
|
50 |
"This resource specification was automatically generated |
|
51 |
by the UIPainter of ST/X." |
|
52 |
||
53 |
"Do not manually edit this!! If it is corrupted, |
|
54 |
the UIPainter may not be able to read the specification." |
|
55 |
||
56 |
" |
|
10287 | 57 |
UIPainter new openOnClass:Tools::VariableList andSelector:#windowSpec |
58 |
Tools::VariableList new openInterface:#windowSpec |
|
59 |
Tools::VariableList open |
|
5591 | 60 |
" |
61 |
||
62 |
<resource: #canvas> |
|
63 |
||
64 |
^ |
|
10287 | 65 |
#(FullSpec |
66 |
name: windowSpec |
|
67 |
window: |
|
68 |
(WindowSpec |
|
69 |
label: 'VariableList' |
|
70 |
name: 'VariableList' |
|
71 |
min: (Point 0 0) |
|
72 |
bounds: (Rectangle 0 0 300 300) |
|
9461 | 73 |
) |
10287 | 74 |
component: |
75 |
(SpecCollection |
|
76 |
collection: ( |
|
77 |
(SequenceViewSpec |
|
78 |
name: 'List' |
|
79 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
80 |
tabable: true |
|
81 |
model: selectedVariableEntries |
|
82 |
menu: menuHolder |
|
83 |
hasHorizontalScrollBar: true |
|
84 |
hasVerticalScrollBar: true |
|
85 |
miniScrollerHorizontal: true |
|
86 |
isMultiSelect: true |
|
87 |
valueChangeSelector: selectionChangedByClick |
|
88 |
useIndex: false |
|
89 |
sequenceList: variableList |
|
90 |
doubleClickChannel: doubleClickChannel |
|
9461 | 91 |
) |
92 |
) |
|
5591 | 93 |
|
9461 | 94 |
) |
5591 | 95 |
) |
96 |
! ! |
|
97 |
||
98 |
!VariableList class methodsFor:'plugIn spec'! |
|
99 |
||
100 |
aspectSelectors |
|
101 |
"This resource specification was automatically generated |
|
102 |
by the UIPainter of ST/X." |
|
103 |
||
104 |
"Do not manually edit this. If it is corrupted, |
|
105 |
the UIPainter may not be able to read the specification." |
|
106 |
||
107 |
"Return a description of exported aspects; |
|
108 |
these can be connected to aspects of an embedding application |
|
109 |
(if this app is embedded in a subCanvas)." |
|
110 |
||
111 |
^ #( |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
112 |
#(#doubleClickChannel #action ) |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
113 |
#classHolder |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
114 |
#forceGeneratorTrigger |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
115 |
#immediateUpdate |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
116 |
#inGeneratorHolder |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
117 |
#menuHolder |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
118 |
#outGeneratorHolder |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
119 |
#packageFilter |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
120 |
#selectedVariables |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
121 |
#selectionChangeCondition |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
122 |
#updateTrigger |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
123 |
#showClassVarsInVariableList |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
124 |
#slaveMode |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
125 |
#sortVariablesByName |
5591 | 126 |
). |
127 |
! ! |
|
128 |
||
129 |
!VariableList methodsFor:'aspects'! |
|
130 |
||
131 |
classHolder |
|
132 |
classHolder isNil ifTrue:[ |
|
133 |
classHolder := #() asValue. |
|
134 |
classHolder addDependent:self |
|
135 |
]. |
|
136 |
^ classHolder |
|
137 |
! |
|
138 |
||
139 |
classHolder:aValueHolder |
|
140 |
classHolder notNil ifTrue:[ |
|
10308 | 141 |
classHolder removeDependent:self |
5591 | 142 |
]. |
143 |
classHolder := aValueHolder. |
|
144 |
classHolder notNil ifTrue:[ |
|
10308 | 145 |
classHolder isBehavior ifTrue:[self error:'should not happen']. |
146 |
classHolder addDependent:self |
|
5591 | 147 |
]. |
10308 | 148 |
|
149 |
"Modified: / 11-07-2011 / 17:04:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5591 | 150 |
! |
151 |
||
152 |
defaultSlaveModeValue |
|
153 |
^ false. |
|
154 |
! |
|
155 |
||
10255 | 156 |
selectedVariableEntries |
157 |
<resource: #uiAspect> |
|
158 |
||
159 |
"automatically generated by UIPainter ..." |
|
160 |
||
161 |
"*** the code below creates a default model when invoked." |
|
162 |
"*** (which may not be the one you wanted)" |
|
163 |
"*** Please change as required and accept it in the browser." |
|
164 |
"*** (and replace this comment by something more useful ;-)" |
|
165 |
||
166 |
selectedVariableEntries isNil ifTrue:[ |
|
167 |
selectedVariableEntries := #() asValue. |
|
168 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
169 |
selectedVariableEntries addDependent:self. |
|
170 |
"/ selectedVariableEntries onChangeSend:#selectedVariableEntriesChanged to:self. |
|
171 |
]. |
|
172 |
^ selectedVariableEntries. |
|
173 |
||
174 |
"Modified: / 12-04-2011 / 15:49:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
175 |
! |
|
176 |
||
5591 | 177 |
selectedVariables |
178 |
^ self selectionHolder |
|
179 |
||
180 |
! |
|
181 |
||
182 |
selectedVariables:aValueHolder |
|
183 |
^ self selectionHolder:aValueHolder |
|
184 |
||
185 |
! |
|
186 |
||
187 |
showClassVarsInVariableList |
|
188 |
showClassVars isNil ifTrue:[ |
|
189 |
showClassVars := false asValue. |
|
190 |
showClassVars addDependent:self |
|
191 |
]. |
|
192 |
^ showClassVars |
|
193 |
! |
|
194 |
||
195 |
showClassVarsInVariableList:aValueHolder |
|
196 |
showClassVars notNil ifTrue:[ |
|
197 |
showClassVars removeDependent:self |
|
198 |
]. |
|
199 |
showClassVars := aValueHolder. |
|
200 |
showClassVars notNil ifTrue:[ |
|
201 |
showClassVars addDependent:self |
|
202 |
]. |
|
203 |
! |
|
204 |
||
205 |
showingInheritedClassVars |
|
206 |
^ false |
|
207 |
"/ ^ true |
|
208 |
! |
|
209 |
||
210 |
sortVariablesByName |
|
211 |
sortVariablesByName isNil ifTrue:[ |
|
212 |
sortVariablesByName := false asValue. |
|
213 |
sortVariablesByName addDependent:self |
|
214 |
]. |
|
215 |
^ sortVariablesByName |
|
216 |
! |
|
217 |
||
218 |
sortVariablesByName:aValueHolder |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
219 |
"/ self assert:(aValueHolder value isBoolean). |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
220 |
|
5591 | 221 |
sortVariablesByName notNil ifTrue:[ |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
222 |
sortVariablesByName removeDependent:self |
5591 | 223 |
]. |
224 |
sortVariablesByName := aValueHolder. |
|
225 |
sortVariablesByName notNil ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
226 |
sortVariablesByName addDependent:self |
5591 | 227 |
]. |
228 |
! |
|
229 |
||
230 |
variableList |
|
231 |
variableList isNil ifTrue:[ |
|
232 |
variableList := ValueHolder new |
|
233 |
]. |
|
234 |
^ variableList |
|
235 |
||
236 |
||
237 |
! ! |
|
238 |
||
239 |
!VariableList methodsFor:'change & update'! |
|
240 |
||
241 |
delayedUpdate:something with:aParameter from:changedObject |
|
242 |
|selectedClasses changedClass anyChange| |
|
243 |
||
244 |
self inSlaveModeOrInvisible ifTrue:[self invalidateList. ^ self]. |
|
245 |
"/ slaveMode value == true ifTrue:[^ self]. |
|
246 |
||
247 |
changedObject == slaveMode ifTrue:[ |
|
248 |
listValid ~~ true ifTrue:[ |
|
249 |
self enqueueDelayedUpdateList |
|
250 |
]. |
|
251 |
"/ self invalidateList. |
|
252 |
^ self |
|
253 |
]. |
|
254 |
||
255 |
changedObject == classHolder ifTrue:[ |
|
256 |
self invalidateList. |
|
257 |
^ self |
|
258 |
]. |
|
259 |
changedObject == showClassVars ifTrue:[ |
|
260 |
self invalidateList. |
|
261 |
^ self. |
|
262 |
]. |
|
263 |
changedObject == sortVariablesByName ifTrue:[ |
|
264 |
self invalidateList. |
|
265 |
^ self. |
|
266 |
]. |
|
267 |
changedObject == Smalltalk ifTrue:[ |
|
268 |
(something == #classDefinition |
|
269 |
or:[something == #classVariables and:[showClassVars value == true]]) |
|
270 |
ifTrue:[ |
|
271 |
changedClass := aParameter. |
|
272 |
selectedClasses := classHolder value. |
|
273 |
selectedClasses notNil ifTrue:[ |
|
274 |
selectedClasses isSequenceable ifFalse:[ |
|
275 |
selectedClasses := selectedClasses asOrderedCollection |
|
276 |
]. |
|
277 |
selectedClasses keysAndValuesDo:[:idx :cls | |nm| |
|
278 |
cls notNil ifTrue:[ |
|
279 |
cls isObsolete ifTrue:[ |
|
280 |
cls isMeta ifTrue:[ |
|
281 |
nm := cls theNonMetaclass name. |
|
282 |
selectedClasses at:idx put:(Smalltalk at:nm) class. |
|
283 |
] ifFalse:[ |
|
284 |
nm := cls name. |
|
285 |
selectedClasses at:idx put:(Smalltalk at:nm). |
|
286 |
]. |
|
287 |
anyChange := true. |
|
288 |
] ifFalse:[ |
|
289 |
(cls == aParameter |
|
290 |
or:[something == #classVariables |
|
291 |
and:[showClassVars value == true |
|
292 |
and:[cls theNonMetaclass == aParameter theNonMetaclass]]]) ifTrue:[ |
|
293 |
anyChange := true. |
|
294 |
] |
|
295 |
] |
|
296 |
] |
|
297 |
]. |
|
298 |
(selectedClasses includes:nil) ifTrue:[ |
|
299 |
"/ can happen, if a selected class is removed... |
|
300 |
"/ self halt:'should this happen ?'. |
|
301 |
"/ fix it ... |
|
302 |
selectedClasses := selectedClasses select:[:each | each notNil]. |
|
303 |
classHolder value:selectedClasses. |
|
304 |
anyChange := true. |
|
305 |
]. |
|
306 |
anyChange == true ifTrue:[ |
|
307 |
self invalidateList. |
|
308 |
^ self |
|
309 |
]. |
|
310 |
]. |
|
311 |
^ self |
|
312 |
]. |
|
313 |
] ifFalse:[ |
|
314 |
changedObject isBehavior ifTrue:[ |
|
315 |
anyChange := false. |
|
316 |
selectedClasses := classHolder value. |
|
317 |
selectedClasses notNil ifTrue:[ |
|
318 |
selectedClasses keysAndValuesDo:[:idx :cls | |nm| |
|
319 |
cls isObsolete ifTrue:[ |
|
320 |
nm := cls name. |
|
321 |
selectedClasses at:idx put:(Smalltalk at:nm). |
|
322 |
anyChange := true. |
|
323 |
] |
|
324 |
]. |
|
325 |
anyChange == true ifTrue:[ |
|
326 |
self invalidateList. |
|
327 |
^ self |
|
328 |
]. |
|
329 |
||
330 |
(selectedClasses includesIdentical:something) ifTrue:[ |
|
331 |
self invalidateList. |
|
332 |
^ self |
|
333 |
]. |
|
334 |
]. |
|
335 |
^ self |
|
336 |
]. |
|
337 |
]. |
|
338 |
super delayedUpdate:something with:aParameter from:changedObject |
|
339 |
! |
|
340 |
||
341 |
makeDependent |
|
342 |
Smalltalk addDependent:self |
|
343 |
||
344 |
! |
|
345 |
||
346 |
makeIndependent |
|
347 |
Smalltalk removeDependent:self |
|
348 |
||
349 |
! |
|
350 |
||
351 |
selectionChangedByClick |
|
352 |
"we are not interested in that - get another notification |
|
353 |
via the changed valueHolder" |
|
354 |
||
355 |
||
356 |
! |
|
357 |
||
358 |
update:something with:aParameter from:changedObject |
|
359 |
"/ ^ self delayedUpdate:something with:aParameter from:changedObject. |
|
360 |
||
361 |
changedObject == Smalltalk ifTrue:[ |
|
10255 | 362 |
something == #methodDictionary ifTrue:[ |
363 |
^ self |
|
364 |
]. |
|
365 |
something == #methodTrap ifTrue:[ |
|
366 |
^ self |
|
367 |
]. |
|
10366 | 368 |
something == #methodCoverageInfo ifTrue:[ |
369 |
^ self |
|
370 |
]. |
|
10255 | 371 |
something == #methodInClass ifTrue:[ |
372 |
^ self |
|
373 |
]. |
|
374 |
something == #methodInClassRemoved ifTrue:[ |
|
375 |
^ self |
|
376 |
]. |
|
377 |
something == #classComment ifTrue:[ |
|
378 |
^ self. |
|
379 |
]. |
|
5591 | 380 |
]. |
381 |
"/ self window sensor isNil ifTrue:[ |
|
382 |
"/ "/ I am not visible ... |
|
383 |
"/ self invalidateList. |
|
384 |
"/ ^ self |
|
385 |
"/ ]. |
|
10255 | 386 |
changedObject == selectedVariableEntries ifTrue:[ |
387 |
self selectedVariables value: |
|
388 |
((selectedVariableEntries value ? #()) |
|
389 |
collect:[:e|e name]). |
|
390 |
^self. |
|
391 |
]. |
|
392 |
||
393 |
||
5591 | 394 |
super update:something with:aParameter from:changedObject |
395 |
||
10255 | 396 |
"Modified: / 12-04-2011 / 15:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10366 | 397 |
"Modified: / 20-07-2011 / 18:52:44 / cg" |
5591 | 398 |
! ! |
399 |
||
400 |
!VariableList methodsFor:'generators'! |
|
401 |
||
402 |
makeGenerator |
|
403 |
||
404 |
||
405 |
||
406 |
! ! |
|
407 |
||
408 |
!VariableList methodsFor:'private'! |
|
409 |
||
5909 | 410 |
commonPostBuild |
5591 | 411 |
|list| |
412 |
||
5909 | 413 |
super commonPostBuild. |
5591 | 414 |
|
5909 | 415 |
list := builder componentAt:#List. |
5591 | 416 |
list notNil ifTrue:[ |
5909 | 417 |
list selectConditionBlock:[:item | self selectionChangeAllowed:item]. |
418 |
list ignoreReselect:false. |
|
5591 | 419 |
]. |
420 |
! |
|
421 |
||
422 |
commonSubClassIn:classes |
|
423 |
"return true if there is a common subclass" |
|
424 |
||
425 |
|theCommonSubClass "classesByInheritance"| |
|
426 |
||
427 |
theCommonSubClass := nil. |
|
428 |
classes do:[:eachClass | |
|
429 |
theCommonSubClass isNil ifTrue:[ |
|
430 |
theCommonSubClass := eachClass |
|
431 |
] ifFalse:[ |
|
432 |
(eachClass isSubclassOf:theCommonSubClass) ifTrue:[ |
|
433 |
theCommonSubClass := eachClass |
|
434 |
] ifFalse:[ |
|
435 |
(theCommonSubClass isSubclassOf:eachClass) ifFalse:[ |
|
436 |
^ nil |
|
437 |
] |
|
438 |
] |
|
439 |
] |
|
440 |
]. |
|
441 |
^ theCommonSubClass. |
|
442 |
||
443 |
"/ classesByInheritance := classes topologicalSort:[:a :b | a isSubclassOf:b]. |
|
444 |
"/ classesByInheritance keysAndValuesDo:[:index :eachClass | |
|
445 |
"/ "/ all classes after that one must be superclasses ... |
|
446 |
"/ classesByInheritance from:index+1 to:classesByInheritance size do:[:otherClass | |
|
447 |
"/ (eachClass isSubclassOf:otherClass) ifFalse:[ |
|
448 |
"/ ^ nil. |
|
449 |
"/ ] |
|
450 |
"/ ]. |
|
451 |
"/ ]. |
|
452 |
"/ ^ classesByInheritance first |
|
453 |
! |
|
454 |
||
10324
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
455 |
iconInBrowserForVariable:varName in:aClass |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
456 |
"variables for which an entry is found in the xml-spec (if any) are marked |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
457 |
with an <xml>-icon." |
10255 | 458 |
|
10324
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
459 |
(Expecco::ExpeccoXMLDecoder notNil |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
460 |
and:[aClass canUnderstand: #xmlSpecFor:]) ifTrue:[ |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
461 |
Error handle:[:ex | |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
462 |
] do:[ |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
463 |
(Expecco::ExpeccoXMLDecoder xmlSpecForObject:aClass basicNew) |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
464 |
do:[:spec | spec getter = varName ifTrue:[ |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
465 |
^ SystemBrowser instVarOverlayXmlSpec |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
466 |
] |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
467 |
]. |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
468 |
]. |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
469 |
]. |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
470 |
^ nil |
10255 | 471 |
|
472 |
"Created: / 12-04-2011 / 19:58:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10324
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
473 |
"Modified: / 15-07-2011 / 18:32:47 / cg" |
10255 | 474 |
! |
475 |
||
476 |
listEntryForClass: cls name:name |
|
477 |
||
478 |
" (showWarningAboutMissingEntryInXmlSpec not |
|
479 |
and:[Expecco::ExpeccoXMLDecoder notNil |
|
480 |
and:[cls canUnderstand: #xmlSpecFor:]]) ifTrue: |
|
481 |
[| hasSpecEntry | |
|
482 |
hasSpecEntry := false. |
|
483 |
(Expecco::ExpeccoXMLDecoder xmlSpecForObject:cls basicNew) |
|
484 |
do:[:spec|spec getter = name ifTrue: |
|
485 |
[ |
|
486 |
hasSpecEntry := true]]. |
|
487 |
showWarningAboutMissingEntryInXmlSpec := hasSpecEntry not]. " |
|
488 |
||
489 |
^VariableEntry application: self class: cls name: name |
|
490 |
||
491 |
"Created: / 12-04-2011 / 15:41:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
492 |
"Modified: / 12-04-2011 / 21:36:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
493 |
! |
|
494 |
||
5591 | 495 |
listOfVariables |
496 |
|nameList numClasses classes class commonSubclass showingClassVars |
|
10550 | 497 |
sortByName classesAlreadyProcessed| |
5591 | 498 |
|
499 |
classHolder isNil ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
500 |
"/ testing |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
501 |
^ #() |
5591 | 502 |
]. |
503 |
||
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
504 |
showingClassVars := self showClassVarsInVariableList value == true. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
505 |
sortByName := self sortVariablesByName value. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
506 |
"/ self assert:(sortByName isBoolean). |
5591 | 507 |
|
508 |
classes := classHolder value. |
|
509 |
(numClasses := classes size) == 0 ifTrue:[^ #() ]. |
|
510 |
numClasses > 1 ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
511 |
"/ multiple classes - see if there is a common subclass ... |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
512 |
commonSubclass := self commonSubClassIn:classes. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
513 |
commonSubclass notNil ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
514 |
"/ yes - treat like a single class |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
515 |
classes := Array with:(commonSubclass). |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
516 |
numClasses := 1. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
517 |
]. |
5591 | 518 |
]. |
519 |
||
520 |
numClasses > 1 ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
521 |
"/ multiple classes - sort alphabetically ... |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
522 |
"/ unless there is a common subclass ... |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
523 |
nameList := Set new. |
10550 | 524 |
classesAlreadyProcessed := IdentitySet new. |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
525 |
classes do:[:class | |
10550 | 526 |
(classesAlreadyProcessed includes:class) ifFalse:[ |
527 |
showingClassVars ifTrue:[ |
|
528 |
self showingInheritedClassVars ifTrue:[ |
|
529 |
class theNonMetaclass withAllSuperclassesDo:[:cls| |
|
530 |
(classesAlreadyProcessed includes:cls) ifFalse:[ |
|
531 |
nameList addAll: |
|
532 |
(cls classVarNames collect:[:nm|self listEntryForClass: cls name: nm]). |
|
533 |
classesAlreadyProcessed add:cls. |
|
534 |
] |
|
535 |
] |
|
536 |
] ifFalse:[ |
|
10255 | 537 |
nameList addAll: |
10550 | 538 |
(class classVarNames collect:[:nm|self listEntryForClass: class name: nm]) |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
539 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
540 |
] ifFalse:[ |
10550 | 541 |
class withAllSuperclassesDo:[:cls| |
542 |
(classesAlreadyProcessed includes:cls) ifFalse:[ |
|
543 |
nameList addAll: |
|
544 |
(cls classVarNames collect:[:nm|self listEntryForClass: cls name: nm]). |
|
545 |
classesAlreadyProcessed add:cls. |
|
546 |
] |
|
547 |
] |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
548 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
549 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
550 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
551 |
nameList := nameList asOrderedCollection. |
5591 | 552 |
] ifFalse:[ |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
553 |
"/ only a single class - sort by inheritance |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
554 |
class := classes first. |
5591 | 555 |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
556 |
nameList := OrderedCollection new. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
557 |
class notNil ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
558 |
showingClassVars ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
559 |
class := class theNonMetaclass |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
560 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
561 |
class withAllSuperclassesDo:[:cls| |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
562 |
|varNames| |
5591 | 563 |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
564 |
varNames := showingClassVars ifTrue:[ cls classVarNames ] ifFalse:[ cls instVarNames ]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
565 |
varNames copy reverse do:[:varName| |
10255 | 566 |
nameList addFirst: (self listEntryForClass: cls name: varName). |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
567 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
568 |
sortByName ifFalse:[ |
10255 | 569 |
nameList addFirst:(("'----- ' , "cls nameInBrowser" , ' -----'") asText colorizeAllWith: Color gray). |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
570 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
571 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
572 |
]. |
5591 | 573 |
]. |
574 |
||
575 |
(numClasses > 1 or:[sortByName]) ifTrue:[ |
|
10255 | 576 |
nameList := nameList asSortedCollection:[:a :b|a name < b name]. |
5591 | 577 |
]. |
578 |
^ nameList |
|
579 |
||
10255 | 580 |
"Created: / 05-02-2000 / 13:42:11 / cg" |
581 |
"Modified: / 28-04-2011 / 13:18:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10550 | 582 |
"Modified: / 08-08-2011 / 16:20:58 / cg" |
5591 | 583 |
! |
584 |
||
585 |
postBuildWith:aBuilder |
|
586 |
|listView| |
|
587 |
||
588 |
(listView := aBuilder componentAt:#List) notNil ifTrue:[ |
|
589 |
listView scrollWhenUpdating:#end |
|
590 |
]. |
|
591 |
super postBuildWith:aBuilder |
|
592 |
||
593 |
! |
|
594 |
||
595 |
release |
|
596 |
super release. |
|
597 |
||
598 |
classHolder removeDependent:self. |
|
599 |
showClassVars removeDependent:self. |
|
600 |
! |
|
601 |
||
602 |
selectionChangeAllowed:index |
|
10255 | 603 |
|
604 |
| entry | |
|
605 |
^((entry := variableList value at:index) isString" and:[entry startsWith:'---']") not. |
|
606 |
||
607 |
"Modified: / 28-04-2011 / 13:18:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5591 | 608 |
! |
609 |
||
610 |
updateList |
|
611 |
| prevSelection newSelection newList oldList selectedVariablesHolder| |
|
612 |
||
613 |
oldList := self variableList value copy. |
|
10255 | 614 |
showWarningAboutMissingEntryInXmlSpec := false. |
5591 | 615 |
newList := self listOfVariables. |
616 |
||
617 |
newList ~= variableList value ifTrue:[ |
|
10495 | 618 |
selectedVariablesHolder := self selectedVariableEntries. |
10255 | 619 |
prevSelection := (selectedVariablesHolder value copy) ? #(). |
620 |
variableList value:newList. |
|
621 |
||
622 |
newSelection := prevSelection select:[:item | newList includes:item]. |
|
5591 | 623 |
|
10255 | 624 |
newSelection size > 0 ifTrue:[ |
625 |
"/ force change (for dependents) |
|
626 |
selectedVariablesHolder value:nil. |
|
627 |
selectedVariablesHolder value:newSelection. |
|
628 |
] ifFalse:[ |
|
629 |
prevSelection := selectedVariablesHolder value. |
|
630 |
selectedVariablesHolder value:nil. |
|
631 |
]. |
|
632 |
(prevSelection size > 0 or:[newSelection size > 0]) ifTrue:[ |
|
633 |
self updateOutputGenerator. |
|
634 |
]. |
|
635 |
]. |
|
636 |
(showWarningAboutMissingEntryInXmlSpec and:[self topApplication respondsTo: #showMessage:]) |
|
637 |
ifTrue: |
|
638 |
[ |
|
639 |
self topApplication showMessage: |
|
640 |
'One or more instance variables are not listed in #xmlSpecFor:'. |
|
641 |
]. |
|
642 |
showWarningAboutMissingEntryInXmlSpec := false. |
|
643 |
listValid := true. |
|
644 |
||
10495 | 645 |
"Modified: / 05-08-2011 / 12:34:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10255 | 646 |
! ! |
647 |
||
648 |
!VariableList::VariableEntry class methodsFor:'instance creation'! |
|
649 |
||
650 |
application: app class: aClass name: aString |
|
651 |
||
652 |
^self new application: app; class: aClass; name: aString |
|
653 |
||
654 |
"Created: / 12-04-2011 / 19:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
655 |
! |
|
656 |
||
657 |
class: aClass name: aString |
|
658 |
||
659 |
^self new class: aClass; name: aString |
|
660 |
||
661 |
"Created: / 12-04-2011 / 15:39:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
662 |
! ! |
|
663 |
||
664 |
!VariableList::VariableEntry methodsFor:'accessing'! |
|
665 |
||
666 |
application: anObject |
|
5591 | 667 |
|
10255 | 668 |
application := anObject |
669 |
||
670 |
"Created: / 12-04-2011 / 19:55:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
671 |
! |
|
672 |
||
10308 | 673 |
asString |
674 |
||
675 |
^self name |
|
676 |
||
677 |
"Created: / 11-07-2011 / 17:03:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
678 |
! |
|
679 |
||
10255 | 680 |
class:aClass |
681 |
class := aClass. |
|
682 |
! |
|
683 |
||
684 |
icon |
|
685 |
||
686 |
icon ifNil:[icon := application iconInBrowserForVariable: name in: class]. |
|
687 |
icon ifNil:[icon := #NOICON]. |
|
688 |
^icon |
|
689 |
||
690 |
"Created: / 12-04-2011 / 15:54:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
691 |
"Modified: / 12-04-2011 / 19:58:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
692 |
! |
|
693 |
||
694 |
klass |
|
695 |
^ class |
|
696 |
||
697 |
"Created: / 12-04-2011 / 19:54:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
698 |
! |
|
699 |
||
700 |
name |
|
701 |
^ name |
|
702 |
! |
|
703 |
||
704 |
name:aString |
|
705 |
name := aString. |
|
706 |
! |
|
707 |
||
708 |
string |
|
709 |
||
710 |
^name |
|
711 |
||
712 |
"Created: / 12-04-2011 / 15:45:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
713 |
! ! |
|
714 |
||
715 |
!VariableList::VariableEntry methodsFor:'displaying'! |
|
716 |
||
717 |
displayOn:aGC x:x y:y opaque: opaque |
|
718 |
||
719 |
| icn | |
|
720 |
icn := self icon. |
|
721 |
icn ~~ #NOICON ifTrue:[ |
|
722 |
icn displayOn:aGC x:x + 1 y:y - icn height. |
|
5591 | 723 |
]. |
10255 | 724 |
^name displayOn:aGC x:x + 20 y:y opaque: opaque |
725 |
||
726 |
"Created: / 12-04-2011 / 15:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5591 | 727 |
! ! |
728 |
||
729 |
!VariableList class methodsFor:'documentation'! |
|
730 |
||
9461 | 731 |
version_CVS |
10550 | 732 |
^ '$Header: /cvs/stx/stx/libtool/Tools__VariableList.st,v 1.12 2011-08-08 16:28:30 cg Exp $' |
5591 | 733 |
! ! |