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