author | Claus Gittinger <cg@exept.de> |
Fri, 15 Jul 2011 18:33:46 +0200 | |
changeset 10324 | d68f7aa2e449 |
parent 10308 | c4012347958b |
child 10366 | 381d075b9370 |
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 |
]. |
|
368 |
something == #methodInClass ifTrue:[ |
|
369 |
^ self |
|
370 |
]. |
|
371 |
something == #methodInClassRemoved ifTrue:[ |
|
372 |
^ self |
|
373 |
]. |
|
374 |
something == #classComment ifTrue:[ |
|
375 |
^ self. |
|
376 |
]. |
|
5591 | 377 |
]. |
378 |
"/ self window sensor isNil ifTrue:[ |
|
379 |
"/ "/ I am not visible ... |
|
380 |
"/ self invalidateList. |
|
381 |
"/ ^ self |
|
382 |
"/ ]. |
|
10255 | 383 |
changedObject == selectedVariableEntries ifTrue:[ |
384 |
self selectedVariables value: |
|
385 |
((selectedVariableEntries value ? #()) |
|
386 |
collect:[:e|e name]). |
|
387 |
^self. |
|
388 |
]. |
|
389 |
||
390 |
||
5591 | 391 |
super update:something with:aParameter from:changedObject |
392 |
||
10255 | 393 |
"Modified: / 20-11-2001 / 21:55:22 / cg" |
394 |
"Modified: / 12-04-2011 / 15:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5591 | 395 |
! ! |
396 |
||
397 |
!VariableList methodsFor:'generators'! |
|
398 |
||
399 |
makeGenerator |
|
400 |
||
401 |
||
402 |
||
403 |
! ! |
|
404 |
||
405 |
!VariableList methodsFor:'private'! |
|
406 |
||
5909 | 407 |
commonPostBuild |
5591 | 408 |
|list| |
409 |
||
5909 | 410 |
super commonPostBuild. |
5591 | 411 |
|
5909 | 412 |
list := builder componentAt:#List. |
5591 | 413 |
list notNil ifTrue:[ |
5909 | 414 |
list selectConditionBlock:[:item | self selectionChangeAllowed:item]. |
415 |
list ignoreReselect:false. |
|
5591 | 416 |
]. |
417 |
! |
|
418 |
||
419 |
commonSubClassIn:classes |
|
420 |
"return true if there is a common subclass" |
|
421 |
||
422 |
|theCommonSubClass "classesByInheritance"| |
|
423 |
||
424 |
theCommonSubClass := nil. |
|
425 |
classes do:[:eachClass | |
|
426 |
theCommonSubClass isNil ifTrue:[ |
|
427 |
theCommonSubClass := eachClass |
|
428 |
] ifFalse:[ |
|
429 |
(eachClass isSubclassOf:theCommonSubClass) ifTrue:[ |
|
430 |
theCommonSubClass := eachClass |
|
431 |
] ifFalse:[ |
|
432 |
(theCommonSubClass isSubclassOf:eachClass) ifFalse:[ |
|
433 |
^ nil |
|
434 |
] |
|
435 |
] |
|
436 |
] |
|
437 |
]. |
|
438 |
^ theCommonSubClass. |
|
439 |
||
440 |
"/ classesByInheritance := classes topologicalSort:[:a :b | a isSubclassOf:b]. |
|
441 |
"/ classesByInheritance keysAndValuesDo:[:index :eachClass | |
|
442 |
"/ "/ all classes after that one must be superclasses ... |
|
443 |
"/ classesByInheritance from:index+1 to:classesByInheritance size do:[:otherClass | |
|
444 |
"/ (eachClass isSubclassOf:otherClass) ifFalse:[ |
|
445 |
"/ ^ nil. |
|
446 |
"/ ] |
|
447 |
"/ ]. |
|
448 |
"/ ]. |
|
449 |
"/ ^ classesByInheritance first |
|
450 |
! |
|
451 |
||
10324
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
452 |
iconInBrowserForVariable:varName in:aClass |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
453 |
"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
|
454 |
with an <xml>-icon." |
10255 | 455 |
|
10324
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
456 |
(Expecco::ExpeccoXMLDecoder notNil |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
457 |
and:[aClass canUnderstand: #xmlSpecFor:]) ifTrue:[ |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
458 |
Error handle:[:ex | |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
459 |
] do:[ |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
460 |
(Expecco::ExpeccoXMLDecoder xmlSpecForObject:aClass basicNew) |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
461 |
do:[:spec | spec getter = varName ifTrue:[ |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
462 |
^ SystemBrowser instVarOverlayXmlSpec |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
463 |
] |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
464 |
]. |
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
465 |
]. |
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 |
^ nil |
10255 | 468 |
|
469 |
"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
|
470 |
"Modified: / 15-07-2011 / 18:32:47 / cg" |
10255 | 471 |
! |
472 |
||
473 |
listEntryForClass: cls name:name |
|
474 |
||
475 |
" (showWarningAboutMissingEntryInXmlSpec not |
|
476 |
and:[Expecco::ExpeccoXMLDecoder notNil |
|
477 |
and:[cls canUnderstand: #xmlSpecFor:]]) ifTrue: |
|
478 |
[| hasSpecEntry | |
|
479 |
hasSpecEntry := false. |
|
480 |
(Expecco::ExpeccoXMLDecoder xmlSpecForObject:cls basicNew) |
|
481 |
do:[:spec|spec getter = name ifTrue: |
|
482 |
[ |
|
483 |
hasSpecEntry := true]]. |
|
484 |
showWarningAboutMissingEntryInXmlSpec := hasSpecEntry not]. " |
|
485 |
||
486 |
^VariableEntry application: self class: cls name: name |
|
487 |
||
488 |
"Created: / 12-04-2011 / 15:41:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
489 |
"Modified: / 12-04-2011 / 21:36:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
490 |
! |
|
491 |
||
5591 | 492 |
listOfVariables |
493 |
|nameList numClasses classes class commonSubclass showingClassVars |
|
494 |
sortByName| |
|
495 |
||
496 |
classHolder isNil ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
497 |
"/ testing |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
498 |
^ #() |
5591 | 499 |
]. |
500 |
||
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
501 |
showingClassVars := self showClassVarsInVariableList value == true. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
502 |
sortByName := self sortVariablesByName value. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
503 |
"/ self assert:(sortByName isBoolean). |
5591 | 504 |
|
505 |
classes := classHolder value. |
|
506 |
(numClasses := classes size) == 0 ifTrue:[^ #() ]. |
|
507 |
numClasses > 1 ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
508 |
"/ 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
|
509 |
commonSubclass := self commonSubClassIn:classes. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
510 |
commonSubclass notNil ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
511 |
"/ yes - treat like a single class |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
512 |
classes := Array with:(commonSubclass). |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
513 |
numClasses := 1. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
514 |
]. |
5591 | 515 |
]. |
516 |
||
517 |
numClasses > 1 ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
518 |
"/ multiple classes - sort alphabetically ... |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
519 |
"/ unless there is a common subclass ... |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
520 |
nameList := Set new. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
521 |
classes do:[:class | |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
522 |
showingClassVars ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
523 |
self showingInheritedClassVars ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
524 |
class theNonMetaclass withAllSuperclassesDo:[:cls| |
10255 | 525 |
nameList addAll: |
526 |
(cls classVarNames collect:[:nm|self listEntryForClass: cls name: nm]) |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
527 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
528 |
] ifFalse:[ |
10255 | 529 |
nameList addAll: |
530 |
(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
|
531 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
532 |
] ifFalse:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
533 |
class withAllSuperclassesDo:[:cls| |
10255 | 534 |
nameList addAll: |
535 |
(cls classVarNames collect:[:nm|self listEntryForClass: cls name: nm]) |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
536 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
537 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
538 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
539 |
nameList := nameList asOrderedCollection. |
5591 | 540 |
] ifFalse:[ |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
541 |
"/ only a single class - sort by inheritance |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
542 |
class := classes first. |
5591 | 543 |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
544 |
nameList := OrderedCollection new. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
545 |
class notNil ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
546 |
showingClassVars ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
547 |
class := class theNonMetaclass |
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 |
class withAllSuperclassesDo:[:cls| |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
550 |
|varNames| |
5591 | 551 |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
552 |
varNames := showingClassVars ifTrue:[ cls classVarNames ] ifFalse:[ cls instVarNames ]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
553 |
varNames copy reverse do:[:varName| |
10255 | 554 |
nameList addFirst: (self listEntryForClass: cls name: varName). |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
555 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
556 |
sortByName ifFalse:[ |
10255 | 557 |
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
|
558 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
559 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
560 |
]. |
5591 | 561 |
]. |
562 |
||
563 |
(numClasses > 1 or:[sortByName]) ifTrue:[ |
|
10255 | 564 |
nameList := nameList asSortedCollection:[:a :b|a name < b name]. |
5591 | 565 |
]. |
566 |
^ nameList |
|
567 |
||
10255 | 568 |
"Created: / 05-02-2000 / 13:42:11 / cg" |
569 |
"Modified: / 26-02-2000 / 01:05:36 / cg" |
|
570 |
"Modified: / 28-04-2011 / 13:18:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5591 | 571 |
! |
572 |
||
573 |
postBuildWith:aBuilder |
|
574 |
|listView| |
|
575 |
||
576 |
(listView := aBuilder componentAt:#List) notNil ifTrue:[ |
|
577 |
listView scrollWhenUpdating:#end |
|
578 |
]. |
|
579 |
super postBuildWith:aBuilder |
|
580 |
||
581 |
! |
|
582 |
||
583 |
release |
|
584 |
super release. |
|
585 |
||
586 |
classHolder removeDependent:self. |
|
587 |
showClassVars removeDependent:self. |
|
588 |
! |
|
589 |
||
590 |
selectionChangeAllowed:index |
|
10255 | 591 |
|
592 |
| entry | |
|
593 |
^((entry := variableList value at:index) isString" and:[entry startsWith:'---']") not. |
|
594 |
||
595 |
"Modified: / 28-04-2011 / 13:18:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5591 | 596 |
! |
597 |
||
598 |
updateList |
|
599 |
| prevSelection newSelection newList oldList selectedVariablesHolder| |
|
600 |
||
601 |
oldList := self variableList value copy. |
|
10255 | 602 |
showWarningAboutMissingEntryInXmlSpec := false. |
5591 | 603 |
newList := self listOfVariables. |
604 |
||
605 |
newList ~= variableList value ifTrue:[ |
|
10255 | 606 |
selectedVariablesHolder := self selectedVariables. |
607 |
prevSelection := (selectedVariablesHolder value copy) ? #(). |
|
608 |
variableList value:newList. |
|
609 |
||
610 |
newSelection := prevSelection select:[:item | newList includes:item]. |
|
5591 | 611 |
|
10255 | 612 |
newSelection size > 0 ifTrue:[ |
613 |
"/ force change (for dependents) |
|
614 |
selectedVariablesHolder value:nil. |
|
615 |
selectedVariablesHolder value:newSelection. |
|
616 |
] ifFalse:[ |
|
617 |
prevSelection := selectedVariablesHolder value. |
|
618 |
selectedVariablesHolder value:nil. |
|
619 |
]. |
|
620 |
(prevSelection size > 0 or:[newSelection size > 0]) ifTrue:[ |
|
621 |
self updateOutputGenerator. |
|
622 |
]. |
|
623 |
]. |
|
624 |
(showWarningAboutMissingEntryInXmlSpec and:[self topApplication respondsTo: #showMessage:]) |
|
625 |
ifTrue: |
|
626 |
[ |
|
627 |
self topApplication showMessage: |
|
628 |
'One or more instance variables are not listed in #xmlSpecFor:'. |
|
629 |
]. |
|
630 |
showWarningAboutMissingEntryInXmlSpec := false. |
|
631 |
listValid := true. |
|
632 |
||
633 |
"Modified: / 12-04-2011 / 20:16:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
634 |
! ! |
|
635 |
||
636 |
!VariableList::VariableEntry class methodsFor:'instance creation'! |
|
637 |
||
638 |
application: app class: aClass name: aString |
|
639 |
||
640 |
^self new application: app; class: aClass; name: aString |
|
641 |
||
642 |
"Created: / 12-04-2011 / 19:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
643 |
! |
|
644 |
||
645 |
class: aClass name: aString |
|
646 |
||
647 |
^self new class: aClass; name: aString |
|
648 |
||
649 |
"Created: / 12-04-2011 / 15:39:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
650 |
! ! |
|
651 |
||
652 |
!VariableList::VariableEntry methodsFor:'accessing'! |
|
653 |
||
654 |
application: anObject |
|
5591 | 655 |
|
10255 | 656 |
application := anObject |
657 |
||
658 |
"Created: / 12-04-2011 / 19:55:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
659 |
! |
|
660 |
||
10308 | 661 |
asString |
662 |
||
663 |
^self name |
|
664 |
||
665 |
"Created: / 11-07-2011 / 17:03:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
666 |
! |
|
667 |
||
10255 | 668 |
class:aClass |
669 |
class := aClass. |
|
670 |
! |
|
671 |
||
672 |
icon |
|
673 |
||
674 |
icon ifNil:[icon := application iconInBrowserForVariable: name in: class]. |
|
675 |
icon ifNil:[icon := #NOICON]. |
|
676 |
^icon |
|
677 |
||
678 |
"Created: / 12-04-2011 / 15:54:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
679 |
"Modified: / 12-04-2011 / 19:58:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
680 |
! |
|
681 |
||
682 |
klass |
|
683 |
^ class |
|
684 |
||
685 |
"Created: / 12-04-2011 / 19:54:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
686 |
! |
|
687 |
||
688 |
name |
|
689 |
^ name |
|
690 |
! |
|
691 |
||
692 |
name:aString |
|
693 |
name := aString. |
|
694 |
! |
|
695 |
||
696 |
string |
|
697 |
||
698 |
^name |
|
699 |
||
700 |
"Created: / 12-04-2011 / 15:45:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
701 |
! ! |
|
702 |
||
703 |
!VariableList::VariableEntry methodsFor:'displaying'! |
|
704 |
||
705 |
displayOn:aGC x:x y:y opaque: opaque |
|
706 |
||
707 |
| icn | |
|
708 |
icn := self icon. |
|
709 |
icn ~~ #NOICON ifTrue:[ |
|
710 |
icn displayOn:aGC x:x + 1 y:y - icn height. |
|
5591 | 711 |
]. |
10255 | 712 |
^name displayOn:aGC x:x + 20 y:y opaque: opaque |
713 |
||
714 |
"Created: / 12-04-2011 / 15:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5591 | 715 |
! ! |
716 |
||
717 |
!VariableList class methodsFor:'documentation'! |
|
718 |
||
9461 | 719 |
version_CVS |
10324
d68f7aa2e449
I dont like extensions too much.
Claus Gittinger <cg@exept.de>
parents:
10308
diff
changeset
|
720 |
^ '$Header: /cvs/stx/stx/libtool/Tools__VariableList.st,v 1.9 2011-07-15 16:33:46 cg Exp $' |
5591 | 721 |
! ! |