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