author | Stefan Vogel <sv@exept.de> |
Fri, 17 May 2019 17:11:44 +0200 | |
changeset 18767 | 0478d93cdb75 |
parent 18710 | 518f0f70390b |
permissions | -rw-r--r-- |
18710 | 1 |
"{ Encoding: utf8 }" |
2 |
||
10005 | 3 |
" |
4 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
14 |
"{ Package: 'stx:libtool' }" |
|
15 |
||
16 |
"{ NameSpace: Tools }" |
|
17 |
||
18 |
ClassList subclass:#HierarchicalClassList |
|
19 |
instanceVariableNames:'topClassHolder' |
|
20 |
classVariableNames:'InheritedEntry' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Interface-Browsers-New' |
|
23 |
! |
|
24 |
||
25 |
!HierarchicalClassList class methodsFor:'documentation'! |
|
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
Like a ClassList, but shows classes hierarchical. |
|
44 |
||
45 |
If topClassHolders value is non-nil, only that classes hierarchy |
|
46 |
is shown. |
|
47 |
||
48 |
embeddable application displaying the classes as listed by |
|
49 |
the inputGenerator. |
|
50 |
Provides an outputGenerator, which enumerates the classes and |
|
51 |
their protocols (method-categories) in the selected classes. |
|
52 |
||
53 |
[author:] |
|
54 |
Claus Gittinger (cg@exept.de) |
|
55 |
" |
|
56 |
||
57 |
||
58 |
! ! |
|
59 |
||
60 |
!HierarchicalClassList class methodsFor:'initialization'! |
|
61 |
||
62 |
initialize |
|
63 |
InheritedEntry := '* inheritance *' |
|
64 |
||
65 |
"Created: / 24.2.2000 / 20:19:19 / cg" |
|
66 |
! ! |
|
67 |
||
68 |
!HierarchicalClassList class methodsFor:'queries-plugin'! |
|
69 |
||
70 |
aspectSelectors |
|
71 |
^ super aspectSelectors , |
|
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
72 |
#( |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
73 |
topClassHolder |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
74 |
) |
10005 | 75 |
|
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
76 |
"Modified: / 24-02-2014 / 10:38:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10005 | 77 |
! ! |
78 |
||
79 |
!HierarchicalClassList methodsFor:'accessing'! |
|
80 |
||
81 |
showMethodComplexity:aValueHolder |
|
82 |
||
83 |
"Created: / 05-11-2007 / 17:15:35 / cg" |
|
84 |
! |
|
85 |
||
86 |
showMethodInheritance:aValueHolder |
|
87 |
||
88 |
"Created: / 05-11-2007 / 17:15:23 / cg" |
|
89 |
! |
|
90 |
||
91 |
showMethodTypeIcon:aValueHolder |
|
92 |
||
93 |
"Created: / 05-11-2007 / 17:15:42 / cg" |
|
94 |
! ! |
|
95 |
||
96 |
!HierarchicalClassList methodsFor:'aspects'! |
|
97 |
||
98 |
methodVisibilityHolder:aValueHolder |
|
99 |
||
100 |
"Created: / 05-11-2007 / 17:15:48 / cg" |
|
101 |
! |
|
102 |
||
103 |
topClassHolder |
|
104 |
topClassHolder isNil ifTrue:[ |
|
105 |
topClassHolder := Object asValue. |
|
106 |
topClassHolder addDependent:self |
|
107 |
]. |
|
108 |
^ topClassHolder |
|
109 |
! |
|
110 |
||
111 |
topClassHolder:aValueHolder |
|
112 |
|oldTopClass newTopClass| |
|
113 |
||
114 |
oldTopClass := topClassHolder value. |
|
115 |
||
116 |
topClassHolder notNil ifTrue:[ |
|
117 |
topClassHolder removeDependent:self |
|
118 |
]. |
|
119 |
topClassHolder := aValueHolder. |
|
120 |
||
121 |
topClassHolder notNil ifTrue:[ |
|
122 |
topClassHolder isBehavior ifTrue:[self halt:'should not happen']. |
|
123 |
topClassHolder addDependent:self. |
|
124 |
]. |
|
125 |
||
126 |
newTopClass := topClassHolder value. |
|
127 |
newTopClass ~~ oldTopClass ifTrue:[ |
|
128 |
self enqueueDelayedUpdateList. |
|
129 |
]. |
|
130 |
! ! |
|
131 |
||
132 |
!HierarchicalClassList methodsFor:'change & update'! |
|
133 |
||
134 |
classDefinitionChanged:aClass |
|
135 |
|prevTop prevSelection newSelection selectedClassesHolder| |
|
136 |
||
137 |
listValid ifFalse:[^ self]. |
|
138 |
slaveMode value == true ifTrue:[ |
|
139 |
self invalidateList. |
|
140 |
^ self. |
|
141 |
]. |
|
142 |
||
143 |
selectedClassesHolder := self selectedClasses. |
|
144 |
prevSelection := selectedClassesHolder value copy. |
|
145 |
||
146 |
prevTop := self topClassHolder value. |
|
147 |
prevTop notNil ifTrue:[ |
|
148 |
(prevTop name = aClass name) ifTrue:[ |
|
149 |
"/ forced update |
|
150 |
topClassHolder value:aClass. |
|
151 |
] ifFalse:[ |
|
152 |
(prevTop name = aClass class name) ifTrue:[ |
|
153 |
"/ forced update |
|
154 |
topClassHolder value:aClass class. |
|
155 |
] |
|
156 |
] |
|
157 |
]. |
|
158 |
||
159 |
"/ must update the list (notice, that the hierarchy might have changed..) |
|
160 |
||
161 |
self updateList. |
|
162 |
||
163 |
selectedClassesHolder value ~= prevSelection ifTrue:[ |
|
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
164 |
newSelection := prevSelection collect:[:eachOldClass | environment classNamed:(eachOldClass name)]. |
10005 | 165 |
selectedClassesHolder value:newSelection. |
166 |
] |
|
167 |
||
168 |
"Modified: / 26.2.2000 / 01:17:01 / cg" |
|
169 |
! |
|
170 |
||
171 |
classRemoved:aClass |
|
172 |
|prevTop newTop prevSel nPrevSelected selectedClassesHolder newSelection wasMeta| |
|
173 |
||
174 |
prevTop := self topClassHolder value. |
|
175 |
||
176 |
prevTop notNil ifTrue:[ |
|
177 |
wasMeta := prevTop isMeta. |
|
178 |
newTop := prevTop theNonMetaclass. |
|
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
179 |
[newTop notNil and:[(environment at:newTop name) ~= newTop]] whileTrue:[ |
10005 | 180 |
newTop := newTop superclass. |
181 |
]. |
|
182 |
wasMeta ifTrue:[ |
|
183 |
newTop := newTop theMetaclass |
|
184 |
]. |
|
185 |
newTop ~~ prevTop ifTrue:[ |
|
186 |
self topClassHolder value:newTop. |
|
187 |
]. |
|
188 |
]. |
|
189 |
||
190 |
selectedClassesHolder := self selectedClasses. |
|
191 |
||
192 |
"/ if there is a single selection, |
|
193 |
"/ which is the old top, replace it. |
|
194 |
prevSel := selectedClassesHolder value. |
|
195 |
nPrevSelected := prevSel size. |
|
196 |
nPrevSelected > 0 ifTrue:[ |
|
197 |
nPrevSelected == 1 ifTrue:[ |
|
198 |
prevSel first == aClass ifTrue:[ |
|
199 |
newTop notNil ifTrue:[ |
|
200 |
newSelection := Array with:newTop. |
|
201 |
] ifFalse:[ |
|
202 |
newSelection := #(). |
|
203 |
] |
|
204 |
]. |
|
205 |
] ifFalse:[ |
|
206 |
nPrevSelected ~~ 0 ifTrue:[ |
|
207 |
"/ clear the selection |
|
208 |
newSelection := #(). |
|
209 |
] |
|
210 |
]. |
|
211 |
newSelection notNil ifTrue:[ |
|
212 |
selectedClassesHolder value:newSelection |
|
213 |
]. |
|
214 |
]. |
|
215 |
||
216 |
super classRemoved:aClass. |
|
217 |
! ! |
|
218 |
||
219 |
!HierarchicalClassList methodsFor:'private'! |
|
220 |
||
221 |
addTo:aList whereSuperclassIs:aSuperclass |
|
222 |
|theClasses| |
|
223 |
||
224 |
aSuperclass isNil ifTrue:[ |
|
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
225 |
theClasses := environment allClasses select:[:cls | cls superclass isNil] |
10005 | 226 |
] ifFalse:[ |
227 |
theClasses := aSuperclass subclasses. |
|
228 |
]. |
|
229 |
(self hideUnloadedClasses value) ifTrue:[ |
|
230 |
theClasses := theClasses select:[:cls | cls isLoaded]. |
|
231 |
]. |
|
232 |
||
233 |
theClasses := theClasses asOrderedCollection sort:[:a :b | (a name ? '??') < (b name ? '??')]. |
|
234 |
theClasses do:[:aClass | |
|
235 |
aList add:aClass. |
|
236 |
self addTo:aList whereSuperclassIs:aClass |
|
237 |
]. |
|
238 |
! |
|
239 |
||
240 |
defaultSlaveModeValue |
|
241 |
|mode| |
|
242 |
||
243 |
mode := self topApplication perform:#initialOrganizerMode ifNotUnderstood:nil. |
|
244 |
mode == OrganizerCanvas organizerModeClassHierarchy ifTrue:[^ false]. |
|
245 |
mode isNil ifTrue:[^ false]. |
|
246 |
||
247 |
self organizerMode value == OrganizerCanvas organizerModeCategory ifTrue:[^ true]. |
|
248 |
^ false |
|
249 |
! |
|
250 |
||
251 |
listOfClasses |
|
252 |
|classes top| |
|
253 |
||
254 |
classes := OrderedCollection new. |
|
255 |
(top := self topClassHolder value) notNil ifTrue:[ |
|
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
256 |
top := top theNonMetaclass. |
15534
b7f97664fc12
class: Tools::HierarchicalClassList
Claus Gittinger <cg@exept.de>
parents:
14286
diff
changeset
|
257 |
classes addAll:(top withAllSuperclasses reversed). |
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
258 |
|
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
259 |
"/ Must check whether environment contains the class and filter it out, |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
260 |
"/ if not. Think of limited environment to Java classes which should not |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
261 |
"/ show Object & JavaObject even if they are real superclasses of any Java |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
262 |
"/ class. |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
263 |
"/ Q: Should we rather ignore all superclasses after first class which is not |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
264 |
"/ in environment? |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
265 |
classes := classes select:[:class | (environment at: class name ifAbsent:[nil]) notNil ]. |
10005 | 266 |
]. |
267 |
self addTo:classes whereSuperclassIs:top. |
|
268 |
^ classes |
|
269 |
||
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
270 |
"Modified: / 24-02-2000 / 13:27:43 / cg" |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
271 |
"Modified (format): / 27-04-2014 / 20:47:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10005 | 272 |
! |
273 |
||
274 |
nameListEntryFor:aClass withNameSpace:useFullName |
|
275 |
|indent superClass nm| |
|
276 |
||
277 |
aClass == (self class nameListEntryForALL) ifTrue:[ ^ aClass ]. |
|
278 |
aClass == InheritedEntry ifTrue:[ ^ aClass ]. |
|
279 |
||
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
280 |
nm := aClass nameInBrowser. |
10005 | 281 |
nm isNil ifTrue:[^ '???']. |
282 |
||
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
283 |
aClass isLoaded ifFalse:[ |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
284 |
"/ nm := nm,(' (?) ' colorizeAllWith:Color grey). |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
285 |
] ifTrue:[ |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
286 |
aClass isAbstract ifTrue:[ nm := nm allItalic ]. |
17286 | 287 |
nm := nm,((' (%1+%2) ' bindWith:(aClass methodsCount) with:(aClass class methodsCount)) |
16496 | 288 |
withColor:self class pseudoEntryForegroundColor). |
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
289 |
]. |
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
290 |
|
10005 | 291 |
indent := 0. |
292 |
superClass := aClass superclass. |
|
293 |
[superClass notNil] whileTrue:[ |
|
294 |
indent := indent + 1. |
|
295 |
superClass := superClass superclass. |
|
296 |
]. |
|
297 |
||
298 |
indent == 0 ifTrue:[ |
|
299 |
^ nm |
|
300 |
]. |
|
301 |
||
302 |
indent <= 5 ifTrue:[ |
|
303 |
indent := #( |
|
304 |
'' |
|
305 |
' ' |
|
306 |
' ' |
|
307 |
' ' |
|
308 |
' ' |
|
309 |
' ' |
|
310 |
) at:indent+1. |
|
311 |
] ifFalse:[ |
|
18710 | 312 |
indent := String new:indent*4. |
10005 | 313 |
]. |
314 |
^ indent , nm |
|
315 |
||
18710 | 316 |
"Modified: / 24-02-2000 / 20:19:47 / cg" |
317 |
"Modified: / 24-03-2019 / 09:58:54 / Claus Gittinger" |
|
10005 | 318 |
! |
319 |
||
320 |
release |
|
321 |
super release. |
|
322 |
||
323 |
topClassHolder removeDependent:self. |
|
324 |
! ! |
|
325 |
||
326 |
!HierarchicalClassList class methodsFor:'documentation'! |
|
327 |
||
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
328 |
version |
16496 | 329 |
^ '$Header$' |
10005 | 330 |
! ! |
331 |
||
14286
badb3e840d06
Fix in #listOfClasses - must check whether all superclasses are actually in environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10005
diff
changeset
|
332 |
|
10005 | 333 |
HierarchicalClassList initialize! |