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