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