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