author | Claus Gittinger <cg@exept.de> |
Mon, 14 Feb 2011 18:16:30 +0100 | |
changeset 9774 | 5bde45b1c359 |
parent 9461 | bc5bcb61a654 |
child 10255 | 3dce3562365a |
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 |
|
17 |
instanceVariableNames:'variableList classHolder showClassVars sortVariablesByName' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-Browsers-New' |
|
21 |
! |
|
22 |
||
23 |
!VariableList class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! ! |
|
38 |
||
39 |
!VariableList class methodsFor:'interface specs'! |
|
40 |
||
41 |
windowSpec |
|
42 |
"This resource specification was automatically generated |
|
43 |
by the UIPainter of ST/X." |
|
44 |
||
45 |
"Do not manually edit this!! If it is corrupted, |
|
46 |
the UIPainter may not be able to read the specification." |
|
47 |
||
48 |
" |
|
49 |
UIPainter new openOnClass:VariableList andSelector:#windowSpec |
|
50 |
VariableList new openInterface:#windowSpec |
|
51 |
VariableList open |
|
52 |
" |
|
53 |
||
54 |
<resource: #canvas> |
|
55 |
||
56 |
^ |
|
57 |
#(#FullSpec |
|
9461 | 58 |
#name: #windowSpec |
59 |
#window: |
|
5591 | 60 |
#(#WindowSpec |
9461 | 61 |
#label: 'VariableList' |
62 |
#name: 'VariableList' |
|
63 |
#min: #(#Point 0 0) |
|
64 |
#bounds: #(#Rectangle 16 46 316 346) |
|
65 |
) |
|
66 |
#component: |
|
5591 | 67 |
#(#SpecCollection |
9461 | 68 |
#collection: #( |
69 |
#(#SequenceViewSpec |
|
70 |
#name: 'List' |
|
71 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
72 |
#tabable: true |
|
73 |
#model: #selectedVariables |
|
74 |
#menu: #menuHolder |
|
75 |
#hasHorizontalScrollBar: true |
|
76 |
#hasVerticalScrollBar: true |
|
77 |
#miniScrollerHorizontal: true |
|
78 |
#isMultiSelect: true |
|
79 |
#valueChangeSelector: #selectionChangedByClick |
|
80 |
#useIndex: false |
|
81 |
#sequenceList: #variableList |
|
82 |
#doubleClickChannel: #doubleClickChannel |
|
83 |
) |
|
84 |
) |
|
5591 | 85 |
|
9461 | 86 |
) |
5591 | 87 |
) |
88 |
! ! |
|
89 |
||
90 |
!VariableList class methodsFor:'plugIn spec'! |
|
91 |
||
92 |
aspectSelectors |
|
93 |
"This resource specification was automatically generated |
|
94 |
by the UIPainter of ST/X." |
|
95 |
||
96 |
"Do not manually edit this. If it is corrupted, |
|
97 |
the UIPainter may not be able to read the specification." |
|
98 |
||
99 |
"Return a description of exported aspects; |
|
100 |
these can be connected to aspects of an embedding application |
|
101 |
(if this app is embedded in a subCanvas)." |
|
102 |
||
103 |
^ #( |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
104 |
#(#doubleClickChannel #action ) |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
105 |
#classHolder |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
106 |
#forceGeneratorTrigger |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
107 |
#immediateUpdate |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
108 |
#inGeneratorHolder |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
109 |
#menuHolder |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
110 |
#outGeneratorHolder |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
111 |
#packageFilter |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
112 |
#selectedVariables |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
113 |
#selectionChangeCondition |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
114 |
#updateTrigger |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
115 |
#showClassVarsInVariableList |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
116 |
#slaveMode |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
117 |
#sortVariablesByName |
5591 | 118 |
). |
119 |
! ! |
|
120 |
||
121 |
!VariableList methodsFor:'aspects'! |
|
122 |
||
123 |
classHolder |
|
124 |
classHolder isNil ifTrue:[ |
|
125 |
classHolder := #() asValue. |
|
126 |
classHolder addDependent:self |
|
127 |
]. |
|
128 |
^ classHolder |
|
129 |
! |
|
130 |
||
131 |
classHolder:aValueHolder |
|
132 |
classHolder notNil ifTrue:[ |
|
133 |
classHolder removeDependent:self |
|
134 |
]. |
|
135 |
classHolder := aValueHolder. |
|
136 |
classHolder notNil ifTrue:[ |
|
137 |
classHolder isBehavior ifTrue:[self halt:'should not happen']. |
|
138 |
classHolder addDependent:self |
|
139 |
]. |
|
140 |
! |
|
141 |
||
142 |
defaultSlaveModeValue |
|
143 |
^ false. |
|
144 |
! |
|
145 |
||
146 |
selectedVariables |
|
147 |
^ self selectionHolder |
|
148 |
||
149 |
! |
|
150 |
||
151 |
selectedVariables:aValueHolder |
|
152 |
^ self selectionHolder:aValueHolder |
|
153 |
||
154 |
! |
|
155 |
||
156 |
showClassVarsInVariableList |
|
157 |
showClassVars isNil ifTrue:[ |
|
158 |
showClassVars := false asValue. |
|
159 |
showClassVars addDependent:self |
|
160 |
]. |
|
161 |
^ showClassVars |
|
162 |
! |
|
163 |
||
164 |
showClassVarsInVariableList:aValueHolder |
|
165 |
showClassVars notNil ifTrue:[ |
|
166 |
showClassVars removeDependent:self |
|
167 |
]. |
|
168 |
showClassVars := aValueHolder. |
|
169 |
showClassVars notNil ifTrue:[ |
|
170 |
showClassVars addDependent:self |
|
171 |
]. |
|
172 |
! |
|
173 |
||
174 |
showingInheritedClassVars |
|
175 |
^ false |
|
176 |
"/ ^ true |
|
177 |
! |
|
178 |
||
179 |
sortVariablesByName |
|
180 |
sortVariablesByName isNil ifTrue:[ |
|
181 |
sortVariablesByName := false asValue. |
|
182 |
sortVariablesByName addDependent:self |
|
183 |
]. |
|
184 |
^ sortVariablesByName |
|
185 |
! |
|
186 |
||
187 |
sortVariablesByName:aValueHolder |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
188 |
"/ self assert:(aValueHolder value isBoolean). |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
189 |
|
5591 | 190 |
sortVariablesByName notNil ifTrue:[ |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
191 |
sortVariablesByName removeDependent:self |
5591 | 192 |
]. |
193 |
sortVariablesByName := aValueHolder. |
|
194 |
sortVariablesByName notNil ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
195 |
sortVariablesByName addDependent:self |
5591 | 196 |
]. |
197 |
! |
|
198 |
||
199 |
variableList |
|
200 |
variableList isNil ifTrue:[ |
|
201 |
variableList := ValueHolder new |
|
202 |
]. |
|
203 |
^ variableList |
|
204 |
||
205 |
||
206 |
! ! |
|
207 |
||
208 |
!VariableList methodsFor:'change & update'! |
|
209 |
||
210 |
delayedUpdate:something with:aParameter from:changedObject |
|
211 |
|selectedClasses changedClass anyChange| |
|
212 |
||
213 |
self inSlaveModeOrInvisible ifTrue:[self invalidateList. ^ self]. |
|
214 |
"/ slaveMode value == true ifTrue:[^ self]. |
|
215 |
||
216 |
changedObject == slaveMode ifTrue:[ |
|
217 |
listValid ~~ true ifTrue:[ |
|
218 |
self enqueueDelayedUpdateList |
|
219 |
]. |
|
220 |
"/ self invalidateList. |
|
221 |
^ self |
|
222 |
]. |
|
223 |
||
224 |
changedObject == classHolder ifTrue:[ |
|
225 |
self invalidateList. |
|
226 |
^ self |
|
227 |
]. |
|
228 |
changedObject == showClassVars ifTrue:[ |
|
229 |
self invalidateList. |
|
230 |
^ self. |
|
231 |
]. |
|
232 |
changedObject == sortVariablesByName ifTrue:[ |
|
233 |
self invalidateList. |
|
234 |
^ self. |
|
235 |
]. |
|
236 |
changedObject == Smalltalk ifTrue:[ |
|
237 |
(something == #classDefinition |
|
238 |
or:[something == #classVariables and:[showClassVars value == true]]) |
|
239 |
ifTrue:[ |
|
240 |
changedClass := aParameter. |
|
241 |
selectedClasses := classHolder value. |
|
242 |
selectedClasses notNil ifTrue:[ |
|
243 |
selectedClasses isSequenceable ifFalse:[ |
|
244 |
selectedClasses := selectedClasses asOrderedCollection |
|
245 |
]. |
|
246 |
selectedClasses keysAndValuesDo:[:idx :cls | |nm| |
|
247 |
cls notNil ifTrue:[ |
|
248 |
cls isObsolete ifTrue:[ |
|
249 |
cls isMeta ifTrue:[ |
|
250 |
nm := cls theNonMetaclass name. |
|
251 |
selectedClasses at:idx put:(Smalltalk at:nm) class. |
|
252 |
] ifFalse:[ |
|
253 |
nm := cls name. |
|
254 |
selectedClasses at:idx put:(Smalltalk at:nm). |
|
255 |
]. |
|
256 |
anyChange := true. |
|
257 |
] ifFalse:[ |
|
258 |
(cls == aParameter |
|
259 |
or:[something == #classVariables |
|
260 |
and:[showClassVars value == true |
|
261 |
and:[cls theNonMetaclass == aParameter theNonMetaclass]]]) ifTrue:[ |
|
262 |
anyChange := true. |
|
263 |
] |
|
264 |
] |
|
265 |
] |
|
266 |
]. |
|
267 |
(selectedClasses includes:nil) ifTrue:[ |
|
268 |
"/ can happen, if a selected class is removed... |
|
269 |
"/ self halt:'should this happen ?'. |
|
270 |
"/ fix it ... |
|
271 |
selectedClasses := selectedClasses select:[:each | each notNil]. |
|
272 |
classHolder value:selectedClasses. |
|
273 |
anyChange := true. |
|
274 |
]. |
|
275 |
anyChange == true ifTrue:[ |
|
276 |
self invalidateList. |
|
277 |
^ self |
|
278 |
]. |
|
279 |
]. |
|
280 |
^ self |
|
281 |
]. |
|
282 |
] ifFalse:[ |
|
283 |
changedObject isBehavior ifTrue:[ |
|
284 |
anyChange := false. |
|
285 |
selectedClasses := classHolder value. |
|
286 |
selectedClasses notNil ifTrue:[ |
|
287 |
selectedClasses keysAndValuesDo:[:idx :cls | |nm| |
|
288 |
cls isObsolete ifTrue:[ |
|
289 |
nm := cls name. |
|
290 |
selectedClasses at:idx put:(Smalltalk at:nm). |
|
291 |
anyChange := true. |
|
292 |
] |
|
293 |
]. |
|
294 |
anyChange == true ifTrue:[ |
|
295 |
self invalidateList. |
|
296 |
^ self |
|
297 |
]. |
|
298 |
||
299 |
(selectedClasses includesIdentical:something) ifTrue:[ |
|
300 |
self invalidateList. |
|
301 |
^ self |
|
302 |
]. |
|
303 |
]. |
|
304 |
^ self |
|
305 |
]. |
|
306 |
]. |
|
307 |
super delayedUpdate:something with:aParameter from:changedObject |
|
308 |
! |
|
309 |
||
310 |
makeDependent |
|
311 |
Smalltalk addDependent:self |
|
312 |
||
313 |
! |
|
314 |
||
315 |
makeIndependent |
|
316 |
Smalltalk removeDependent:self |
|
317 |
||
318 |
! |
|
319 |
||
320 |
selectionChangedByClick |
|
321 |
"we are not interested in that - get another notification |
|
322 |
via the changed valueHolder" |
|
323 |
||
324 |
||
325 |
! |
|
326 |
||
327 |
update:something with:aParameter from:changedObject |
|
328 |
"/ ^ self delayedUpdate:something with:aParameter from:changedObject. |
|
329 |
||
330 |
changedObject == Smalltalk ifTrue:[ |
|
331 |
something == #methodDictionary ifTrue:[ |
|
332 |
^ self |
|
333 |
]. |
|
334 |
something == #methodTrap ifTrue:[ |
|
335 |
^ self |
|
336 |
]. |
|
337 |
something == #methodInClass ifTrue:[ |
|
338 |
^ self |
|
339 |
]. |
|
340 |
something == #methodInClassRemoved ifTrue:[ |
|
341 |
^ self |
|
342 |
]. |
|
343 |
something == #classComment ifTrue:[ |
|
344 |
^ self. |
|
345 |
]. |
|
346 |
]. |
|
347 |
"/ self window sensor isNil ifTrue:[ |
|
348 |
"/ "/ I am not visible ... |
|
349 |
"/ self invalidateList. |
|
350 |
"/ ^ self |
|
351 |
"/ ]. |
|
352 |
super update:something with:aParameter from:changedObject |
|
353 |
||
354 |
"Modified: / 20.11.2001 / 21:55:22 / cg" |
|
355 |
! ! |
|
356 |
||
357 |
!VariableList methodsFor:'generators'! |
|
358 |
||
359 |
makeGenerator |
|
360 |
||
361 |
||
362 |
||
363 |
! ! |
|
364 |
||
365 |
!VariableList methodsFor:'private'! |
|
366 |
||
5909 | 367 |
commonPostBuild |
5591 | 368 |
|list| |
369 |
||
5909 | 370 |
super commonPostBuild. |
5591 | 371 |
|
5909 | 372 |
list := builder componentAt:#List. |
5591 | 373 |
list notNil ifTrue:[ |
5909 | 374 |
list selectConditionBlock:[:item | self selectionChangeAllowed:item]. |
375 |
list ignoreReselect:false. |
|
5591 | 376 |
]. |
377 |
! |
|
378 |
||
379 |
commonSubClassIn:classes |
|
380 |
"return true if there is a common subclass" |
|
381 |
||
382 |
|theCommonSubClass "classesByInheritance"| |
|
383 |
||
384 |
theCommonSubClass := nil. |
|
385 |
classes do:[:eachClass | |
|
386 |
theCommonSubClass isNil ifTrue:[ |
|
387 |
theCommonSubClass := eachClass |
|
388 |
] ifFalse:[ |
|
389 |
(eachClass isSubclassOf:theCommonSubClass) ifTrue:[ |
|
390 |
theCommonSubClass := eachClass |
|
391 |
] ifFalse:[ |
|
392 |
(theCommonSubClass isSubclassOf:eachClass) ifFalse:[ |
|
393 |
^ nil |
|
394 |
] |
|
395 |
] |
|
396 |
] |
|
397 |
]. |
|
398 |
^ theCommonSubClass. |
|
399 |
||
400 |
"/ classesByInheritance := classes topologicalSort:[:a :b | a isSubclassOf:b]. |
|
401 |
"/ classesByInheritance keysAndValuesDo:[:index :eachClass | |
|
402 |
"/ "/ all classes after that one must be superclasses ... |
|
403 |
"/ classesByInheritance from:index+1 to:classesByInheritance size do:[:otherClass | |
|
404 |
"/ (eachClass isSubclassOf:otherClass) ifFalse:[ |
|
405 |
"/ ^ nil. |
|
406 |
"/ ] |
|
407 |
"/ ]. |
|
408 |
"/ ]. |
|
409 |
"/ ^ classesByInheritance first |
|
410 |
! |
|
411 |
||
412 |
listOfVariables |
|
413 |
|nameList numClasses classes class commonSubclass showingClassVars |
|
414 |
sortByName| |
|
415 |
||
416 |
classHolder isNil ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
417 |
"/ testing |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
418 |
^ #() |
5591 | 419 |
]. |
420 |
||
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
421 |
showingClassVars := self showClassVarsInVariableList value == true. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
422 |
sortByName := self sortVariablesByName value. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
423 |
"/ self assert:(sortByName isBoolean). |
5591 | 424 |
|
425 |
classes := classHolder value. |
|
426 |
(numClasses := classes size) == 0 ifTrue:[^ #() ]. |
|
427 |
numClasses > 1 ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
428 |
"/ 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
|
429 |
commonSubclass := self commonSubClassIn:classes. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
430 |
commonSubclass notNil ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
431 |
"/ yes - treat like a single class |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
432 |
classes := Array with:(commonSubclass). |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
433 |
numClasses := 1. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
434 |
]. |
5591 | 435 |
]. |
436 |
||
437 |
numClasses > 1 ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
438 |
"/ multiple classes - sort alphabetically ... |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
439 |
"/ unless there is a common subclass ... |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
440 |
nameList := Set new. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
441 |
classes do:[:class | |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
442 |
showingClassVars ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
443 |
self showingInheritedClassVars ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
444 |
class theNonMetaclass withAllSuperclassesDo:[:cls| |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
445 |
nameList addAll:(cls classVarNames) |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
446 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
447 |
] ifFalse:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
448 |
nameList addAll:(class classVarNames) |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
449 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
450 |
] ifFalse:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
451 |
class withAllSuperclassesDo:[:cls| |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
452 |
nameList addAll:(cls instVarNames) |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
453 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
454 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
455 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
456 |
nameList := nameList asOrderedCollection. |
5591 | 457 |
] ifFalse:[ |
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
458 |
"/ only a single class - sort by inheritance |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
459 |
class := classes first. |
5591 | 460 |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
461 |
nameList := OrderedCollection new. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
462 |
class notNil ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
463 |
showingClassVars ifTrue:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
464 |
class := class theNonMetaclass |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
465 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
466 |
class withAllSuperclassesDo:[:cls| |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
467 |
|varNames| |
5591 | 468 |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
469 |
varNames := showingClassVars ifTrue:[ cls classVarNames ] ifFalse:[ cls instVarNames ]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
470 |
varNames copy reverse do:[:varName| |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
471 |
nameList addFirst:varName. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
472 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
473 |
sortByName ifFalse:[ |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
474 |
nameList addFirst:'----- ' , cls nameInBrowser , ' -----'. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
475 |
] |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
476 |
]. |
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
477 |
]. |
5591 | 478 |
]. |
479 |
||
480 |
(numClasses > 1 or:[sortByName]) ifTrue:[ |
|
6721
c49f5a3cbca2
variableList (sort) fixed in hierarchy views
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
481 |
nameList sort. |
5591 | 482 |
]. |
483 |
^ nameList |
|
484 |
||
485 |
"Created: / 5.2.2000 / 13:42:11 / cg" |
|
486 |
"Modified: / 26.2.2000 / 01:05:36 / cg" |
|
487 |
! |
|
488 |
||
489 |
postBuildWith:aBuilder |
|
490 |
|listView| |
|
491 |
||
492 |
(listView := aBuilder componentAt:#List) notNil ifTrue:[ |
|
493 |
listView scrollWhenUpdating:#end |
|
494 |
]. |
|
495 |
super postBuildWith:aBuilder |
|
496 |
||
497 |
! |
|
498 |
||
499 |
release |
|
500 |
super release. |
|
501 |
||
502 |
classHolder removeDependent:self. |
|
503 |
showClassVars removeDependent:self. |
|
504 |
! |
|
505 |
||
506 |
selectionChangeAllowed:index |
|
507 |
^ ((variableList value at:index) startsWith:'---') not. |
|
508 |
! |
|
509 |
||
510 |
updateList |
|
511 |
| prevSelection newSelection newList oldList selectedVariablesHolder| |
|
512 |
||
513 |
oldList := self variableList value copy. |
|
514 |
newList := self listOfVariables. |
|
515 |
||
516 |
newList ~= variableList value ifTrue:[ |
|
517 |
selectedVariablesHolder := self selectedVariables. |
|
518 |
prevSelection := (selectedVariablesHolder value copy) ? #(). |
|
519 |
variableList value:newList. |
|
520 |
||
521 |
newSelection := prevSelection select:[:item | newList includes:item]. |
|
522 |
||
523 |
newSelection size > 0 ifTrue:[ |
|
524 |
"/ force change (for dependents) |
|
525 |
selectedVariablesHolder value:nil. |
|
526 |
selectedVariablesHolder value:newSelection. |
|
527 |
] ifFalse:[ |
|
528 |
prevSelection := selectedVariablesHolder value. |
|
529 |
selectedVariablesHolder value:nil. |
|
530 |
]. |
|
531 |
(prevSelection size > 0 or:[newSelection size > 0]) ifTrue:[ |
|
532 |
self updateOutputGenerator. |
|
533 |
]. |
|
534 |
]. |
|
535 |
listValid := true. |
|
536 |
! ! |
|
537 |
||
538 |
!VariableList class methodsFor:'documentation'! |
|
539 |
||
540 |
version |
|
9461 | 541 |
^ '$Header: /cvs/stx/stx/libtool/Attic/Tools_VariableList.st,v 1.5 2010-05-07 12:27:20 cg Exp $' |
542 |
! |
|
543 |
||
544 |
version_CVS |
|
545 |
^ '$Header: /cvs/stx/stx/libtool/Attic/Tools_VariableList.st,v 1.5 2010-05-07 12:27:20 cg Exp $' |
|
5591 | 546 |
! ! |