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