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