2500
|
1 |
ApplicationModel subclass:#HierarchicalVersionDiffBrowser
|
|
2 |
instanceVariableNames:'versionDiffBrowser'
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'Interface-Browsers'
|
|
6 |
!
|
|
7 |
|
|
8 |
HierarchicalItem subclass:#AbstractVersionDiffBrowserItem
|
|
9 |
instanceVariableNames:''
|
|
10 |
classVariableNames:''
|
|
11 |
poolDictionaries:''
|
|
12 |
privateIn:HierarchicalVersionDiffBrowser
|
|
13 |
!
|
|
14 |
|
|
15 |
HierarchicalVersionDiffBrowser::AbstractVersionDiffBrowserItem subclass:#ClassItemRoot
|
|
16 |
instanceVariableNames:''
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
privateIn:HierarchicalVersionDiffBrowser
|
|
20 |
!
|
|
21 |
|
|
22 |
HierarchicalVersionDiffBrowser::AbstractVersionDiffBrowserItem subclass:#ClassItem
|
|
23 |
instanceVariableNames:'myClass'
|
|
24 |
classVariableNames:''
|
|
25 |
poolDictionaries:''
|
|
26 |
privateIn:HierarchicalVersionDiffBrowser
|
|
27 |
!
|
|
28 |
|
|
29 |
HierarchicalVersionDiffBrowser::AbstractVersionDiffBrowserItem subclass:#RevisionItem
|
|
30 |
instanceVariableNames:'revision'
|
|
31 |
classVariableNames:''
|
|
32 |
poolDictionaries:''
|
|
33 |
privateIn:HierarchicalVersionDiffBrowser
|
|
34 |
!
|
|
35 |
|
|
36 |
|
|
37 |
!HierarchicalVersionDiffBrowser class methodsFor:'interface specs'!
|
|
38 |
|
|
39 |
contentsSpecVersionDiffBrowser
|
|
40 |
"This resource specification was automatically generated
|
|
41 |
by the UIPainter of ST/X."
|
|
42 |
|
|
43 |
"Do not manually edit this!! If it is corrupted,
|
|
44 |
the UIPainter may not be able to read the specification."
|
|
45 |
|
|
46 |
"
|
|
47 |
UIPainter new openOnClass:HierarchicalVersionDiffBrowser andSelector:#contentsSpecVersionDiffBrowser
|
|
48 |
HierarchicalVersionDiffBrowser new openInterface:#contentsSpecVersionDiffBrowser
|
|
49 |
"
|
|
50 |
|
|
51 |
<resource: #canvas>
|
|
52 |
|
|
53 |
^
|
|
54 |
#(#FullSpec
|
|
55 |
#name: #contentsSpecVersionDiffBrowser
|
|
56 |
#window:
|
|
57 |
#(#WindowSpec
|
|
58 |
#label: 'Hierarchical Version DiffBrowser'
|
|
59 |
#name: 'Hierarchical Version DiffBrowser'
|
|
60 |
#min: #(#Point 10 10)
|
|
61 |
#max: #(#Point 9999 9999)
|
|
62 |
#bounds: #(#Rectangle 12 22 877 551)
|
|
63 |
)
|
|
64 |
#component:
|
|
65 |
#(#SpecCollection
|
|
66 |
#collection: #(
|
|
67 |
#(#SubCanvasSpec
|
|
68 |
#name: 'VersionDiffBrowser'
|
|
69 |
#layout: #(#LayoutFrame 0 0.0 30 0.0 0 1.0 0 1.0)
|
|
70 |
#hasHorizontalScrollBar: false
|
|
71 |
#hasVerticalScrollBar: false
|
|
72 |
#majorKey: #VersionDiffBrowser
|
|
73 |
#minorKey: #windowSpec
|
|
74 |
#clientKey: #versionDiffBrowser
|
|
75 |
)
|
|
76 |
#(#LabelSpec
|
|
77 |
#name: 'Label1'
|
|
78 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 20 0)
|
|
79 |
#visibilityChannel: #''
|
|
80 |
#translateLabel: true
|
|
81 |
#labelChannel: #versionDiffModel
|
|
82 |
#resizeForLabel: false
|
|
83 |
#adjust: #left
|
|
84 |
)
|
|
85 |
)
|
|
86 |
|
|
87 |
)
|
|
88 |
)
|
|
89 |
!
|
|
90 |
|
|
91 |
windowSpec
|
|
92 |
"This resource specification was automatically generated
|
|
93 |
by the UIPainter of ST/X."
|
|
94 |
|
|
95 |
"Do not manually edit this!! If it is corrupted,
|
|
96 |
the UIPainter may not be able to read the specification."
|
|
97 |
|
|
98 |
"
|
|
99 |
UIPainter new openOnClass:HierarchicalVersionDiffBrowser andSelector:#windowSpec
|
|
100 |
HierarchicalVersionDiffBrowser new openInterface:#windowSpec
|
|
101 |
HierarchicalVersionDiffBrowser open
|
|
102 |
"
|
|
103 |
|
|
104 |
<resource: #canvas>
|
|
105 |
|
|
106 |
^
|
|
107 |
#(#FullSpec
|
|
108 |
#name: #windowSpec
|
|
109 |
#window:
|
|
110 |
#(#WindowSpec
|
|
111 |
#label: 'Hierarchical Version DiffBrowser'
|
|
112 |
#name: 'Hierarchical Version DiffBrowser'
|
|
113 |
#min: #(#Point 10 10)
|
|
114 |
#max: #(#Point 9999 9999)
|
|
115 |
#bounds: #(#Rectangle 12 22 877 551)
|
|
116 |
)
|
|
117 |
#component:
|
|
118 |
#(#SpecCollection
|
|
119 |
#collection: #(
|
|
120 |
#(#MenuPanelSpec
|
|
121 |
#name: 'menuPanel'
|
|
122 |
#layout: #(#LayoutFrame 0 0 0 0 0 1.0 24 0)
|
|
123 |
#level: 1
|
|
124 |
#tabable: true
|
|
125 |
#style:
|
|
126 |
#(#Font
|
|
127 |
'helvetica' 'bold'
|
|
128 |
'oblique' 10
|
|
129 |
)
|
|
130 |
)
|
|
131 |
#(#VariableHorizontalPanelSpec
|
|
132 |
#name: 'VariableHorizontalPanel1'
|
|
133 |
#layout: #(#LayoutFrame 0 0.0 21 0.0 0 1.0 0 1.0)
|
|
134 |
#level: 0
|
|
135 |
#component:
|
|
136 |
#(#SpecCollection
|
|
137 |
#collection: #(
|
|
138 |
#(#HierarchicalListViewSpec
|
|
139 |
#name: 'HierarchicalItemListView'
|
|
140 |
#model: #hierarchicalItemSelectionAspect
|
|
141 |
#menu: #selectHierarchicalItemMenu
|
|
142 |
#hasHorizontalScrollBar: true
|
|
143 |
#hasVerticalScrollBar: true
|
|
144 |
#listModel: #hierarchicalItemListModel
|
|
145 |
#multipleSelectOk: true
|
|
146 |
#highlightMode: #label
|
|
147 |
#doubleClickSelector: #doubleClick:
|
|
148 |
#indicatorSelector: #doubleClick:
|
|
149 |
)
|
|
150 |
#(#UISubSpecification
|
|
151 |
#name: 'SubSpecification1'
|
|
152 |
#majorKey: #HierarchicalVersionDiffBrowser
|
|
153 |
#minorKey: #contentsSpecVersionDiffBrowser
|
|
154 |
)
|
|
155 |
)
|
|
156 |
|
|
157 |
)
|
|
158 |
#handles: #(#Any 0.289017 1.0)
|
|
159 |
)
|
|
160 |
)
|
|
161 |
|
|
162 |
)
|
|
163 |
)
|
|
164 |
! !
|
|
165 |
|
|
166 |
!HierarchicalVersionDiffBrowser class methodsFor:'menu specs'!
|
|
167 |
|
|
168 |
resourceItemMenu
|
|
169 |
"This resource specification was automatically generated
|
|
170 |
by the MenuEditor of ST/X."
|
|
171 |
|
|
172 |
"Do not manually edit this!! If it is corrupted,
|
|
173 |
the MenuEditor may not be able to read the specification."
|
|
174 |
|
|
175 |
"
|
|
176 |
MenuEditor new openOnClass:HierarchicalVersionDiffBrowser andSelector:#resourceItemMenu
|
|
177 |
(Menu new fromLiteralArrayEncoding:(HierarchicalVersionDiffBrowser resourceItemMenu)) startUp
|
|
178 |
"
|
|
179 |
|
|
180 |
<resource: #menu>
|
|
181 |
|
|
182 |
^
|
|
183 |
#(#Menu
|
|
184 |
#(
|
|
185 |
#(#MenuItem
|
|
186 |
#label: 'Compare Changes'
|
|
187 |
#translateLabel: true
|
|
188 |
#value: #menuActionCompareChanges
|
|
189 |
)
|
|
190 |
)
|
|
191 |
nil
|
|
192 |
nil
|
|
193 |
)
|
|
194 |
! !
|
|
195 |
|
|
196 |
!HierarchicalVersionDiffBrowser class methodsFor:'startup'!
|
|
197 |
|
|
198 |
openOnClasses:aClassColl
|
|
199 |
|theBrowser theClassItemColl|
|
|
200 |
|
|
201 |
theBrowser := self new.
|
|
202 |
theBrowser allButOpen.
|
|
203 |
theClassItemColl := aClassColl collect:[:eachClass |
|
|
204 |
|theClassItem theClass|
|
|
205 |
theClassItem := ClassItem new.
|
|
206 |
theClass := Smalltalk resolveName:eachClass inClass:self.
|
|
207 |
theClassItem myClass:theClass.
|
|
208 |
theClassItem].
|
|
209 |
theBrowser hierarchicalItemList addAll: theClassItemColl.
|
|
210 |
theBrowser hierarchicalListSelectionIndexColl:(Array with:1).
|
|
211 |
theBrowser openWindow.
|
|
212 |
|
|
213 |
|
|
214 |
"
|
|
215 |
HierarchicalVersionDiffBrowser openOnClasses:#(VersionDiffBrowser FileBrowser Array)
|
|
216 |
HierarchicalVersionDiffBrowser openOnClasses:(Smalltalk allClasses asOrderedCollection sort:[:x : y|x name < y name])
|
|
217 |
"
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
! !
|
|
222 |
|
|
223 |
!HierarchicalVersionDiffBrowser methodsFor:'accessing'!
|
|
224 |
|
|
225 |
hierarchicalListItemForSelectionIndex: anIndex
|
|
226 |
|
|
227 |
^self hierarchicalItemListModel at:anIndex ifAbsent:nil
|
|
228 |
!
|
|
229 |
|
|
230 |
hierarchicalListSelectionIndexColl
|
|
231 |
|
|
232 |
^self hierarchicalItemSelectionAspect value
|
|
233 |
!
|
|
234 |
|
|
235 |
hierarchicalListSelectionIndexColl:anArray
|
|
236 |
|
|
237 |
^self hierarchicalItemSelectionAspect value:anArray
|
|
238 |
! !
|
|
239 |
|
|
240 |
!HierarchicalVersionDiffBrowser methodsFor:'actions'!
|
|
241 |
|
|
242 |
doubleClick: anIndex
|
|
243 |
"automatically generated by UIPainter ..."
|
|
244 |
|
|
245 |
"*** the code below performs no action"
|
|
246 |
"*** (except for some feedback on the Transcript)"
|
|
247 |
"*** Please change as required and accept in the browser."
|
|
248 |
|
|
249 |
"action to be added ..."
|
|
250 |
|
|
251 |
(self hierarchicalItemListModel at: anIndex) toggleExpand
|
|
252 |
!
|
|
253 |
|
|
254 |
menuActionCompareChanges
|
|
255 |
|
|
256 |
|theSelectionIndexColl theFirstRevisionItem theSecondRevisionString theClass theFirstRevisionString|
|
|
257 |
|
|
258 |
theSelectionIndexColl := self hierarchicalListSelectionIndexColl.
|
|
259 |
theFirstRevisionItem := (self hierarchicalListItemForSelectionIndex:theSelectionIndexColl first).
|
|
260 |
theClass := theFirstRevisionItem parent myClass.
|
|
261 |
theFirstRevisionString := theFirstRevisionItem revision.
|
|
262 |
theSecondRevisionString := (self hierarchicalListItemForSelectionIndex:theSelectionIndexColl last) revision.
|
|
263 |
self updateVersionDiffLabelForClass:theClass andVersionA:theFirstRevisionString andVersionB:theSecondRevisionString.
|
|
264 |
self withWaitCursorDo:[
|
|
265 |
self versionDiffBrowser setupForClass:theClass versionA:theFirstRevisionString versionB:theSecondRevisionString.
|
|
266 |
].
|
|
267 |
!
|
|
268 |
|
|
269 |
selectHierarchicalItemMenu
|
|
270 |
"
|
|
271 |
<return: Block>
|
|
272 |
"
|
|
273 |
|
|
274 |
^[|menu|
|
|
275 |
self checkIfTwoResourceItemsSelected
|
|
276 |
ifFalse:[menu := nil]
|
|
277 |
ifTrue: [menu := Menu new fromLiteralArrayEncoding:(self class resourceItemMenu).
|
|
278 |
menu receiver:self].
|
|
279 |
menu
|
|
280 |
]
|
|
281 |
!
|
|
282 |
|
|
283 |
versionDiffBrowser
|
|
284 |
versionDiffBrowser isNil ifTrue:[
|
|
285 |
versionDiffBrowser := VersionDiffBrowser new.
|
|
286 |
"/ versionDiffBrowser hasMenu:false.
|
|
287 |
versionDiffBrowser masterApplication:self.
|
|
288 |
].
|
|
289 |
^ versionDiffBrowser
|
|
290 |
! !
|
|
291 |
|
|
292 |
!HierarchicalVersionDiffBrowser methodsFor:'aspects'!
|
|
293 |
|
|
294 |
hierarchicalItemList
|
|
295 |
"automatically generated by UIPainter ..."
|
|
296 |
|
|
297 |
"*** the code below creates a default model when invoked."
|
|
298 |
"*** (which may not be the one you wanted)"
|
|
299 |
"*** Please change as required and accept it in the browser."
|
|
300 |
|
|
301 |
^ self hierarchicalItemListModel root
|
|
302 |
|
|
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
!
|
|
308 |
|
|
309 |
hierarchicalItemListModel
|
|
310 |
"automatically generated by UIPainter ..."
|
|
311 |
|
|
312 |
"*** the code below creates a default model when invoked."
|
|
313 |
"*** (which may not be the one you wanted)"
|
|
314 |
"*** Please change as required and accept it in the browser."
|
|
315 |
|
|
316 |
|holder|
|
|
317 |
|
|
318 |
(holder := builder bindingAt:#hierarchicalItemListModel) isNil ifTrue:[
|
|
319 |
holder := HierarchicalList new.
|
|
320 |
holder root:(ClassItemRoot new).
|
|
321 |
holder showRoot:false.
|
|
322 |
builder aspectAt:#hierarchicalItemListModel put:holder.
|
|
323 |
holder application:self.
|
|
324 |
].
|
|
325 |
|
|
326 |
^ holder.
|
|
327 |
|
|
328 |
!
|
|
329 |
|
|
330 |
hierarchicalItemSelectionAspect
|
|
331 |
"automatically generated by UIPainter ..."
|
|
332 |
|
|
333 |
"*** the code below creates a default model when invoked."
|
|
334 |
"*** (which may not be the one you wanted)"
|
|
335 |
"*** Please change as required and accept it in the browser."
|
|
336 |
|
|
337 |
|holder|
|
|
338 |
|
|
339 |
(holder := builder bindingAt:#hierarchicalItemSelectionAspect) isNil ifTrue:[
|
|
340 |
holder := ValueHolder new.
|
|
341 |
builder aspectAt:#hierarchicalItemSelectionAspect put:holder.
|
|
342 |
holder addDependent: self.
|
|
343 |
].
|
|
344 |
^ holder.
|
|
345 |
|
|
346 |
!
|
|
347 |
|
|
348 |
versionDiffModel
|
|
349 |
"automatically generated by UIPainter ..."
|
|
350 |
|
|
351 |
"*** the code below creates a default model when invoked."
|
|
352 |
"*** (which may not be the one you wanted)"
|
|
353 |
"*** Please change as required and accept it in the browser."
|
|
354 |
|
|
355 |
|holder|
|
|
356 |
|
|
357 |
(holder := builder bindingAt:#versionDiffModel) isNil ifTrue:[
|
|
358 |
holder := String new asValue.
|
|
359 |
builder aspectAt:#versionDiffModel put:holder.
|
|
360 |
].
|
|
361 |
^ holder.
|
|
362 |
! !
|
|
363 |
|
|
364 |
!HierarchicalVersionDiffBrowser methodsFor:'interface opening'!
|
|
365 |
|
|
366 |
postOpenWith: aBuilder
|
|
367 |
|
|
368 |
|
|
369 |
super postOpenWith: aBuilder.
|
|
370 |
self hierarchicalItemList expand.
|
|
371 |
! !
|
|
372 |
|
|
373 |
!HierarchicalVersionDiffBrowser methodsFor:'testing'!
|
|
374 |
|
|
375 |
checkIfTwoResourceItemsSelected
|
|
376 |
|
|
377 |
|theSelectionIndexColl|
|
|
378 |
|
|
379 |
((theSelectionIndexColl := self hierarchicalListSelectionIndexColl) isNil or:
|
|
380 |
[theSelectionIndexColl size ~~ 2])
|
|
381 |
ifTrue:[^false].
|
|
382 |
^((self hierarchicalListItemForSelectionIndex:theSelectionIndexColl first) isRevisionItem
|
|
383 |
and:[(self hierarchicalListItemForSelectionIndex:theSelectionIndexColl last) isRevisionItem])
|
|
384 |
! !
|
|
385 |
|
|
386 |
!HierarchicalVersionDiffBrowser methodsFor:'update'!
|
|
387 |
|
|
388 |
updateVersionDiffLabelForClass:aClass andVersionA:aVersionA andVersionB:aVersionB
|
|
389 |
|
|
390 |
|
|
391 |
|theStream|
|
|
392 |
|
|
393 |
theStream := WriteStream on:#String.
|
|
394 |
theStream nextPutAll:'Compare '.
|
|
395 |
theStream nextPutAll: aClass name.
|
|
396 |
theStream nextPutAll:' revision '''.
|
|
397 |
theStream nextPutAll: aVersionA.
|
|
398 |
theStream nextPutAll: ''' with revision '''.
|
|
399 |
theStream nextPutAll: aVersionB.
|
|
400 |
theStream nextPutAll: '''.'.
|
|
401 |
self versionDiffModel value:theStream contents
|
|
402 |
! !
|
|
403 |
|
|
404 |
!HierarchicalVersionDiffBrowser::AbstractVersionDiffBrowserItem methodsFor:'protocol'!
|
|
405 |
|
|
406 |
children
|
|
407 |
"returns list of children
|
|
408 |
*** to optimize:redefine by subClass
|
|
409 |
"
|
|
410 |
children isNil ifTrue:[
|
|
411 |
children := #()
|
|
412 |
].
|
|
413 |
^ children
|
|
414 |
|
|
415 |
|
|
416 |
|
|
417 |
|
|
418 |
|
|
419 |
|
|
420 |
!
|
|
421 |
|
|
422 |
icon
|
|
423 |
^ nil
|
|
424 |
|
|
425 |
|
|
426 |
!
|
|
427 |
|
|
428 |
label
|
|
429 |
^ nil
|
|
430 |
|
|
431 |
!
|
|
432 |
|
|
433 |
middleButtonMenu
|
|
434 |
"returns the middleButtonMenu or nil if no menu is defined
|
|
435 |
"
|
|
436 |
^ nil
|
|
437 |
|
|
438 |
! !
|
|
439 |
|
|
440 |
!HierarchicalVersionDiffBrowser::AbstractVersionDiffBrowserItem methodsFor:'testing'!
|
|
441 |
|
|
442 |
isClassItem
|
|
443 |
|
|
444 |
^false
|
|
445 |
!
|
|
446 |
|
|
447 |
isRevisionItem
|
|
448 |
|
|
449 |
^false
|
|
450 |
! !
|
|
451 |
|
|
452 |
!HierarchicalVersionDiffBrowser::ClassItemRoot methodsFor:'initialization'!
|
|
453 |
|
|
454 |
initialize
|
|
455 |
super initialize.
|
|
456 |
|
|
457 |
children := OrderedCollection new.
|
|
458 |
isExpanded := true.
|
|
459 |
|
|
460 |
|
|
461 |
! !
|
|
462 |
|
|
463 |
!HierarchicalVersionDiffBrowser::ClassItem methodsFor:'accessing'!
|
|
464 |
|
|
465 |
myClass
|
|
466 |
"return the value of the instance variable 'myClass' (automatically generated)"
|
|
467 |
|
|
468 |
^ myClass!
|
|
469 |
|
|
470 |
myClass:something
|
|
471 |
"set the value of the instance variable 'myClass' (automatically generated)"
|
|
472 |
|
|
473 |
myClass := something.! !
|
|
474 |
|
|
475 |
!HierarchicalVersionDiffBrowser::ClassItem methodsFor:'protocol'!
|
|
476 |
|
|
477 |
children
|
|
478 |
"returns list of children. The revision for the class myClass
|
|
479 |
are computed via the sourcecode manager. Only when the childrens
|
|
480 |
are needed, they are calculated.
|
|
481 |
|
|
482 |
<return: List>
|
|
483 |
"
|
|
484 |
|
|
485 |
children ifNil:[
|
|
486 |
self application withWaitCursorDo:[
|
|
487 |
|theRevisionItemColl|
|
|
488 |
theRevisionItemColl := (myClass sourceCodeManager revisionsOf:myClass) collect:[:eachRevision|
|
|
489 |
|theRevisionItem|
|
|
490 |
theRevisionItem := HierarchicalVersionDiffBrowser::RevisionItem new.
|
|
491 |
theRevisionItem revision:eachRevision.
|
|
492 |
theRevisionItem].
|
|
493 |
children:=theRevisionItemColl.
|
|
494 |
children do:[:aChild| aChild parent:self]]].
|
|
495 |
^children
|
|
496 |
!
|
|
497 |
|
|
498 |
hasChildren
|
|
499 |
children ifNil:[^ true].
|
|
500 |
^ children size ~~ 0
|
|
501 |
!
|
|
502 |
|
|
503 |
label
|
|
504 |
|
|
505 |
^myClass name
|
|
506 |
|
|
507 |
|
|
508 |
! !
|
|
509 |
|
|
510 |
!HierarchicalVersionDiffBrowser::ClassItem methodsFor:'testing'!
|
|
511 |
|
|
512 |
isClassItem
|
|
513 |
|
|
514 |
^true
|
|
515 |
|
|
516 |
|
|
517 |
! !
|
|
518 |
|
|
519 |
!HierarchicalVersionDiffBrowser::RevisionItem methodsFor:'accessing'!
|
|
520 |
|
|
521 |
revision
|
|
522 |
"return the value of the instance variable 'revision' (automatically generated)"
|
|
523 |
|
|
524 |
^ revision!
|
|
525 |
|
|
526 |
revision:something
|
|
527 |
"set the value of the instance variable 'revision' (automatically generated)"
|
|
528 |
|
|
529 |
revision := something.! !
|
|
530 |
|
|
531 |
!HierarchicalVersionDiffBrowser::RevisionItem methodsFor:'protocol'!
|
|
532 |
|
|
533 |
label
|
|
534 |
|
|
535 |
|
|
536 |
^revision
|
|
537 |
|
|
538 |
|
|
539 |
! !
|
|
540 |
|
|
541 |
!HierarchicalVersionDiffBrowser::RevisionItem methodsFor:'testing'!
|
|
542 |
|
|
543 |
isRevisionItem
|
|
544 |
|
|
545 |
^true
|
|
546 |
|
|
547 |
! !
|
|
548 |
|
|
549 |
!HierarchicalVersionDiffBrowser class methodsFor:'documentation'!
|
|
550 |
|
|
551 |
version
|
|
552 |
^ '$Header: /cvs/stx/stx/libtool/HierarchicalVersionDiffBrowser.st,v 1.1 1999-12-23 15:31:19 ps Exp $'
|
|
553 |
! !
|