author | Claus Gittinger <cg@exept.de> |
Fri, 24 Feb 2017 16:54:59 +0100 | |
changeset 17444 | 4506360ae3c8 |
parent 2626 | 4ee750caddab |
child 12123 | 4bde08cebd48 |
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 |
" |
|
12 |
||
13 |
||
14 |
||
2500 | 15 |
ApplicationModel subclass:#HierarchicalVersionDiffBrowser |
2538 | 16 |
instanceVariableNames:'versionDiffBrowser classTree treeSelectionHolder classHolder' |
2500 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-Browsers' |
|
20 |
! |
|
21 |
||
2548 | 22 |
!HierarchicalVersionDiffBrowser 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 |
||
2548 | 40 |
documentation |
41 |
" |
|
2626 | 42 |
This is not yet finished (work in progress) - do not use. |
43 |
||
2549
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
44 |
A hierarchical version diff browser, allowing easy comparison |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
45 |
between a classes versions; will also eventually add capabilities |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
46 |
to checkIn / load classes into / from the repository. |
2548 | 47 |
|
48 |
[author:] |
|
49 |
Pierre Schwarz (ps@exept.de) |
|
50 |
||
51 |
[see also:] |
|
52 |
||
53 |
[instance variables:] |
|
54 |
||
55 |
[class variables:] |
|
56 |
" |
|
57 |
||
2549
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
58 |
! |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
59 |
|
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
60 |
examples |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
61 |
" |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
62 |
[exBegin] |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
63 |
HierarchicalVersionDiffBrowser openOnClasses:(Array with:Smalltalk) |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
64 |
[exEnd] |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
65 |
|
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
66 |
[exBegin] |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
67 |
HierarchicalVersionDiffBrowser openOnClasses:(Project current changedClasses) |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
68 |
[exEnd] |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
69 |
" |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
70 |
|
2548 | 71 |
! ! |
2500 | 72 |
|
73 |
!HierarchicalVersionDiffBrowser class methodsFor:'interface specs'! |
|
74 |
||
75 |
contentsSpecVersionDiffBrowser |
|
76 |
"This resource specification was automatically generated |
|
77 |
by the UIPainter of ST/X." |
|
78 |
||
79 |
"Do not manually edit this!! If it is corrupted, |
|
80 |
the UIPainter may not be able to read the specification." |
|
81 |
||
82 |
" |
|
2515 | 83 |
UIPainter new openOnClass:ClassRevisionTree andSelector:#contentsSpecVersionDiffBrowser |
84 |
ClassRevisionTree new openInterface:#contentsSpecVersionDiffBrowser |
|
2500 | 85 |
" |
86 |
||
87 |
<resource: #canvas> |
|
88 |
||
89 |
^ |
|
90 |
#(#FullSpec |
|
2515 | 91 |
#name: #contentsSpecVersionDiffBrowser |
92 |
#window: |
|
2500 | 93 |
#(#WindowSpec |
2515 | 94 |
#label: 'Hierarchical Version DiffBrowser' |
95 |
#name: 'Hierarchical Version DiffBrowser' |
|
96 |
#min: #(#Point 10 10) |
|
97 |
#max: #(#Point 9999 9999) |
|
98 |
#bounds: #(#Rectangle 12 22 877 551) |
|
99 |
) |
|
100 |
#component: |
|
2500 | 101 |
#(#SpecCollection |
2515 | 102 |
#collection: #( |
103 |
#(#SubCanvasSpec |
|
104 |
#name: 'VersionDiffBrowser' |
|
105 |
#layout: #(#LayoutFrame 0 0.0 30 0.0 0 1.0 0 1.0) |
|
106 |
#hasHorizontalScrollBar: false |
|
107 |
#hasVerticalScrollBar: false |
|
108 |
#majorKey: #VersionDiffBrowser |
|
109 |
#minorKey: #windowSpec |
|
110 |
#clientKey: #versionDiffBrowser |
|
111 |
) |
|
112 |
#(#LabelSpec |
|
113 |
#name: 'Label1' |
|
114 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 20 0) |
|
115 |
#visibilityChannel: #'' |
|
116 |
#translateLabel: true |
|
117 |
#labelChannel: #versionDiffModel |
|
118 |
#resizeForLabel: false |
|
119 |
#adjust: #left |
|
120 |
) |
|
121 |
) |
|
2500 | 122 |
|
2515 | 123 |
) |
2500 | 124 |
) |
125 |
! |
|
126 |
||
127 |
windowSpec |
|
128 |
"This resource specification was automatically generated |
|
129 |
by the UIPainter of ST/X." |
|
130 |
||
131 |
"Do not manually edit this!! If it is corrupted, |
|
132 |
the UIPainter may not be able to read the specification." |
|
133 |
||
134 |
" |
|
135 |
UIPainter new openOnClass:HierarchicalVersionDiffBrowser andSelector:#windowSpec |
|
136 |
HierarchicalVersionDiffBrowser new openInterface:#windowSpec |
|
137 |
HierarchicalVersionDiffBrowser open |
|
138 |
" |
|
139 |
||
140 |
<resource: #canvas> |
|
141 |
||
142 |
^ |
|
143 |
#(#FullSpec |
|
144 |
#name: #windowSpec |
|
145 |
#window: |
|
146 |
#(#WindowSpec |
|
147 |
#label: 'Hierarchical Version DiffBrowser' |
|
148 |
#name: 'Hierarchical Version DiffBrowser' |
|
149 |
#min: #(#Point 10 10) |
|
150 |
#max: #(#Point 9999 9999) |
|
2508 | 151 |
#bounds: #(#Rectangle 16 46 881 575) |
2500 | 152 |
) |
153 |
#component: |
|
154 |
#(#SpecCollection |
|
155 |
#collection: #( |
|
156 |
#(#MenuPanelSpec |
|
157 |
#name: 'menuPanel' |
|
158 |
#layout: #(#LayoutFrame 0 0 0 0 0 1.0 24 0) |
|
159 |
#level: 1 |
|
160 |
#tabable: true |
|
161 |
#style: |
|
162 |
#(#Font |
|
163 |
'helvetica' 'bold' |
|
164 |
'oblique' 10 |
|
165 |
) |
|
166 |
) |
|
167 |
#(#VariableHorizontalPanelSpec |
|
168 |
#name: 'VariableHorizontalPanel1' |
|
2508 | 169 |
#layout: #(#LayoutFrame 0 0.0 25 0.0 0 1.0 0 1.0) |
170 |
#level: 2 |
|
2500 | 171 |
#component: |
172 |
#(#SpecCollection |
|
173 |
#collection: #( |
|
2515 | 174 |
#(#SubCanvasSpec |
175 |
#name: 'ClassTree' |
|
176 |
#hasHorizontalScrollBar: false |
|
177 |
#hasVerticalScrollBar: false |
|
178 |
#majorKey: #ClassRevisonTree |
|
179 |
#minorKey: #windowSpec |
|
180 |
#clientKey: #classTree |
|
2500 | 181 |
) |
182 |
#(#UISubSpecification |
|
183 |
#name: 'SubSpecification1' |
|
184 |
#majorKey: #HierarchicalVersionDiffBrowser |
|
185 |
#minorKey: #contentsSpecVersionDiffBrowser |
|
186 |
) |
|
187 |
) |
|
188 |
||
189 |
) |
|
2538 | 190 |
#handles: #(#Any 0.310983 1.0) |
2500 | 191 |
) |
192 |
) |
|
193 |
||
194 |
) |
|
195 |
) |
|
196 |
! ! |
|
197 |
||
2538 | 198 |
!HierarchicalVersionDiffBrowser class methodsFor:'menu specs'! |
199 |
||
200 |
resourceClassItemMenu |
|
201 |
"This resource specification was automatically generated |
|
202 |
by the MenuEditor of ST/X." |
|
203 |
||
204 |
"Do not manually edit this!! If it is corrupted, |
|
205 |
the MenuEditor may not be able to read the specification." |
|
206 |
||
207 |
" |
|
208 |
MenuEditor new openOnClass:ClassRevisionTree andSelector:#resourceRevisonItemMenu |
|
209 |
(Menu new fromLiteralArrayEncoding:(ClassRevisionTree resourceRevisonItemMenu)) startUp |
|
210 |
" |
|
211 |
||
212 |
<resource: #menu> |
|
213 |
||
214 |
^ |
|
215 |
#(#Menu |
|
216 |
#( |
|
217 |
#(#MenuItem |
|
218 |
#label: 'Browse Class' |
|
219 |
#translateLabel: true |
|
220 |
#value: #menuActionBrowseClass |
|
221 |
) |
|
2549
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
222 |
#(#MenuItem |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
223 |
#label: 'Checkin...' |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
224 |
#translateLabel: true |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
225 |
#value: #menuActionCheckInClass |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
226 |
#enabled: #canCheckInClass |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
227 |
) |
2538 | 228 |
) |
229 |
nil |
|
230 |
nil |
|
231 |
) |
|
232 |
||
233 |
! |
|
234 |
||
235 |
resourceCompareChangesMenu |
|
236 |
"This resource specification was automatically generated |
|
237 |
by the MenuEditor of ST/X." |
|
238 |
||
239 |
"Do not manually edit this!! If it is corrupted, |
|
240 |
the MenuEditor may not be able to read the specification." |
|
241 |
||
242 |
" |
|
243 |
MenuEditor new openOnClass:ClassRevisionTree andSelector:#resourceCompareChangesMenu |
|
244 |
(Menu new fromLiteralArrayEncoding:(ClassRevisionTree resourceCompareChangesMenu)) startUp |
|
245 |
" |
|
246 |
||
247 |
<resource: #menu> |
|
248 |
||
249 |
^ |
|
250 |
#(#Menu |
|
251 |
#( |
|
252 |
#(#MenuItem |
|
253 |
#label: 'Compare Changes' |
|
254 |
#translateLabel: true |
|
255 |
#value: #menuActionCompareChanges |
|
256 |
) |
|
257 |
) |
|
258 |
nil |
|
259 |
nil |
|
260 |
) |
|
261 |
||
262 |
! |
|
263 |
||
264 |
resourceRevisonItemMenu |
|
265 |
"This resource specification was automatically generated |
|
266 |
by the MenuEditor of ST/X." |
|
267 |
||
268 |
"Do not manually edit this!! If it is corrupted, |
|
269 |
the MenuEditor may not be able to read the specification." |
|
270 |
||
271 |
" |
|
272 |
MenuEditor new openOnClass:ClassRevisionTree andSelector:#resourceRevisonItemMenu |
|
273 |
(Menu new fromLiteralArrayEncoding:(ClassRevisionTree resourceRevisonItemMenu)) startUp |
|
274 |
" |
|
275 |
||
276 |
<resource: #menu> |
|
277 |
||
278 |
^ |
|
279 |
#(#Menu |
|
280 |
#( |
|
281 |
#(#MenuItem |
|
282 |
#label: 'Load Revision' |
|
283 |
#translateLabel: true |
|
284 |
#nameKey: #menuActionLoadRevision |
|
285 |
#value: #menuActionLoadRevision |
|
286 |
) |
|
287 |
) |
|
288 |
nil |
|
289 |
nil |
|
290 |
) |
|
291 |
||
292 |
! ! |
|
293 |
||
294 |
!HierarchicalVersionDiffBrowser class methodsFor:'protocol'! |
|
295 |
||
296 |
browserClass |
|
297 |
||
298 |
^SystemBrowser |
|
299 |
! |
|
300 |
||
301 |
tree |
|
302 |
||
303 |
^ClassRevisionTree |
|
304 |
! ! |
|
305 |
||
2500 | 306 |
!HierarchicalVersionDiffBrowser class methodsFor:'startup'! |
307 |
||
2614 | 308 |
openOnClassRevisionInfo:aClassRevisionInfoColl |
309 |
|theBrowser theTree| |
|
310 |
||
311 |
SourceCodeManager isNil ifTrue:[ |
|
312 |
self warn:'SourceCodeManagement is disabled.\\I will not be able to show old versions.' withCRs. |
|
313 |
]. |
|
314 |
theBrowser := self new. |
|
315 |
theTree := self tree new. |
|
316 |
theTree classItemClass: ClassNameItem. |
|
317 |
theTree setUpClassItemBlock:[ |
|
318 |
|theClassRevisionInfoColl root theClassItemColl | |
|
319 |
self halt. |
|
320 |
root := ClassItemRoot new. |
|
321 |
(theClassRevisionInfoColl := self classHolder value) notNil ifTrue:[ |
|
322 |
theClassItemColl := theClassRevisionInfoColl collect:[:eachClass | |
|
323 |
|theClassItem theClass| |
|
324 |
theClassItem := ClassNameItem new. |
|
325 |
theClassItem myClass:(eachClass at:1). |
|
326 |
theClassItem]. |
|
327 |
root addAll: theClassItemColl. |
|
328 |
]. |
|
329 |
self listModel root:root. |
|
330 |
]. |
|
331 |
theBrowser classTree:theTree. |
|
332 |
theBrowser allButOpen. |
|
333 |
theTree classHolder:(theBrowser classHolder value:aClassRevisionInfoColl). |
|
334 |
"theTree selectionHolder:theBrowser treeSelectionHolder." |
|
335 |
"theTree menuBlock:theBrowser menuBlock." |
|
336 |
theBrowser openWindow. |
|
337 |
^theBrowser |
|
338 |
" |
|
339 |
self openOnClassRevisionInfo:#(#(VersionDiffBrowser 1.1 1.2) #(FileBrowser 1.1 1.2) #(Array 1.1 1.2)). |
|
340 |
" |
|
341 |
! |
|
342 |
||
2500 | 343 |
openOnClasses:aClassColl |
2515 | 344 |
|theBrowser theTree| |
2500 | 345 |
|
2549
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
346 |
SourceCodeManager isNil ifTrue:[ |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
347 |
self warn:'SourceCodeManagement is disabled.\\I will not be able to show old versions.' withCRs. |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
348 |
]. |
2500 | 349 |
theBrowser := self new. |
2538 | 350 |
theTree := self tree new. |
351 |
theBrowser classTree:theTree. |
|
2500 | 352 |
theBrowser allButOpen. |
2538 | 353 |
theTree classHolder:(theBrowser classHolder value:aClassColl). |
354 |
theTree selectionHolder:theBrowser treeSelectionHolder. |
|
355 |
theTree menuBlock:theBrowser menuBlock. |
|
2515 | 356 |
theBrowser openWindow. |
2538 | 357 |
^theBrowser |
2500 | 358 |
" |
2538 | 359 |
|theBrowser| |
360 |
theBrowser := self openOnClasses:#(VersionDiffBrowser FileBrowser Array). |
|
361 |
Delay waitForMilliseconds:1500. |
|
362 |
theBrowser classHolder value:(Smalltalk allClasses asOrderedCollection sort:[:x : y|x name < y name]) |
|
2500 | 363 |
" |
364 |
! ! |
|
365 |
||
366 |
!HierarchicalVersionDiffBrowser methodsFor:'accessing'! |
|
367 |
||
2538 | 368 |
classHolder |
369 |
"return the value of the instance variable 'classHolder' (automatically generated)" |
|
370 |
||
371 |
^ classHolder ifNil:[classHolder := ValueHolder new] |
|
372 |
! |
|
373 |
||
374 |
classHolder:something |
|
375 |
"set the value of the instance variable 'classHolder' (automatically generated)" |
|
376 |
||
377 |
classHolder := something.! |
|
378 |
||
2515 | 379 |
classTree |
2500 | 380 |
|
2515 | 381 |
^ classTree |
2500 | 382 |
! |
383 |
||
2515 | 384 |
classTree:something |
385 |
"set the value of the instance variable 'classTree' (automatically generated)" |
|
2509 | 386 |
|
2515 | 387 |
classTree := something.! |
2509 | 388 |
|
2515 | 389 |
treeSelectionHolder |
2500 | 390 |
|
2538 | 391 |
^treeSelectionHolder ifNil:[treeSelectionHolder := ValueHolder new] |
2500 | 392 |
! |
393 |
||
394 |
versionDiffBrowser |
|
2515 | 395 |
|
2500 | 396 |
versionDiffBrowser isNil ifTrue:[ |
397 |
versionDiffBrowser := VersionDiffBrowser new. |
|
398 |
versionDiffBrowser masterApplication:self. |
|
399 |
]. |
|
400 |
^ versionDiffBrowser |
|
401 |
! ! |
|
402 |
||
403 |
!HierarchicalVersionDiffBrowser methodsFor:'aspects'! |
|
404 |
||
2549
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
405 |
canCheckInClass |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
406 |
SourceCodeManager isNil ifTrue:[^ false]. |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
407 |
^ true |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
408 |
! |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
409 |
|
2500 | 410 |
versionDiffModel |
411 |
"automatically generated by UIPainter ..." |
|
412 |
||
413 |
"*** the code below creates a default model when invoked." |
|
414 |
"*** (which may not be the one you wanted)" |
|
415 |
"*** Please change as required and accept it in the browser." |
|
416 |
||
417 |
|holder| |
|
418 |
||
419 |
(holder := builder bindingAt:#versionDiffModel) isNil ifTrue:[ |
|
420 |
holder := String new asValue. |
|
421 |
builder aspectAt:#versionDiffModel put:holder. |
|
422 |
]. |
|
423 |
^ holder. |
|
424 |
! ! |
|
425 |
||
2614 | 426 |
!HierarchicalVersionDiffBrowser methodsFor:'change & update'! |
427 |
||
428 |
delayedUpdate |
|
429 |
||
430 |
self halt. |
|
431 |
||
432 |
! |
|
433 |
||
434 |
update:something with:someArgument from:changedObject |
|
435 |
|sensor| |
|
436 |
||
437 |
"/ delayed update |
|
438 |
"/ if such an update is already in the queue, ignore it. |
|
439 |
"/ Otherwise push it as an event, to be handled when I am back |
|
440 |
||
441 |
(sensor := self window sensor) isNil |
|
442 |
ifTrue:[^ self delayedUpdate]. |
|
443 |
||
444 |
(sensor hasEvent:#delayedUpdate for:self ) |
|
445 |
ifTrue:[^ self]. |
|
446 |
||
447 |
sensor pushUserEvent:#delayedUpdate for:self |
|
448 |
||
449 |
||
450 |
||
451 |
! ! |
|
452 |
||
2538 | 453 |
!HierarchicalVersionDiffBrowser methodsFor:'menu'! |
454 |
||
455 |
menuForClassItemSelected |
|
456 |
" |
|
457 |
<return: Menu> |
|
458 |
" |
|
459 |
|menu| |
|
460 |
||
461 |
menu := Menu new fromLiteralArrayEncoding:(self class resourceClassItemMenu). |
|
462 |
menu receiver:self. |
|
463 |
^menu |
|
464 |
||
465 |
! |
|
466 |
||
467 |
menuForOneRevisionItemSelected |
|
468 |
" |
|
469 |
<return: Menu> |
|
470 |
" |
|
471 |
|menu theItemColl| |
|
472 |
||
473 |
menu := Menu new fromLiteralArrayEncoding:(self class resourceRevisonItemMenu). |
|
474 |
"disable load button, if version already loaded" |
|
475 |
theItemColl := self treeSelectionHolder value. |
|
476 |
theItemColl first isLoadedRevision |
|
477 |
ifTrue:[menu allItemsDo:[:eachItem | eachItem nameKey == #menuActionLoadRevision |
|
478 |
ifTrue:[eachItem isEnabled:false]]. |
|
479 |
]. |
|
480 |
menu receiver:self. |
|
481 |
^menu |
|
482 |
! |
|
483 |
||
484 |
menuForTwoRevisionItemsSelected |
|
485 |
" |
|
486 |
<return: Menu> |
|
487 |
" |
|
488 |
|menu| |
|
489 |
||
490 |
menu := Menu new fromLiteralArrayEncoding:(self class resourceCompareChangesMenu). |
|
491 |
menu receiver:self. |
|
492 |
^menu |
|
493 |
||
494 |
! ! |
|
495 |
||
496 |
!HierarchicalVersionDiffBrowser methodsFor:'menu actions'! |
|
497 |
||
498 |
menuActionBrowseClass |
|
2549
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
499 |
|cls| |
2538 | 500 |
|
2549
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
501 |
cls := self treeSelectionHolder value first myClass. |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
502 |
cls browserClass openInClass:cls |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
503 |
|
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
504 |
! |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
505 |
|
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
506 |
menuActionCheckInClass |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
507 |
|cls| |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
508 |
|
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
509 |
cls := self treeSelectionHolder value first myClass. |
68695c53b707
accessor for defaultForegroundColor
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
510 |
SourceCodeManagerUtilities checkinClass:cls |
2538 | 511 |
|
512 |
! |
|
513 |
||
514 |
menuActionCompareChanges |
|
515 |
||
516 |
self updateVersionDiffBrowser |
|
517 |
||
518 |
||
519 |
! |
|
520 |
||
521 |
menuActionLoadRevision |
|
522 |
||
523 |
|theSelectedItem theLoadedItem theChangeSetA theChangeSetB theChangeDic| |
|
2500 | 524 |
|
2538 | 525 |
theSelectedItem := self treeSelectionHolder value first. |
526 |
theLoadedItem := theSelectedItem parent loadedRevisionItem. |
|
527 |
theChangeSetA := ChangeSet fromStream:(theSelectedItem sourceStream). |
|
528 |
theChangeSetB := ChangeSet fromStream:(theLoadedItem sourceStream). |
|
529 |
(theChangeSetA isNil or:[theChangeSetB isNil]) ifTrue:[^self]. |
|
530 |
theChangeDic := (theChangeSetA diffSetsAgainst:theChangeSetB). |
|
531 |
self applyChangesIn:theChangeDic. |
|
532 |
! |
|
533 |
||
534 |
menuBlock |
|
535 |
||
536 |
^[ |
|
537 |
|menu| |
|
538 |
self checkIfTwoRevisionItemsSelected |
|
539 |
ifTrue: [menu := self menuForTwoRevisionItemsSelected]. |
|
540 |
self checkIfOneRevisionItemSelected |
|
541 |
ifTrue: [menu := self menuForOneRevisionItemSelected]. |
|
542 |
self checkIfClassItemSelected |
|
543 |
ifTrue: [menu := self menuForClassItemSelected]. |
|
544 |
menu |
|
545 |
] |
|
546 |
||
547 |
! ! |
|
548 |
||
549 |
!HierarchicalVersionDiffBrowser methodsFor:'menu testing'! |
|
550 |
||
551 |
checkIfClassItemSelected |
|
552 |
||
553 |
|theItemColl| |
|
554 |
||
555 |
theItemColl := self treeSelectionHolder value. |
|
556 |
^(theItemColl size == 1) and:[theItemColl first isClassItem] |
|
557 |
! |
|
2500 | 558 |
|
2538 | 559 |
checkIfOneRevisionItemSelected |
560 |
||
561 |
|theItemColl theItem| |
|
562 |
||
563 |
theItemColl := self treeSelectionHolder value. |
|
2614 | 564 |
^(theItemColl size == 1) and: |
565 |
[(theItem := theItemColl first) isRevisionItem and: |
|
566 |
[theItem isSourceRevisionItem not and: |
|
567 |
[theItem hasSourceStream]]] |
|
2538 | 568 |
! |
569 |
||
570 |
checkIfTwoRevisionItemsSelected |
|
571 |
||
572 |
|theFirstItem theSecondItem theItemColl| |
|
573 |
||
574 |
theItemColl := self treeSelectionHolder value. |
|
575 |
theItemColl size ~~ 2 |
|
576 |
ifTrue:[^false]. |
|
577 |
theFirstItem := theItemColl first. |
|
578 |
theSecondItem := theItemColl last. |
|
579 |
||
580 |
^theFirstItem isRevisionItem and:[theSecondItem isRevisionItem and: |
|
581 |
[theFirstItem hasSourceStream and:[theSecondItem hasSourceStream and: |
|
582 |
[theFirstItem myClass == theSecondItem myClass]]]] |
|
583 |
! ! |
|
584 |
||
585 |
!HierarchicalVersionDiffBrowser methodsFor:'private'! |
|
586 |
||
587 |
applyChangesIn:aChangeDic |
|
588 |
||
589 |
self halt. |
|
590 |
(aChangeDic at:#onlyInReceiver) apply. |
|
591 |
((aChangeDic at:#changed) collect:[:each | each first]) do:[:eachMethodChange | eachMethodChange apply]. |
|
592 |
(aChangeDic at:#onlyInArg) do: |
|
593 |
[:eachChange | eachChange isMethodChange |
|
594 |
ifTrue:[|theClass| |
|
595 |
(theClass := eachChange changeClass) notNil |
|
596 |
ifTrue:[theClass removeSelector:eachChange selector]]]. |
|
597 |
||
2500 | 598 |
|
599 |
! ! |
|
600 |
||
601 |
!HierarchicalVersionDiffBrowser methodsFor:'update'! |
|
602 |
||
2515 | 603 |
updateVersionDiffBrowser |
604 |
" |
|
605 |
||
606 |
<return: self> |
|
607 |
" |
|
608 |
|theFirstTreeItem theSecondTreeItem theClass theFirstRevisionString theSecondRevisionString| |
|
2500 | 609 |
|
2515 | 610 |
theFirstTreeItem := self treeSelectionHolder value first. |
611 |
theSecondTreeItem := self treeSelectionHolder value last. |
|
612 |
theClass := theFirstTreeItem myClass. |
|
613 |
theFirstRevisionString := theFirstTreeItem revisionString. |
|
614 |
theSecondRevisionString := theSecondTreeItem revisionString. |
|
615 |
self updateVersionDiffLabelForClass:theClass andVersionA:theFirstRevisionString andVersionB:theSecondRevisionString. |
|
616 |
self versionDiffBrowser setupForClass:theClass |
|
617 |
labelA:theFirstRevisionString |
|
618 |
sourceA:theFirstTreeItem sourceStream |
|
619 |
labelB:theSecondRevisionString |
|
620 |
sourceB:theSecondTreeItem sourceStream |
|
621 |
! |
|
2500 | 622 |
|
2515 | 623 |
updateVersionDiffLabelForClass:aClass andVersionA:aVersionA andVersionB:aVersionB |
624 |
" |
|
625 |
||
626 |
<return: self> |
|
627 |
" |
|
2500 | 628 |
|theStream| |
629 |
||
630 |
theStream := WriteStream on:#String. |
|
631 |
theStream nextPutAll:'Compare '. |
|
632 |
theStream nextPutAll: aClass name. |
|
633 |
theStream nextPutAll:' revision '''. |
|
634 |
theStream nextPutAll: aVersionA. |
|
635 |
theStream nextPutAll: ''' with revision '''. |
|
636 |
theStream nextPutAll: aVersionB. |
|
637 |
theStream nextPutAll: '''.'. |
|
638 |
self versionDiffModel value:theStream contents |
|
639 |
! ! |
|
640 |
||
641 |
!HierarchicalVersionDiffBrowser class methodsFor:'documentation'! |
|
642 |
||
643 |
version |
|
2626 | 644 |
^ '$Header: /cvs/stx/stx/libtool/HierarchicalVersionDiffBrowser.st,v 1.9 2000-02-18 14:06:52 cg Exp $' |
2500 | 645 |
! ! |