author | Claus Gittinger <cg@exept.de> |
Tue, 07 Dec 1999 15:20:00 +0100 | |
changeset 2467 | 32ba79b6cbff |
parent 2465 | 0567a72d20a5 |
child 2468 | 9ebc05bc8582 |
permissions | -rw-r--r-- |
2221 | 1 |
ApplicationModel subclass:#VersionDiffBrowser |
2 |
instanceVariableNames:'classBeingCompared versionA versionB changeSetA changeSetB |
|
2224 | 3 |
filteredChangeSetA filteredChangeSetB changedMethodsChangeSet |
2221 | 4 |
indexFromChangedToA indexFromChangedToB diffTextView' |
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Interface-Browsers' |
|
8 |
! |
|
9 |
||
2224 | 10 |
VersionDiffBrowser comment:'some comment |
11 |
'! |
|
12 |
||
2221 | 13 |
|
14 |
!VersionDiffBrowser class methodsFor:'interface specs'! |
|
15 |
||
16 |
windowSpec |
|
17 |
"This resource specification was automatically generated |
|
18 |
by the UIPainter of ST/X." |
|
19 |
||
20 |
"Do not manually edit this!! If it is corrupted, |
|
21 |
the UIPainter may not be able to read the specification." |
|
22 |
||
23 |
" |
|
24 |
UIPainter new openOnClass:VersionDiffBrowser andSelector:#windowSpec |
|
25 |
VersionDiffBrowser new openInterface:#windowSpec |
|
26 |
VersionDiffBrowser open |
|
27 |
" |
|
28 |
||
29 |
<resource: #canvas> |
|
30 |
||
31 |
^ |
|
32 |
#(#FullSpec |
|
33 |
#name: #windowSpec |
|
34 |
#window: |
|
35 |
#(#WindowSpec |
|
36 |
#label: 'Version DiffBrowser' |
|
37 |
#name: 'Version DiffBrowser' |
|
38 |
#layout: #(#LayoutFrame 220 0 200 0 1084 0 703 0) |
|
39 |
#level: 0 |
|
40 |
#min: #(#Point 10 10) |
|
41 |
#max: #(#Point nil nil) |
|
42 |
#bounds: #(#Rectangle 220 200 1085 704) |
|
43 |
#menu: #mainMenu |
|
44 |
#usePreferredExtent: false |
|
45 |
#returnIsOKInDialog: true |
|
46 |
#escapeIsCancelInDialog: true |
|
47 |
) |
|
48 |
#component: |
|
49 |
#(#SpecCollection |
|
50 |
#collection: #( |
|
51 |
#(#VariableVerticalPanelSpec |
|
52 |
#name: 'VariableVerticalPanel1' |
|
53 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
54 |
#handles: #(#Any 0.319444 1.0) |
|
55 |
#component: |
|
56 |
#(#SpecCollection |
|
57 |
#collection: #( |
|
58 |
#(#HorizontalPanelViewSpec |
|
59 |
#name: 'TopHorizontalPanel' |
|
60 |
#horizontalLayout: #fit |
|
61 |
#verticalLayout: #fit |
|
62 |
#horizontalSpace: 3 |
|
63 |
#verticalSpace: 3 |
|
64 |
#component: |
|
65 |
#(#SpecCollection |
|
66 |
#collection: #( |
|
67 |
#(#ViewSpec |
|
68 |
#name: 'BoxA' |
|
69 |
#level: 0 |
|
70 |
#component: |
|
71 |
#(#SpecCollection |
|
72 |
#collection: #( |
|
73 |
#(#LabelSpec |
|
74 |
#label: 'Only in A' |
|
2224 | 75 |
#name: 'OnlyInALabel' |
2221 | 76 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
77 |
#translateLabel: true |
|
78 |
#labelChannel: #onlyInALabelHolder |
|
79 |
) |
|
80 |
#(#SequenceViewSpec |
|
81 |
#name: 'ListA' |
|
82 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
83 |
#model: #methodsOnlyInASelection |
|
84 |
#menu: #menuA |
|
85 |
#hasHorizontalScrollBar: true |
|
86 |
#hasVerticalScrollBar: true |
|
87 |
#miniScrollerHorizontal: true |
|
88 |
#valueChangeSelector: #methodsOnlyInASelectionChanged |
|
89 |
#useIndex: true |
|
90 |
#sequenceList: #methodsOnlyInA |
|
91 |
) |
|
92 |
) |
|
93 |
||
94 |
) |
|
95 |
#extent: #(#Point 286 160) |
|
96 |
) |
|
97 |
#(#ViewSpec |
|
98 |
#name: 'BoxM' |
|
99 |
#component: |
|
100 |
#(#SpecCollection |
|
101 |
#collection: #( |
|
102 |
#(#LabelSpec |
|
103 |
#label: 'Changed' |
|
104 |
#name: 'Label2' |
|
105 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
|
106 |
#translateLabel: true |
|
107 |
#labelChannel: #changedLabelHolder |
|
108 |
) |
|
109 |
#(#SequenceViewSpec |
|
110 |
#name: 'ListM' |
|
111 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
112 |
#model: #methodsChangedSelection |
|
113 |
#menu: #menuM |
|
114 |
#hasHorizontalScrollBar: true |
|
115 |
#hasVerticalScrollBar: true |
|
116 |
#miniScrollerHorizontal: true |
|
117 |
#valueChangeSelector: #methodsChangedSelectionChanged |
|
118 |
#useIndex: true |
|
119 |
#sequenceList: #methodsChanged |
|
120 |
) |
|
121 |
) |
|
122 |
||
123 |
) |
|
124 |
#extent: #(#Point 286 160) |
|
125 |
) |
|
126 |
#(#ViewSpec |
|
127 |
#name: 'BoxB' |
|
128 |
#component: |
|
129 |
#(#SpecCollection |
|
130 |
#collection: #( |
|
131 |
#(#LabelSpec |
|
132 |
#label: 'Only in B' |
|
2224 | 133 |
#name: 'OnlyInBLabel' |
2221 | 134 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
135 |
#translateLabel: true |
|
136 |
#labelChannel: #onlyInBLabelHolder |
|
137 |
) |
|
138 |
#(#SequenceViewSpec |
|
139 |
#name: 'ListB' |
|
140 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
141 |
#model: #methodsOnlyInBSelection |
|
142 |
#menu: #menuB |
|
143 |
#hasHorizontalScrollBar: true |
|
144 |
#hasVerticalScrollBar: true |
|
145 |
#miniScrollerHorizontal: true |
|
146 |
#valueChangeSelector: #methodsOnlyInBSelectionChanged |
|
147 |
#useIndex: true |
|
148 |
#sequenceList: #methodsOnlyInB |
|
149 |
) |
|
150 |
) |
|
151 |
||
152 |
) |
|
153 |
#extent: #(#Point 287 160) |
|
154 |
) |
|
155 |
) |
|
156 |
||
157 |
) |
|
158 |
) |
|
159 |
#(#ViewSpec |
|
160 |
#name: 'Box4' |
|
161 |
#component: |
|
162 |
#(#SpecCollection |
|
163 |
#collection: #( |
|
164 |
#(#ViewSpec |
|
165 |
#name: 'diffTextViewBox' |
|
166 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
167 |
#initiallyInvisible: true |
|
168 |
#component: |
|
169 |
#(#SpecCollection |
|
170 |
#collection: #( |
|
171 |
#(#LabelSpec |
|
172 |
#label: 'A' |
|
173 |
#name: 'DiffTextLabelA' |
|
174 |
#layout: #(#LayoutFrame 0 0 0 0 0 0.5 20 0) |
|
175 |
#translateLabel: true |
|
176 |
#labelChannel: #diffTextLabelA |
|
177 |
) |
|
178 |
#(#LabelSpec |
|
179 |
#label: 'B' |
|
180 |
#name: 'DiffTextLabelB' |
|
181 |
#layout: #(#LayoutFrame 0 0.5 0 0 0 1 20 0) |
|
182 |
#translateLabel: true |
|
183 |
#labelChannel: #diffTextLabelB |
|
184 |
) |
|
185 |
#(#ArbitraryComponentSpec |
|
186 |
#name: 'diffTextView' |
|
187 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 0 1.0) |
|
188 |
#hasBorder: false |
|
189 |
#component: #diffTextView |
|
190 |
) |
|
191 |
) |
|
192 |
||
193 |
) |
|
194 |
) |
|
195 |
#(#TextEditorSpec |
|
196 |
#name: 'singleTextView' |
|
197 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
198 |
#model: #methodText |
|
199 |
#hasHorizontalScrollBar: true |
|
200 |
#hasVerticalScrollBar: true |
|
201 |
#miniScrollerHorizontal: true |
|
202 |
) |
|
203 |
) |
|
204 |
||
205 |
) |
|
206 |
) |
|
207 |
) |
|
208 |
||
209 |
) |
|
210 |
) |
|
211 |
) |
|
212 |
||
213 |
) |
|
214 |
) |
|
215 |
! ! |
|
216 |
||
217 |
!VersionDiffBrowser class methodsFor:'menu specs'! |
|
218 |
||
219 |
mainMenu |
|
220 |
"This resource specification was automatically generated |
|
221 |
by the MenuEditor of ST/X." |
|
222 |
||
223 |
"Do not manually edit this!! If it is corrupted, |
|
224 |
the MenuEditor may not be able to read the specification." |
|
225 |
||
226 |
" |
|
227 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#mainMenu |
|
228 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser mainMenu)) startUp |
|
229 |
" |
|
230 |
||
231 |
<resource: #menu> |
|
232 |
||
233 |
^ |
|
234 |
#(#Menu |
|
235 |
#( |
|
236 |
#(#MenuItem |
|
237 |
#label: 'File' |
|
238 |
#translateLabel: true |
|
239 |
#submenu: |
|
240 |
#(#Menu |
|
241 |
#( |
|
242 |
#(#MenuItem |
|
243 |
#label: 'Exit' |
|
244 |
#translateLabel: true |
|
245 |
#value: #closeRequest |
|
246 |
) |
|
247 |
) |
|
248 |
nil |
|
249 |
nil |
|
250 |
) |
|
251 |
) |
|
252 |
#(#MenuItem |
|
253 |
#label: 'Help' |
|
254 |
#translateLabel: true |
|
255 |
#startGroup: #right |
|
256 |
#submenu: |
|
257 |
#(#Menu |
|
258 |
#( |
|
259 |
#(#MenuItem |
|
260 |
#label: 'Documentation' |
|
261 |
#translateLabel: true |
|
262 |
#value: #openDocumentation |
|
263 |
) |
|
264 |
#(#MenuItem |
|
265 |
#label: '-' |
|
266 |
) |
|
267 |
#(#MenuItem |
|
268 |
#label: 'About this Application' |
|
269 |
#translateLabel: true |
|
270 |
#value: #openAboutThisApplication |
|
271 |
) |
|
272 |
) |
|
273 |
nil |
|
274 |
nil |
|
275 |
) |
|
276 |
) |
|
277 |
) |
|
278 |
nil |
|
279 |
nil |
|
280 |
) |
|
281 |
! |
|
282 |
||
283 |
menuA |
|
284 |
"This resource specification was automatically generated |
|
285 |
by the MenuEditor of ST/X." |
|
286 |
||
287 |
"Do not manually edit this!! If it is corrupted, |
|
288 |
the MenuEditor may not be able to read the specification." |
|
289 |
||
290 |
" |
|
291 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menu1 |
|
292 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menu1)) startUp |
|
293 |
" |
|
294 |
||
295 |
<resource: #menu> |
|
296 |
||
297 |
^ |
|
298 |
#(#Menu |
|
299 |
#( |
|
300 |
#(#MenuItem |
|
301 |
#label: 'Inspect' |
|
302 |
#translateLabel: true |
|
303 |
#value: #inspectSelectedChangeInA |
|
304 |
#choiceValue: 'nil "UndefinedObject" ' |
|
305 |
) |
|
2465 | 306 |
#(#MenuItem |
307 |
#label: '-' |
|
308 |
) |
|
309 |
#(#MenuItem |
|
310 |
#label: 'Browse' |
|
311 |
#translateLabel: true |
|
312 |
#value: #browseClassInA |
|
313 |
) |
|
2221 | 314 |
) |
315 |
nil |
|
316 |
nil |
|
317 |
) |
|
318 |
! |
|
319 |
||
320 |
menuB |
|
321 |
"This resource specification was automatically generated |
|
322 |
by the MenuEditor of ST/X." |
|
323 |
||
324 |
"Do not manually edit this!! If it is corrupted, |
|
325 |
the MenuEditor may not be able to read the specification." |
|
326 |
||
327 |
" |
|
328 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menuB |
|
329 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menuB)) startUp |
|
330 |
" |
|
331 |
||
332 |
<resource: #menu> |
|
333 |
||
334 |
^ |
|
335 |
#(#Menu |
|
336 |
#( |
|
337 |
#(#MenuItem |
|
338 |
#label: 'Inspect' |
|
339 |
#translateLabel: true |
|
340 |
#value: #inspectSelectedChangeInB |
|
341 |
#choiceValue: 'nil "UndefinedObject" ' |
|
342 |
) |
|
2465 | 343 |
#(#MenuItem |
344 |
#label: '-' |
|
345 |
) |
|
346 |
#(#MenuItem |
|
347 |
#label: 'Browse' |
|
348 |
#translateLabel: true |
|
349 |
#value: #browseClassInB |
|
350 |
) |
|
2221 | 351 |
) |
352 |
nil |
|
353 |
nil |
|
354 |
) |
|
355 |
! |
|
356 |
||
357 |
menuM |
|
358 |
"This resource specification was automatically generated |
|
359 |
by the MenuEditor of ST/X." |
|
360 |
||
361 |
"Do not manually edit this!! If it is corrupted, |
|
362 |
the MenuEditor may not be able to read the specification." |
|
363 |
||
364 |
" |
|
365 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menu1 |
|
366 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menu1)) startUp |
|
367 |
" |
|
368 |
||
369 |
<resource: #menu> |
|
370 |
||
371 |
^ |
|
372 |
#(#Menu |
|
373 |
#( |
|
374 |
#(#MenuItem |
|
2224 | 375 |
#label: 'Inspect both' |
2221 | 376 |
#translateLabel: true |
377 |
#value: #inspectSelectedChangeInM |
|
378 |
#choiceValue: 'nil "UndefinedObject" ' |
|
379 |
) |
|
2465 | 380 |
#(#MenuItem |
381 |
#label: '-' |
|
382 |
) |
|
383 |
#(#MenuItem |
|
384 |
#label: 'Browse' |
|
385 |
#translateLabel: true |
|
386 |
#value: #browseClassInM |
|
387 |
) |
|
2221 | 388 |
) |
389 |
nil |
|
390 |
nil |
|
391 |
) |
|
392 |
! ! |
|
393 |
||
394 |
!VersionDiffBrowser class methodsFor:'startup'! |
|
395 |
||
2224 | 396 |
openOnClass:aClass labelA:lblA sourceA:srcA labelB:lblB sourceB:srcB |
397 |
|browser| |
|
398 |
||
399 |
browser := self new. |
|
400 |
browser allButOpen. |
|
401 |
||
402 |
browser classBeingCompared:aClass. |
|
403 |
browser |
|
404 |
labelA:lblA sourceA:srcA |
|
405 |
labelB:lblB sourceB:srcB. |
|
406 |
||
407 |
browser openWindow. |
|
408 |
||
409 |
^ browser. |
|
410 |
||
411 |
" |
|
412 |
self openOnClass:Array versionA:'1.116' versionB:'1.113' |
|
413 |
" |
|
414 |
! |
|
415 |
||
2221 | 416 |
openOnClass:aClass versionA:vsnA versionB:vsnB |
417 |
|browser| |
|
418 |
||
419 |
browser := self new. |
|
420 |
browser allButOpen. |
|
421 |
||
422 |
browser classBeingCompared:aClass. |
|
423 |
browser versionA:vsnA. |
|
424 |
browser versionB:vsnB. |
|
425 |
||
426 |
browser openWindow. |
|
427 |
||
428 |
^ browser. |
|
429 |
||
430 |
" |
|
431 |
self openOnClass:Array versionA:'1.116' versionB:'1.113' |
|
432 |
" |
|
433 |
! ! |
|
434 |
||
435 |
!VersionDiffBrowser methodsFor:'accessing'! |
|
436 |
||
437 |
classBeingCompared |
|
438 |
"return the value of the instance variable 'classBeingCompared' (automatically generated)" |
|
439 |
||
440 |
^ classBeingCompared! |
|
441 |
||
442 |
classBeingCompared:something |
|
443 |
"set the value of the instance variable 'classBeingCompared' (automatically generated)" |
|
444 |
||
445 |
classBeingCompared := something. |
|
446 |
self updateViewsIfPossible. |
|
447 |
! |
|
448 |
||
2224 | 449 |
labelA:lblA sourceA:srcA labelB:lblB sourceB:srcB |
450 |
|s| |
|
451 |
||
452 |
changeSetA := ChangeSet fromStream:(s := srcA readStream). |
|
453 |
s close. |
|
454 |
changeSetB := ChangeSet fromStream:(s := srcB readStream). |
|
455 |
s close. |
|
456 |
versionA := lblA. |
|
457 |
versionB := lblB. |
|
458 |
self updateLabels. |
|
459 |
self updateLists. |
|
460 |
||
461 |
! |
|
462 |
||
2221 | 463 |
versionA |
464 |
"return the value of the instance variable 'versionA' (automatically generated)" |
|
465 |
||
466 |
^ versionA! |
|
467 |
||
468 |
versionA:something |
|
469 |
"set the value of the instance variable 'versionA' (automatically generated)" |
|
470 |
||
471 |
versionA := something. |
|
472 |
self updateViewsIfPossible. |
|
473 |
||
474 |
! |
|
475 |
||
476 |
versionB |
|
477 |
"return the value of the instance variable 'versionB' (automatically generated)" |
|
478 |
||
479 |
^ versionB! |
|
480 |
||
481 |
versionB:something |
|
482 |
"set the value of the instance variable 'versionB' (automatically generated)" |
|
483 |
||
484 |
versionB := something. |
|
485 |
self updateViewsIfPossible. |
|
486 |
||
487 |
! ! |
|
488 |
||
489 |
!VersionDiffBrowser methodsFor:'actions'! |
|
490 |
||
491 |
methodsChangedSelectionChanged |
|
492 |
|sel idxA idxB changeA changeB| |
|
493 |
||
494 |
sel := self methodsChangedSelection value. |
|
495 |
sel notNil ifTrue:[ |
|
496 |
self methodsOnlyInASelection value:nil. |
|
497 |
self methodsOnlyInBSelection value:nil. |
|
498 |
||
499 |
idxA := indexFromChangedToA at:sel ifAbsent:nil. |
|
500 |
idxB := indexFromChangedToB at:sel ifAbsent:nil. |
|
501 |
||
502 |
changeA := changeSetA at:idxA. |
|
503 |
changeB := changeSetB at:idxB. |
|
504 |
||
2377 | 505 |
self withWaitCursorDo:[ |
506 |
self diffTextView text1:changeA source text2:changeB source. |
|
507 |
self diffTextView moveToNextChanged. |
|
508 |
]. |
|
2221 | 509 |
|
510 |
self showDiffTextView. |
|
511 |
||
512 |
] |
|
2377 | 513 |
|
514 |
"Modified: / 3.9.1999 / 15:01:30 / ps" |
|
2221 | 515 |
! |
516 |
||
517 |
methodsOnlyInASelectionChanged |
|
518 |
|change sel| |
|
519 |
||
520 |
sel := self methodsOnlyInASelection value. |
|
521 |
sel notNil ifTrue:[ |
|
522 |
self methodsOnlyInBSelection value:nil. |
|
523 |
self methodsChangedSelection value:nil. |
|
524 |
||
2224 | 525 |
change := filteredChangeSetA at:sel. |
2221 | 526 |
self methodText value:(change source). |
527 |
self showSingleTextView. |
|
528 |
] |
|
529 |
! |
|
530 |
||
531 |
methodsOnlyInBSelectionChanged |
|
532 |
|change sel| |
|
533 |
||
534 |
sel := self methodsOnlyInBSelection value. |
|
535 |
sel notNil ifTrue:[ |
|
536 |
self methodsOnlyInASelection value:nil. |
|
537 |
self methodsChangedSelection value:nil. |
|
538 |
||
2224 | 539 |
change := filteredChangeSetB at:sel. |
2221 | 540 |
self methodText value:(change source). |
541 |
self showSingleTextView. |
|
542 |
] |
|
543 |
! ! |
|
544 |
||
545 |
!VersionDiffBrowser methodsFor:'aspects'! |
|
546 |
||
547 |
changedLabelHolder |
|
548 |
"automatically generated by UIPainter ..." |
|
549 |
||
550 |
"*** the code below creates a default model when invoked." |
|
551 |
"*** (which may not be the one you wanted)" |
|
552 |
"*** Please change as required and accept in the browser." |
|
553 |
||
554 |
|holder| |
|
555 |
||
556 |
(holder := builder bindingAt:#changedLabelHolder) isNil ifTrue:[ |
|
557 |
builder aspectAt:#changedLabelHolder put:(holder := ValueHolder new). |
|
558 |
]. |
|
559 |
^ holder. |
|
560 |
! |
|
561 |
||
562 |
diffTextLabelA |
|
563 |
"automatically generated by UIPainter ..." |
|
564 |
||
565 |
"*** the code below creates a default model when invoked." |
|
566 |
"*** (which may not be the one you wanted)" |
|
567 |
"*** Please change as required and accept in the browser." |
|
568 |
||
569 |
|holder| |
|
570 |
||
571 |
(holder := builder bindingAt:#diffTextLabelA) isNil ifTrue:[ |
|
572 |
builder aspectAt:#diffTextLabelA put:(holder := ValueHolder new). |
|
573 |
]. |
|
574 |
^ holder. |
|
575 |
! |
|
576 |
||
577 |
diffTextLabelB |
|
578 |
"automatically generated by UIPainter ..." |
|
579 |
||
580 |
"*** the code below creates a default model when invoked." |
|
581 |
"*** (which may not be the one you wanted)" |
|
582 |
"*** Please change as required and accept in the browser." |
|
583 |
||
584 |
|holder| |
|
585 |
||
586 |
(holder := builder bindingAt:#diffTextLabelB) isNil ifTrue:[ |
|
587 |
builder aspectAt:#diffTextLabelB put:(holder := ValueHolder new). |
|
588 |
]. |
|
589 |
^ holder. |
|
590 |
! |
|
591 |
||
592 |
methodText |
|
593 |
"automatically generated by UIPainter ..." |
|
594 |
||
595 |
"*** the code below creates a default model when invoked." |
|
596 |
"*** (which may not be the one you wanted)" |
|
597 |
"*** Please change as required and accept in the browser." |
|
598 |
||
599 |
|holder| |
|
600 |
||
601 |
(holder := builder bindingAt:#methodText) isNil ifTrue:[ |
|
602 |
builder aspectAt:#methodText put:(holder := ValueHolder new). |
|
603 |
]. |
|
604 |
^ holder. |
|
605 |
! |
|
606 |
||
607 |
methodsChanged |
|
608 |
"automatically generated by UIPainter ..." |
|
609 |
||
610 |
"*** the code below creates a default model when invoked." |
|
611 |
"*** (which may not be the one you wanted)" |
|
612 |
"*** Please change as required and accept in the browser." |
|
613 |
||
614 |
|holder| |
|
615 |
||
616 |
(holder := builder bindingAt:#methodsChanged) isNil ifTrue:[ |
|
617 |
builder aspectAt:#methodsChanged put:(holder := List new). |
|
618 |
]. |
|
619 |
^ holder. |
|
620 |
! |
|
621 |
||
622 |
methodsChangedSelection |
|
623 |
"automatically generated by UIPainter ..." |
|
624 |
||
625 |
"*** the code below creates a default model when invoked." |
|
626 |
"*** (which may not be the one you wanted)" |
|
627 |
"*** Please change as required and accept in the browser." |
|
628 |
||
629 |
|holder| |
|
630 |
||
631 |
(holder := builder bindingAt:#methodsChangedSelection) isNil ifTrue:[ |
|
632 |
builder aspectAt:#methodsChangedSelection put:(holder := ValueHolder new). |
|
633 |
]. |
|
634 |
^ holder. |
|
635 |
! |
|
636 |
||
637 |
methodsOnlyInA |
|
638 |
"automatically generated by UIPainter ..." |
|
639 |
||
640 |
"*** the code below creates a default model when invoked." |
|
641 |
"*** (which may not be the one you wanted)" |
|
642 |
"*** Please change as required and accept in the browser." |
|
643 |
||
644 |
|holder| |
|
645 |
||
646 |
(holder := builder bindingAt:#methodsOnlyInA) isNil ifTrue:[ |
|
647 |
builder aspectAt:#methodsOnlyInA put:(holder := List new). |
|
648 |
]. |
|
649 |
^ holder. |
|
650 |
! |
|
651 |
||
652 |
methodsOnlyInASelection |
|
653 |
"automatically generated by UIPainter ..." |
|
654 |
||
655 |
"*** the code below creates a default model when invoked." |
|
656 |
"*** (which may not be the one you wanted)" |
|
657 |
"*** Please change as required and accept in the browser." |
|
658 |
||
659 |
|holder| |
|
660 |
||
661 |
(holder := builder bindingAt:#methodsOnlyInASelection) isNil ifTrue:[ |
|
662 |
builder aspectAt:#methodsOnlyInASelection put:(holder := ValueHolder new). |
|
663 |
]. |
|
664 |
^ holder. |
|
665 |
! |
|
666 |
||
667 |
methodsOnlyInB |
|
668 |
"automatically generated by UIPainter ..." |
|
669 |
||
670 |
"*** the code below creates a default model when invoked." |
|
671 |
"*** (which may not be the one you wanted)" |
|
672 |
"*** Please change as required and accept in the browser." |
|
673 |
||
674 |
|holder| |
|
675 |
||
676 |
(holder := builder bindingAt:#methodsOnlyInB) isNil ifTrue:[ |
|
677 |
builder aspectAt:#methodsOnlyInB put:(holder := List new). |
|
678 |
]. |
|
679 |
^ holder. |
|
680 |
! |
|
681 |
||
682 |
methodsOnlyInBSelection |
|
683 |
"automatically generated by UIPainter ..." |
|
684 |
||
685 |
"*** the code below creates a default model when invoked." |
|
686 |
"*** (which may not be the one you wanted)" |
|
687 |
"*** Please change as required and accept in the browser." |
|
688 |
||
689 |
|holder| |
|
690 |
||
691 |
(holder := builder bindingAt:#methodsOnlyInBSelection) isNil ifTrue:[ |
|
692 |
builder aspectAt:#methodsOnlyInBSelection put:(holder := ValueHolder new). |
|
693 |
]. |
|
694 |
^ holder. |
|
695 |
! |
|
696 |
||
697 |
onlyInALabelHolder |
|
698 |
"automatically generated by UIPainter ..." |
|
699 |
||
700 |
"*** the code below creates a default model when invoked." |
|
701 |
"*** (which may not be the one you wanted)" |
|
702 |
"*** Please change as required and accept in the browser." |
|
703 |
||
704 |
|holder| |
|
705 |
||
706 |
(holder := builder bindingAt:#onlyInALabelHolder) isNil ifTrue:[ |
|
707 |
builder aspectAt:#onlyInALabelHolder put:(holder := ValueHolder new). |
|
708 |
]. |
|
709 |
^ holder. |
|
710 |
! |
|
711 |
||
712 |
onlyInBLabelHolder |
|
713 |
"automatically generated by UIPainter ..." |
|
714 |
||
715 |
"*** the code below creates a default model when invoked." |
|
716 |
"*** (which may not be the one you wanted)" |
|
717 |
"*** Please change as required and accept in the browser." |
|
718 |
||
719 |
|holder| |
|
720 |
||
721 |
(holder := builder bindingAt:#onlyInBLabelHolder) isNil ifTrue:[ |
|
722 |
builder aspectAt:#onlyInBLabelHolder put:(holder := ValueHolder new). |
|
723 |
]. |
|
724 |
^ holder. |
|
725 |
! ! |
|
726 |
||
727 |
!VersionDiffBrowser methodsFor:'initialization & release'! |
|
728 |
||
729 |
closeDownViews |
|
730 |
"This is a hook method generated by the Browser. |
|
731 |
It will be invoked when your app/dialog-window is really closed." |
|
732 |
||
733 |
"/ change the code below as required ... |
|
734 |
"/ This should cleanup any leftover resources |
|
735 |
"/ (for example, temporary files) |
|
736 |
"/ super closeRequest will initiate the closeDown |
|
737 |
||
738 |
"/ add your code here |
|
739 |
||
740 |
"/ do not remove the one below ... |
|
741 |
^ super closeDownViews |
|
742 |
! |
|
743 |
||
744 |
closeRequest |
|
745 |
"This is a hook method generated by the Browser. |
|
746 |
It will be invoked when your app/dialog-window is about to be |
|
747 |
closed (and has a chance to suppress the close)." |
|
748 |
||
749 |
"/ change the code below as required ... |
|
750 |
"/ Closing can be suppressed, by returning. |
|
751 |
"/ super closeRequest will initiate the closeDown |
|
752 |
||
753 |
^ super closeRequest |
|
754 |
! |
|
755 |
||
756 |
postBuildWith:aBuilder |
|
757 |
"This is a hook method generated by the Browser. |
|
758 |
It will be invoked during the initialization of your app/dialog, |
|
759 |
after all of the visual components have been built, |
|
760 |
but BEFORE the top window is made visible. |
|
761 |
Add any app-specific actions here (reading files, setting up |
|
762 |
values etc.)" |
|
763 |
||
764 |
"/ add any code here ... |
|
765 |
||
766 |
(aBuilder componentAt:#TopHorizontalPanel) ignoreInvisibleComponents:true. |
|
767 |
||
768 |
^ super postBuildWith:aBuilder |
|
769 |
! ! |
|
770 |
||
771 |
!VersionDiffBrowser methodsFor:'menu action'! |
|
772 |
||
2465 | 773 |
browseChange:aChange |
2467 | 774 |
SystemBrowser |
775 |
openInClass:aChange changeClass |
|
776 |
selector:aChange changeSelector. |
|
2465 | 777 |
! |
778 |
||
779 |
browseClassInA |
|
780 |
self browseChange:(self selectedChangeInA). |
|
781 |
! |
|
2221 | 782 |
|
2465 | 783 |
browseClassInB |
784 |
self browseChange:(self selectedChangeInB). |
|
785 |
! |
|
786 |
||
787 |
browseClassInM |
|
788 |
self browseChange:(self selectedChangesInM first). |
|
789 |
! |
|
790 |
||
791 |
inspectSelectedChangeInA |
|
792 |
self selectedChangeInA inspect. |
|
2221 | 793 |
! |
794 |
||
795 |
inspectSelectedChangeInB |
|
2465 | 796 |
self selectedChangeInB inspect. |
797 |
! |
|
798 |
||
799 |
inspectSelectedChangeInM |
|
800 |
|changes| |
|
801 |
||
802 |
changes := self selectedChangesInM. |
|
803 |
changes do:[:change | |
|
804 |
change inspect |
|
805 |
]. |
|
806 |
! |
|
807 |
||
808 |
selectedChangeInA |
|
809 |
|sel change| |
|
810 |
||
811 |
sel := self methodsOnlyInASelection value. |
|
812 |
sel notNil ifTrue:[ |
|
813 |
change := (changeSetA at:sel). |
|
814 |
]. |
|
815 |
^ change |
|
816 |
! |
|
817 |
||
818 |
selectedChangeInB |
|
819 |
|sel change| |
|
2221 | 820 |
|
821 |
sel := self methodsOnlyInBSelection value. |
|
822 |
sel notNil ifTrue:[ |
|
2465 | 823 |
change := (changeSetB at:sel). |
824 |
]. |
|
825 |
^ change |
|
2221 | 826 |
! |
827 |
||
2465 | 828 |
selectedChangesInM |
2221 | 829 |
|sel idxA idxB| |
830 |
||
831 |
sel := self methodsChangedSelection value. |
|
832 |
sel notNil ifTrue:[ |
|
833 |
idxA := indexFromChangedToA at:sel ifAbsent:nil. |
|
834 |
idxB := indexFromChangedToB at:sel ifAbsent:nil. |
|
835 |
||
2465 | 836 |
^ Array with:(changeSetA at:idxA) |
837 |
with:(changeSetB at:idxB) |
|
838 |
]. |
|
839 |
^ nil |
|
2221 | 840 |
! ! |
841 |
||
842 |
!VersionDiffBrowser methodsFor:'private'! |
|
843 |
||
844 |
showDiffTextView |
|
845 |
(self builder componentAt:#diffTextViewBox) raise; beVisible. |
|
846 |
(self builder componentAt:#singleTextView) beInvisible. |
|
847 |
(self builder componentAt:#diffTextView) realizeAllSubViews. |
|
2465 | 848 |
self addAcceptToTextViewMenus. |
849 |
||
2221 | 850 |
! |
851 |
||
852 |
showSingleTextView |
|
853 |
(self builder componentAt:#singleTextView) raise; beVisible. |
|
854 |
(self builder componentAt:#diffTextViewBox) beInvisible. |
|
855 |
||
856 |
! |
|
857 |
||
2224 | 858 |
updateFromVersions |
859 |
|mgr versionAStream versionBStream| |
|
2221 | 860 |
|
861 |
mgr := classBeingCompared sourceCodeManager. |
|
862 |
||
863 |
versionAStream := mgr getSourceStreamFor:classBeingCompared revision:versionA. |
|
864 |
changeSetA := ChangeSet fromStream:versionAStream. |
|
865 |
versionAStream close. |
|
866 |
||
867 |
versionBStream := mgr getSourceStreamFor:classBeingCompared revision:versionB. |
|
868 |
changeSetB := ChangeSet fromStream:versionBStream. |
|
869 |
versionBStream close. |
|
870 |
||
2224 | 871 |
self updateLists |
872 |
||
873 |
! |
|
874 |
||
875 |
updateLabels |
|
876 |
versionA notNil ifTrue:[ |
|
877 |
self diffTextLabelA value:versionA. |
|
878 |
self onlyInALabelHolder value:('Only in ' , versionA). |
|
879 |
(self builder componentAt:#OnlyInALabel) backgroundColor:Color green darkened. |
|
880 |
]. |
|
881 |
versionB notNil ifTrue:[ |
|
882 |
self diffTextLabelB value:versionB. |
|
883 |
self onlyInBLabelHolder value:('Only in ' , versionB). |
|
884 |
(self builder componentAt:#OnlyInBLabel) backgroundColor:Color red darkened. |
|
885 |
]. |
|
886 |
! |
|
887 |
||
888 |
updateLists |
|
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
889 |
"walk over the two changeSets and add change to one of the tree lists" |
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
890 |
|
2231 | 891 |
|mgr nmListA nmListB nmListM generator| |
2224 | 892 |
|
2221 | 893 |
filteredChangeSetA := ChangeSet new. |
894 |
filteredChangeSetB := ChangeSet new. |
|
895 |
changedMethodsChangeSet := ChangeSet new. |
|
896 |
||
897 |
indexFromChangedToA := OrderedCollection new. |
|
898 |
indexFromChangedToB := OrderedCollection new. |
|
899 |
||
900 |
changeSetA keysAndValuesDo:[:idxA :aChangeInA | |
|
901 |
|anyFound| |
|
902 |
||
903 |
anyFound := false. |
|
904 |
||
905 |
changeSetB do:[:aChangeInB | |
|
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
906 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
2221 | 907 |
anyFound := true. |
908 |
||
909 |
"/ also in B - is it different ? |
|
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
910 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
2221 | 911 |
changedMethodsChangeSet add:aChangeInA. |
912 |
indexFromChangedToA add:idxA. |
|
913 |
indexFromChangedToB add:nil. |
|
914 |
] |
|
915 |
] ifFalse:[ |
|
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
916 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
2221 | 917 |
anyFound := true. |
2224 | 918 |
] ifFalse:[ |
2221 | 919 |
] |
920 |
] |
|
921 |
]. |
|
922 |
||
923 |
anyFound ifFalse:[ |
|
924 |
filteredChangeSetA add:aChangeInA. |
|
925 |
] |
|
926 |
]. |
|
927 |
||
928 |
changeSetB keysAndValuesDo:[:idxB :aChangeInB | |
|
929 |
|anyFound| |
|
930 |
||
931 |
anyFound := false. |
|
932 |
||
933 |
changeSetA do:[:aChangeInA | |
|
934 |
|idxM| |
|
935 |
||
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
936 |
(aChangeInA isForSameAs:aChangeInB) ifTrue:[ |
2221 | 937 |
anyFound := true. |
938 |
||
939 |
"/ also in B - is it different ? |
|
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
940 |
(aChangeInA sameAs:aChangeInB) ifFalse:[ |
2221 | 941 |
"/ already there ? |
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
942 |
idxM := changedMethodsChangeSet findFirst:[:c | c isForSameAs:aChangeInB]. |
2221 | 943 |
idxM == 0 ifTrue:[ |
944 |
changedMethodsChangeSet add:aChangeInB. |
|
945 |
indexFromChangedToB add:idxB. |
|
946 |
] ifFalse:[ |
|
947 |
indexFromChangedToB at:idxM put:idxB |
|
948 |
] |
|
949 |
] |
|
950 |
] ifFalse:[ |
|
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
951 |
(aChangeInA sameAs:aChangeInB) ifTrue:[ |
2221 | 952 |
anyFound := true. |
2224 | 953 |
] ifFalse:[ |
2221 | 954 |
] |
955 |
] |
|
956 |
]. |
|
957 |
anyFound ifFalse:[ |
|
958 |
filteredChangeSetB add:aChangeInB. |
|
959 |
] |
|
960 |
]. |
|
961 |
||
2231 | 962 |
generator := [:c | |
963 |
c isClassDefinitionChange ifTrue:[ |
|
964 |
c printStringWithoutClass |
|
965 |
] ifFalse:[ |
|
2419 | 966 |
c isDoIt ifTrue:[ |
967 |
c source , ' (doIt)' |
|
2231 | 968 |
] ifFalse:[ |
2419 | 969 |
c className = classBeingCompared name ifTrue:[ |
970 |
c printStringWithoutClass |
|
2231 | 971 |
] ifFalse:[ |
2419 | 972 |
"/ include name in private class changes |
973 |
(c className startsWith:(classBeingCompared name , '::')) ifTrue:[ |
|
974 |
(c className copyFrom:(classBeingCompared name size + 3)) , ' ' , c printStringWithoutClass |
|
975 |
] ifFalse:[ |
|
976 |
c printString |
|
977 |
] |
|
2231 | 978 |
] |
979 |
] |
|
980 |
] |
|
981 |
]. |
|
982 |
||
2224 | 983 |
nmListA := self methodsOnlyInA. |
984 |
nmListA removeAll. |
|
2231 | 985 |
nmListA addAll:(filteredChangeSetA collect:generator). |
2221 | 986 |
|
2224 | 987 |
nmListB := self methodsOnlyInB. |
988 |
nmListB removeAll. |
|
2231 | 989 |
nmListB addAll:(filteredChangeSetB collect:generator). |
2221 | 990 |
|
2224 | 991 |
nmListM := self methodsChanged. |
992 |
nmListM removeAll. |
|
2231 | 993 |
nmListM addAll:(changedMethodsChangeSet collect:generator). |
2221 | 994 |
|
2224 | 995 |
nmListA isEmpty ifTrue:[ |
2221 | 996 |
(self builder componentAt:#BoxA) beInvisible. |
997 |
] ifFalse:[ |
|
998 |
(self builder componentAt:#BoxA) beVisible. |
|
999 |
]. |
|
1000 |
||
2224 | 1001 |
nmListB isEmpty ifTrue:[ |
2221 | 1002 |
(self builder componentAt:#BoxB) beInvisible. |
1003 |
] ifFalse:[ |
|
1004 |
(self builder componentAt:#BoxB) beVisible. |
|
1005 |
]. |
|
1006 |
||
2224 | 1007 |
nmListM isEmpty ifTrue:[ |
1008 |
(nmListA notEmpty or:[nmListB notEmpty]) ifTrue:[ |
|
2221 | 1009 |
(self builder componentAt:#BoxM) beInvisible. |
1010 |
] |
|
1011 |
] ifFalse:[ |
|
1012 |
(self builder componentAt:#BoxM) beVisible. |
|
1013 |
] |
|
1014 |
||
1015 |
! |
|
1016 |
||
1017 |
updateViewsIfPossible |
|
1018 |
classBeingCompared notNil ifTrue:[ |
|
1019 |
self window label:'Version Diff Browser on ' , classBeingCompared name. |
|
2224 | 1020 |
|
1021 |
self updateLabels. |
|
1022 |
||
1023 |
changeSetA notNil ifTrue:[ |
|
1024 |
changeSetB notNil ifTrue:[ |
|
1025 |
self updateLists. |
|
1026 |
^ self |
|
1027 |
] |
|
1028 |
]. |
|
1029 |
||
2221 | 1030 |
versionA notNil ifTrue:[ |
1031 |
versionB notNil ifTrue:[ |
|
2224 | 1032 |
self updateFromVersions |
2221 | 1033 |
] |
1034 |
] |
|
1035 |
] |
|
1036 |
||
1037 |
||
1038 |
! ! |
|
1039 |
||
1040 |
!VersionDiffBrowser methodsFor:'values'! |
|
1041 |
||
2465 | 1042 |
addAcceptToTextViewMenus |
1043 |
|m v| |
|
1044 |
||
1045 |
(Array |
|
1046 |
with:diffTextView leftTextView |
|
1047 |
with:diffTextView rightTextView) |
|
1048 |
do:[:v | |
|
1049 |
m := v editMenu. |
|
1050 |
m addLabels:#('-' 'accept') |
|
1051 |
selectors:(Array with:nil with:#accept) |
|
1052 |
after:#copySelection. |
|
1053 |
m |
|
1054 |
actionAt:#accept |
|
1055 |
put:[|idx idx2 text change| |
|
1056 |
||
1057 |
idx := self methodsChangedSelection value. |
|
1058 |
||
1059 |
v == diffTextView leftTextView ifTrue:[ |
|
1060 |
idx2 := indexFromChangedToA at:idx. |
|
1061 |
change := changeSetA at:idx2. |
|
1062 |
] ifFalse:[ |
|
1063 |
idx2 := indexFromChangedToB at:idx. |
|
1064 |
change := changeSetB at:idx2. |
|
1065 |
]. |
|
1066 |
change apply |
|
1067 |
]. |
|
1068 |
m selectorAt:#accept put:nil. |
|
1069 |
v menuHolder:m. |
|
1070 |
v menuMessage:#value. |
|
1071 |
] |
|
1072 |
||
1073 |
! |
|
1074 |
||
2221 | 1075 |
diffTextView |
1076 |
"automatically generated by UIPainter ..." |
|
1077 |
||
1078 |
diffTextView isNil ifTrue:[ |
|
1079 |
diffTextView := HVScrollableView |
|
1080 |
for:DiffTextView |
|
1081 |
miniScrollerH:true miniScrollerV:false. |
|
1082 |
diffTextView addNextPreviousButtons. |
|
2465 | 1083 |
|
1084 |
self addAcceptToTextViewMenus. |
|
2221 | 1085 |
]. |
1086 |
^ diffTextView |
|
1087 |
! ! |
|
1088 |
||
1089 |
!VersionDiffBrowser class methodsFor:'documentation'! |
|
1090 |
||
1091 |
version |
|
2467 | 1092 |
^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.10 1999-12-07 14:20:00 cg Exp $' |
2221 | 1093 |
! ! |