2520
|
1 |
ApplicationModel subclass:#ClassRevisionTree
|
2612
|
2 |
instanceVariableNames:'selectionHolder dataHolder menuBlock selectionBlock listView
|
|
3 |
hierarchicalList'
|
2520
|
4 |
classVariableNames:''
|
|
5 |
poolDictionaries:''
|
2547
|
6 |
category:'Interface-Browsers-Support'
|
2520
|
7 |
!
|
|
8 |
|
2547
|
9 |
!ClassRevisionTree class methodsFor:'documentation'!
|
|
10 |
|
|
11 |
documentation
|
|
12 |
"
|
|
13 |
documentation to be added.
|
|
14 |
|
|
15 |
[author:]
|
|
16 |
Pierre Schwarz (ps@exept.de)
|
|
17 |
|
|
18 |
[see also:]
|
|
19 |
|
|
20 |
[instance variables:]
|
|
21 |
|
|
22 |
[class variables:]
|
|
23 |
"
|
|
24 |
|
|
25 |
! !
|
2520
|
26 |
|
|
27 |
!ClassRevisionTree class methodsFor:'interface spec'!
|
|
28 |
|
|
29 |
windowSpec
|
|
30 |
"This resource specification was automatically generated
|
|
31 |
by the UIPainter of ST/X."
|
|
32 |
|
|
33 |
"Do not manually edit this!! If it is corrupted,
|
|
34 |
the UIPainter may not be able to read the specification."
|
|
35 |
|
|
36 |
"
|
|
37 |
UIPainter new openOnClass:ClassRevisionTree andSelector:#windowSpec
|
|
38 |
ClassRevisionTree new openInterface:#windowSpec
|
|
39 |
ClassRevisionTree open
|
|
40 |
"
|
|
41 |
|
|
42 |
<resource: #canvas>
|
|
43 |
|
|
44 |
^
|
|
45 |
#(#FullSpec
|
|
46 |
#name: #windowSpec
|
|
47 |
#window:
|
|
48 |
#(#WindowSpec
|
|
49 |
#label: 'ClassVersionTree'
|
|
50 |
#name: 'ClassVersionTree'
|
|
51 |
#min: #(#Point 10 10)
|
|
52 |
#max: #(#Point 9999 9999)
|
2538
|
53 |
#bounds: #(#Rectangle 16 46 881 575)
|
2520
|
54 |
)
|
|
55 |
#component:
|
|
56 |
#(#SpecCollection
|
|
57 |
#collection: #(
|
|
58 |
#(#HierarchicalListViewSpec
|
|
59 |
#name: 'HierarchicalItemListView'
|
|
60 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
2538
|
61 |
#menu: #selectItemMenu
|
2520
|
62 |
#hasHorizontalScrollBar: true
|
|
63 |
#hasVerticalScrollBar: true
|
2538
|
64 |
#listModel: #listModel
|
2520
|
65 |
#multipleSelectOk: true
|
2538
|
66 |
#useIndex: false
|
2520
|
67 |
#highlightMode: #label
|
|
68 |
#doubleClickSelector: #doubleClick:
|
2538
|
69 |
#selectConditionSelector: #isItemSelectable:
|
2520
|
70 |
#indicatorSelector: #doubleClick:
|
|
71 |
#retrieveIconsSelector: #icons
|
|
72 |
)
|
|
73 |
)
|
|
74 |
|
|
75 |
)
|
|
76 |
)
|
|
77 |
! !
|
|
78 |
|
2538
|
79 |
!ClassRevisionTree class methodsFor:'protocol'!
|
2520
|
80 |
|
2538
|
81 |
classItemRootClass
|
|
82 |
|
|
83 |
^ClassItemRoot
|
2520
|
84 |
! !
|
|
85 |
|
|
86 |
!ClassRevisionTree class methodsFor:'startup'!
|
|
87 |
|
2538
|
88 |
openOnClassHolder:aClassHolder
|
|
89 |
|
|
90 |
|theTree|
|
2520
|
91 |
|
|
92 |
theTree := self new.
|
|
93 |
theTree allButOpen.
|
2612
|
94 |
theTree classItemRootClass:ClassItemRoot.
|
2538
|
95 |
theTree classHolder:aClassHolder.
|
|
96 |
theTree openWindow.
|
2520
|
97 |
^theTree
|
|
98 |
|
|
99 |
"
|
2538
|
100 |
|theSelectionHolder theClassHolder theTree|
|
2520
|
101 |
|
|
102 |
theSelectionHolder := ValueHolder new.
|
2538
|
103 |
theClassHolder := ValueHolder new.
|
|
104 |
theSelectionHolder compute:[:coll |
|
|
105 |
coll do:[:each | Transcript showCR: each]].
|
|
106 |
theClassHolder value:(Smalltalk allClasses asOrderedCollection sort:[:x : y|x name < y name]).
|
|
107 |
theTree := ClassRevisionTree openOnClassHolder:theClassHolder.
|
|
108 |
theSelectionHolder value:(Array with:(theTree itemList children last)).
|
|
109 |
theTree selectionHolder:theSelectionHolder.
|
|
110 |
Delay waitForMilliseconds:1500.
|
2612
|
111 |
theClassHolder value:(Project current changedClasses asOrderedCollection).
|
2538
|
112 |
Delay waitForMilliseconds:1500.
|
|
113 |
theTree classHolder:nil.
|
|
114 |
Delay waitForMilliseconds:1500.
|
|
115 |
theTree classHolder:theClassHolder.
|
|
116 |
Delay waitForMilliseconds:1500.
|
|
117 |
theClassHolder value:(Smalltalk allClasses asOrderedCollection sort:[:x : y|x name < y name]).
|
2520
|
118 |
"
|
|
119 |
|
|
120 |
|
|
121 |
|
2538
|
122 |
!
|
|
123 |
|
2612
|
124 |
openOnClassRevisionInfoColl:aClassRevisionInfoColl
|
|
125 |
|
|
126 |
|theTree|
|
|
127 |
|
|
128 |
theTree := self new.
|
|
129 |
theTree allButOpen.
|
|
130 |
theTree classItemRootClass:ClassItemRootForRevision.
|
|
131 |
theTree dataHolder value:aClassRevisionInfoColl.
|
|
132 |
theTree openWindow.
|
|
133 |
^theTree
|
|
134 |
"
|
|
135 |
|theTree infoLog|
|
|
136 |
|
|
137 |
infoLog := OrderedCollection new.
|
|
138 |
CVSSourceCodeManager reportHistoryLogSince:'yesterday'
|
|
139 |
filterSTSources:true
|
|
140 |
filterUser:nil
|
|
141 |
filterRepository:nil
|
|
142 |
inTo:[:info| infoLog add:info].
|
|
143 |
|
|
144 |
theTree := self new.
|
|
145 |
theTree open.
|
|
146 |
theTree classItemRootClass:ClassItemRootForRevision.
|
|
147 |
theTree setupOnClasses:infoLog
|
|
148 |
"
|
|
149 |
|
|
150 |
"
|
|
151 |
|infoLog|
|
|
152 |
|
|
153 |
infoLog := OrderedCollection new.
|
|
154 |
CVSSourceCodeManager reportHistoryLogSince:'yesterday'
|
|
155 |
filterSTSources:true
|
|
156 |
filterUser:nil
|
|
157 |
filterRepository:nil
|
|
158 |
inTo:[:info| infoLog add:info].
|
|
159 |
self openOnClassRevisionInfoColl:infoLog.
|
|
160 |
"
|
|
161 |
!
|
|
162 |
|
2538
|
163 |
openOnClasses:aClassColl
|
|
164 |
|
|
165 |
|theTree|
|
|
166 |
|
|
167 |
theTree := self new.
|
2612
|
168 |
theTree classItemRootClass:ClassItemRoot.
|
2538
|
169 |
theTree allButOpen.
|
2612
|
170 |
theTree setupOnClasses:aClassColl.
|
2538
|
171 |
theTree openWindow.
|
2612
|
172 |
^theTree
|
|
173 |
"
|
|
174 |
self openOnClasses:(Smalltalk allClasses asOrderedCollection sort:[:x : y|x name < y name]).
|
|
175 |
"
|
2538
|
176 |
|
|
177 |
"
|
|
178 |
|theSelectionHolder theTree|
|
|
179 |
|
|
180 |
theSelectionHolder := ValueHolder new.
|
|
181 |
theSelectionHolder compute:[:coll |
|
|
182 |
coll do:[:each | Transcript showCR: each]].
|
|
183 |
theTree := ClassRevisionTree openOnClasses:(Smalltalk allClasses asOrderedCollection sort:[:x : y|x name < y name]).
|
|
184 |
theSelectionHolder value:(Array with:(theTree itemList children last)).
|
|
185 |
theTree selectionHolder:theSelectionHolder.
|
|
186 |
"
|
2520
|
187 |
! !
|
|
188 |
|
|
189 |
!ClassRevisionTree methodsFor:'accessing'!
|
|
190 |
|
2612
|
191 |
dataHolder
|
|
192 |
"return the value of the instance variable 'classHolder' (automatically generated)"
|
|
193 |
|
|
194 |
^dataHolder ifNil:[
|
|
195 |
dataHolder := ValueHolder new.
|
|
196 |
dataHolder addDependent:self
|
|
197 |
]
|
|
198 |
!
|
2538
|
199 |
|
2612
|
200 |
dataHolder:aValueHolder
|
|
201 |
"set the value of the instance variable 'classHolder' (automatically generated)"
|
|
202 |
|
|
203 |
(dataHolder ~~ aValueHolder) ifTrue:[
|
|
204 |
dataHolder removeDependent:self.
|
|
205 |
dataHolder := aValueHolder.
|
|
206 |
dataHolder notNil ifTrue:[
|
|
207 |
dataHolder addDependent:self.
|
|
208 |
].
|
|
209 |
self setUpList
|
|
210 |
].
|
2538
|
211 |
!
|
|
212 |
|
2612
|
213 |
hierarchicalList
|
|
214 |
"
|
|
215 |
returns a hierarchical list which is the model for tree. All necassary things like icons,
|
|
216 |
root and subnodes must be hold by this list. Therefore the list must have a special protocoll.
|
|
217 |
See examples.
|
2538
|
218 |
|
2612
|
219 |
<return: HierarchicalList>
|
|
220 |
"
|
2538
|
221 |
|
2612
|
222 |
hierarchicalList isNil
|
|
223 |
ifTrue:[self error: 'no necessary list is set'. "hierarchicalList := HierarchicalList new"].
|
|
224 |
^ hierarchicalList
|
|
225 |
!
|
2538
|
226 |
|
2612
|
227 |
hierarchicalList:aHierarchicalList
|
|
228 |
"
|
|
229 |
sets the hierarchical list which is the model for tree. All necassary things like icons
|
|
230 |
root and subnodes must be hold by this list. Therefore the list must have a special protocoll.
|
|
231 |
See examples.
|
|
232 |
|
|
233 |
<return: self>
|
|
234 |
"
|
|
235 |
|
|
236 |
hierarchicalList := aHierarchicalList.
|
2520
|
237 |
!
|
|
238 |
|
2538
|
239 |
itemForSelectionIndex:anIndex
|
2612
|
240 |
"
|
|
241 |
|
|
242 |
<return: HierarchicalItem | nil >
|
|
243 |
"
|
2538
|
244 |
^self listModel at:anIndex ifAbsent:nil
|
2520
|
245 |
!
|
|
246 |
|
2538
|
247 |
itemList
|
|
248 |
"automatically generated by UIPainter ..."
|
|
249 |
|
|
250 |
"*** the code below creates a default model when invoked."
|
|
251 |
"*** (which may not be the one you wanted)"
|
|
252 |
"*** Please change as required and accept it in the browser."
|
2520
|
253 |
|
2538
|
254 |
^ self listModel root
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
2520
|
260 |
!
|
|
261 |
|
2612
|
262 |
listView
|
|
263 |
"return the value of the instance variable 'listView' (automatically generated)"
|
2520
|
264 |
|
2612
|
265 |
^ listView!
|
2520
|
266 |
|
2612
|
267 |
listView:something
|
|
268 |
"set the value of the instance variable 'listView' (automatically generated)"
|
2520
|
269 |
|
2612
|
270 |
listView := something.! !
|
2520
|
271 |
|
|
272 |
!ClassRevisionTree methodsFor:'actions'!
|
|
273 |
|
2538
|
274 |
doubleClick:anIndex
|
|
275 |
|
|
276 |
|theItem|
|
2520
|
277 |
|
2612
|
278 |
theItem := self itemForSelectionIndex:anIndex. self halt.
|
|
279 |
self listModel root doubleClickOn:theItem.
|
2520
|
280 |
|
|
281 |
!
|
|
282 |
|
2538
|
283 |
isItemSelectable:anIndex
|
|
284 |
"
|
|
285 |
checks if an item at anIndex can be selected. If an selection block
|
|
286 |
is set, evaluate it with the selected item.
|
|
287 |
(Callback from the tree).
|
2520
|
288 |
|
2538
|
289 |
<return: Boolean>
|
|
290 |
"
|
|
291 |
selectionBlock ifNil:[^true].
|
|
292 |
^selectionBlock value:(self itemForSelectionIndex:anIndex)
|
2520
|
293 |
|
|
294 |
! !
|
|
295 |
|
|
296 |
!ClassRevisionTree methodsFor:'aspects'!
|
|
297 |
|
2538
|
298 |
icons
|
2612
|
299 |
"
|
|
300 |
gets the icons from hierarchical list which should be registered on the view.
|
2520
|
301 |
|
2612
|
302 |
<return: Dictionary of: Symbol->Image | nil>
|
|
303 |
"
|
|
304 |
^self hierarchicalList icons
|
2520
|
305 |
!
|
|
306 |
|
2538
|
307 |
listModel
|
2612
|
308 |
"
|
2520
|
309 |
|
2612
|
310 |
<return: HierarchicalList>
|
|
311 |
"
|
2520
|
312 |
|holder|
|
|
313 |
|
2538
|
314 |
(holder := builder bindingAt:#listModel) isNil ifTrue:[
|
2612
|
315 |
holder := self hierarchicalList.
|
2538
|
316 |
builder aspectAt:#listModel put:holder.
|
|
317 |
holder application:self.
|
2520
|
318 |
].
|
|
319 |
^ holder.
|
2538
|
320 |
! !
|
2520
|
321 |
|
2538
|
322 |
!ClassRevisionTree methodsFor:'change & update'!
|
2520
|
323 |
|
2538
|
324 |
update:something with:aParameter from:changedObject
|
|
325 |
|
2612
|
326 |
changedObject == self dataHolder
|
|
327 |
ifTrue:[self setUpList].
|
2538
|
328 |
|
|
329 |
|
2520
|
330 |
! !
|
|
331 |
|
|
332 |
!ClassRevisionTree methodsFor:'interface opening'!
|
|
333 |
|
2538
|
334 |
postBuildWith: aBuilder
|
|
335 |
|
|
336 |
super postBuildWith: aBuilder.
|
2612
|
337 |
self listView:(self builder componentAt:#HierarchicalItemListView).
|
2538
|
338 |
selectionHolder notNil
|
2544
|
339 |
ifTrue:[listView model:selectionHolder].
|
2612
|
340 |
self listView useDefaultIcons:false.
|
2520
|
341 |
!
|
|
342 |
|
|
343 |
release
|
|
344 |
|
2612
|
345 |
"/ self stopItemTask.
|
2520
|
346 |
^super release
|
|
347 |
|
|
348 |
|
|
349 |
! !
|
|
350 |
|
2538
|
351 |
!ClassRevisionTree methodsFor:'menu actions'!
|
2520
|
352 |
|
2538
|
353 |
selectItemMenu
|
|
354 |
"
|
|
355 |
get the menu for the selected items.If a menuBlock is set then evalute this block
|
|
356 |
with the current selection.
|
2520
|
357 |
|
2538
|
358 |
<return: Menu|nil>
|
|
359 |
"
|
|
360 |
^ [ menuBlock value ]
|
|
361 |
! !
|
2520
|
362 |
|
2538
|
363 |
!ClassRevisionTree methodsFor:'private'!
|
2520
|
364 |
|
2612
|
365 |
setUpList
|
2538
|
366 |
|
2612
|
367 |
self halt.
|
|
368 |
^self hierarchicalList newData: self dataHolder value
|
2520
|
369 |
! !
|
|
370 |
|
2538
|
371 |
!ClassRevisionTree methodsFor:'protocol accessing'!
|
|
372 |
|
|
373 |
menuBlock
|
|
374 |
"return the value of the instance variable 'menuBlock' (automatically generated)"
|
|
375 |
|
|
376 |
^ menuBlock
|
|
377 |
!
|
2520
|
378 |
|
2538
|
379 |
menuBlock:something
|
|
380 |
"set the value of the instance variable 'menuBlock' (automatically generated)"
|
|
381 |
|
|
382 |
menuBlock := something.!
|
|
383 |
|
|
384 |
selectionBlock
|
|
385 |
"return the value of the instance variable 'selectionBlock' (automatically generated)"
|
|
386 |
|
|
387 |
^ selectionBlock!
|
|
388 |
|
|
389 |
selectionBlock:something
|
|
390 |
"set the value of the instance variable 'selectionBlock' (automatically generated)"
|
|
391 |
|
|
392 |
selectionBlock := something.!
|
|
393 |
|
|
394 |
selectionHolder
|
2520
|
395 |
|
2538
|
396 |
^selectionHolder
|
|
397 |
!
|
|
398 |
|
|
399 |
selectionHolder:aValueHolder
|
|
400 |
"set the value of the instance variable 'revisionItemSelection' (automatically generated)"
|
|
401 |
|
|
402 |
selectionHolder := aValueHolder.
|
2612
|
403 |
self listView ifNil:[^self].
|
|
404 |
self listView model:selectionHolder
|
2538
|
405 |
! !
|
|
406 |
|
|
407 |
!ClassRevisionTree methodsFor:'protocol setup'!
|
|
408 |
|
2612
|
409 |
setupOnData:aDataObject
|
2538
|
410 |
|
2612
|
411 |
self dataHolder value:aDataObject.
|
2520
|
412 |
"
|
2612
|
413 |
|theTree infoLog theHierarchicalList|
|
2520
|
414 |
|
|
415 |
theTree := ClassRevisionTree new.
|
2612
|
416 |
theHierarchicalList := HierarchicalClassRevisionList new.
|
|
417 |
theTree hierarchicalList:theHierarchicalList.
|
2520
|
418 |
theTree open.
|
2612
|
419 |
infoLog := OrderedCollection new.
|
|
420 |
theTree setupOnData:infoLog.
|
|
421 |
"
|
|
422 |
"
|
|
423 |
|theTree infoLog theHierarchicalList|
|
|
424 |
|
|
425 |
theTree := ClassRevisionTree new.
|
|
426 |
theHierarchicalList := HierarchicalClassRevisionList new.
|
|
427 |
theTree hierarchicalList:theHierarchicalList.
|
|
428 |
infoLog := OrderedCollection new.
|
|
429 |
CVSSourceCodeManager reportHistoryLogSince:'yesterday'
|
|
430 |
filterSTSources:true
|
|
431 |
filterUser:nil
|
|
432 |
filterRepository:nil
|
|
433 |
inTo:[:info| infoLog add:info].
|
|
434 |
theTree open.
|
|
435 |
theTree setupOnData:infoLog.
|
2520
|
436 |
"
|
|
437 |
! !
|
|
438 |
|
|
439 |
!ClassRevisionTree class methodsFor:'documentation'!
|
|
440 |
|
|
441 |
version
|
2612
|
442 |
^ '$Header: /cvs/stx/stx/libtool/ClassRevisionTree.st,v 1.7 2000-02-15 16:49:16 ps Exp $'
|
2520
|
443 |
! !
|