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