author | Claus Gittinger <cg@exept.de> |
Thu, 18 Oct 2001 15:48:32 +0200 | |
changeset 3322 | fc9db494644b |
parent 3147 | 6977e4703d1a |
child 3329 | 30435f09bc6f |
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 |
||
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
14 |
"{ Package: 'stx:libtool' }" |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
15 |
|
2221 | 16 |
ApplicationModel subclass:#VersionDiffBrowser |
2856 | 17 |
instanceVariableNames:'classChangeSet diffTextView boxAVisible boxBVisible boxMVisible |
18 |
classIfSingleClassDiff versionAIfSingleClassDiff |
|
3147 | 19 |
versionBIfSingleClassDiff changedLabelHolder diffTextLabelA |
20 |
diffTextLabelB methodText methodsChanged methodsChangedSelection |
|
21 |
methodsOnlyInA methodsOnlyInASelection methodsOnlyInB |
|
22 |
methodsOnlyInBSelection onlyInALabelHolder onlyInBLabelHolder' |
|
2221 | 23 |
classVariableNames:'' |
24 |
poolDictionaries:'' |
|
25 |
category:'Interface-Browsers' |
|
26 |
! |
|
27 |
||
2497 | 28 |
HierarchicalItem subclass:#ClassChangeSet |
2695 | 29 |
instanceVariableNames:'classBeingCompared labelA labelB diffSet onlyInA onlyInB |
2856 | 30 |
changedMethods versionA versionB' |
2497 | 31 |
classVariableNames:'' |
32 |
poolDictionaries:'' |
|
33 |
privateIn:VersionDiffBrowser |
|
34 |
! |
|
35 |
||
2626 | 36 |
!VersionDiffBrowser class methodsFor:'documentation'! |
37 |
||
38 |
copyright |
|
39 |
" |
|
40 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
41 |
All Rights Reserved |
|
42 |
||
43 |
This software is furnished under a license and may be used |
|
44 |
only in accordance with the terms of that license and with the |
|
45 |
inclusion of the above copyright notice. This software may not |
|
46 |
be provided or otherwise made available to, or used by, any |
|
47 |
other person. No title to or ownership of the software is |
|
48 |
hereby transferred. |
|
49 |
" |
|
50 |
||
51 |
! |
|
52 |
||
53 |
documentation |
|
54 |
" |
|
55 |
This is not yet finished (work in progress). |
|
56 |
||
57 |
A browser to show differences between class versions, |
|
58 |
allowing easy comparison; will also eventually add capabilities |
|
59 |
to checkIn / load classes into / from the repository. |
|
60 |
||
61 |
[see also:] |
|
62 |
||
63 |
[instance variables:] |
|
64 |
||
65 |
[class variables:] |
|
66 |
" |
|
67 |
||
68 |
||
69 |
! ! |
|
2221 | 70 |
|
71 |
!VersionDiffBrowser class methodsFor:'interface specs'! |
|
72 |
||
73 |
windowSpec |
|
74 |
"This resource specification was automatically generated |
|
75 |
by the UIPainter of ST/X." |
|
76 |
||
77 |
"Do not manually edit this!! If it is corrupted, |
|
78 |
the UIPainter may not be able to read the specification." |
|
79 |
||
80 |
" |
|
81 |
UIPainter new openOnClass:VersionDiffBrowser andSelector:#windowSpec |
|
82 |
VersionDiffBrowser new openInterface:#windowSpec |
|
83 |
VersionDiffBrowser open |
|
84 |
" |
|
85 |
||
86 |
<resource: #canvas> |
|
87 |
||
88 |
^ |
|
89 |
#(#FullSpec |
|
90 |
#name: #windowSpec |
|
91 |
#window: |
|
92 |
#(#WindowSpec |
|
93 |
#label: 'Version DiffBrowser' |
|
94 |
#name: 'Version DiffBrowser' |
|
95 |
#min: #(#Point 10 10) |
|
96 |
#max: #(#Point nil nil) |
|
2695 | 97 |
#bounds: #(#Rectangle 12 22 877 526) |
2221 | 98 |
#menu: #mainMenu |
99 |
) |
|
100 |
#component: |
|
101 |
#(#SpecCollection |
|
102 |
#collection: #( |
|
103 |
#(#VariableVerticalPanelSpec |
|
104 |
#name: 'VariableVerticalPanel1' |
|
105 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
106 |
#component: |
|
107 |
#(#SpecCollection |
|
108 |
#collection: #( |
|
109 |
#(#HorizontalPanelViewSpec |
|
110 |
#name: 'TopHorizontalPanel' |
|
111 |
#horizontalLayout: #fit |
|
112 |
#verticalLayout: #fit |
|
113 |
#horizontalSpace: 3 |
|
114 |
#verticalSpace: 3 |
|
115 |
#component: |
|
116 |
#(#SpecCollection |
|
117 |
#collection: #( |
|
118 |
#(#ViewSpec |
|
119 |
#name: 'BoxA' |
|
120 |
#level: 0 |
|
2585 | 121 |
#visibilityChannel: #boxAVisible |
2221 | 122 |
#component: |
123 |
#(#SpecCollection |
|
124 |
#collection: #( |
|
125 |
#(#LabelSpec |
|
2726 | 126 |
#label: 'Only in A' |
2224 | 127 |
#name: 'OnlyInALabel' |
2221 | 128 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
129 |
#translateLabel: true |
|
130 |
#labelChannel: #onlyInALabelHolder |
|
131 |
) |
|
132 |
#(#SequenceViewSpec |
|
133 |
#name: 'ListA' |
|
134 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
135 |
#model: #methodsOnlyInASelection |
|
136 |
#menu: #menuA |
|
137 |
#hasHorizontalScrollBar: true |
|
138 |
#hasVerticalScrollBar: true |
|
139 |
#miniScrollerHorizontal: true |
|
140 |
#valueChangeSelector: #methodsOnlyInASelectionChanged |
|
141 |
#useIndex: true |
|
142 |
#sequenceList: #methodsOnlyInA |
|
143 |
) |
|
144 |
) |
|
145 |
||
146 |
) |
|
2497 | 147 |
#extent: #(#Point 286 252) |
2221 | 148 |
) |
149 |
#(#ViewSpec |
|
150 |
#name: 'BoxM' |
|
2585 | 151 |
#visibilityChannel: #boxMVisible |
2221 | 152 |
#component: |
153 |
#(#SpecCollection |
|
154 |
#collection: #( |
|
155 |
#(#LabelSpec |
|
156 |
#label: 'Changed' |
|
157 |
#name: 'Label2' |
|
158 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
|
159 |
#translateLabel: true |
|
160 |
#labelChannel: #changedLabelHolder |
|
161 |
) |
|
162 |
#(#SequenceViewSpec |
|
163 |
#name: 'ListM' |
|
164 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
165 |
#model: #methodsChangedSelection |
|
166 |
#menu: #menuM |
|
167 |
#hasHorizontalScrollBar: true |
|
168 |
#hasVerticalScrollBar: true |
|
169 |
#miniScrollerHorizontal: true |
|
170 |
#valueChangeSelector: #methodsChangedSelectionChanged |
|
171 |
#useIndex: true |
|
172 |
#sequenceList: #methodsChanged |
|
173 |
) |
|
174 |
) |
|
175 |
||
176 |
) |
|
2497 | 177 |
#extent: #(#Point 286 252) |
2221 | 178 |
) |
179 |
#(#ViewSpec |
|
180 |
#name: 'BoxB' |
|
2585 | 181 |
#visibilityChannel: #boxBVisible |
2221 | 182 |
#component: |
183 |
#(#SpecCollection |
|
184 |
#collection: #( |
|
185 |
#(#LabelSpec |
|
2726 | 186 |
#label: 'Only in B' |
2224 | 187 |
#name: 'OnlyInBLabel' |
2221 | 188 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 20 0) |
189 |
#translateLabel: true |
|
190 |
#labelChannel: #onlyInBLabelHolder |
|
191 |
) |
|
192 |
#(#SequenceViewSpec |
|
193 |
#name: 'ListB' |
|
194 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 -3 1.0) |
|
195 |
#model: #methodsOnlyInBSelection |
|
196 |
#menu: #menuB |
|
197 |
#hasHorizontalScrollBar: true |
|
198 |
#hasVerticalScrollBar: true |
|
199 |
#miniScrollerHorizontal: true |
|
200 |
#valueChangeSelector: #methodsOnlyInBSelectionChanged |
|
201 |
#useIndex: true |
|
202 |
#sequenceList: #methodsOnlyInB |
|
203 |
) |
|
204 |
) |
|
205 |
||
206 |
) |
|
2497 | 207 |
#extent: #(#Point 287 252) |
2221 | 208 |
) |
209 |
) |
|
210 |
||
211 |
) |
|
212 |
) |
|
213 |
#(#ViewSpec |
|
214 |
#name: 'Box4' |
|
215 |
#component: |
|
216 |
#(#SpecCollection |
|
217 |
#collection: #( |
|
218 |
#(#ViewSpec |
|
219 |
#name: 'diffTextViewBox' |
|
220 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
221 |
#initiallyInvisible: true |
|
222 |
#component: |
|
223 |
#(#SpecCollection |
|
224 |
#collection: #( |
|
225 |
#(#LabelSpec |
|
226 |
#label: 'A' |
|
227 |
#name: 'DiffTextLabelA' |
|
228 |
#layout: #(#LayoutFrame 0 0 0 0 0 0.5 20 0) |
|
229 |
#translateLabel: true |
|
230 |
#labelChannel: #diffTextLabelA |
|
231 |
) |
|
232 |
#(#LabelSpec |
|
233 |
#label: 'B' |
|
234 |
#name: 'DiffTextLabelB' |
|
235 |
#layout: #(#LayoutFrame 0 0.5 0 0 0 1 20 0) |
|
236 |
#translateLabel: true |
|
237 |
#labelChannel: #diffTextLabelB |
|
238 |
) |
|
239 |
#(#ArbitraryComponentSpec |
|
240 |
#name: 'diffTextView' |
|
241 |
#layout: #(#LayoutFrame 0 0.0 20 0.0 0 1.0 0 1.0) |
|
242 |
#hasBorder: false |
|
243 |
#component: #diffTextView |
|
244 |
) |
|
245 |
) |
|
246 |
||
247 |
) |
|
248 |
) |
|
249 |
#(#TextEditorSpec |
|
250 |
#name: 'singleTextView' |
|
251 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
252 |
#model: #methodText |
|
253 |
#hasHorizontalScrollBar: true |
|
254 |
#hasVerticalScrollBar: true |
|
255 |
#miniScrollerHorizontal: true |
|
256 |
) |
|
257 |
) |
|
258 |
||
259 |
) |
|
260 |
) |
|
261 |
) |
|
262 |
||
263 |
) |
|
2497 | 264 |
#handles: #(#Any 0.5 1.0) |
2221 | 265 |
) |
266 |
) |
|
267 |
||
268 |
) |
|
269 |
) |
|
270 |
! ! |
|
271 |
||
272 |
!VersionDiffBrowser class methodsFor:'menu specs'! |
|
273 |
||
274 |
mainMenu |
|
275 |
"This resource specification was automatically generated |
|
276 |
by the MenuEditor of ST/X." |
|
277 |
||
278 |
"Do not manually edit this!! If it is corrupted, |
|
279 |
the MenuEditor may not be able to read the specification." |
|
280 |
||
281 |
" |
|
282 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#mainMenu |
|
283 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser mainMenu)) startUp |
|
284 |
" |
|
285 |
||
286 |
<resource: #menu> |
|
287 |
||
288 |
^ |
|
289 |
#(#Menu |
|
290 |
#( |
|
291 |
#(#MenuItem |
|
292 |
#label: 'File' |
|
293 |
#translateLabel: true |
|
294 |
#submenu: |
|
295 |
#(#Menu |
|
296 |
#( |
|
297 |
#(#MenuItem |
|
2856 | 298 |
#label: 'Create PatchFile...' |
2469 | 299 |
#translateLabel: true |
300 |
#value: #createPatchFile |
|
301 |
) |
|
302 |
#(#MenuItem |
|
303 |
#label: '-' |
|
304 |
) |
|
305 |
#(#MenuItem |
|
2221 | 306 |
#label: 'Exit' |
307 |
#translateLabel: true |
|
308 |
#value: #closeRequest |
|
309 |
) |
|
310 |
) |
|
311 |
nil |
|
312 |
nil |
|
313 |
) |
|
314 |
) |
|
315 |
#(#MenuItem |
|
316 |
#label: 'Help' |
|
317 |
#translateLabel: true |
|
318 |
#startGroup: #right |
|
319 |
#submenu: |
|
320 |
#(#Menu |
|
321 |
#( |
|
322 |
#(#MenuItem |
|
323 |
#label: 'Documentation' |
|
324 |
#translateLabel: true |
|
325 |
#value: #openDocumentation |
|
326 |
) |
|
327 |
#(#MenuItem |
|
328 |
#label: '-' |
|
329 |
) |
|
330 |
#(#MenuItem |
|
331 |
#label: 'About this Application' |
|
332 |
#translateLabel: true |
|
333 |
#value: #openAboutThisApplication |
|
334 |
) |
|
335 |
) |
|
336 |
nil |
|
337 |
nil |
|
338 |
) |
|
339 |
) |
|
340 |
) |
|
341 |
nil |
|
342 |
nil |
|
343 |
) |
|
344 |
! |
|
345 |
||
346 |
menuA |
|
347 |
"This resource specification was automatically generated |
|
348 |
by the MenuEditor of ST/X." |
|
349 |
||
350 |
"Do not manually edit this!! If it is corrupted, |
|
351 |
the MenuEditor may not be able to read the specification." |
|
352 |
||
353 |
" |
|
354 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menu1 |
|
355 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menu1)) startUp |
|
356 |
" |
|
357 |
||
358 |
<resource: #menu> |
|
359 |
||
360 |
^ |
|
361 |
#(#Menu |
|
362 |
#( |
|
363 |
#(#MenuItem |
|
3322 | 364 |
#label: 'Apply' |
2221 | 365 |
#translateLabel: true |
3322 | 366 |
#value: #applySelectedChangeInA |
367 |
) |
|
368 |
#(#MenuItem |
|
369 |
#label: 'Browse' |
|
370 |
#translateLabel: true |
|
371 |
#value: #browseClassInA |
|
2221 | 372 |
) |
2465 | 373 |
#(#MenuItem |
374 |
#label: '-' |
|
375 |
) |
|
376 |
#(#MenuItem |
|
3322 | 377 |
#label: 'Inspect' |
2465 | 378 |
#translateLabel: true |
3322 | 379 |
#value: #inspectSelectedChangeInA |
380 |
#choiceValue: 'nil "UndefinedObject" ' |
|
2465 | 381 |
) |
2221 | 382 |
) |
383 |
nil |
|
384 |
nil |
|
385 |
) |
|
386 |
! |
|
387 |
||
388 |
menuB |
|
389 |
"This resource specification was automatically generated |
|
390 |
by the MenuEditor of ST/X." |
|
391 |
||
392 |
"Do not manually edit this!! If it is corrupted, |
|
393 |
the MenuEditor may not be able to read the specification." |
|
394 |
||
395 |
" |
|
396 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menuB |
|
397 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menuB)) startUp |
|
398 |
" |
|
399 |
||
400 |
<resource: #menu> |
|
401 |
||
402 |
^ |
|
403 |
#(#Menu |
|
404 |
#( |
|
405 |
#(#MenuItem |
|
3322 | 406 |
#label: 'Apply' |
2221 | 407 |
#translateLabel: true |
3322 | 408 |
#value: #applySelectedChangeInB |
409 |
) |
|
410 |
#(#MenuItem |
|
411 |
#label: 'Browse' |
|
412 |
#translateLabel: true |
|
413 |
#value: #browseClassInB |
|
2221 | 414 |
) |
2465 | 415 |
#(#MenuItem |
416 |
#label: '-' |
|
417 |
) |
|
418 |
#(#MenuItem |
|
3322 | 419 |
#label: 'Inspect' |
2465 | 420 |
#translateLabel: true |
3322 | 421 |
#value: #inspectSelectedChangeInB |
422 |
#choiceValue: 'nil "UndefinedObject" ' |
|
2465 | 423 |
) |
2221 | 424 |
) |
425 |
nil |
|
426 |
nil |
|
427 |
) |
|
428 |
! |
|
429 |
||
430 |
menuM |
|
431 |
"This resource specification was automatically generated |
|
432 |
by the MenuEditor of ST/X." |
|
433 |
||
434 |
"Do not manually edit this!! If it is corrupted, |
|
435 |
the MenuEditor may not be able to read the specification." |
|
436 |
||
437 |
" |
|
438 |
MenuEditor new openOnClass:VersionDiffBrowser andSelector:#menu1 |
|
439 |
(Menu new fromLiteralArrayEncoding:(VersionDiffBrowser menu1)) startUp |
|
440 |
" |
|
441 |
||
442 |
<resource: #menu> |
|
443 |
||
444 |
^ |
|
445 |
#(#Menu |
|
446 |
#( |
|
447 |
#(#MenuItem |
|
3322 | 448 |
#label: 'Browse' |
2221 | 449 |
#translateLabel: true |
3322 | 450 |
#value: #browseClassInM |
2221 | 451 |
) |
2465 | 452 |
#(#MenuItem |
453 |
#label: '-' |
|
454 |
) |
|
455 |
#(#MenuItem |
|
3322 | 456 |
#label: 'Inspect both' |
2465 | 457 |
#translateLabel: true |
3322 | 458 |
#value: #inspectSelectedChangeInM |
459 |
#choiceValue: 'nil "UndefinedObject" ' |
|
2465 | 460 |
) |
2221 | 461 |
) |
462 |
nil |
|
463 |
nil |
|
464 |
) |
|
465 |
! ! |
|
466 |
||
2695 | 467 |
!VersionDiffBrowser class methodsFor:'plugIn spec'! |
468 |
||
469 |
aspectSelectors |
|
470 |
"This resource specification was automatically generated |
|
471 |
by the UIPainter of ST/X." |
|
472 |
||
473 |
"Do not manually edit this. If it is corrupted, |
|
474 |
the UIPainter may not be able to read the specification." |
|
475 |
||
476 |
"Return a description of exported aspects; |
|
477 |
these can be connected to aspects of an embedding application |
|
478 |
(if this app is embedded in a subCanvas)." |
|
479 |
||
480 |
^ #( |
|
481 |
#changedLabelHolder |
|
482 |
#onlyInALabelHolder |
|
483 |
#onlyInBLabelHolder |
|
484 |
). |
|
485 |
||
486 |
! ! |
|
487 |
||
2221 | 488 |
!VersionDiffBrowser class methodsFor:'startup'! |
489 |
||
2695 | 490 |
openOnClass:aClass againstVersion:aVersionA |
3147 | 491 |
" |
492 |
create an VersionDiffBrowser instance and set the class change set of the |
|
493 |
browser. The class diff set is generated from classes current against some version |
|
494 |
via the source code manager . |
|
2507 | 495 |
|
3147 | 496 |
<return: VersionDiffBrowser> |
497 |
" |
|
2497 | 498 |
|theBrowser| |
2224 | 499 |
|
2497 | 500 |
theBrowser := self new. |
501 |
theBrowser allButOpen. |
|
2695 | 502 |
theBrowser setupForClass:aClass againstVersion:aVersionA. |
2497 | 503 |
theBrowser openWindow. |
504 |
^ theBrowser. |
|
2224 | 505 |
|
2695 | 506 |
" |
507 |
self openOnClass:Array againstVersion:'1.116' |
|
508 |
self openOnClass:Array againstVersion:nil - against the version on which Array is based upon |
|
509 |
self openOnClass:Array againstVersion:#newest - against the newest repository version |
|
510 |
||
511 |
self openOnClass:VersionDiffBrowser againstVersion:nil |
|
512 |
self openOnClass:VersionDiffBrowser againstVersion:#newest |
|
513 |
" |
|
514 |
! |
|
515 |
||
2949 | 516 |
openOnClass:classA labelA:aLabelA andClass:classB labelB:aLabelB title:ignoredTitle |
3147 | 517 |
" |
518 |
create an VersionDiffBrowser instance and set the class change set of the |
|
519 |
browser. The class diff set is generated from two classes. |
|
2949 | 520 |
|
3147 | 521 |
<return: VersionDiffBrowser> |
522 |
" |
|
2949 | 523 |
^ self |
524 |
openOnClass:classA labelA:aLabelA andClass:classB labelB:aLabelB title:ignoredTitle ifSame:nil |
|
525 |
! |
|
526 |
||
527 |
openOnClass:classA labelA:aLabelA andClass:classB labelB:aLabelB title:ignoredTitle ifSame:sameAction |
|
3147 | 528 |
" |
529 |
create an VersionDiffBrowser instance and set the class change set of the |
|
530 |
browser. The class diff set is generated from two classes. |
|
2949 | 531 |
|
3147 | 532 |
<return: VersionDiffBrowser> |
533 |
" |
|
2949 | 534 |
|theBrowser| |
535 |
||
536 |
theBrowser := self new. |
|
537 |
theBrowser allButOpen. |
|
538 |
theBrowser setupForClass:classA labelA:aLabelA andClass:classB labelB:aLabelB. |
|
539 |
||
540 |
sameAction notNil ifTrue:[ |
|
541 |
"/ check if same ... |
|
542 |
(theBrowser classChangeSet methodsOnlyInA isEmpty |
|
543 |
and:[theBrowser classChangeSet methodsOnlyInB isEmpty |
|
544 |
and:[theBrowser classChangeSet diffSet isEmpty]]) ifTrue:[ |
|
545 |
sameAction value. |
|
546 |
^ self "/ do not open |
|
547 |
] |
|
548 |
]. |
|
549 |
theBrowser openWindow. |
|
550 |
^ theBrowser. |
|
551 |
! |
|
552 |
||
2695 | 553 |
openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
3147 | 554 |
" |
555 |
create an VersionDiffBrowser instance and set the class change set of the |
|
556 |
browser. The class diff set is generated from two source files. |
|
2695 | 557 |
|
3147 | 558 |
<return: VersionDiffBrowser> |
559 |
" |
|
2716
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
560 |
^ self |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
561 |
openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
562 |
title:nil |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
563 |
! |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
564 |
|
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
565 |
openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB title:ignoredTitle |
3147 | 566 |
" |
567 |
create an VersionDiffBrowser instance and set the class change set of the |
|
568 |
browser. The class diff set is generated from two source files. |
|
2716
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2714
diff
changeset
|
569 |
|
3147 | 570 |
<return: VersionDiffBrowser> |
571 |
" |
|
2849 | 572 |
^ self openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB title:ignoredTitle ifSame:nil |
573 |
! |
|
574 |
||
575 |
openOnClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB title:ignoredTitle ifSame:sameAction |
|
3147 | 576 |
" |
577 |
create an VersionDiffBrowser instance and set the class change set of the |
|
578 |
browser. The class diff set is generated from two source files. |
|
2849 | 579 |
|
3147 | 580 |
<return: VersionDiffBrowser> |
581 |
" |
|
2695 | 582 |
|theBrowser| |
583 |
||
584 |
theBrowser := self new. |
|
585 |
theBrowser allButOpen. |
|
586 |
theBrowser setupForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB. |
|
2849 | 587 |
sameAction notNil ifTrue:[ |
2853 | 588 |
"/ check if same ... |
589 |
(theBrowser classChangeSet methodsOnlyInA isEmpty |
|
590 |
and:[theBrowser classChangeSet methodsOnlyInB isEmpty |
|
591 |
and:[theBrowser classChangeSet diffSet isEmpty]]) ifTrue:[ |
|
592 |
sameAction value. |
|
593 |
^ self "/ do not open |
|
594 |
] |
|
2849 | 595 |
]. |
2695 | 596 |
theBrowser openWindow. |
597 |
^ theBrowser. |
|
2224 | 598 |
! |
599 |
||
2497 | 600 |
openOnClass:aClass versionA:aVersionA versionB:aVersionB |
3147 | 601 |
" |
602 |
create an VersionDiffBrowser instance and set the class change set of the |
|
603 |
browser. The class diff set is generated from two class versions via |
|
604 |
the source code manager . |
|
2507 | 605 |
|
3147 | 606 |
<return: VersionDiffBrowser> |
607 |
" |
|
2497 | 608 |
|theBrowser| |
2221 | 609 |
|
2497 | 610 |
theBrowser := self new. |
611 |
theBrowser allButOpen. |
|
2695 | 612 |
theBrowser setupForClass:aClass versionA:aVersionA versionB:aVersionB. |
2497 | 613 |
theBrowser openWindow. |
614 |
^ theBrowser. |
|
2221 | 615 |
|
616 |
" |
|
617 |
self openOnClass:Array versionA:'1.116' versionB:'1.113' |
|
618 |
" |
|
619 |
! ! |
|
620 |
||
621 |
!VersionDiffBrowser methodsFor:'accessing'! |
|
622 |
||
2497 | 623 |
changeSetA |
3147 | 624 |
" |
625 |
gets the change set which contains only the new methods |
|
626 |
in versionA of the class |
|
2221 | 627 |
|
3147 | 628 |
<return: ChangeSet> |
629 |
" |
|
2221 | 630 |
|
2497 | 631 |
^ self classChangeSet methodsOnlyInA |
2221 | 632 |
! |
633 |
||
2497 | 634 |
changeSetB |
3147 | 635 |
" |
636 |
gets the change set which contains only the new methods |
|
637 |
in versionB of the class |
|
2497 | 638 |
|
3147 | 639 |
<return: ChangeSet> |
640 |
" |
|
2497 | 641 |
|
642 |
^ self classChangeSet methodsOnlyInB |
|
643 |
! |
|
644 |
||
2856 | 645 |
class:aClass versionA:revA versionB:revB |
646 |
classIfSingleClassDiff := aClass. |
|
647 |
versionAIfSingleClassDiff := revA. |
|
648 |
versionBIfSingleClassDiff := revB. |
|
649 |
! |
|
650 |
||
2497 | 651 |
classBeingCompared |
3147 | 652 |
" |
653 |
gets the class from the change set which is compared. |
|
2224 | 654 |
|
3147 | 655 |
<return: Class> |
656 |
" |
|
2497 | 657 |
^ self classChangeSet classBeingCompared |
658 |
! |
|
659 |
||
660 |
classChangeSet |
|
3147 | 661 |
" |
662 |
returns the class change set which is the model of the version diff browser. |
|
2224 | 663 |
|
3147 | 664 |
<return: ClassChangeSet> |
665 |
" |
|
2507 | 666 |
^ classChangeSet |
667 |
! |
|
2497 | 668 |
|
2507 | 669 |
classChangeSet:aClassChangeSet |
3147 | 670 |
" |
671 |
sets the class change set which is the model of the version diff browser. |
|
672 |
The labels, the lists, the visibility and the selection of the lists must be reseted |
|
673 |
when a new change set is given. |
|
2497 | 674 |
|
3147 | 675 |
<return: self> |
676 |
" |
|
2507 | 677 |
classChangeSet := aClassChangeSet. |
2501 | 678 |
self updateLabels. |
679 |
self updateLists. |
|
680 |
self resetSelectionHolders. |
|
681 |
! |
|
2224 | 682 |
|
2507 | 683 |
selectedChangeInA |
3147 | 684 |
" |
685 |
gets the selected method change for the 'method only in version A'. |
|
2507 | 686 |
|
3147 | 687 |
<return: MethodChange | nil> |
688 |
" |
|
2507 | 689 |
|sel change| |
690 |
||
691 |
sel := self methodsOnlyInASelection value. |
|
692 |
sel notNil ifTrue:[ |
|
693 |
change := (self changeSetA at:sel). |
|
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
694 |
^ change |
2507 | 695 |
]. |
696 |
^ nil |
|
697 |
! |
|
698 |
||
699 |
selectedChangeInB |
|
3147 | 700 |
" |
701 |
gets the selected method change for the 'method only in version B'. |
|
2507 | 702 |
|
3147 | 703 |
<return: MethodChange | nil> |
704 |
" |
|
2507 | 705 |
|sel change| |
706 |
||
707 |
sel := self methodsOnlyInBSelection value. |
|
708 |
sel notNil ifTrue:[ |
|
709 |
change := (self changeSetB at:sel). |
|
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
710 |
^ change |
2507 | 711 |
]. |
712 |
^ nil |
|
713 |
! |
|
714 |
||
715 |
selectedChangesInM |
|
3147 | 716 |
" |
717 |
get the two method changes for the selected 'changed method'. |
|
2507 | 718 |
|
3147 | 719 |
<return: <Array with:MethodChange with:MethodChange | nil>> |
720 |
" |
|
2745 | 721 |
|sel changeA changeB theTwoChanges| |
2507 | 722 |
|
723 |
sel := self methodsChangedSelection value. |
|
724 |
sel notNil ifTrue:[ |
|
2745 | 725 |
theTwoChanges := self classChangeSet methodsChanged at:sel. |
726 |
changeA := theTwoChanges first. |
|
727 |
changeB := theTwoChanges second. |
|
728 |
^ Array with:changeA with:changeB |
|
2507 | 729 |
]. |
730 |
^ nil |
|
731 |
! |
|
732 |
||
2221 | 733 |
versionA |
3147 | 734 |
" |
735 |
gets the first class version to be compared |
|
2221 | 736 |
|
3147 | 737 |
<return: String> |
738 |
" |
|
2731 | 739 |
classChangeSet isNil ifTrue:[^ 'A']. |
740 |
^ classChangeSet labelA |
|
2221 | 741 |
! |
742 |
||
743 |
versionB |
|
3147 | 744 |
" |
745 |
gets the second class version to be compared |
|
2221 | 746 |
|
3147 | 747 |
<return: String> |
748 |
" |
|
2731 | 749 |
classChangeSet isNil ifTrue:[^ 'B']. |
750 |
^ classChangeSet labelB |
|
2221 | 751 |
! ! |
752 |
||
753 |
!VersionDiffBrowser methodsFor:'actions'! |
|
754 |
||
755 |
methodsChangedSelectionChanged |
|
3147 | 756 |
" |
757 |
the selection in the list of the 'changed methods' changed. |
|
758 |
Reset the selection of the two other lists and calc the method change. |
|
2507 | 759 |
|
3147 | 760 |
<return: self> |
761 |
" |
|
2695 | 762 |
|sel idxA idxB changeA changeB methodsChanged| |
2221 | 763 |
|
764 |
sel := self methodsChangedSelection value. |
|
765 |
sel notNil ifTrue:[ |
|
766 |
self methodsOnlyInASelection value:nil. |
|
767 |
self methodsOnlyInBSelection value:nil. |
|
2695 | 768 |
methodsChanged := self classChangeSet methodsChanged. |
769 |
changeA := (methodsChanged at:sel) first. |
|
770 |
changeB := (methodsChanged at:sel) second. |
|
2501 | 771 |
self withReadCursorDo:[ |
3051 | 772 |
self diffTextView text1:changeA prettyPrintedSource text2:changeB prettyPrintedSource. |
2501 | 773 |
self diffTextView moveToNextChanged |
2377 | 774 |
]. |
2221 | 775 |
self showDiffTextView. |
776 |
] |
|
2377 | 777 |
|
778 |
"Modified: / 3.9.1999 / 15:01:30 / ps" |
|
2221 | 779 |
! |
780 |
||
781 |
methodsOnlyInASelectionChanged |
|
3147 | 782 |
" |
783 |
the selection in the list of the 'method only in version A' changed. |
|
784 |
Reset the selection of the two other lists and show the method in |
|
785 |
the text view. |
|
2507 | 786 |
|
3147 | 787 |
<return: self> |
788 |
" |
|
2221 | 789 |
|change sel| |
790 |
||
791 |
sel := self methodsOnlyInASelection value. |
|
792 |
sel notNil ifTrue:[ |
|
793 |
self methodsOnlyInBSelection value:nil. |
|
794 |
self methodsChangedSelection value:nil. |
|
2497 | 795 |
change := self changeSetA at:sel. |
3051 | 796 |
self methodText value:(change prettyPrintedSource). |
2221 | 797 |
self showSingleTextView. |
798 |
] |
|
799 |
! |
|
800 |
||
801 |
methodsOnlyInBSelectionChanged |
|
3147 | 802 |
" |
803 |
the selection in the list of the 'method only in version B' changed. |
|
804 |
Reset the selection of the two other lists and show the method in |
|
805 |
the text view. |
|
2507 | 806 |
|
3147 | 807 |
<return: self> |
808 |
" |
|
2221 | 809 |
|change sel| |
810 |
||
811 |
sel := self methodsOnlyInBSelection value. |
|
812 |
sel notNil ifTrue:[ |
|
813 |
self methodsOnlyInASelection value:nil. |
|
814 |
self methodsChangedSelection value:nil. |
|
2497 | 815 |
change := self changeSetB at:sel. |
3051 | 816 |
self methodText value:(change prettyPrintedSource). |
2221 | 817 |
self showSingleTextView. |
818 |
] |
|
819 |
! ! |
|
820 |
||
821 |
!VersionDiffBrowser methodsFor:'aspects'! |
|
822 |
||
2585 | 823 |
boxAVisible |
2745 | 824 |
boxAVisible isNil ifTrue:[ |
825 |
boxAVisible := true asValue. |
|
2585 | 826 |
]. |
2745 | 827 |
^ boxAVisible. |
2585 | 828 |
! |
829 |
||
830 |
boxBVisible |
|
2745 | 831 |
boxBVisible isNil ifTrue:[ |
832 |
boxBVisible := true asValue. |
|
2585 | 833 |
]. |
2745 | 834 |
^ boxBVisible. |
2585 | 835 |
! |
836 |
||
837 |
boxMVisible |
|
2745 | 838 |
boxMVisible isNil ifTrue:[ |
839 |
boxMVisible := true asValue. |
|
2585 | 840 |
]. |
2745 | 841 |
^ boxMVisible. |
2585 | 842 |
! |
843 |
||
2221 | 844 |
changedLabelHolder |
3147 | 845 |
" |
846 |
aspect for the label of the changed method box. |
|
2221 | 847 |
|
3147 | 848 |
<return: ValueHolder on: nil> |
849 |
" |
|
2221 | 850 |
|
3147 | 851 |
changedLabelHolder isNil ifTrue:[ |
852 |
changedLabelHolder := ValueHolder new. |
|
2221 | 853 |
]. |
3147 | 854 |
^ changedLabelHolder. |
2221 | 855 |
! |
856 |
||
857 |
diffTextLabelA |
|
3147 | 858 |
" |
859 |
aspect for the label for version A. |
|
2221 | 860 |
|
3147 | 861 |
<return: ValueHolder on: nil> |
862 |
" |
|
2221 | 863 |
|
3147 | 864 |
diffTextLabelA isNil ifTrue:[ |
865 |
diffTextLabelA := ValueHolder new. |
|
2221 | 866 |
]. |
3147 | 867 |
^ diffTextLabelA. |
2221 | 868 |
! |
869 |
||
870 |
diffTextLabelB |
|
3147 | 871 |
" |
872 |
aspect for the label for version B. |
|
2221 | 873 |
|
3147 | 874 |
<return: ValueHolder on: nil> |
875 |
" |
|
2221 | 876 |
|
3147 | 877 |
diffTextLabelB isNil ifTrue:[ |
878 |
diffTextLabelB := ValueHolder new. |
|
2221 | 879 |
]. |
3147 | 880 |
^ diffTextLabelB. |
2221 | 881 |
! |
882 |
||
2497 | 883 |
diffTextView |
3147 | 884 |
" |
885 |
return the component for the diff text view. |
|
2497 | 886 |
|
3147 | 887 |
<return: HVScrollableView> |
888 |
" |
|
2497 | 889 |
diffTextView isNil ifTrue:[ |
890 |
diffTextView := HVScrollableView |
|
891 |
for:DiffTextView |
|
892 |
miniScrollerH:true miniScrollerV:false. |
|
893 |
diffTextView addNextPreviousButtons. |
|
894 |
]. |
|
895 |
^ diffTextView |
|
896 |
! |
|
897 |
||
2221 | 898 |
methodText |
3147 | 899 |
" |
900 |
aspect for the text in the method text view. |
|
2221 | 901 |
|
3147 | 902 |
<return: ValueHolder on: nil> |
903 |
" |
|
2221 | 904 |
|
3147 | 905 |
methodText isNil ifTrue:[ |
906 |
methodText := ValueHolder new. |
|
2221 | 907 |
]. |
3147 | 908 |
^ methodText. |
2221 | 909 |
! |
910 |
||
911 |
methodsChanged |
|
3147 | 912 |
" |
913 |
aspect for the 'changed method' list. |
|
2221 | 914 |
|
3147 | 915 |
<return: List> |
916 |
" |
|
2221 | 917 |
|
3147 | 918 |
methodsChanged isNil ifTrue:[ |
919 |
methodsChanged := List new. |
|
2221 | 920 |
]. |
3147 | 921 |
^ methodsChanged. |
2221 | 922 |
! |
923 |
||
924 |
methodsChangedSelection |
|
3147 | 925 |
" |
926 |
aspect for the selection holder of 'changed method'-list. |
|
2221 | 927 |
|
3147 | 928 |
<return: ValueHolder on: nil> |
929 |
" |
|
2221 | 930 |
|
3147 | 931 |
methodsChangedSelection isNil ifTrue:[ |
932 |
methodsChangedSelection := ValueHolder new. |
|
2221 | 933 |
]. |
3147 | 934 |
^ methodsChangedSelection. |
2221 | 935 |
! |
936 |
||
937 |
methodsOnlyInA |
|
3147 | 938 |
" |
939 |
aspect for the 'method only in version A' list. |
|
2221 | 940 |
|
3147 | 941 |
<return: List> |
942 |
" |
|
2221 | 943 |
|
3147 | 944 |
methodsOnlyInA isNil ifTrue:[ |
945 |
methodsOnlyInA := List new. |
|
2221 | 946 |
]. |
3147 | 947 |
^ methodsOnlyInA. |
2221 | 948 |
! |
949 |
||
950 |
methodsOnlyInASelection |
|
3147 | 951 |
" |
952 |
aspect for the selection holder of 'method only in version A'-list. |
|
2221 | 953 |
|
3147 | 954 |
<return: ValueHolder on: nil> |
955 |
" |
|
2221 | 956 |
|
3147 | 957 |
methodsOnlyInASelection isNil ifTrue:[ |
958 |
methodsOnlyInASelection := ValueHolder new. |
|
2221 | 959 |
]. |
3147 | 960 |
^ methodsOnlyInASelection. |
2221 | 961 |
! |
962 |
||
963 |
methodsOnlyInB |
|
3147 | 964 |
" |
965 |
aspect for the 'method only in version B' list. |
|
2221 | 966 |
|
3147 | 967 |
<return: List> |
968 |
" |
|
2221 | 969 |
|
3147 | 970 |
methodsOnlyInB isNil ifTrue:[ |
971 |
methodsOnlyInB := List new. |
|
2221 | 972 |
]. |
3147 | 973 |
^ methodsOnlyInB. |
2221 | 974 |
! |
975 |
||
976 |
methodsOnlyInBSelection |
|
3147 | 977 |
" |
978 |
aspect for the selection holder of 'method only in version B'-list. |
|
2221 | 979 |
|
3147 | 980 |
<return: ValueHolder on: nil> |
981 |
" |
|
2221 | 982 |
|
3147 | 983 |
methodsOnlyInBSelection isNil ifTrue:[ |
984 |
methodsOnlyInBSelection := ValueHolder new. |
|
2221 | 985 |
]. |
3147 | 986 |
^ methodsOnlyInBSelection. |
2221 | 987 |
! |
988 |
||
989 |
onlyInALabelHolder |
|
3147 | 990 |
" |
991 |
aspect for the label for 'method only in version A'. |
|
2221 | 992 |
|
3147 | 993 |
<return: ValueHolder on: nil> |
994 |
" |
|
2221 | 995 |
|
3147 | 996 |
onlyInALabelHolder isNil ifTrue:[ |
997 |
onlyInALabelHolder := ValueHolder new. |
|
2221 | 998 |
]. |
3147 | 999 |
^ onlyInALabelHolder. |
2221 | 1000 |
! |
1001 |
||
1002 |
onlyInBLabelHolder |
|
3147 | 1003 |
" |
1004 |
aspect for the label for 'method only in version B'. |
|
2221 | 1005 |
|
3147 | 1006 |
<return: ValueHolder on: nil> |
1007 |
" |
|
2221 | 1008 |
|
3147 | 1009 |
onlyInBLabelHolder isNil ifTrue:[ |
1010 |
onlyInBLabelHolder := ValueHolder new. |
|
2221 | 1011 |
]. |
3147 | 1012 |
^ onlyInBLabelHolder. |
2221 | 1013 |
! ! |
1014 |
||
2725 | 1015 |
!VersionDiffBrowser methodsFor:'aspects-exported'! |
2695 | 1016 |
|
1017 |
changedLabelHolder:aValueHolder |
|
1018 |
builder aspectAt:#changedLabelHolder put:aValueHolder. |
|
1019 |
||
1020 |
! |
|
1021 |
||
1022 |
classHolder:aValueHolder |
|
1023 |
|holder| |
|
1024 |
||
1025 |
(holder := builder bindingAt:#classHolder) notNil ifTrue:[ |
|
1026 |
holder removeDependent:self |
|
1027 |
]. |
|
1028 |
builder aspectAt:#classHolder put:aValueHolder. |
|
1029 |
aValueHolder notNil ifTrue:[ |
|
1030 |
aValueHolder addDependent:self |
|
1031 |
] |
|
1032 |
! |
|
1033 |
||
1034 |
onlyInALabelHolder:aValueHolder |
|
1035 |
builder aspectAt:#onlyInALabelHolder put:aValueHolder. |
|
1036 |
! |
|
1037 |
||
1038 |
onlyInBLabelHolder:aValueHolder |
|
1039 |
builder aspectAt:#onlyInBLabelHolder put:aValueHolder. |
|
1040 |
! |
|
1041 |
||
1042 |
versionAHolder:aValueHolder |
|
1043 |
|holder| |
|
1044 |
||
1045 |
(holder := builder bindingAt:#versionAHolder) notNil ifTrue:[ |
|
1046 |
holder removeDependent:self |
|
1047 |
]. |
|
1048 |
builder aspectAt:#versionAHolder put:aValueHolder. |
|
1049 |
aValueHolder notNil ifTrue:[ |
|
1050 |
aValueHolder addDependent:self |
|
1051 |
] |
|
1052 |
! |
|
1053 |
||
1054 |
versionBHolder:aValueHolder |
|
1055 |
|holder| |
|
1056 |
||
1057 |
(holder := builder bindingAt:#versionBHolder) notNil ifTrue:[ |
|
1058 |
holder removeDependent:self |
|
1059 |
]. |
|
1060 |
builder aspectAt:#versionBHolder put:aValueHolder. |
|
1061 |
aValueHolder notNil ifTrue:[ |
|
1062 |
aValueHolder addDependent:self |
|
1063 |
] |
|
1064 |
! ! |
|
1065 |
||
1066 |
!VersionDiffBrowser methodsFor:'change & update'! |
|
1067 |
||
1068 |
update:something with:parameter from:changedObject |
|
1069 |
|classHolder versionAHolder versionBHolder| |
|
1070 |
||
1071 |
classHolder := self classHolder. |
|
1072 |
versionAHolder := self versionAHolder. |
|
1073 |
versionBHolder := self versionBHolder. |
|
1074 |
||
1075 |
(changedObject == classHolder |
|
1076 |
or:[changedObject == versionAHolder |
|
1077 |
or:[changedObject == versionBHolder]]) ifTrue:[ |
|
1078 |
self setupForClass:(classHolder value) versionA:(versionAHolder value) versionB:(versionBHolder value) |
|
1079 |
. ^ self |
|
1080 |
]. |
|
1081 |
super update:something with:parameter from:changedObject |
|
1082 |
! ! |
|
1083 |
||
2221 | 1084 |
!VersionDiffBrowser methodsFor:'initialization & release'! |
1085 |
||
1086 |
postBuildWith:aBuilder |
|
3147 | 1087 |
" |
1088 |
components which are invisible should be ignored by the panel. |
|
1089 |
Cannot be set via the interface builder. |
|
2221 | 1090 |
|
3147 | 1091 |
<return: self> |
1092 |
" |
|
1093 |
||
2221 | 1094 |
(aBuilder componentAt:#TopHorizontalPanel) ignoreInvisibleComponents:true. |
1095 |
^ super postBuildWith:aBuilder |
|
1096 |
! ! |
|
1097 |
||
1098 |
!VersionDiffBrowser methodsFor:'menu action'! |
|
1099 |
||
2465 | 1100 |
browseChange:aChange |
3147 | 1101 |
" |
1102 |
browse the change in aChange |
|
2507 | 1103 |
|
3147 | 1104 |
<return: self> |
1105 |
" |
|
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1106 |
|cls sel m| |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1107 |
|
2578
29264fb3847e
avoid debugger in browse-menu
Claus Gittinger <cg@exept.de>
parents:
2536
diff
changeset
|
1108 |
aChange isNil ifTrue:[^ self]. |
2650
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1109 |
cls := aChange changeClass. |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1110 |
sel := aChange changeSelector. |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1111 |
(cls compiledMethodAt:sel) isNil ifTrue:[ |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1112 |
self information:'Method does not exist.' |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1113 |
]. |
447c99ac6f76
oops - inspect & browse menu was broken.
Claus Gittinger <cg@exept.de>
parents:
2626
diff
changeset
|
1114 |
|
3138 | 1115 |
UserPreferences systemBrowserClass openInClass:cls selector:sel. |
2465 | 1116 |
! |
1117 |
||
1118 |
browseClassInA |
|
3147 | 1119 |
" |
1120 |
browse the selected method. |
|
2507 | 1121 |
|
3147 | 1122 |
<return: self> |
1123 |
" |
|
2465 | 1124 |
self browseChange:(self selectedChangeInA). |
1125 |
! |
|
2221 | 1126 |
|
2465 | 1127 |
browseClassInB |
3147 | 1128 |
" |
1129 |
browse the selected method. |
|
2507 | 1130 |
|
3147 | 1131 |
<return: self> |
1132 |
" |
|
2465 | 1133 |
self browseChange:(self selectedChangeInB). |
1134 |
! |
|
1135 |
||
1136 |
browseClassInM |
|
3147 | 1137 |
" |
1138 |
browse the selected method. |
|
2507 | 1139 |
|
3147 | 1140 |
<return: self> |
1141 |
" |
|
2465 | 1142 |
self browseChange:(self selectedChangesInM first). |
1143 |
! |
|
1144 |
||
2469 | 1145 |
createPatchFile |
2856 | 1146 |
"create a patchFile, to patch the old version (versionB) into the new version (versionA). |
1147 |
I.e. a little changeFile to transport those changes." |
|
1148 |
||
1149 |
|defaultName f oldVersion newVersion vsnMthdA vsnMthdB vsnA vsnB info| |
|
1150 |
||
1151 |
defaultName := 'patchFile.chg'. |
|
2469 | 1152 |
|
2856 | 1153 |
classChangeSet classBeingCompared notNil ifTrue:[ |
1154 |
defaultName := classChangeSet classBeingCompared nameWithoutPrefix. |
|
1155 |
classChangeSet versionA notNil ifTrue:[ |
|
1156 |
defaultName := defaultName , '-'. |
|
1157 |
defaultName := defaultName , classChangeSet versionA. |
|
1158 |
classChangeSet versionB notNil ifTrue:[ |
|
1159 |
defaultName := defaultName , '-'. |
|
1160 |
defaultName := defaultName , classChangeSet versionB. |
|
1161 |
]. |
|
1162 |
]. |
|
1163 |
defaultName := defaultName , '.chg'. |
|
1164 |
]. |
|
1165 |
f := Dialog |
|
1166 |
requestFileName:'Name of patchFile:' |
|
1167 |
default:defaultName. |
|
1168 |
self warn:'Sorry: This function is not yet implemented'. |
|
2730 | 1169 |
^ self. |
1170 |
||
3103 | 1171 |
"/ vsnMthdA := self changeSetA |
1172 |
"/ detect:[:ch | ch isMethodChange |
|
1173 |
"/ and:[ch changeClass isMeta |
|
1174 |
"/ and:[ch changeSelector = #version]]] |
|
1175 |
"/ ifNone:nil. |
|
1176 |
"/ vsnMthdB := self changeSetA |
|
1177 |
"/ detect:[:ch | ch isMethodChange |
|
1178 |
"/ and:[ch changeClass isMeta |
|
1179 |
"/ and:[ch changeSelector = #version]]] |
|
1180 |
"/ ifNone:nil. |
|
1181 |
"/ |
|
1182 |
"/ vsnMthdA notNil ifTrue:[ |
|
1183 |
"/ "/ extract the version |
|
1184 |
"/ vsnA := Class revisionStringFromSource:vsnMthdA source. |
|
1185 |
"/ vsnA notNil ifTrue:[ |
|
1186 |
"/ info := Class revisionInfoFromString:vsnA. |
|
1187 |
"/ info notNil ifTrue:[ |
|
1188 |
"/ vsnA := info at:#revision ifAbsent:nil. |
|
1189 |
"/ ] ifFalse:[ |
|
1190 |
"/ vsnA := nil. |
|
1191 |
"/ ]. |
|
1192 |
"/ ]. |
|
1193 |
"/ ]. |
|
1194 |
"/ vsnMthdB notNil ifTrue:[ |
|
1195 |
"/ "/ extract the version |
|
1196 |
"/ vsnB := Class revisionStringFromSource:vsnMthdB source. |
|
1197 |
"/ vsnB notNil ifTrue:[ |
|
1198 |
"/ info := Class revisionInfoFromString:vsnB. |
|
1199 |
"/ info notNil ifTrue:[ |
|
1200 |
"/ vsnB := info at:#revision ifAbsent:nil. |
|
1201 |
"/ ] ifFalse:[ |
|
1202 |
"/ vsnB := nil. |
|
1203 |
"/ ]. |
|
1204 |
"/ ]. |
|
1205 |
"/ ]. |
|
1206 |
"/ |
|
1207 |
"/ (vsnA isNil or:[vsnB isNil or:[vsnA = vsnB]]) ifTrue:[ |
|
1208 |
"/ self warn:'The generated patch file will not be able to validate/update the class version'. |
|
1209 |
"/ ]. |
|
1210 |
"/ |
|
1211 |
"/self halt:'not yet finished'. |
|
2469 | 1212 |
! |
1213 |
||
2465 | 1214 |
inspectSelectedChangeInA |
3147 | 1215 |
" |
1216 |
inspect the selected method change for the 'method only in version A'. |
|
2507 | 1217 |
|
3147 | 1218 |
<return: self> |
1219 |
" |
|
2465 | 1220 |
self selectedChangeInA inspect. |
2221 | 1221 |
! |
1222 |
||
1223 |
inspectSelectedChangeInB |
|
3147 | 1224 |
" |
1225 |
inspect the selected method change for the 'method only in version B'. |
|
2507 | 1226 |
|
3147 | 1227 |
<return: self> |
1228 |
" |
|
2465 | 1229 |
self selectedChangeInB inspect. |
1230 |
! |
|
1231 |
||
1232 |
inspectSelectedChangeInM |
|
3147 | 1233 |
" |
1234 |
inspect the two method changes for the selected 'changed method'. |
|
2507 | 1235 |
|
3147 | 1236 |
<return: self> |
1237 |
" |
|
2465 | 1238 |
|changes| |
1239 |
||
1240 |
changes := self selectedChangesInM. |
|
1241 |
changes do:[:change | |
|
1242 |
change inspect |
|
1243 |
]. |
|
1244 |
! |
|
1245 |
||
2501 | 1246 |
mainMenu |
3147 | 1247 |
" |
1248 |
if this application runs as an subapplication, |
|
1249 |
the menu bar should not be used. |
|
2507 | 1250 |
|
3147 | 1251 |
<return: self> |
1252 |
" |
|
2501 | 1253 |
self masterApplication isNil ifTrue:[ |
1254 |
^ self class mainMenu |
|
1255 |
]. |
|
1256 |
^ nil |
|
2221 | 1257 |
! ! |
1258 |
||
1259 |
!VersionDiffBrowser methodsFor:'private'! |
|
1260 |
||
2745 | 1261 |
addAcceptToTextViewMenus |
3147 | 1262 |
" |
1263 |
add to the standard diff text view or single text views menu an accept entry. |
|
1264 |
The acceptAction will fetch the corresponding change and apply it |
|
1265 |
(not the shown text) |
|
2745 | 1266 |
|
3147 | 1267 |
<return: self> |
1268 |
" |
|
2745 | 1269 |
|
1270 |
|m v diffTextView leftView rightView singleView| |
|
1271 |
||
1272 |
diffTextView := self diffTextView. |
|
1273 |
leftView := diffTextView leftTextView. |
|
1274 |
rightView := diffTextView rightTextView. |
|
1275 |
singleView := self builder componentAt:#singleTextView. |
|
1276 |
||
1277 |
(Array |
|
1278 |
with:leftView |
|
1279 |
with:rightView |
|
1280 |
with:singleView) |
|
1281 |
do:[:v | |
|
1282 |
m := v editMenu. |
|
1283 |
(m selectorAt:#accept) isNil ifTrue:[ |
|
2776 | 1284 |
m addLabels:(resources array:#('-' 'accept')) |
2745 | 1285 |
selectors:(Array with:nil with:#accept) |
1286 |
after:#copySelection. |
|
1287 |
]. |
|
1288 |
m |
|
1289 |
actionAt:#accept |
|
1290 |
put:[ |
|
1291 |
|idx idx2 text change changeSet| |
|
1292 |
||
1293 |
changeSet := self classChangeSet. |
|
1294 |
||
1295 |
v == singleView ifTrue:[ |
|
1296 |
self methodsOnlyInASelection value notNil |
|
1297 |
ifTrue: [ |
|
1298 |
change := (changeSet methodsOnlyInA at: self methodsOnlyInASelection value) |
|
1299 |
] ifFalse:[ |
|
1300 |
change := (changeSet methodsOnlyInB at: self methodsOnlyInBSelection value) |
|
1301 |
]. |
|
1302 |
] ifFalse:[ |
|
1303 |
idx := self methodsChangedSelection value. |
|
1304 |
||
1305 |
v == self diffTextView leftTextView ifTrue:[ |
|
1306 |
change := (changeSet methodsChanged at:idx) first. |
|
1307 |
] ifFalse:[ |
|
1308 |
change := (changeSet methodsChanged at:idx) second. |
|
1309 |
]. |
|
1310 |
]. |
|
1311 |
change apply |
|
1312 |
]. |
|
1313 |
m selectorAt:#accept put:nil. |
|
1314 |
v menuHolder:m. |
|
1315 |
v menuMessage:#value. |
|
1316 |
] |
|
1317 |
! |
|
1318 |
||
2497 | 1319 |
generator |
3147 | 1320 |
" |
1321 |
generate a print string for a change. |
|
2497 | 1322 |
|
3147 | 1323 |
<return: Block> |
1324 |
" |
|
2507 | 1325 |
^[:aChange | |
2585 | 1326 |
|result mPkg cPkg cls m changeClassName| |
1327 |
||
2507 | 1328 |
aChange isClassDefinitionChange ifTrue:[ |
2585 | 1329 |
result := aChange printStringWithoutClassName |
2497 | 1330 |
] ifFalse:[ |
2507 | 1331 |
aChange isDoIt ifTrue:[ |
1332 |
result := aChange source , ' (doIt)' |
|
2497 | 1333 |
] ifFalse:[ |
2585 | 1334 |
changeClassName := aChange className. |
1335 |
changeClassName = self classBeingCompared name ifTrue:[ |
|
1336 |
result := aChange printStringWithoutClassName. |
|
2745 | 1337 |
|
1338 |
aChange isMethodCategoryChange ifTrue:[ |
|
1339 |
result := result , ' (category)' |
|
1340 |
] ifFalse:[ |
|
1341 |
aChange isMethodChange ifTrue:[ |
|
1342 |
cls := aChange changeClass. |
|
1343 |
cls notNil ifTrue:[ |
|
1344 |
m := cls compiledMethodAt:aChange selector. |
|
1345 |
(m notNil |
|
1346 |
and:[m package ~= cls package]) ifTrue:[ |
|
1347 |
result := aChange printStringWithoutClassName , ' [' , m package , ']'. |
|
1348 |
]. |
|
2497 | 1349 |
]. |
2745 | 1350 |
] |
2497 | 1351 |
] |
1352 |
] ifFalse:[ |
|
1353 |
"/ include name in private class changes |
|
2585 | 1354 |
(changeClassName startsWith:(self classBeingCompared name , '::')) ifTrue:[ |
1355 |
result := (changeClassName copyFrom:(self classBeingCompared name size + 3)) , ' ' , aChange printStringWithoutClassName |
|
2497 | 1356 |
] ifFalse:[ |
2507 | 1357 |
result := aChange printString |
2497 | 1358 |
] |
1359 |
] |
|
1360 |
] |
|
1361 |
]. |
|
1362 |
result |
|
1363 |
]. |
|
1364 |
! |
|
1365 |
||
2501 | 1366 |
resetSelectionHolders |
3147 | 1367 |
" |
1368 |
reset all selection holders when a new change set is given. |
|
1369 |
First set the selection to nil. |
|
2507 | 1370 |
|
3147 | 1371 |
<return: self> |
1372 |
" |
|
2501 | 1373 |
|
1374 |
self methodsChangedSelection value:nil. |
|
1375 |
self methodsOnlyInASelection value:nil. |
|
1376 |
self methodsOnlyInBSelection value:nil. |
|
2507 | 1377 |
self diffTextView text1:'' text2:''. |
1378 |
self methodText value:''. |
|
1379 |
||
1380 |
"/ self methodsChangedSelectionChanged. |
|
1381 |
"/ self methodsOnlyInASelectionChanged. |
|
1382 |
"/ self methodsOnlyInBSelectionChanged. |
|
2501 | 1383 |
! |
1384 |
||
2221 | 1385 |
showDiffTextView |
3147 | 1386 |
" |
1387 |
if a method change is selected, then show the diff text view. |
|
1388 |
Add an accept entry to the popup menu. |
|
2507 | 1389 |
|
3147 | 1390 |
<return: self> |
1391 |
" |
|
2694 | 1392 |
|builder| |
1393 |
||
1394 |
builder := self builder. |
|
1395 |
(builder componentAt:#diffTextViewBox) raise; beVisible. |
|
1396 |
(builder componentAt:#singleTextView) beInvisible. |
|
1397 |
(builder componentAt:#diffTextView) realizeAllSubViews. |
|
1398 |
||
2465 | 1399 |
self addAcceptToTextViewMenus. |
2221 | 1400 |
! |
1401 |
||
1402 |
showSingleTextView |
|
3147 | 1403 |
" |
1404 |
if a method is selected which is only in version A or B of the class, |
|
1405 |
then show the text view. |
|
1406 |
Add an accept entry to the popup menu. |
|
2507 | 1407 |
|
3147 | 1408 |
<return: self> |
1409 |
" |
|
2507 | 1410 |
|
2694 | 1411 |
|builder| |
1412 |
||
1413 |
builder := self builder. |
|
1414 |
(builder componentAt:#singleTextView) raise; beVisible. |
|
1415 |
(builder componentAt:#diffTextViewBox) beInvisible. |
|
2501 | 1416 |
self addAcceptToTextViewMenus. |
2221 | 1417 |
! |
1418 |
||
2497 | 1419 |
updateLabels |
3147 | 1420 |
" |
1421 |
update the labels of the diff text view. Show the version numbers |
|
1422 |
of the class. |
|
2221 | 1423 |
|
3147 | 1424 |
<return: self> |
1425 |
" |
|
2221 | 1426 |
|
2694 | 1427 |
|theVersionA theVersionB builder| |
2224 | 1428 |
|
2694 | 1429 |
builder := self builder. |
2497 | 1430 |
(theVersionA := self versionA) notNil ifTrue:[ |
1431 |
self diffTextLabelA value:theVersionA. |
|
2726 | 1432 |
self onlyInALabelHolder value:('Only in ' , theVersionA). |
2694 | 1433 |
(builder componentAt:#OnlyInALabel) backgroundColor:Color green darkened. |
2224 | 1434 |
]. |
2497 | 1435 |
(theVersionB :=self versionB) notNil ifTrue:[ |
1436 |
self diffTextLabelB value:theVersionB. |
|
2726 | 1437 |
self onlyInBLabelHolder value:('Only in ' , theVersionB). |
2694 | 1438 |
(builder componentAt:#OnlyInBLabel) backgroundColor:Color red darkened. |
2224 | 1439 |
]. |
1440 |
! |
|
1441 |
||
1442 |
updateLists |
|
3147 | 1443 |
"walk over the two changeSets and add change to one of the tree lists. |
1444 |
Methods which belong to the version A of the class or version B go |
|
1445 |
to the list methodsOnlyInA or methodsOnlyInB. |
|
1446 |
Methods which are changed from version A to B go to the list methodsChanged. |
|
2507 | 1447 |
|
3147 | 1448 |
<return: self> |
1449 |
" |
|
2731 | 1450 |
|classChangeSet listOnlyInA listOnlyInB listChanged| |
2230
5e10eebb1de2
move change-compare code to where it belongs (Change-hierarchy)
Claus Gittinger <cg@exept.de>
parents:
2229
diff
changeset
|
1451 |
|
2585 | 1452 |
classChangeSet := self classChangeSet. |
1453 |
||
2731 | 1454 |
listOnlyInA := self methodsOnlyInA. |
1455 |
listOnlyInA removeAll. |
|
1456 |
classChangeSet notNil ifTrue:[ |
|
1457 |
listOnlyInA addAll: (classChangeSet methodsOnlyInA collect:self generator). |
|
1458 |
]. |
|
2585 | 1459 |
|
2731 | 1460 |
listOnlyInB := self methodsOnlyInB. |
1461 |
listOnlyInB removeAll. |
|
1462 |
classChangeSet notNil ifTrue:[ |
|
1463 |
listOnlyInB addAll: (classChangeSet methodsOnlyInB collect:self generator). |
|
1464 |
]. |
|
2221 | 1465 |
|
2731 | 1466 |
listChanged := self methodsChanged. |
1467 |
listChanged removeAll. |
|
1468 |
classChangeSet notNil ifTrue:[ |
|
1469 |
listChanged addAll: (classChangeSet methodsChanged collect:[:arr| self generator value:(arr first)]). |
|
1470 |
]. |
|
2221 | 1471 |
|
2731 | 1472 |
self boxAVisible value:(listOnlyInA notEmpty). |
1473 |
self boxBVisible value:(listOnlyInB notEmpty). |
|
2221 | 1474 |
|
2731 | 1475 |
self boxMVisible value:(listChanged isEmpty |
1476 |
and: [(listOnlyInA notEmpty |
|
1477 |
or:[listOnlyInB notEmpty])]) not. |
|
2221 | 1478 |
! ! |
1479 |
||
2501 | 1480 |
!VersionDiffBrowser methodsFor:'setup'! |
1481 |
||
2695 | 1482 |
setupForClass:aClass againstVersion:aVersionA |
3147 | 1483 |
" |
1484 |
compute the class change set for the class aClass of its current version against the repository version A. |
|
1485 |
When setting the class change set, the labels, list etc. of the receiver |
|
1486 |
are updated. |
|
2695 | 1487 |
|
3147 | 1488 |
<return: self> |
1489 |
" |
|
2731 | 1490 |
|changeSet| |
1491 |
||
2745 | 1492 |
aClass isNil ifTrue:[ |
1493 |
changeSet := nil |
|
1494 |
] ifFalse:[ |
|
1495 |
aClass isNameSpace ifFalse:[ |
|
1496 |
aClass isLoaded ifTrue:[ |
|
1497 |
changeSet := (ClassChangeSet newForClass:aClass againstVersion:aVersionA). |
|
1498 |
] |
|
1499 |
]. |
|
2731 | 1500 |
]. |
2856 | 1501 |
self classChangeSet:changeSet. |
2857
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1502 |
aVersionA isNil ifTrue:[ |
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1503 |
self class:aClass versionA:'rep' versionB:'current'. |
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1504 |
] ifFalse:[ |
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1505 |
self class:aClass versionA:aVersionA versionB:(aVersionA , 'm'). |
0c467f6b1741
handle case if invoked without versionString
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
1506 |
] |
2695 | 1507 |
! |
1508 |
||
2949 | 1509 |
setupForClass:classA labelA:aLabelA andClass:classB labelB:aLabelB |
3147 | 1510 |
" |
1511 |
generate the class change set from the two classes A and B. |
|
1512 |
When setting the class change set, the labels, list etc. of the receiver |
|
1513 |
are updated. |
|
2949 | 1514 |
|
3147 | 1515 |
<return: self> |
1516 |
" |
|
2949 | 1517 |
|changeSet| |
1518 |
||
1519 |
changeSet := (ClassChangeSet newForClass:classA labelA:aLabelA andClass:classB labelB:aLabelB). |
|
1520 |
self classChangeSet:changeSet |
|
1521 |
! |
|
1522 |
||
2510 | 1523 |
setupForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
3147 | 1524 |
" |
1525 |
generate the class change set from the two source files A and B. |
|
1526 |
When setting the class change set, the labels, list etc. of the receiver |
|
1527 |
are updated. |
|
2510 | 1528 |
|
3147 | 1529 |
<return: self> |
1530 |
" |
|
2731 | 1531 |
|changeSet| |
1532 |
||
2751
f2fbe11e166a
oops - isNameSpace query prevented Smalltalk-diffs from beeing shown
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1533 |
(aClass isNameSpace not or:[aClass == Smalltalk]) ifTrue:[ |
2731 | 1534 |
aClass isLoaded ifTrue:[ |
1535 |
changeSet := (ClassChangeSet newForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB). |
|
1536 |
] |
|
1537 |
]. |
|
1538 |
self classChangeSet:changeSet |
|
2510 | 1539 |
! |
1540 |
||
2501 | 1541 |
setupForClass:aClass versionA:aVersionA versionB:aVersionB |
3147 | 1542 |
" |
1543 |
compute the class change set for the class aClass and the versions A and B. |
|
1544 |
When setting the class change set, the labels, list etc. of the receiver |
|
1545 |
are updated. |
|
2501 | 1546 |
|
3147 | 1547 |
<return: self> |
1548 |
" |
|
2731 | 1549 |
|changeSet| |
1550 |
||
1551 |
aClass isNameSpace ifFalse:[ |
|
1552 |
aClass isLoaded ifTrue:[ |
|
1553 |
changeSet := (ClassChangeSet newForClass:aClass versionA:aVersionA versionB:aVersionB). |
|
1554 |
] |
|
1555 |
]. |
|
2856 | 1556 |
self classChangeSet:changeSet. |
1557 |
self class:aClass versionA:aVersionA versionB:aVersionB. |
|
2501 | 1558 |
! ! |
1559 |
||
2497 | 1560 |
!VersionDiffBrowser::ClassChangeSet class methodsFor:'instance creation'! |
1561 |
||
2695 | 1562 |
changeSetForClass:aClass |
1563 |
"return a ChangeSet for the class aClass and its current source. |
|
1564 |
The source is generated into a stream and then the change set is generated |
|
1565 |
from the source stream. |
|
1566 |
||
1567 |
<return: ChangeSet|nil> |
|
1568 |
" |
|
1569 |
|theChangeSet source s| |
|
1570 |
||
1571 |
s := '' writeStream. |
|
1572 |
aClass fileOutOn:s. |
|
1573 |
source := s contents. |
|
1574 |
||
1575 |
theChangeSet := ChangeSet fromStream:(source readStream). |
|
1576 |
^theChangeSet |
|
1577 |
! |
|
1578 |
||
2497 | 1579 |
changeSetForClass:aClass andRevision:aVersion |
1580 |
"return a ChangeSet for the class aClass and version aVersion. |
|
1581 |
The version from the class source stream is checked out from the repositiory |
|
1582 |
into a source stream. Then the change set is generated from the source stream. |
|
1583 |
||
1584 |
<return: ChangeSet|nil> |
|
1585 |
" |
|
1586 |
|theSourceCodeManager theSourceStream theChangeSet| |
|
1587 |
||
1588 |
theSourceCodeManager := aClass sourceCodeManager. |
|
1589 |
[theSourceStream := theSourceCodeManager getSourceStreamFor:aClass revision:aVersion. |
|
1590 |
theSourceStream notNil |
|
1591 |
ifTrue:[theChangeSet:=ChangeSet fromStream:theSourceStream]] |
|
1592 |
valueNowOrOnUnwindDo: |
|
1593 |
[theSourceStream notNil ifTrue:[theSourceStream close]]. |
|
1594 |
^theChangeSet |
|
1595 |
! |
|
1596 |
||
1597 |
changeSetForClass:aClass andSource:aSource |
|
1598 |
"return a ChangeSet for the class aClass and source aSource. |
|
1599 |
The source is converted to a stream and then the change set is generated |
|
1600 |
from the source stream. |
|
1601 |
||
1602 |
<return: ChangeSet|nil> |
|
1603 |
" |
|
1604 |
|theChangeSet theSourceStream| |
|
1605 |
||
1606 |
[(theSourceStream := aSource readStream) notNil |
|
1607 |
ifTrue:[theChangeSet:=ChangeSet fromStream:(theSourceStream := aSource readStream)]] |
|
1608 |
valueNowOrOnUnwindDo: |
|
1609 |
[theSourceStream notNil |
|
1610 |
ifTrue:[theSourceStream close]]. |
|
1611 |
^theChangeSet |
|
1612 |
! |
|
1613 |
||
2695 | 1614 |
newForClass:aClass againstVersion:aVersionA |
1615 |
"return a ClassChangeSet for the class aClass against some verison in the repository. |
|
1616 |
A new instance of ClassChangeSet is generated containing |
|
1617 |
the correspondenting changes. |
|
1618 |
||
1619 |
<return: ClassChangeSet> |
|
1620 |
" |
|
2710
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1621 |
|theChangeSetA theChangeSetB theClassChangeSet versionCompared diffSet| |
2695 | 1622 |
|
1623 |
theClassChangeSet := self new. |
|
1624 |
theClassChangeSet classBeingCompared:aClass. |
|
1625 |
versionCompared := aVersionA. |
|
1626 |
aVersionA isNil ifTrue:[ |
|
1627 |
theClassChangeSet labelA:(versionCompared := aClass revision). |
|
2856 | 1628 |
theClassChangeSet versionA:versionCompared. |
2695 | 1629 |
] ifFalse:[ |
1630 |
aVersionA == #newest ifTrue:[ |
|
2776 | 1631 |
theClassChangeSet labelA:(VersionDiffBrowser resources string:'newest'). |
2695 | 1632 |
] ifFalse:[ |
1633 |
theClassChangeSet labelA:versionCompared. |
|
2856 | 1634 |
theClassChangeSet versionA:versionCompared. |
2695 | 1635 |
] |
1636 |
]. |
|
2776 | 1637 |
theClassChangeSet labelB:(VersionDiffBrowser resources string:'current'). |
2695 | 1638 |
theChangeSetA := self changeSetForClass: aClass andRevision: versionCompared. |
1639 |
theChangeSetB := self changeSetForClass: aClass. |
|
1640 |
theChangeSetA isNil |
|
1641 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1642 |
theChangeSetB isNil |
|
1643 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
2710
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1644 |
"/ if we are comparing a private class, prune out other changes |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1645 |
aClass isPrivate ifTrue:[ |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1646 |
theChangeSetA removeAllSuchThat:[:aChange | |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1647 |
aChange className ~= aClass name |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1648 |
]. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1649 |
theChangeSetB removeAllSuchThat:[:aChange | |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1650 |
aChange className ~= aClass name |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1651 |
]. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1652 |
]. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1653 |
self activityNotification:'generating diff-set...'. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1654 |
diffSet := theClassChangeSet diffSet:(theChangeSetA diffSetsAgainst:theChangeSetB). |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1655 |
self activityNotification:nil. |
88a97fa1d140
allow comparing private classes
Claus Gittinger <cg@exept.de>
parents:
2697
diff
changeset
|
1656 |
^ diffSet |
2695 | 1657 |
! |
1658 |
||
2949 | 1659 |
newForClass:classA labelA:aLabelA andClass:classB labelB:aLabelB |
1660 |
"return a ClassChangeSet for two classes. |
|
1661 |
A new instance of ClassChangeSet is generated containing the correspondenting changes. |
|
1662 |
||
1663 |
<return: ClassChangeSet> |
|
1664 |
" |
|
1665 |
|aStream sourceA sourceB theChangeSetA theChangeSetB theClassChangeSet| |
|
1666 |
||
1667 |
theClassChangeSet := self new. |
|
1668 |
theClassChangeSet classBeingCompared:classA. |
|
1669 |
theClassChangeSet labelA:aLabelA. |
|
1670 |
theClassChangeSet labelB:aLabelB. |
|
1671 |
||
1672 |
aStream := '' writeStream. |
|
1673 |
Method flushSourceStreamCache. |
|
1674 |
classA fileOutOn:aStream withTimeStamp:false. |
|
1675 |
sourceA := aStream contents asString. |
|
1676 |
||
1677 |
aStream := '' writeStream. |
|
1678 |
Method flushSourceStreamCache. |
|
1679 |
classB fileOutOn:aStream withTimeStamp:false. |
|
1680 |
sourceB := aStream contents asString. |
|
1681 |
||
1682 |
theChangeSetA:=self changeSetForClass:classA andSource:sourceA. |
|
1683 |
theChangeSetB:=self changeSetForClass:classB andSource:sourceB. |
|
1684 |
theChangeSetA isNil |
|
1685 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1686 |
theChangeSetB isNil |
|
1687 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
1688 |
||
1689 |
"/ just in case (if comparing a class against another), |
|
1690 |
"/ unify the classes of the changes (to avoid that all changes are detected as different) |
|
1691 |
||
1692 |
theChangeSetB do:[:eachChange | |
|
1693 |
eachChange isMethodChange ifTrue:[ |
|
1694 |
eachChange changeClass isMeta ifTrue:[ |
|
1695 |
eachChange changeClass ~~ classA theMetaclass ifTrue:[ |
|
1696 |
eachChange changeClass:classA theMetaclass. |
|
1697 |
] |
|
1698 |
] ifFalse:[ |
|
1699 |
eachChange changeClass ~~ classA theNonMetaclass ifTrue:[ |
|
1700 |
eachChange changeClass:classA theNonMetaclass. |
|
1701 |
] |
|
1702 |
]. |
|
1703 |
]. |
|
1704 |
]. |
|
1705 |
"/ remove all #initialize doIts |
|
1706 |
theChangeSetA := theChangeSetA select:[:eachChange | eachChange isDoIt not or:[eachChange isInitialize not]]. |
|
1707 |
theChangeSetB := theChangeSetB select:[:eachChange | eachChange isDoIt not or:[eachChange isInitialize not]]. |
|
1708 |
||
1709 |
^theClassChangeSet diffSet:(theChangeSetA diffSetsAgainst:theChangeSetB) |
|
1710 |
! |
|
1711 |
||
2497 | 1712 |
newForClass:aClass labelA:aLabelA sourceA:aSourceA labelB:aLabelB sourceB:aSourceB |
1713 |
"return a ClassChangeSet for the class aClass and the two sources. |
|
1714 |
The two classes are compared via the source files. A new instance of |
|
1715 |
ClassChangeSet is generated containing the correspondenting changes. |
|
1716 |
||
1717 |
<return: ClassChangeSet> |
|
1718 |
" |
|
1719 |
|theChangeSetA theChangeSetB theClassChangeSet| |
|
1720 |
||
1721 |
theClassChangeSet := self new. |
|
1722 |
theClassChangeSet classBeingCompared:aClass. |
|
1723 |
theClassChangeSet labelA:aLabelA. |
|
1724 |
theClassChangeSet labelB:aLabelB. |
|
1725 |
theChangeSetA:=self changeSetForClass:aClass andSource:aSourceA. |
|
1726 |
theChangeSetB:=self changeSetForClass:aClass andSource:aSourceB. |
|
1727 |
theChangeSetA isNil |
|
1728 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1729 |
theChangeSetB isNil |
|
1730 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
2947 | 1731 |
|
2695 | 1732 |
^theClassChangeSet diffSet:(theChangeSetA diffSetsAgainst:theChangeSetB) |
2465 | 1733 |
! |
1734 |
||
2497 | 1735 |
newForClass:aClass versionA:aVersionA versionB:aVersionB |
1736 |
"return a ClassChangeSet for the class aClass and the two versions. |
|
1737 |
The two class version are checked out from the repository and then being |
|
1738 |
compared. A new instance of ClassChangeSet is generated containing |
|
1739 |
the correspondenting changes. |
|
1740 |
||
1741 |
<return: ClassChangeSet> |
|
1742 |
" |
|
1743 |
|theChangeSetA theChangeSetB theClassChangeSet| |
|
1744 |
||
1745 |
theClassChangeSet := self new. |
|
1746 |
theClassChangeSet classBeingCompared:aClass. |
|
2856 | 1747 |
theClassChangeSet versionA:aVersionA. |
1748 |
theClassChangeSet versionB:aVersionB. |
|
2497 | 1749 |
theClassChangeSet labelA:aVersionA. |
1750 |
theClassChangeSet labelB:aVersionB. |
|
1751 |
theChangeSetA := self changeSetForClass: aClass andRevision: aVersionA. |
|
1752 |
theChangeSetB := self changeSetForClass: aClass andRevision: aVersionB. |
|
1753 |
theChangeSetA isNil |
|
1754 |
ifTrue: [theChangeSetA := ChangeSet new]. |
|
1755 |
theChangeSetB isNil |
|
1756 |
ifTrue: [theChangeSetB := ChangeSet new]. |
|
2695 | 1757 |
^theClassChangeSet diffSet:(theChangeSetA diffSetsAgainst:theChangeSetB) |
2497 | 1758 |
! ! |
1759 |
||
1760 |
!VersionDiffBrowser::ClassChangeSet methodsFor:'accessing'! |
|
1761 |
||
1762 |
classBeingCompared |
|
1763 |
"returns the value of the class which is compared |
|
1764 |
||
1765 |
<return: Behavior> |
|
1766 |
" |
|
1767 |
||
1768 |
^ classBeingCompared |
|
1769 |
! |
|
2221 | 1770 |
|
2497 | 1771 |
classBeingCompared:something |
1772 |
"set the value of the class which is compared |
|
1773 |
||
1774 |
<return: self>" |
|
1775 |
||
1776 |
classBeingCompared := something. |
|
1777 |
! |
|
1778 |
||
2695 | 1779 |
diffSet |
1780 |
"returns a identity dictionary containing the different changes. |
|
1781 |
key: value: |
|
1782 |
#changed OrderedCollection of arrays containing ChangeSets for methods |
|
1783 |
which are changed and exists in the class versionA and versionB |
|
1784 |
#onlyInArg ChangeSet for the methods which exists only in the class versionB |
|
1785 |
#onlyInReceiver ChangeSet for the methods which exists only in the class versionA |
|
1786 |
||
1787 |
<return: IdentityDictionary> |
|
1788 |
" |
|
1789 |
^ diffSet |
|
1790 |
! |
|
1791 |
||
1792 |
diffSet:something |
|
1793 |
"sets a identity dictionary containing the different changes. |
|
1794 |
key: value: |
|
1795 |
#changed OrderedCollection of arrays containing ChangeSets for methods |
|
1796 |
which are changed and exists in the class versionA and versionB |
|
1797 |
#onlyInArg ChangeSet for the methods which exists only in the class versionB |
|
1798 |
#onlyInReceiver ChangeSet for the methods which exists only in the class versionA |
|
1799 |
||
1800 |
<return: self> |
|
1801 |
" |
|
1802 |
||
1803 |
diffSet := something. |
|
1804 |
! |
|
1805 |
||
2497 | 1806 |
labelA |
1807 |
"returns the label for the class versionA |
|
1808 |
||
1809 |
<return: String> |
|
1810 |
" |
|
1811 |
^ labelA |
|
1812 |
! |
|
1813 |
||
1814 |
labelA:something |
|
1815 |
"sets the label for the class versionA |
|
1816 |
||
1817 |
<return: self> |
|
1818 |
" |
|
1819 |
labelA := something. |
|
1820 |
! |
|
1821 |
||
1822 |
labelB |
|
1823 |
"returns the label for the class versionB |
|
1824 |
||
1825 |
<return: String> |
|
1826 |
" |
|
1827 |
^ labelB |
|
1828 |
! |
|
2465 | 1829 |
|
2497 | 1830 |
labelB:something |
1831 |
"sets the label for the class versionB |
|
1832 |
||
1833 |
<return: self> |
|
1834 |
" |
|
1835 |
||
1836 |
labelB := something. |
|
1837 |
! |
|
1838 |
||
1839 |
methodsChanged |
|
1840 |
"returns a OrderedCollection of arrays containing ChangeSets for methods |
|
1841 |
which are changed and exists in the class versionA and versionB |
|
1842 |
||
1843 |
<return: OrderedCollection> |
|
1844 |
" |
|
2695 | 1845 |
^ self diffSet at:#changed |
2497 | 1846 |
! |
1847 |
||
1848 |
methodsOnlyInA |
|
1849 |
"returns a ChangeSet for the methods which exists only in the class versionA |
|
1850 |
||
1851 |
<return: ChangeSet> |
|
1852 |
" |
|
1853 |
||
2695 | 1854 |
^ self diffSet at:#onlyInReceiver |
2497 | 1855 |
! |
1856 |
||
1857 |
methodsOnlyInB |
|
1858 |
"returns a ChangeSet for the methods which exists only in the class versionB |
|
1859 |
||
1860 |
<return: ChangeSet> |
|
1861 |
" |
|
1862 |
||
2695 | 1863 |
^ self diffSet at:#onlyInArg |
2856 | 1864 |
! |
1865 |
||
1866 |
versionA |
|
1867 |
"return the value of the instance variable 'versionA' (automatically generated)" |
|
1868 |
||
1869 |
^ versionA |
|
1870 |
! |
|
1871 |
||
1872 |
versionA:something |
|
1873 |
"set the value of the instance variable 'versionA' (automatically generated)" |
|
1874 |
||
1875 |
versionA := something. |
|
1876 |
! |
|
1877 |
||
1878 |
versionB |
|
1879 |
"return the value of the instance variable 'versionB' (automatically generated)" |
|
1880 |
||
1881 |
^ versionB |
|
1882 |
! |
|
1883 |
||
1884 |
versionB:something |
|
1885 |
"set the value of the instance variable 'versionB' (automatically generated)" |
|
1886 |
||
1887 |
versionB := something. |
|
2221 | 1888 |
! ! |
1889 |
||
1890 |
!VersionDiffBrowser class methodsFor:'documentation'! |
|
1891 |
||
1892 |
version |
|
3322 | 1893 |
^ '$Header: /cvs/stx/stx/libtool/VersionDiffBrowser.st,v 1.47 2001-10-18 13:48:32 cg Exp $' |
2221 | 1894 |
! ! |