author | Claus Gittinger <cg@exept.de> |
Fri, 18 Feb 2000 15:10:15 +0100 | |
changeset 2626 | 4ee750caddab |
parent 2585 | 718f8fce7ca4 |
child 2650 | 447c99ac6f76 |
permissions | -rw-r--r-- |
2626 | 1 |
" |
2 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
2221 | 14 |
ApplicationModel subclass:#VersionDiffBrowser |
2497 | 15 |
instanceVariableNames:'classChangeSet diffTextView' |
2221 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Interface-Browsers' |
|
19 |
! |
|
20 |
||
2497 | 21 |
HierarchicalItem subclass:#ClassChangeSet |
22 |
instanceVariableNames:'classBeingCompared labelA labelB changeSet onlyInA onlyInB |
|
23 |
changedMethods' |
|
24 |
classVariableNames:'' |
|
25 |
poolDictionaries:'' |
|
26 |
privateIn:VersionDiffBrowser |
|
27 |
! |
|
28 |
||
2224 | 29 |
VersionDiffBrowser comment:'some comment |
30 |
'! |
|
31 |
||
2626 | 32 |
!VersionDiffBrowser class methodsFor:'documentation'! |
33 |
||
34 |
copyright |
|
35 |
" |
|
36 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
37 |
All Rights Reserved |
|
38 |
||
39 |
This software is furnished under a license and may be used |
|
40 |
only in accordance with the terms of that license and with the |
|
41 |
inclusion of the above copyright notice. This software may not |
|
42 |
be provided or otherwise made available to, or used by, any |
|
43 |
other person. No title to or ownership of the software is |
|
44 |
hereby transferred. |
|
45 |
" |
|
46 |
||
47 |
! |
|
48 |
||
49 |
documentation |
|
50 |
" |
|
51 |
This is not yet finished (work in progress). |
|
52 |
||
53 |
A browser to show differences between class versions, |
|
54 |
allowing easy comparison; will also eventually add capabilities |
|
55 |
to checkIn / load classes into / from the repository. |
|
56 |
||
57 |
[see also:] |
|
58 |
||
59 |
[instance variables:] |
|
60 |
||
61 |
[class variables:] |
|
62 |
" |
|
63 |
||
64 |
||
65 |
! ! |
|
2221 | 66 |
|
67 |
!VersionDiffBrowser class methodsFor:'interface specs'! |
|
68 |
||
69 |
windowSpec |
|
70 |
"This resource specification was automatically generated |
|
71 |
by the UIPainter of ST/X." |
|
72 |
||
73 |
"Do not manually edit this!! If it is corrupted, |
|
74 |
the UIPainter may not be able to read the specification." |
|
75 |
||
76 |
" |
|
77 |
UIPainter new openOnClass:VersionDiffBrowser andSelector:#windowSpec |
|
78 |
VersionDiffBrowser new openInterface:#windowSpec |
|
79 |
VersionDiffBrowser open |
|
80 |
" |
|
81 |
||
82 |
<resource: #canvas> |
|
83 |
||
84 |
^ |
|
85 |
#(#FullSpec |
|
86 |
#name: #windowSpec |
|
87 |
#window: |
|
88 |
#(#WindowSpec |
|
89 |
#label: 'Version DiffBrowser' |
|
90 |
#name: 'Version DiffBrowser' |
|
91 |
#min: #(#Point 10 10) |
|
92 |
#max: #(#Point nil nil) |
|
2585 | 93 |
#bounds: #(#Rectangle 294 23 1159 527) |
2221 | 94 |
#menu: #mainMenu |
95 |
) |
|
96 |
#component: |
|
97 |
#(#SpecCollection |
|
98 |
#collection: #( |
|
99 |
#(#VariableVerticalPanelSpec |
|
100 |
#name: 'VariableVerticalPanel1' |
|
101 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
102 |
#component: |
|
103 |
#(#SpecCollection |
|
104 |
#collection: #( |
|
105 |
#(#HorizontalPanelViewSpec |
|
106 |
#name: 'TopHorizontalPanel' |
|
107 |
#horizontalLayout: #fit |
|
108 |
#verticalLayout: #fit |
|
109 |
#horizontalSpace: 3 |
|
110 |
#verticalSpace: 3 |
|
111 |
#component: |
|
112 |
#(#SpecCollection |
|
113 |
#collection: #( |
|
114 |
#(#ViewSpec |
|
115 |
#name: 'BoxA' |
|
116 |
#level: 0 |
|
2585 | 117 |
#visibilityChannel: #boxAVisible |
2221 | 118 |
#component: |
119 |
#(#SpecCollection |
|
120 |
#collection: #( |
|
121 |
#(#LabelSpec |
|
122 |
#label: 'Only in A' |
|
2224 | 123 |
#name: 'OnlyInALabel' |
2221 | 124 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
125 |
#translateLabel: true |
|
126 |
#labelChannel: #onlyInALabelHolder |
|
127 |
) |
|
128 |
#(#SequenceViewSpec |
|
129 |
#name: 'ListA' |
|
130 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
131 |
#model: #methodsOnlyInASelection |
|
132 |
#menu: #menuA |
|
133 |
#hasHorizontalScrollBar: true |
|
134 |
#hasVerticalScrollBar: true |
|
135 |
#miniScrollerHorizontal: true |
|
136 |
#valueChangeSelector: #methodsOnlyInASelectionChanged |
|
137 |
#useIndex: true |
|
138 |
#sequenceList: #methodsOnlyInA |
|
139 |
) |
|
140 |
) |
|
141 |
||
142 |
) |
|
2497 | 143 |
#extent: #(#Point 286 252) |
2221 | 144 |
) |
145 |
#(#ViewSpec |
|
146 |
#name: 'BoxM' |
|
2585 | 147 |
#visibilityChannel: #boxMVisible |
2221 | 148 |
#component: |
149 |
#(#SpecCollection |
|
150 |
#collection: #( |
|
151 |
#(#LabelSpec |
|
152 |
#label: 'Changed' |
|
153 |
#name: 'Label2' |
|
154 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
|
155 |
#translateLabel: true |
|
156 |
#labelChannel: #changedLabelHolder |
|
157 |
) |
|
158 |
#(#SequenceViewSpec |
|
159 |
#name: 'ListM' |
|
160 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
161 |
#model: #methodsChangedSelection |
|
162 |
#menu: #menuM |
|
163 |
#hasHorizontalScrollBar: true |
|
164 |
#hasVerticalScrollBar: true |
|
165 |
#miniScrollerHorizontal: true |
|
166 |
#valueChangeSelector: #methodsChangedSelectionChanged |
|
167 |
#useIndex: true |
|
168 |
#sequenceList: #methodsChanged |
|
169 |
) |
|
170 |
) |
|
171 |
||
172 |
) |
|
2497 | 173 |
#extent: #(#Point 286 252) |
2221 | 174 |
) |
175 |
#(#ViewSpec |
|
176 |
#name: 'BoxB' |
|
2585 | 177 |
#visibilityChannel: #boxBVisible |
2221 | 178 |
#component: |
179 |
#(#SpecCollection |
|
180 |
#collection: #( |
|
181 |
#(#LabelSpec |
|
182 |
#label: 'Only in B' |
|
2224 | 183 |
#name: 'OnlyInBLabel' |
2221 | 184 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
185 |
#translateLabel: true |
|
186 |
#labelChannel: #onlyInBLabelHolder |
|
187 |
) |
|
188 |
#(#SequenceViewSpec |
|
189 |
#name: 'ListB' |
|
190 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
191 |
#model: #methodsOnlyInBSelection |
|
192 |
#menu: #menuB |
|
193 |
#hasHorizontalScrollBar: true |
|
194 |
#hasVerticalScrollBar: true |
|
195 |
#miniScrollerHorizontal: true |
|
196 |
#valueChangeSelector: #methodsOnlyInBSelectionChanged |
|
197 |
#useIndex: true |
|
198 |
#sequenceList: #methodsOnlyInB |
|
199 |
) |
|
200 |
) |
|
201 |
||
202 |
) |
|
2497 | 203 |
#extent: #(#Point 287 252) |
2221 | 204 |
) |
205 |
) |
|
206 |
||
207 |
) |
|
208 |
) |
|
209 |
#(#ViewSpec |
|
210 |
#name: 'Box4' |
|
211 |
#component: |
|
212 |
#(#SpecCollection |
|
213 |
#collection: #( |
|
214 |
#(#ViewSpec |
|
215 |
#name: 'diffTextViewBox' |
|
216 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
217 |
#initiallyInvisible: true |
|
218 |
#component: |
|
219 |
#(#SpecCollection |
|
220 |
#collection: #( |
|
221 |
#(#LabelSpec |
|
222 |
#label: 'A' |
|
223 |
#name: 'DiffTextLabelA' |
|
224 |
#layout: #(#LayoutFrame 0 0 0 0 0 0.5 20 0) |
|
225 |
#translateLabel: true |
|
226 |
#labelChannel: #diffTextLabelA |
|
227 |
) |
|
228 |
#(#LabelSpec |
|
229 |
#label: 'B' |
|
230 |
#name: 'DiffTextLabelB' |
|
231 |
#layout: #(#LayoutFrame 0 0.5 0 0 0 1 20 0) |
|
232 |
#translateLabel: true |
|
233 |
#labelChannel: #diffTextLabelB |
|
234 |
) |
|
235 |
#(#ArbitraryComponentSpec |
|
236 |
#name: 'diffTextView' |
|
237 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 0 1.0) |
|
238 |
#hasBorder: false |
|
239 |
#component: #diffTextView |
|
240 |
) |
|
241 |
) |
|
242 |
||
243 |
) |
|
244 |
) |
|
245 |
#(#TextEditorSpec |
|
246 |
#name: 'singleTextView' |
|
247 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
248 |
#model: #methodText |
|
249 |
#hasHorizontalScrollBar: true |
|
250 |
#hasVerticalScrollBar: true |
|
251 |
#miniScrollerHorizontal: true |
|
252 |
) |
|
253 |
) |
|
254 |
||
255 |
) |
|
256 |
) |
|
257 |
) |
|
258 |
||
259 |
) |
|
2497 | 260 |
#handles: #(#Any 0.5 1.0) |
2221 | 261 |
) |
262 |
) |
|
263 |
||
264 |
) |
|
265 |
) |
|
266 |
! ! |
|
267 |
||
268 |
!VersionDiffBrowser class methodsFor:'menu specs'! |
|
269 |
||
270 |
mainMenu |
|
271 |
"This resource specification was automatically generated |
|
272 |
by the MenuEditor of ST/X." |
|
273 |
||
274 |
"Do not manually edit this!! If it is corrupted, |
|
275 |
the MenuEditor may not be able to read the specification." |
|
276 |
||
277 |
" |
|
278 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#mainMenu |
|
279 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser mainMenu)) startUp |
|
280 |
" |
|
281 |
||
282 |
<resource: #menu> |
|
283 |
||
284 |
^ |
|
285 |
#(#Menu |
|
286 |
#( |
|
287 |
#(#MenuItem |
|
288 |
#label: 'File' |
|
289 |
#translateLabel: true |
|
290 |
#submenu: |
|
291 |
#(#Menu |
|
292 |
#( |
|
293 |
#(#MenuItem |
|
2469 | 294 |
#label: 'Create PatchFile' |
295 |
#translateLabel: true |
|
296 |
#value: #createPatchFile |
|
297 |
) |
|
298 |
#(#MenuItem |
|
299 |
#label: '-' |
|
300 |
) |
|
301 |
#(#MenuItem |
|
2221 | 302 |
#label: 'Exit' |
303 |
#translateLabel: true |
|
304 |
#value: #closeRequest |
|
305 |
) |
|
306 |
) |
|
307 |
nil |
|
308 |
nil |
|
309 |
) |
|
310 |
) |
|
311 |
#(#MenuItem |
|
312 |
#label: 'Help' |
|
313 |
#translateLabel: true |
|
314 |
#startGroup: #right |
|
315 |
#submenu: |
|
316 |
#(#Menu |
|
317 |
#( |
|
318 |
#(#MenuItem |
|
319 |
#label: 'Documentation' |
|
320 |
#translateLabel: true |
|
321 |
#value: #openDocumentation |
|
322 |
) |
|
323 |
#(#MenuItem |
|
324 |
#label: '-' |
|
325 |
) |
|
326 |
#(#MenuItem |
|
327 |
#label: 'About this Application' |
|
328 |
#translateLabel: true |
|
329 |
#value: #openAboutThisApplication |
|
330 |
) |
|
331 |
) |
|
332 |
nil |
|
333 |
nil |
|
334 |
) |
|
335 |
) |
|
336 |
) |
|
337 |
nil |
|
338 |
nil |
|
339 |
) |
|
340 |
! |
|
341 |
||
342 |
menuA |
|
343 |
"This resource specification was automatically generated |
|
344 |
by the MenuEditor of ST/X." |
|
345 |
||
346 |
"Do not manually edit this!! If it is corrupted, |
|
347 |
the MenuEditor may not be able to read the specification." |
|
348 |
||
349 |
" |
|
350 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menu1 |
|
351 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menu1)) startUp |
|
352 |
" |
|
353 |
||
354 |
<resource: #menu> |
|
355 |
||
356 |
^ |
|
357 |
#(#Menu |
|
358 |
#( |
|
359 |
#(#MenuItem |
|
360 |
#label: 'Inspect' |
|
361 |
#translateLabel: true |
|
362 |
#value: #inspectSelectedChangeInA |
|
363 |
#choiceValue: 'nil "UndefinedObject" ' |
|
364 |
) |
|
2465 | 365 |
#(#MenuItem |
366 |
#label: '-' |
|
367 |
) |
|
368 |
#(#MenuItem |
|
369 |
#label: 'Browse' |
|
370 |
#translateLabel: true |
|
371 |
#value: #browseClassInA |
|
372 |
) |
|
2221 | 373 |
) |
374 |
nil |
|
375 |
nil |
|
376 |
) |
|
377 |
! |
|
378 |
||
379 |
menuB |
|
380 |
"This resource specification was automatically generated |
|
381 |
by the MenuEditor of ST/X." |
|
382 |
||
383 |
"Do not manually edit this!! If it is corrupted, |
|
384 |
the MenuEditor may not be able to read the specification." |
|
385 |
||
386 |
" |
|
387 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menuB |
|
388 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menuB)) startUp |
|
389 |
" |
|
390 |
||
391 |
<resource: #menu> |
|
392 |
||
393 |
^ |
|
394 |
#(#Menu |
|
395 |
#( |
|
396 |
#(#MenuItem |
|
397 |
#label: 'Inspect' |
|
398 |
#translateLabel: true |
|
399 |
#value: #inspectSelectedChangeInB |
|
400 |
#choiceValue: 'nil "UndefinedObject" ' |
|
401 |
) |
|
2465 | 402 |
#(#MenuItem |
403 |
#label: '-' |
|
404 |
) |
|
405 |
#(#MenuItem |
|
406 |
#label: 'Browse' |
|
407 |
#translateLabel: true |
|
408 |
#value: #browseClassInB |
|
409 |
) |
|
2221 | 410 |
) |
411 |
nil |
|
412 |
nil |
|
413 |
) |
|
414 |
! |
|
415 |
||
416 |
menuM |
|
417 |
"This resource specification was automatically generated |
|
418 |
by the MenuEditor of ST/X." |
|
419 |
||
420 |
"Do not manually edit this!! If it is corrupted, |
|
421 |
the MenuEditor may not be able to read the specification." |
|
422 |
||
423 |
" |
|
424 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menu1 |
|
425 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menu1)) startUp |
|
426 |
" |
|
427 |
||
428 |
<resource: #menu> |
|
429 |
||
430 |
^ |
|
431 |
#(#Menu |
|
432 |
#( |
|
433 |
#(#MenuItem |
|
2224 | 434 |
#label: 'Inspect both' |
2221 | 435 |
#translateLabel: true |
436 |
#value: #inspectSelectedChangeInM |
|
437 |
#choiceValue: 'nil "UndefinedObject" ' |
|
438 |
) |
|
2465 | 439 |
#(#MenuItem |
440 |
#label: '-' |
|
441 |
) |
|
442 |
#(#MenuItem |
|
443 |
#label: 'Browse' |
|
444 |
#translateLabel: true |
|
445 |
#value: #browseClassInM |
|
446 |
) |
|
2221 | 447 |
) |
448 |
nil |
|
449 |
nil |
|
450 |
) |
|
451 |
! ! |
|
452 |
||
453 |
!VersionDiffBrowser class methodsFor:'startup'! |
|
454 |
||
2497 | 455 |
openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
2507 | 456 |
" |
457 |
create an VersionDiffBrowser instance and set the class change set of the |
|
2510 | 458 |
broswer. The class change set is generated from two source files. |
2507 | 459 |
|
460 |
<return: VersionDiffBrowser> |
|
461 |
" |
|
2497 | 462 |
|theBrowser| |
2224 | 463 |
|
2497 | 464 |
theBrowser := self new. |
465 |
theBrowser allButOpen. |
|
466 |
theBrowser classChangeSet:(ClassChangeSet newForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB). |
|
467 |
theBrowser openWindow. |
|
468 |
^ theBrowser. |
|
2224 | 469 |
|
470 |
! |
|
471 |
||
2497 | 472 |
openOnClass:aClass versionA:aVersionA versionB:aVersionB |
2507 | 473 |
" |
474 |
create an VersionDiffBrowser instance and set the class change set of the |
|
475 |
broswer. The class change set is generated from two class versions via |
|
476 |
the source code manager . |
|
477 |
||
478 |
<return: VersionDiffBrowser> |
|
479 |
" |
|
2497 | 480 |
|theBrowser| |
2221 | 481 |
|
2497 | 482 |
theBrowser := self new. |
483 |
theBrowser allButOpen. |
|
484 |
theBrowser classChangeSet:(ClassChangeSet newForClass:aClass versionA:aVersionA versionB:aVersionB). |
|
485 |
theBrowser openWindow. |
|
486 |
^ theBrowser. |
|
2221 | 487 |
|
488 |
" |
|
489 |
self openOnClass:Array versionA:'1.116' versionB:'1.113' |
|
490 |
" |
|
491 |
! ! |
|
492 |
||
493 |
!VersionDiffBrowser methodsFor:'accessing'! |
|
494 |
||
2497 | 495 |
changeSetA |
496 |
" |
|
497 |
gets the change set which contains only the new methods |
|
498 |
in versionA of the class |
|
2221 | 499 |
|
2497 | 500 |
<return: ChangeSet> |
501 |
" |
|
2221 | 502 |
|
2497 | 503 |
^ self classChangeSet methodsOnlyInA |
2221 | 504 |
! |
505 |
||
2497 | 506 |
changeSetB |
507 |
" |
|
508 |
gets the change set which contains only the new methods |
|
509 |
in versionB of the class |
|
510 |
||
511 |
<return: ChangeSet> |
|
512 |
" |
|
513 |
||
514 |
^ self classChangeSet methodsOnlyInB |
|
515 |
! |
|
516 |
||
517 |
classBeingCompared |
|
2507 | 518 |
" |
519 |
gets the class from the change set which is compared. |
|
2224 | 520 |
|
2507 | 521 |
<return: Class> |
522 |
" |
|
2497 | 523 |
^ self classChangeSet classBeingCompared |
524 |
! |
|
525 |
||
526 |
classChangeSet |
|
2507 | 527 |
" |
528 |
returns the class change set which is the model of the version diff browser. |
|
2224 | 529 |
|
2507 | 530 |
<return: ClassChangeSet> |
531 |
" |
|
532 |
^ classChangeSet |
|
533 |
! |
|
2497 | 534 |
|
2507 | 535 |
classChangeSet:aClassChangeSet |
2501 | 536 |
" |
2507 | 537 |
sets the class change set which is the model of the version diff browser. |
538 |
The labels, the lists, the visibility and the selection of the lists must be reseted |
|
539 |
when a new change set is given. |
|
2497 | 540 |
|
2507 | 541 |
<return: self> |
2501 | 542 |
" |
2507 | 543 |
classChangeSet := aClassChangeSet. |
2501 | 544 |
self updateLabels. |
545 |
self updateLists. |
|
546 |
self resetSelectionHolders. |
|
547 |
! |
|
2224 | 548 |
|
2507 | 549 |
selectedChangeInA |
550 |
" |
|
551 |
gets the selected method change for the 'method only in version A'. |
|
552 |
||
553 |
<return: MethodChange | nil> |
|
554 |
" |
|
555 |
|sel change| |
|
556 |
||
557 |
sel := self methodsOnlyInASelection value. |
|
558 |
sel notNil ifTrue:[ |
|
559 |
change := (self changeSetA at:sel). |
|
560 |
]. |
|
561 |
^ nil |
|
562 |
! |
|
563 |
||
564 |
selectedChangeInB |
|
565 |
" |
|
566 |
gets the selected method change for the 'method only in version B'. |
|
567 |
||
568 |
<return: MethodChange | nil> |
|
569 |
" |
|
570 |
|sel change| |
|
571 |
||
572 |
sel := self methodsOnlyInBSelection value. |
|
573 |
sel notNil ifTrue:[ |
|
574 |
change := (self changeSetB at:sel). |
|
575 |
]. |
|
576 |
^ nil |
|
577 |
! |
|
578 |
||
579 |
selectedChangesInM |
|
580 |
" |
|
581 |
get the two method changes for the selected 'changed method'. |
|
582 |
||
583 |
<return: <Array with:MethodChange with:MethodChange | nil>> |
|
584 |
" |
|
585 |
|sel changeA changeB| |
|
586 |
||
587 |
sel := self methodsChangedSelection value. |
|
588 |
sel notNil ifTrue:[ |
|
589 |
changeA := (self classChangeSet methodsChanged at:sel) first. |
|
590 |
changeB := (self classChangeSet methodsChanged at:sel) second. |
|
591 |
^ Array with:changeA |
|
592 |
with:changeB |
|
593 |
]. |
|
594 |
^ nil |
|
595 |
! |
|
596 |
||
2221 | 597 |
versionA |
2507 | 598 |
" |
599 |
gets the first class version to be compared |
|
2221 | 600 |
|
2507 | 601 |
<return: String> |
602 |
" |
|
2497 | 603 |
^ self classChangeSet labelA |
2221 | 604 |
|
605 |
! |
|
606 |
||
607 |
versionB |
|
2507 | 608 |
" |
609 |
gets the second class version to be compared |
|
2221 | 610 |
|
2507 | 611 |
<return: String> |
612 |
" |
|
2497 | 613 |
^ self classChangeSet labelB |
2221 | 614 |
|
615 |
! ! |
|
616 |
||
617 |
!VersionDiffBrowser methodsFor:'actions'! |
|
618 |
||
619 |
methodsChangedSelectionChanged |
|
2507 | 620 |
" |
621 |
the selection in the list of the 'changed methods' changed. |
|
622 |
Reset the selection of the two other lists and calc the method change. |
|
623 |
||
624 |
<return: self> |
|
625 |
" |
|
2221 | 626 |
|sel idxA idxB changeA changeB| |
627 |
||
628 |
sel := self methodsChangedSelection value. |
|
629 |
sel notNil ifTrue:[ |
|
630 |
self methodsOnlyInASelection value:nil. |
|
631 |
self methodsOnlyInBSelection value:nil. |
|
2497 | 632 |
changeA := (self classChangeSet methodsChanged at:sel) first. |
633 |
changeB := (self classChangeSet methodsChanged at:sel) second. |
|
2501 | 634 |
self withReadCursorDo:[ |
2377 | 635 |
self diffTextView text1:changeA source text2:changeB source. |
2501 | 636 |
self diffTextView moveToNextChanged |
2377 | 637 |
]. |
2221 | 638 |
self showDiffTextView. |
639 |
] |
|
2377 | 640 |
|
641 |
"Modified: / 3.9.1999 / 15:01:30 / ps" |
|
2221 | 642 |
! |
643 |
||
644 |
methodsOnlyInASelectionChanged |
|
2507 | 645 |
" |
646 |
the selection in the list of the 'method only in version A' changed. |
|
647 |
Reset the selection of the two other lists and show the method in |
|
648 |
the text view. |
|
649 |
||
650 |
<return: self> |
|
651 |
" |
|
2221 | 652 |
|change sel| |
653 |
||
654 |
sel := self methodsOnlyInASelection value. |
|
655 |
sel notNil ifTrue:[ |
|
656 |
self methodsOnlyInBSelection value:nil. |
|
657 |
self methodsChangedSelection value:nil. |
|
2497 | 658 |
change := self changeSetA at:sel. |
2221 | 659 |
self methodText value:(change source). |
660 |
self showSingleTextView. |
|
661 |
] |
|
662 |
! |
|
663 |
||
664 |
methodsOnlyInBSelectionChanged |
|
2507 | 665 |
" |
666 |
the selection in the list of the 'method only in version B' changed. |
|
667 |
Reset the selection of the two other lists and show the method in |
|
668 |
the text view. |
|
669 |
||
670 |
<return: self> |
|
671 |
" |
|
2221 | 672 |
|change sel| |
673 |
||
674 |
sel := self methodsOnlyInBSelection value. |
|
675 |
sel notNil ifTrue:[ |
|
676 |
self methodsOnlyInASelection value:nil. |
|
677 |
self methodsChangedSelection value:nil. |
|
2497 | 678 |
change := self changeSetB at:sel. |
2221 | 679 |
self methodText value:(change source). |
680 |
self showSingleTextView. |
|
681 |
] |
|
682 |
! ! |
|
683 |
||
684 |
!VersionDiffBrowser methodsFor:'aspects'! |
|
685 |
||
2585 | 686 |
boxAVisible |
687 |
|holder| |
|
688 |
||
689 |
(holder := builder bindingAt:#boxAVisible) isNil ifTrue:[ |
|
690 |
builder aspectAt:#boxAVisible put:(holder := true asValue). |
|
691 |
]. |
|
692 |
^ holder. |
|
693 |
! |
|
694 |
||
695 |
boxBVisible |
|
696 |
|holder| |
|
697 |
||
698 |
(holder := builder bindingAt:#boxBVisible) isNil ifTrue:[ |
|
699 |
builder aspectAt:#boxBVisible put:(holder := true asValue). |
|
700 |
]. |
|
701 |
^ holder. |
|
702 |
! |
|
703 |
||
704 |
boxMVisible |
|
705 |
|holder| |
|
706 |
||
707 |
(holder := builder bindingAt:#boxMVisible) isNil ifTrue:[ |
|
708 |
builder aspectAt:#boxMVisible put:(holder := true asValue). |
|
709 |
]. |
|
710 |
^ holder. |
|
711 |
! |
|
712 |
||
2221 | 713 |
changedLabelHolder |
2507 | 714 |
" |
715 |
aspect for the label of the changed method box. |
|
2221 | 716 |
|
2507 | 717 |
<return: ValueHolder on: nil> |
718 |
" |
|
2221 | 719 |
|holder| |
720 |
||
721 |
(holder := builder bindingAt:#changedLabelHolder) isNil ifTrue:[ |
|
722 |
builder aspectAt:#changedLabelHolder put:(holder := ValueHolder new). |
|
723 |
]. |
|
724 |
^ holder. |
|
725 |
! |
|
726 |
||
727 |
diffTextLabelA |
|
2507 | 728 |
" |
729 |
aspect for the label for version A. |
|
2221 | 730 |
|
2507 | 731 |
<return: ValueHolder on: nil> |
732 |
" |
|
2221 | 733 |
|
734 |
|holder| |
|
735 |
||
736 |
(holder := builder bindingAt:#diffTextLabelA) isNil ifTrue:[ |
|
737 |
builder aspectAt:#diffTextLabelA put:(holder := ValueHolder new). |
|
738 |
]. |
|
739 |
^ holder. |
|
740 |
! |
|
741 |
||
742 |
diffTextLabelB |
|
2507 | 743 |
" |
744 |
aspect for the label for version B. |
|
2221 | 745 |
|
2507 | 746 |
<return: ValueHolder on: nil> |
747 |
" |
|
2221 | 748 |
|
749 |
|holder| |
|
750 |
||
751 |
(holder := builder bindingAt:#diffTextLabelB) isNil ifTrue:[ |
|
752 |
builder aspectAt:#diffTextLabelB put:(holder := ValueHolder new). |
|
753 |
]. |
|
754 |
^ holder. |
|
755 |
! |
|
756 |
||
2497 | 757 |
diffTextView |
2507 | 758 |
" |
759 |
return the component for the diff text view. |
|
2497 | 760 |
|
2507 | 761 |
<return: HVScrollableView> |
762 |
" |
|
2497 | 763 |
diffTextView isNil ifTrue:[ |
764 |
diffTextView := HVScrollableView |
|
765 |
for:DiffTextView |
|
766 |
miniScrollerH:true miniScrollerV:false. |
|
767 |
diffTextView addNextPreviousButtons. |
|
768 |
]. |
|
769 |
^ diffTextView |
|
770 |
! |
|
771 |
||
2221 | 772 |
methodText |
2507 | 773 |
" |
774 |
aspect for the text in the method text view. |
|
2221 | 775 |
|
2507 | 776 |
<return: ValueHolder on: nil> |
777 |
" |
|
2221 | 778 |
|holder| |
779 |
||
780 |
(holder := builder bindingAt:#methodText) isNil ifTrue:[ |
|
781 |
builder aspectAt:#methodText put:(holder := ValueHolder new). |
|
782 |
]. |
|
783 |
^ holder. |
|
784 |
! |
|
785 |
||
786 |
methodsChanged |
|
2507 | 787 |
" |
788 |
aspect for the 'changed method' list. |
|
2221 | 789 |
|
2507 | 790 |
<return: List> |
791 |
" |
|
2221 | 792 |
|
793 |
|holder| |
|
794 |
||
795 |
(holder := builder bindingAt:#methodsChanged) isNil ifTrue:[ |
|
796 |
builder aspectAt:#methodsChanged put:(holder := List new). |
|
797 |
]. |
|
798 |
^ holder. |
|
799 |
! |
|
800 |
||
801 |
methodsChangedSelection |
|
2507 | 802 |
" |
803 |
aspect for the selection holder of 'changed method'-list. |
|
2221 | 804 |
|
2507 | 805 |
<return: ValueHolder on: nil> |
806 |
" |
|
2221 | 807 |
|
808 |
|holder| |
|
809 |
||
810 |
(holder := builder bindingAt:#methodsChangedSelection) isNil ifTrue:[ |
|
811 |
builder aspectAt:#methodsChangedSelection put:(holder := ValueHolder new). |
|
812 |
]. |
|
813 |
^ holder. |
|
814 |
! |
|
815 |
||
816 |
methodsOnlyInA |
|
2507 | 817 |
" |
818 |
aspect for the 'method only in version A' list. |
|
2221 | 819 |
|
2507 | 820 |
<return: List> |
821 |
" |
|
2221 | 822 |
|
823 |
|holder| |
|
824 |
||
825 |
(holder := builder bindingAt:#methodsOnlyInA) isNil ifTrue:[ |
|
826 |
builder aspectAt:#methodsOnlyInA put:(holder := List new). |
|
827 |
]. |
|
828 |
^ holder. |
|
829 |
! |
|
830 |
||
831 |
methodsOnlyInASelection |
|
2507 | 832 |
" |
833 |
aspect for the selection holder of 'method only in version A'-list. |
|
2221 | 834 |
|
2507 | 835 |
<return: ValueHolder on: nil> |
836 |
" |
|
2221 | 837 |
|
838 |
|holder| |
|
839 |
||
840 |
(holder := builder bindingAt:#methodsOnlyInASelection) isNil ifTrue:[ |
|
841 |
builder aspectAt:#methodsOnlyInASelection put:(holder := ValueHolder new). |
|
842 |
]. |
|
843 |
^ holder. |
|
844 |
! |
|
845 |
||
846 |
methodsOnlyInB |
|
2507 | 847 |
" |
848 |
aspect for the 'method only in version B' list. |
|
2221 | 849 |
|
2507 | 850 |
<return: List> |
851 |
" |
|
2221 | 852 |
|
853 |
|holder| |
|
854 |
||
855 |
(holder := builder bindingAt:#methodsOnlyInB) isNil ifTrue:[ |
|
856 |
builder aspectAt:#methodsOnlyInB put:(holder := List new). |
|
857 |
]. |
|
858 |
^ holder. |
|
859 |
! |
|
860 |
||
861 |
methodsOnlyInBSelection |
|
2507 | 862 |
" |
863 |
aspect for the selection holder of 'method only in version B'-list. |
|
2221 | 864 |
|
2507 | 865 |
<return: ValueHolder on: nil> |
866 |
" |
|
2221 | 867 |
|
868 |
|holder| |
|
869 |
||
870 |
(holder := builder bindingAt:#methodsOnlyInBSelection) isNil ifTrue:[ |
|
871 |
builder aspectAt:#methodsOnlyInBSelection put:(holder := ValueHolder new). |
|
872 |
]. |
|
873 |
^ holder. |
|
874 |
! |
|
875 |
||
876 |
onlyInALabelHolder |
|
2507 | 877 |
" |
878 |
aspect for the label for 'method only in version A'. |
|
2221 | 879 |
|
2507 | 880 |
<return: ValueHolder on: nil> |
881 |
" |
|
2221 | 882 |
|
883 |
|holder| |
|
884 |
||
885 |
(holder := builder bindingAt:#onlyInALabelHolder) isNil ifTrue:[ |
|
886 |
builder aspectAt:#onlyInALabelHolder put:(holder := ValueHolder new). |
|
887 |
]. |
|
888 |
^ holder. |
|
889 |
! |
|
890 |
||
891 |
onlyInBLabelHolder |
|
2507 | 892 |
" |
893 |
aspect for the label for 'method only in version B'. |
|
2221 | 894 |
|
2507 | 895 |
<return: ValueHolder on: nil> |
896 |
" |
|
2221 | 897 |
|
898 |
|holder| |
|
899 |
||
900 |
(holder := builder bindingAt:#onlyInBLabelHolder) isNil ifTrue:[ |
|
901 |
builder aspectAt:#onlyInBLabelHolder put:(holder := ValueHolder new). |
|
902 |
]. |
|
903 |
^ holder. |
|
904 |
! ! |
|
905 |
||
906 |
!VersionDiffBrowser methodsFor:'initialization & release'! |
|
907 |
||
908 |
postBuildWith:aBuilder |
|
2507 | 909 |
" |
910 |
components which are invisible should be ignored by the panel. |
|
911 |
Cannot be set via the interface builder. |
|
2221 | 912 |
|
2507 | 913 |
<return: self> |
914 |
" |
|
2221 | 915 |
(aBuilder componentAt:#TopHorizontalPanel) ignoreInvisibleComponents:true. |
916 |
^ super postBuildWith:aBuilder |
|
917 |
! ! |
|
918 |
||
919 |
!VersionDiffBrowser methodsFor:'menu action'! |
|
920 |
||
2465 | 921 |
browseChange:aChange |
2507 | 922 |
" |
923 |
browse the change in aChange |
|
924 |
||
925 |
<return: self> |
|
926 |
" |
|
2578
29264fb3847e
avoid debugger in browse-menu
Claus Gittinger <cg@exept.de>
parents:
2536
diff
changeset
|
927 |
aChange isNil ifTrue:[^ self]. |
2467 | 928 |
SystemBrowser |
929 |
openInClass:aChange changeClass |
|
930 |
selector:aChange changeSelector. |
|
2465 | 931 |
! |
932 |
||
933 |
browseClassInA |
|
2507 | 934 |
" |
935 |
browse the selected method. |
|
936 |
||
937 |
<return: self> |
|
938 |
" |
|
2465 | 939 |
self browseChange:(self selectedChangeInA). |
940 |
! |
|
2221 | 941 |
|
2465 | 942 |
browseClassInB |
2507 | 943 |
" |
944 |
browse the selected method. |
|
945 |
||
946 |
<return: self> |
|
947 |
" |
|
2465 | 948 |
self browseChange:(self selectedChangeInB). |
949 |
! |
|
950 |
||
951 |
browseClassInM |
|
2507 | 952 |
" |
953 |
browse the selected method. |
|
954 |
||
955 |
<return: self> |
|
956 |
" |
|
2465 | 957 |
self browseChange:(self selectedChangesInM first). |
958 |
! |
|
959 |
||
2469 | 960 |
createPatchFile |
961 |
"create a pacthFile, to patch the old version (versionB) into |
|
962 |
the new version (versionA)" |
|
963 |
||
964 |
|oldVersion newVersion vsnMthdA vsnMthdB vsnA vsnB info| |
|
2507 | 965 |
self halt. |
2497 | 966 |
vsnMthdA := self changeSetA |
2469 | 967 |
detect:[:ch | ch isMethodChange |
968 |
and:[ch changeClass isMeta |
|
969 |
and:[ch changeSelector = #version]]] |
|
970 |
ifNone:nil. |
|
2497 | 971 |
vsnMthdB := self changeSetA |
2469 | 972 |
detect:[:ch | ch isMethodChange |
973 |
and:[ch changeClass isMeta |
|
974 |
and:[ch changeSelector = #version]]] |
|
975 |
ifNone:nil. |
|
976 |
||
977 |
vsnMthdA notNil ifTrue:[ |
|
978 |
"/ extract the version |
|
979 |
vsnA := Class revisionStringFromSource:vsnMthdA source. |
|
980 |
vsnA notNil ifTrue:[ |
|
981 |
info := Class revisionInfoFromString:vsnA. |
|
982 |
info notNil ifTrue:[ |
|
983 |
vsnA := info at:#revision ifAbsent:nil. |
|
984 |
] ifFalse:[ |
|
985 |
vsnA := nil. |
|
986 |
]. |
|
987 |
]. |
|
988 |
]. |
|
989 |
vsnMthdB notNil ifTrue:[ |
|
990 |
"/ extract the version |
|
991 |
vsnB := Class revisionStringFromSource:vsnMthdB source. |
|
992 |
vsnB notNil ifTrue:[ |
|
993 |
info := Class revisionInfoFromString:vsnB. |
|
994 |
info notNil ifTrue:[ |
|
995 |
vsnB := info at:#revision ifAbsent:nil. |
|
996 |
] ifFalse:[ |
|
997 |
vsnB := nil. |
|
998 |
]. |
|
999 |
]. |
|
1000 |
]. |
|
1001 |
||
2507 | 1002 |
(vsnA isNil or:[vsnB isNil or:[vsnA = vsnB]]) ifTrue:[ |
2469 | 1003 |
self warn:'The generated patch file will not be able to validate/update the class version'. |
1004 |
]. |
|
1005 |
||
1006 |
self halt. |
|
1007 |
||
1008 |
! |
|
1009 |
||
2465 | 1010 |
inspectSelectedChangeInA |
2507 | 1011 |
" |
1012 |
inspect the selected method change for the 'method only in version A'. |
|
1013 |
||
1014 |
<return: self> |
|
1015 |
" |
|
2465 | 1016 |
self selectedChangeInA inspect. |
2221 | 1017 |
! |
1018 |
||
1019 |
inspectSelectedChangeInB |
|
2507 | 1020 |
" |
1021 |
inspect the selected method change for the 'method only in version B'. |
|
1022 |
||
1023 |
<return: self> |
|
1024 |
" |
|
2465 | 1025 |
self selectedChangeInB inspect. |
1026 |
! |
|
1027 |
||
1028 |
inspectSelectedChangeInM |
|
2507 | 1029 |
" |
1030 |
inspect the two method changes for the selected 'changed method'. |
|
1031 |
||
1032 |
<return: self> |
|
1033 |
" |
|
2465 | 1034 |
|changes| |
1035 |
||
1036 |
changes := self selectedChangesInM. |
|
1037 |
changes do:[:change | |
|
1038 |
change inspect |
|
1039 |
]. |
|
1040 |
! |
|
1041 |
||
2501 | 1042 |
mainMenu |
2507 | 1043 |
" |
1044 |
if this application runs as an subapplication, |
|
1045 |
the menu bar should not be used. |
|
1046 |
||
1047 |
<return: self> |
|
1048 |
" |
|
2501 | 1049 |
self masterApplication isNil ifTrue:[ |
1050 |
^ self class mainMenu |
|
1051 |
]. |
|
1052 |
^ nil |
|
2221 | 1053 |
! ! |
1054 |
||
1055 |
!VersionDiffBrowser methodsFor:'private'! |
|
1056 |
||
2497 | 1057 |
generator |
2507 | 1058 |
" |
1059 |
generate a print string for a change. |
|
2497 | 1060 |
|
2507 | 1061 |
<return: Block> |
1062 |
" |
|
1063 |
^[:aChange | |
|
2585 | 1064 |
|result mPkg cPkg cls m changeClassName| |
1065 |
||
2507 | 1066 |
aChange isClassDefinitionChange ifTrue:[ |
2585 | 1067 |
result := aChange printStringWithoutClassName |
2497 | 1068 |
] ifFalse:[ |
2507 | 1069 |
aChange isDoIt ifTrue:[ |
1070 |
result := aChange source , ' (doIt)' |
|
2497 | 1071 |
] ifFalse:[ |
2585 | 1072 |
changeClassName := aChange className. |
1073 |
changeClassName = self classBeingCompared name ifTrue:[ |
|
1074 |
result := aChange printStringWithoutClassName. |
|
2507 | 1075 |
aChange isMethodChange ifTrue:[ |
1076 |
cls := aChange changeClass. |
|
2497 | 1077 |
cls notNil ifTrue:[ |
2507 | 1078 |
m := cls compiledMethodAt:aChange selector. |
2497 | 1079 |
(m notNil |
1080 |
and:[m package ~= cls package]) ifTrue:[ |
|
2585 | 1081 |
result := aChange printStringWithoutClassName , ' [' , m package , ']'. |
2497 | 1082 |
]. |
1083 |
]. |
|
1084 |
] |
|
1085 |
] ifFalse:[ |
|
1086 |
"/ include name in private class changes |
|
2585 | 1087 |
(changeClassName startsWith:(self classBeingCompared name , '::')) ifTrue:[ |
1088 |
result := (changeClassName copyFrom:(self classBeingCompared name size + 3)) , ' ' , aChange printStringWithoutClassName |
|
2497 | 1089 |
] ifFalse:[ |
2507 | 1090 |
result := aChange printString |
2497 | 1091 |
] |
1092 |
] |
|
1093 |
] |
|
1094 |
]. |
|
1095 |
result |
|
1096 |
]. |
|
1097 |
||
1098 |
! |
|
1099 |
||
2501 | 1100 |
resetSelectionHolders |
2507 | 1101 |
" |
1102 |
reset all selection holders when a new change set is given. |
|
1103 |
First set the selection to nil. |
|
1104 |
||
1105 |
<return: self> |
|
1106 |
" |
|
2501 | 1107 |
|
1108 |
self methodsChangedSelection value:nil. |
|
1109 |
self methodsOnlyInASelection value:nil. |
|
1110 |
self methodsOnlyInBSelection value:nil. |
|
2507 | 1111 |
self diffTextView text1:'' text2:''. |
1112 |
self methodText value:''. |
|
1113 |
||
1114 |
"/ self methodsChangedSelectionChanged. |
|
1115 |
"/ self methodsOnlyInASelectionChanged. |
|
1116 |
"/ self methodsOnlyInBSelectionChanged. |
|
2501 | 1117 |
|
1118 |
! |
|
1119 |
||
2221 | 1120 |
showDiffTextView |
2507 | 1121 |
" |
1122 |
if a method change is selected, then show the diff text view. |
|
1123 |
Add an accept entry to the popup menu. |
|
1124 |
||
1125 |
<return: self> |
|
1126 |
" |
|
2221 | 1127 |
(self builder componentAt:#diffTextViewBox) raise; beVisible. |
1128 |
(self builder componentAt:#singleTextView) beInvisible. |
|
1129 |
(self builder componentAt:#diffTextView) realizeAllSubViews. |
|
2465 | 1130 |
self addAcceptToTextViewMenus. |
2221 | 1131 |
! |
1132 |
||
1133 |
showSingleTextView |
|
2507 | 1134 |
" |
1135 |
if a method is selected which is only in version A or B of the class, |
|
1136 |
then show the text view. |
|
1137 |
Add an accept entry to the popup menu. |
|
1138 |
||
1139 |
<return: self> |
|
1140 |
" |
|
1141 |
||
2221 | 1142 |
(self builder componentAt:#singleTextView) raise; beVisible. |
1143 |
(self builder componentAt:#diffTextViewBox) beInvisible. |
|
2501 | 1144 |
self addAcceptToTextViewMenus. |
2221 | 1145 |
|
1146 |
! |
|
1147 |
||
2497 | 1148 |
updateLabels |
2507 | 1149 |
" |
1150 |
update the labels of the diff text view. Show the version numbers |
|
1151 |
of the class. |
|
2221 | 1152 |
|
2507 | 1153 |
<return: self> |
1154 |
" |
|
2221 | 1155 |
|
2497 | 1156 |
|theVersionA theVersionB| |
2224 | 1157 |
|
2497 | 1158 |
(theVersionA := self versionA) notNil ifTrue:[ |
1159 |
self diffTextLabelA value:theVersionA. |
|
1160 |
self onlyInALabelHolder value:('Only in ' , theVersionA). |
|
2224 | 1161 |
(self builder componentAt:#OnlyInALabel) backgroundColor:Color green darkened. |
1162 |
]. |
|
2497 | 1163 |
(theVersionB :=self versionB) notNil ifTrue:[ |
1164 |
self diffTextLabelB value:theVersionB. |
|
1165 |
self onlyInBLabelHolder value:('Only in ' , theVersionB). |
|
2224 | 1166 |
(self builder componentAt:#OnlyInBLabel) backgroundColor:Color red darkened. |
1167 |
]. |
|
1168 |
! |
|
1169 |
||
1170 |
updateLists |
|
2507 | 1171 |
"walk over the two changeSets and add change to one of the tree lists. |
1172 |
Methods which belong to the version A of the class or version B go |
|
1173 |
to the list methodsOnlyInA or methodsOnlyInB. |
|
1174 |
Methods which are changed from version A to B go to the list methodsChanged. |
|
1175 |
||
1176 |
<return: self> |
|
1177 |
" |
|
2585 | 1178 |
|classChangeSet| |
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
1179 |
|
2585 | 1180 |
classChangeSet := self classChangeSet. |
1181 |
||
1182 |
self methodsOnlyInA |
|
1183 |
removeAll; addAll: (classChangeSet methodsOnlyInA collect:self generator). |
|
1184 |
||
1185 |
self methodsOnlyInB |
|
1186 |
removeAll; addAll: (classChangeSet methodsOnlyInB collect:self generator). |
|
2221 | 1187 |
|
2585 | 1188 |
self methodsChanged |
1189 |
removeAll; addAll: (classChangeSet methodsChanged collect:[:arr| self generator value:(arr first)]). |
|
2221 | 1190 |
|
2585 | 1191 |
self boxAVisible value:(self methodsOnlyInA notEmpty). |
1192 |
self boxBVisible value:(self methodsOnlyInB notEmpty). |
|
2221 | 1193 |
|
2585 | 1194 |
self boxMVisible value:(self methodsChanged isEmpty |
1195 |
and: [(self methodsOnlyInA notEmpty |
|
1196 |
or:[self methodsOnlyInB notEmpty])]) not. |
|
2221 | 1197 |
! ! |
1198 |
||
2501 | 1199 |
!VersionDiffBrowser methodsFor:'setup'! |
1200 |
||
2510 | 1201 |
setupForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
1202 |
" |
|
1203 |
generate the class change set from the two source files A and B. |
|
1204 |
When setting the class change set, the labels, list etc. of the receiver |
|
1205 |
are updated. |
|
1206 |
||
1207 |
<return: self> |
|
1208 |
" |
|
1209 |
self classChangeSet:(ClassChangeSet newForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB) |
|
1210 |
! |
|
1211 |
||
2501 | 1212 |
setupForClass:aClass versionA:aVersionA versionB:aVersionB |
2507 | 1213 |
" |
1214 |
compute the class change set for the class aClass and the versions A and B. |
|
1215 |
When setting the class change set, the labels, list etc. of the receiver |
|
1216 |
are updated. |
|
2501 | 1217 |
|
2507 | 1218 |
<return: self> |
1219 |
" |
|
2501 | 1220 |
self classChangeSet:(ClassChangeSet newForClass:aClass versionA:aVersionA versionB:aVersionB) |
1221 |
! ! |
|
1222 |
||
2221 | 1223 |
!VersionDiffBrowser methodsFor:'values'! |
1224 |
||
2465 | 1225 |
addAcceptToTextViewMenus |
2507 | 1226 |
" |
1227 |
add to the standard diff text view or single text views menu an accept entry. |
|
1228 |
||
1229 |
<return: self> |
|
1230 |
" |
|
1231 |
||
2465 | 1232 |
|m v| |
1233 |
||
1234 |
(Array |
|
2497 | 1235 |
with:self diffTextView leftTextView |
2501 | 1236 |
with:self diffTextView rightTextView |
1237 |
with:(self builder componentAt:#singleTextView)) |
|
2465 | 1238 |
do:[:v | |
1239 |
m := v editMenu. |
|
2536 | 1240 |
(m selectorAt:#accept) isNil ifTrue:[ |
1241 |
m addLabels:#('-' 'accept') |
|
1242 |
selectors:(Array with:nil with:#accept) |
|
1243 |
after:#copySelection. |
|
1244 |
]. |
|
2465 | 1245 |
m |
1246 |
actionAt:#accept |
|
2536 | 1247 |
put:[|idx idx2 text change| |
2501 | 1248 |
v == (self builder componentAt:#singleTextView) |
1249 |
ifTrue:[ |
|
1250 |
self methodsOnlyInASelection value notNil |
|
1251 |
ifTrue: [change := (self classChangeSet methodsOnlyInA at: self methodsOnlyInASelection value)] |
|
1252 |
ifFalse:[change := (self classChangeSet methodsOnlyInB at: self methodsOnlyInBSelection value)]. |
|
1253 |
] |
|
2536 | 1254 |
ifFalse:[ |
2501 | 1255 |
idx := self methodsChangedSelection value. |
2465 | 1256 |
|
2501 | 1257 |
v == self diffTextView leftTextView ifTrue:[ |
1258 |
change := (self classChangeSet methodsChanged at:idx) first. |
|
1259 |
] ifFalse:[ |
|
1260 |
change := (self classChangeSet methodsChanged at:idx) second. |
|
1261 |
]. |
|
1262 |
]. |
|
1263 |
change apply |
|
2465 | 1264 |
]. |
1265 |
m selectorAt:#accept put:nil. |
|
1266 |
v menuHolder:m. |
|
1267 |
v menuMessage:#value. |
|
1268 |
] |
|
1269 |
||
2497 | 1270 |
! ! |
1271 |
||
1272 |
!VersionDiffBrowser::ClassChangeSet class methodsFor:'instance creation'! |
|
1273 |
||
1274 |
changeSetForClass:aClass andRevision:aVersion |
|
1275 |
"return a ChangeSet for the class aClass and version aVersion. |
|
1276 |
The version from the class source stream is checked out from the repositiory |
|
1277 |
into a source stream. Then the change set is generated from the source stream. |
|
1278 |
||
1279 |
<return: ChangeSet|nil> |
|
1280 |
" |
|
1281 |
|theSourceCodeManager theSourceStream theChangeSet| |
|
1282 |
||
1283 |
theSourceCodeManager := aClass sourceCodeManager. |
|
1284 |
[theSourceStream := theSourceCodeManager getSourceStreamFor:aClass revision:aVersion. |
|
1285 |
theSourceStream notNil |
|
1286 |
ifTrue:[theChangeSet:=ChangeSet fromStream:theSourceStream]] |
|
1287 |
valueNowOrOnUnwindDo: |
|
1288 |
[theSourceStream notNil ifTrue:[theSourceStream close]]. |
|
1289 |
^theChangeSet |
|
1290 |
! |
|
1291 |
||
1292 |
changeSetForClass:aClass andSource:aSource |
|
1293 |
"return a ChangeSet for the class aClass and source aSource. |
|
1294 |
The source is converted to a stream and then the change set is generated |
|
1295 |
from the source stream. |
|
1296 |
||
1297 |
<return: ChangeSet|nil> |
|
1298 |
" |
|
1299 |
|theChangeSet theSourceStream| |
|
1300 |
||
1301 |
[(theSourceStream := aSource readStream) notNil |
|
1302 |
ifTrue:[theChangeSet:=ChangeSet fromStream:(theSourceStream := aSource readStream)]] |
|
1303 |
valueNowOrOnUnwindDo: |
|
1304 |
[theSourceStream notNil |
|
1305 |
ifTrue:[theSourceStream close]]. |
|
1306 |
^theChangeSet |
|
1307 |
! |
|
1308 |
||
1309 |
newForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
|
1310 |
"return a ClassChangeSet for the class aClass and the two sources. |
|
1311 |
The two classes are compared via the source files. A new instance of |
|
1312 |
ClassChangeSet is generated containing the correspondenting changes. |
|
1313 |
||
1314 |
<return: ClassChangeSet> |
|
1315 |
" |
|
1316 |
|theChangeSetA theChangeSetB theClassChangeSet| |
|
1317 |
||
1318 |
theClassChangeSet := self new. |
|
1319 |
theClassChangeSet classBeingCompared:aClass. |
|
1320 |
theClassChangeSet labelA:aLabelA. |
|
1321 |
theClassChangeSet labelB:aLabelB. |
|
1322 |
theChangeSetA:=self changeSetForClass:aClass andSource:aSourceA. |
|
1323 |
theChangeSetB:=self changeSetForClass:aClass andSource:aSourceB. |
|
1324 |
theChangeSetA isNil |
|
1325 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1326 |
theChangeSetB isNil |
|
1327 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
1328 |
^theClassChangeSet changeSet:(theChangeSetA diffSetsAgainst:theChangeSetB) |
|
2465 | 1329 |
! |
1330 |
||
2497 | 1331 |
newForClass:aClass versionA:aVersionA versionB:aVersionB |
1332 |
"return a ClassChangeSet for the class aClass and the two versions. |
|
1333 |
The two class version are checked out from the repository and then being |
|
1334 |
compared. A new instance of ClassChangeSet is generated containing |
|
1335 |
the correspondenting changes. |
|
1336 |
||
1337 |
<return: ClassChangeSet> |
|
1338 |
" |
|
1339 |
|theChangeSetA theChangeSetB theClassChangeSet| |
|
1340 |
||
1341 |
theClassChangeSet := self new. |
|
1342 |
theClassChangeSet classBeingCompared:aClass. |
|
1343 |
theClassChangeSet labelA:aVersionA. |
|
1344 |
theClassChangeSet labelB:aVersionB. |
|
1345 |
theChangeSetA := self changeSetForClass: aClass andRevision: aVersionA. |
|
1346 |
theChangeSetB := self changeSetForClass: aClass andRevision: aVersionB. |
|
1347 |
theChangeSetA isNil |
|
1348 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1349 |
theChangeSetB isNil |
|
1350 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
1351 |
^theClassChangeSet changeSet:(theChangeSetA diffSetsAgainst:theChangeSetB) |
|
1352 |
||
1353 |
! ! |
|
1354 |
||
1355 |
!VersionDiffBrowser::ClassChangeSet methodsFor:'accessing'! |
|
1356 |
||
1357 |
changeSet |
|
1358 |
"returns a identity dictionary containing the different changes. |
|
1359 |
key: value: |
|
1360 |
#changed OrderedCollection of arrays containing ChangeSets for methods |
|
1361 |
which are changed and exists in the class versionA and versionB |
|
1362 |
#onlyInArg ChangeSet for the methods which exists only in the class versionB |
|
1363 |
#onlyInReceiver ChangeSet for the methods which exists only in the class versionA |
|
1364 |
||
1365 |
<return: IdentityDictionary> |
|
1366 |
" |
|
1367 |
^ changeSet |
|
1368 |
! |
|
1369 |
||
1370 |
changeSet:something |
|
1371 |
"sets a identity dictionary containing the different changes. |
|
1372 |
key: value: |
|
1373 |
#changed OrderedCollection of arrays containing ChangeSets for methods |
|
1374 |
which are changed and exists in the class versionA and versionB |
|
1375 |
#onlyInArg ChangeSet for the methods which exists only in the class versionB |
|
1376 |
#onlyInReceiver ChangeSet for the methods which exists only in the class versionA |
|
1377 |
||
1378 |
<return: self> |
|
1379 |
" |
|
1380 |
||
1381 |
changeSet := something. |
|
1382 |
! |
|
1383 |
||
1384 |
classBeingCompared |
|
1385 |
"returns the value of the class which is compared |
|
1386 |
||
1387 |
<return: Behavior> |
|
1388 |
" |
|
1389 |
||
1390 |
^ classBeingCompared |
|
1391 |
! |
|
2221 | 1392 |
|
2497 | 1393 |
classBeingCompared:something |
1394 |
"set the value of the class which is compared |
|
1395 |
||
1396 |
<return: self>" |
|
1397 |
||
1398 |
classBeingCompared := something. |
|
1399 |
! |
|
1400 |
||
1401 |
labelA |
|
1402 |
"returns the label for the class versionA |
|
1403 |
||
1404 |
<return: String> |
|
1405 |
" |
|
1406 |
^ labelA |
|
1407 |
! |
|
1408 |
||
1409 |
labelA:something |
|
1410 |
"sets the label for the class versionA |
|
1411 |
||
1412 |
<return: self> |
|
1413 |
" |
|
1414 |
labelA := something. |
|
1415 |
! |
|
1416 |
||
1417 |
labelB |
|
1418 |
"returns the label for the class versionB |
|
1419 |
||
1420 |
<return: String> |
|
1421 |
" |
|
1422 |
^ labelB |
|
1423 |
! |
|
2465 | 1424 |
|
2497 | 1425 |
labelB:something |
1426 |
"sets the label for the class versionB |
|
1427 |
||
1428 |
<return: self> |
|
1429 |
" |
|
1430 |
||
1431 |
labelB := something. |
|
1432 |
! |
|
1433 |
||
1434 |
methodsChanged |
|
1435 |
"returns a OrderedCollection of arrays containing ChangeSets for methods |
|
1436 |
which are changed and exists in the class versionA and versionB |
|
1437 |
||
1438 |
<return: OrderedCollection> |
|
1439 |
" |
|
1440 |
^ self changeSet at:#changed |
|
1441 |
! |
|
1442 |
||
1443 |
methodsOnlyInA |
|
1444 |
"returns a ChangeSet for the methods which exists only in the class versionA |
|
1445 |
||
1446 |
<return: ChangeSet> |
|
1447 |
" |
|
1448 |
||
1449 |
^ self changeSet at:#onlyInReceiver |
|
1450 |
! |
|
1451 |
||
1452 |
methodsOnlyInB |
|
1453 |
"returns a ChangeSet for the methods which exists only in the class versionB |
|
1454 |
||
1455 |
<return: ChangeSet> |
|
1456 |
" |
|
1457 |
||
1458 |
^ self changeSet at:#onlyInArg |
|
2221 | 1459 |
! ! |
1460 |
||
1461 |
!VersionDiffBrowser class methodsFor:'documentation'! |
|
1462 |
||
1463 |
version |
|
2626 | 1464 |
^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.21 2000-02-18 14:07:09 cg Exp $' |
2221 | 1465 |
! ! |