author | Claus Gittinger <cg@exept.de> |
Mon, 15 Jul 2019 18:47:18 +0200 | |
changeset 18902 | c2dea21fb224 |
parent 14022 | c494bb9d1516 |
permissions | -rw-r--r-- |
6179 | 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 |
" |
|
5592 | 12 |
"{ Package: 'stx:libtool' }" |
5591 | 13 |
|
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
MethodList subclass:#ImplementingMethodList |
|
17 |
instanceVariableNames:'selectorList selectedSelectors' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-Browsers-New' |
|
21 |
! |
|
22 |
||
23 |
!ImplementingMethodList class methodsFor:'documentation'! |
|
24 |
||
6179 | 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 |
||
5591 | 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 |
!ImplementingMethodList class methodsFor:'plugIn spec'! |
|
59 |
||
60 |
aspectSelectors |
|
61 |
"This resource specification was automatically generated |
|
62 |
by the UIPainter of ST/X." |
|
63 |
||
64 |
"Do not manually edit this. If it is corrupted, |
|
65 |
the UIPainter may not be able to read the specification." |
|
66 |
||
67 |
"Return a description of exported aspects; |
|
68 |
these can be connected to aspects of an embedding application |
|
69 |
(if this app is embedded in a subCanvas)." |
|
70 |
||
71 |
^ #( |
|
14022
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
72 |
environmentHolder |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
73 |
#classHolder |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
74 |
#(#doubleClickChannel #action ) |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
75 |
#forceGeneratorTrigger |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
76 |
#immediateUpdate |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
77 |
#inGeneratorHolder |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
78 |
#outGeneratorHolder |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
79 |
#menuHolder |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
80 |
#methodCategoryHolder |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
81 |
#packageFilter |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
82 |
#selectedMethods |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
83 |
#selectionChangeCondition |
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
84 |
#updateTrigger |
5591 | 85 |
). |
86 |
||
14022
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
87 |
"Modified: / 24-02-2014 / 10:37:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5591 | 88 |
! ! |
89 |
||
90 |
!ImplementingMethodList methodsFor:'aspects'! |
|
91 |
||
92 |
selectedSelectors |
|
93 |
selectedSelectors isNil ifTrue:[ |
|
94 |
selectedSelectors := ValueHolder new. |
|
95 |
selectedSelectors addDependent:self |
|
96 |
]. |
|
97 |
^ selectedSelectors. |
|
98 |
||
99 |
||
100 |
! ! |
|
101 |
||
102 |
!ImplementingMethodList methodsFor:'change & update'! |
|
103 |
||
104 |
delayedUpdate:something with:aParameter from:changedObject |
|
105 |
changedObject == selectedMethodNameIndices ifTrue:[ |
|
106 |
"/ self selectedMethods value:(self selectedMethodNameIndices value collect:[:idx | methodList at:idx]). |
|
107 |
"/ lastSelectedMethods := self selectedMethods value. |
|
108 |
||
109 |
self selectedSelectors value:(self selectedMethodNameIndices value collect:[:idx | selectorList at:idx]). |
|
110 |
"/ lastSelectedSelectors := self selectedSelectors value. |
|
111 |
^ self |
|
112 |
]. |
|
113 |
changedObject == selectedSelectors ifTrue:[ |
|
114 |
self updateOutputGenerator. |
|
115 |
^ self |
|
116 |
]. |
|
117 |
super delayedUpdate:something with:aParameter from:changedObject |
|
118 |
||
119 |
"Created: / 5.2.2000 / 13:42:14 / cg" |
|
120 |
"Modified: / 6.2.2000 / 00:05:26 / cg" |
|
121 |
! |
|
122 |
||
123 |
selectedMethodsChanged |
|
124 |
self updateOutputGenerator |
|
125 |
! |
|
126 |
||
127 |
selectionChanged |
|
128 |
self halt:'should not happen' |
|
129 |
! ! |
|
130 |
||
131 |
!ImplementingMethodList methodsFor:'generators'! |
|
132 |
||
133 |
makeGenerator |
|
134 |
"return a generator which enumerates the methods from the selected protocol; |
|
135 |
that generator generates 4-element elements (includes the class and protocol), |
|
136 |
in order to make the consumers only depend on one input |
|
137 |
(i.e. to pass multiple-class and multiple-protocol info |
|
138 |
without a need for another classHolder/protocolHolder in the methodList)." |
|
139 |
||
140 |
^ Iterator on:[:whatToDo | |
|
141 |
|selectors items packages| |
|
142 |
||
143 |
items := OrderedCollection new. |
|
144 |
||
145 |
selectors := self selectedSelectors value ? #(). |
|
146 |
selectors size > 0 ifTrue:[ |
|
147 |
packages := packageFilter value value. |
|
148 |
selectors do:[:eachSelector | |
|
149 |
classes do:[:eachClass | |mthd| |
|
150 |
mthd := eachClass compiledMethodAt:eachSelector. |
|
151 |
mthd notNil ifTrue:[ |
|
152 |
(packages isNil |
|
153 |
or:[packages includes:mthd package]) ifTrue:[ |
|
154 |
items add:(Array with:eachClass with:mthd category with:eachSelector with:mthd) |
|
155 |
] |
|
156 |
] |
|
157 |
] |
|
158 |
] |
|
159 |
]. |
|
160 |
items sort:[:a :b | |
|
161 |
|nm1 nm2 sel1 sel2| |
|
162 |
||
163 |
nm1 := (a at:1) name. |
|
164 |
nm2 := (b at:1) name. |
|
165 |
nm1 < nm2 ifTrue:[ true ] |
|
166 |
ifFalse:[ |
|
167 |
nm1 = nm2 ifFalse:[ false ] |
|
168 |
ifTrue:[ |
|
169 |
sel1 := a at:3. |
|
170 |
sel2 := b at:3. |
|
171 |
sel1 < sel2 |
|
172 |
] |
|
173 |
] |
|
174 |
]. |
|
175 |
items do:[:eachItem | whatToDo valueWithArguments:eachItem]. |
|
176 |
] |
|
177 |
||
178 |
||
179 |
||
180 |
! ! |
|
181 |
||
182 |
!ImplementingMethodList methodsFor:'private'! |
|
183 |
||
184 |
listOfMethodNames |
|
185 |
|entries selectorsAlready newNameList |
|
186 |
newClasses allCategories allSelectors generator |
|
187 |
"showCategory" categoryOrCountPerSelector| |
|
188 |
||
189 |
generator := inGeneratorHolder value. |
|
190 |
generator isNil ifTrue:[^ #() ]. |
|
191 |
||
192 |
newClasses := IdentitySet new. |
|
193 |
selectorsAlready := IdentitySet new. |
|
194 |
entries := OrderedCollection new. |
|
195 |
allCategories := Set new. |
|
196 |
allSelectors := Bag identityNew. |
|
197 |
categoryOrCountPerSelector := IdentityDictionary new. |
|
198 |
||
199 |
"/ generator generates nil-selector entries |
|
200 |
"/ to pass multiple-class and multiple-protocol info |
|
201 |
generator do:[:cls :cat :sel :mthd | |
|
202 |
|catsAlready| |
|
203 |
||
204 |
sel notNil ifTrue:[ |
|
205 |
(selectorsAlready includes:sel) ifFalse:[ |
|
206 |
entries add:(Array with:cls with:sel with:mthd). |
|
207 |
selectorsAlready add:sel |
|
208 |
]. |
|
209 |
newClasses add:cls. |
|
210 |
allCategories add:cat. |
|
211 |
allSelectors add:sel. |
|
212 |
||
213 |
catsAlready := categoryOrCountPerSelector at:sel ifAbsent:nil. |
|
214 |
catsAlready isNil ifTrue:[ |
|
215 |
categoryOrCountPerSelector at:sel put:cat. |
|
216 |
] ifFalse:[ |
|
217 |
catsAlready isInteger ifTrue:[ |
|
218 |
categoryOrCountPerSelector at:sel put:(catsAlready + 1). |
|
219 |
] ifFalse:[ |
|
220 |
catsAlready ~= cat ifTrue:[ |
|
221 |
categoryOrCountPerSelector at:sel put:2. |
|
222 |
] |
|
223 |
] |
|
224 |
] |
|
225 |
] |
|
226 |
]. |
|
227 |
||
228 |
entries sort:[:a :b | |nmA nmB clsNmA clsNmB| |
|
229 |
nmA := (a at:2). |
|
230 |
nmB := (b at:2). |
|
231 |
nmA = nmB ifTrue:[ |
|
232 |
clsNmA := (a at:1) name. |
|
233 |
clsNmB := (b at:1) name. |
|
234 |
clsNmA < clsNmB |
|
235 |
] ifFalse:[ |
|
236 |
nmA < nmB |
|
237 |
] |
|
238 |
]. |
|
239 |
||
240 |
newNameList := OrderedCollection new. |
|
241 |
selectorList := OrderedCollection new. |
|
242 |
||
243 |
"/ showCategory := allCategories size > 1. |
|
244 |
||
245 |
entries do:[:entry | |
|
246 |
|cls sel mthd s catOrCounts| |
|
247 |
||
248 |
cls := entry at:1. |
|
249 |
sel := entry at:2. |
|
250 |
mthd := entry at:3. |
|
251 |
"/ s := self |
|
252 |
"/ listEntryForMethod:mthd |
|
253 |
"/ selector:sel |
|
254 |
"/ class:cls |
|
255 |
"/ showClass:false |
|
256 |
"/ showCategory:showCategory |
|
257 |
"/ classFirst:false. |
|
258 |
"/ newNameList add:s. |
|
259 |
||
260 |
selectorList add:sel. |
|
261 |
s := sel. |
|
262 |
||
263 |
catOrCounts := categoryOrCountPerSelector at:sel. |
|
264 |
catOrCounts isInteger ifTrue:[ |
|
265 |
s := s , ' { ... }' "/ in multiple categories |
|
266 |
] ifFalse:[ |
|
267 |
allCategories size > 1 ifTrue:[ |
|
268 |
s := s , ' {' , catOrCounts , '}' |
|
269 |
] |
|
270 |
]. |
|
271 |
newNameList add:s. |
|
272 |
]. |
|
273 |
||
274 |
classes := newClasses. |
|
275 |
^ newNameList. |
|
276 |
||
277 |
"Created: / 5.2.2000 / 22:43:40 / cg" |
|
278 |
"Modified: / 1.3.2000 / 21:00:26 / cg" |
|
279 |
! |
|
280 |
||
281 |
release |
|
282 |
super release. |
|
283 |
||
284 |
selectedSelectors removeDependent:self. |
|
285 |
! ! |
|
286 |
||
287 |
!ImplementingMethodList class methodsFor:'documentation'! |
|
288 |
||
289 |
version |
|
14022
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
290 |
^ '$Header: /cvs/stx/stx/libtool/Tools_ImplementingMethodList.st,v 1.4 2014-02-25 10:41:10 vrany Exp $' |
5591 | 291 |
! ! |
14022
c494bb9d1516
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6179
diff
changeset
|
292 |