10004
|
1 |
"
|
10039
|
2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
|
|
3 |
Copyright (c) 2009-2010 eXept Software AG
|
10004
|
4 |
|
10039
|
5 |
Permission is hereby granted, free of charge, to any person
|
|
6 |
obtaining a copy of this software and associated documentation
|
|
7 |
files (the 'Software'), to deal in the Software without
|
|
8 |
restriction, including without limitation the rights to use,
|
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10 |
copies of the Software, and to permit persons to whom the
|
|
11 |
Software is furnished to do so, subject to the following
|
|
12 |
conditions:
|
|
13 |
|
|
14 |
The above copyright notice and this permission notice shall be
|
|
15 |
included in all copies or substantial portions of the Software.
|
|
16 |
|
|
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24 |
OTHER DEALINGS IN THE SOFTWARE.
|
10004
|
25 |
"
|
|
26 |
"{ Package: 'stx:libtool' }"
|
|
27 |
|
|
28 |
"{ NameSpace: Tools }"
|
|
29 |
|
|
30 |
MethodList subclass:#ImplementingMethodList
|
|
31 |
instanceVariableNames:'selectorList selectedSelectors'
|
|
32 |
classVariableNames:''
|
|
33 |
poolDictionaries:''
|
|
34 |
category:'Interface-Browsers-New'
|
|
35 |
!
|
|
36 |
|
|
37 |
!ImplementingMethodList class methodsFor:'documentation'!
|
|
38 |
|
|
39 |
copyright
|
|
40 |
"
|
10039
|
41 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
|
|
42 |
Copyright (c) 2009-2010 eXept Software AG
|
|
43 |
|
|
44 |
Permission is hereby granted, free of charge, to any person
|
|
45 |
obtaining a copy of this software and associated documentation
|
|
46 |
files (the 'Software'), to deal in the Software without
|
|
47 |
restriction, including without limitation the rights to use,
|
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
49 |
copies of the Software, and to permit persons to whom the
|
|
50 |
Software is furnished to do so, subject to the following
|
|
51 |
conditions:
|
10004
|
52 |
|
10039
|
53 |
The above copyright notice and this permission notice shall be
|
|
54 |
included in all copies or substantial portions of the Software.
|
|
55 |
|
|
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
63 |
OTHER DEALINGS IN THE SOFTWARE.
|
10004
|
64 |
"
|
|
65 |
!
|
|
66 |
|
|
67 |
documentation
|
|
68 |
"
|
|
69 |
Like a ClassList, but shows classes hierarchical.
|
|
70 |
|
|
71 |
If topClassHolders value is non-nil, only that classes hierarchy
|
|
72 |
is shown.
|
|
73 |
|
|
74 |
embeddable application displaying the classes as listed by
|
|
75 |
the inputGenerator.
|
|
76 |
Provides an outputGenerator, which enumerates the classes and
|
|
77 |
their protocols (method-categories) in the selected classes.
|
|
78 |
|
|
79 |
[author:]
|
|
80 |
Claus Gittinger (cg@exept.de)
|
|
81 |
"
|
|
82 |
|
|
83 |
|
|
84 |
! !
|
|
85 |
|
|
86 |
!ImplementingMethodList class methodsFor:'plugIn spec'!
|
|
87 |
|
|
88 |
aspectSelectors
|
|
89 |
"This resource specification was automatically generated
|
|
90 |
by the UIPainter of ST/X."
|
|
91 |
|
|
92 |
"Do not manually edit this. If it is corrupted,
|
|
93 |
the UIPainter may not be able to read the specification."
|
|
94 |
|
|
95 |
"Return a description of exported aspects;
|
|
96 |
these can be connected to aspects of an embedding application
|
|
97 |
(if this app is embedded in a subCanvas)."
|
|
98 |
|
|
99 |
^ #(
|
|
100 |
#classHolder
|
|
101 |
#(#doubleClickChannel #action )
|
|
102 |
#forceGeneratorTrigger
|
|
103 |
#immediateUpdate
|
|
104 |
#inGeneratorHolder
|
|
105 |
#outGeneratorHolder
|
|
106 |
#menuHolder
|
|
107 |
#methodCategoryHolder
|
|
108 |
#packageFilter
|
|
109 |
#selectedMethods
|
|
110 |
#selectionChangeCondition
|
|
111 |
#updateTrigger
|
|
112 |
).
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
! !
|
|
117 |
|
|
118 |
!ImplementingMethodList methodsFor:'aspects'!
|
|
119 |
|
|
120 |
selectedSelectors
|
|
121 |
selectedSelectors isNil ifTrue:[
|
|
122 |
selectedSelectors := ValueHolder new.
|
|
123 |
selectedSelectors addDependent:self
|
|
124 |
].
|
|
125 |
^ selectedSelectors.
|
|
126 |
|
|
127 |
|
|
128 |
! !
|
|
129 |
|
|
130 |
!ImplementingMethodList methodsFor:'change & update'!
|
|
131 |
|
|
132 |
delayedUpdate:something with:aParameter from:changedObject
|
|
133 |
changedObject == selectedMethodNameIndices ifTrue:[
|
|
134 |
"/ self selectedMethods value:(self selectedMethodNameIndices value collect:[:idx | methodList at:idx]).
|
|
135 |
"/ lastSelectedMethods := self selectedMethods value.
|
|
136 |
|
|
137 |
self selectedSelectors value:(self selectedMethodNameIndices value collect:[:idx | selectorList at:idx]).
|
|
138 |
"/ lastSelectedSelectors := self selectedSelectors value.
|
|
139 |
^ self
|
|
140 |
].
|
|
141 |
changedObject == selectedSelectors ifTrue:[
|
|
142 |
self updateOutputGenerator.
|
|
143 |
^ self
|
|
144 |
].
|
|
145 |
super delayedUpdate:something with:aParameter from:changedObject
|
|
146 |
|
|
147 |
"Created: / 5.2.2000 / 13:42:14 / cg"
|
|
148 |
"Modified: / 6.2.2000 / 00:05:26 / cg"
|
|
149 |
!
|
|
150 |
|
|
151 |
selectedMethodsChanged
|
|
152 |
self updateOutputGenerator
|
|
153 |
!
|
|
154 |
|
|
155 |
selectionChanged
|
|
156 |
self halt:'should not happen'
|
|
157 |
! !
|
|
158 |
|
|
159 |
!ImplementingMethodList methodsFor:'generators'!
|
|
160 |
|
|
161 |
makeGenerator
|
|
162 |
"return a generator which enumerates the methods from the selected protocol;
|
|
163 |
that generator generates 4-element elements (includes the class and protocol),
|
|
164 |
in order to make the consumers only depend on one input
|
|
165 |
(i.e. to pass multiple-class and multiple-protocol info
|
|
166 |
without a need for another classHolder/protocolHolder in the methodList)."
|
|
167 |
|
|
168 |
^ Iterator on:[:whatToDo |
|
|
169 |
|selectors items packages|
|
|
170 |
|
|
171 |
items := OrderedCollection new.
|
|
172 |
|
|
173 |
selectors := self selectedSelectors value ? #().
|
|
174 |
selectors size > 0 ifTrue:[
|
|
175 |
packages := packageFilter value value.
|
|
176 |
selectors do:[:eachSelector |
|
|
177 |
classes do:[:eachClass | |mthd|
|
|
178 |
mthd := eachClass compiledMethodAt:eachSelector.
|
|
179 |
mthd notNil ifTrue:[
|
|
180 |
(packages isNil
|
|
181 |
or:[packages includes:mthd package]) ifTrue:[
|
|
182 |
items add:(Array with:eachClass with:mthd category with:eachSelector with:mthd)
|
|
183 |
]
|
|
184 |
]
|
|
185 |
]
|
|
186 |
]
|
|
187 |
].
|
|
188 |
items sort:[:a :b |
|
|
189 |
|nm1 nm2 sel1 sel2|
|
|
190 |
|
|
191 |
nm1 := (a at:1) name.
|
|
192 |
nm2 := (b at:1) name.
|
|
193 |
nm1 < nm2 ifTrue:[ true ]
|
|
194 |
ifFalse:[
|
|
195 |
nm1 = nm2 ifFalse:[ false ]
|
|
196 |
ifTrue:[
|
|
197 |
sel1 := a at:3.
|
|
198 |
sel2 := b at:3.
|
|
199 |
sel1 < sel2
|
|
200 |
]
|
|
201 |
]
|
|
202 |
].
|
|
203 |
items do:[:eachItem | whatToDo valueWithArguments:eachItem].
|
|
204 |
]
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
! !
|
|
209 |
|
|
210 |
!ImplementingMethodList methodsFor:'private'!
|
|
211 |
|
|
212 |
listOfMethodNames
|
|
213 |
|entries selectorsAlready newNameList
|
|
214 |
newClasses allCategories allSelectors generator
|
|
215 |
"showCategory" categoryOrCountPerSelector|
|
|
216 |
|
|
217 |
generator := inGeneratorHolder value.
|
|
218 |
generator isNil ifTrue:[^ #() ].
|
|
219 |
|
|
220 |
newClasses := IdentitySet new.
|
|
221 |
selectorsAlready := IdentitySet new.
|
|
222 |
entries := OrderedCollection new.
|
|
223 |
allCategories := Set new.
|
|
224 |
allSelectors := Bag identityNew.
|
|
225 |
categoryOrCountPerSelector := IdentityDictionary new.
|
|
226 |
|
|
227 |
"/ generator generates nil-selector entries
|
|
228 |
"/ to pass multiple-class and multiple-protocol info
|
|
229 |
generator do:[:cls :cat :sel :mthd |
|
|
230 |
|catsAlready|
|
|
231 |
|
|
232 |
sel notNil ifTrue:[
|
|
233 |
(selectorsAlready includes:sel) ifFalse:[
|
|
234 |
entries add:(Array with:cls with:sel with:mthd).
|
|
235 |
selectorsAlready add:sel
|
|
236 |
].
|
|
237 |
newClasses add:cls.
|
|
238 |
allCategories add:cat.
|
|
239 |
allSelectors add:sel.
|
|
240 |
|
|
241 |
catsAlready := categoryOrCountPerSelector at:sel ifAbsent:nil.
|
|
242 |
catsAlready isNil ifTrue:[
|
|
243 |
categoryOrCountPerSelector at:sel put:cat.
|
|
244 |
] ifFalse:[
|
|
245 |
catsAlready isInteger ifTrue:[
|
|
246 |
categoryOrCountPerSelector at:sel put:(catsAlready + 1).
|
|
247 |
] ifFalse:[
|
|
248 |
catsAlready ~= cat ifTrue:[
|
|
249 |
categoryOrCountPerSelector at:sel put:2.
|
|
250 |
]
|
|
251 |
]
|
|
252 |
]
|
|
253 |
]
|
|
254 |
].
|
|
255 |
|
|
256 |
entries sort:[:a :b | |nmA nmB clsNmA clsNmB|
|
|
257 |
nmA := (a at:2).
|
|
258 |
nmB := (b at:2).
|
|
259 |
nmA = nmB ifTrue:[
|
|
260 |
clsNmA := (a at:1) name.
|
|
261 |
clsNmB := (b at:1) name.
|
|
262 |
clsNmA < clsNmB
|
|
263 |
] ifFalse:[
|
|
264 |
nmA < nmB
|
|
265 |
]
|
|
266 |
].
|
|
267 |
|
|
268 |
newNameList := OrderedCollection new.
|
|
269 |
selectorList := OrderedCollection new.
|
|
270 |
|
|
271 |
"/ showCategory := allCategories size > 1.
|
|
272 |
|
|
273 |
entries do:[:entry |
|
|
274 |
|cls sel mthd s catOrCounts|
|
|
275 |
|
|
276 |
cls := entry at:1.
|
|
277 |
sel := entry at:2.
|
|
278 |
mthd := entry at:3.
|
|
279 |
"/ s := self
|
|
280 |
"/ listEntryForMethod:mthd
|
|
281 |
"/ selector:sel
|
|
282 |
"/ class:cls
|
|
283 |
"/ showClass:false
|
|
284 |
"/ showCategory:showCategory
|
|
285 |
"/ classFirst:false.
|
|
286 |
"/ newNameList add:s.
|
|
287 |
|
|
288 |
selectorList add:sel.
|
|
289 |
s := sel.
|
|
290 |
|
|
291 |
catOrCounts := categoryOrCountPerSelector at:sel.
|
|
292 |
catOrCounts isInteger ifTrue:[
|
|
293 |
s := s , ' { ... }' "/ in multiple categories
|
|
294 |
] ifFalse:[
|
|
295 |
allCategories size > 1 ifTrue:[
|
|
296 |
s := s , ' {' , catOrCounts , '}'
|
|
297 |
]
|
|
298 |
].
|
|
299 |
newNameList add:s.
|
|
300 |
].
|
|
301 |
|
|
302 |
classes := newClasses.
|
|
303 |
^ newNameList.
|
|
304 |
|
|
305 |
"Created: / 5.2.2000 / 22:43:40 / cg"
|
|
306 |
"Modified: / 1.3.2000 / 21:00:26 / cg"
|
|
307 |
!
|
|
308 |
|
|
309 |
release
|
|
310 |
super release.
|
|
311 |
|
|
312 |
selectedSelectors removeDependent:self.
|
|
313 |
! !
|
|
314 |
|
|
315 |
!ImplementingMethodList class methodsFor:'documentation'!
|
|
316 |
|
|
317 |
version_CVS
|
10039
|
318 |
^ '$Header: /cvs/stx/stx/libtool/Tools__ImplementingMethodList.st,v 1.2 2011-07-03 13:37:06 cg Exp $'
|
10004
|
319 |
!
|
|
320 |
|
|
321 |
version_SVN
|
|
322 |
^ '§Id: Tools__ImplementingMethodList.st 7796 2011-06-23 16:01:32Z vranyj1 §'
|
|
323 |
! !
|