author | Jan Vrany <jan.vrany@labware.com> |
Wed, 15 Sep 2021 21:56:16 +0100 | |
branch | jv |
changeset 19609 | a54d8409a28f |
parent 18226 | 346376844040 |
permissions | -rw-r--r-- |
13859 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
18226 | 3 |
COPYRIGHT (c) 2016 Jan Vrany |
13859 | 4 |
All Rights Reserved |
5 |
||
6 |
This software is furnished under a license and may be used |
|
7 |
only in accordance with the terms of that license and with the |
|
8 |
inclusion of the above copyright notice. This software may not |
|
9 |
be provided or otherwise made available to, or used by, any |
|
10 |
other person. No title to or ownership of the software is |
|
11 |
hereby transferred. |
|
12 |
" |
|
13 |
"{ Package: 'stx:libtool' }" |
|
14 |
||
15 |
"{ NameSpace: Tools }" |
|
16 |
||
17 |
TextDiffTool subclass:#TextDiff2Tool |
|
18 |
instanceVariableNames:'showDiffHolder diffSpecHolder codeView' |
|
19 |
classVariableNames:'' |
|
20 |
poolDictionaries:'' |
|
21 |
category:'Interface-Diff' |
|
22 |
! |
|
23 |
||
24 |
!TextDiff2Tool class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
18226 | 29 |
COPYRIGHT (c) 2016 Jan Vrany |
13859 | 30 |
All Rights Reserved |
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
15280
feec24158cac
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15277
diff
changeset
|
43 |
a little UI around the DiffTextView, |
feec24158cac
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15277
diff
changeset
|
44 |
to show two texts side by side. |
13859 | 45 |
|
46 |
[author:] |
|
47 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
48 |
||
49 |
[instance variables:] |
|
50 |
||
51 |
[class variables:] |
|
52 |
||
53 |
[see also:] |
|
54 |
||
55 |
" |
|
56 |
! |
|
57 |
||
58 |
examples |
|
59 |
" |
|
60 |
[exBegin] |
|
61 |
|text1 text2| |
|
62 |
||
63 |
text1 := 'hello world |
|
64 |
here is some difference |
|
65 |
more text |
|
66 |
this line has been removed |
|
67 |
more text |
|
68 |
more text |
|
69 |
'. |
|
70 |
||
71 |
text2 := 'hello world |
|
72 |
where is the difference ? |
|
73 |
more text |
|
74 |
more text |
|
75 |
more text |
|
76 |
this line has been added |
|
77 |
'. |
|
78 |
||
79 |
TextDiff2Tool openOn:text1 label:'text1' |
|
80 |
and:text2 label:'text2' |
|
81 |
[exEnd] |
|
82 |
" |
|
83 |
! ! |
|
84 |
||
85 |
!TextDiff2Tool class methodsFor:'interface opening'! |
|
86 |
||
87 |
openOn:textA label:labelA and: textB label: labelB |
|
88 |
| app | |
|
89 |
||
90 |
app := self new. |
|
91 |
app labelA: labelA; textA: textA. |
|
92 |
app labelB: labelB; textB: textB. |
|
16733
4a33c1b47bc3
Use new TextDiff2Tool for comparing two methods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15724
diff
changeset
|
93 |
app open. |
4a33c1b47bc3
Use new TextDiff2Tool for comparing two methods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15724
diff
changeset
|
94 |
^ app window |
13859 | 95 |
|
96 |
"Created: / 16-03-2012 / 13:15:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
16733
4a33c1b47bc3
Use new TextDiff2Tool for comparing two methods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
15724
diff
changeset
|
97 |
"Modified: / 14-07-2016 / 10:06:46 / jv" |
13859 | 98 |
! ! |
99 |
||
100 |
!TextDiff2Tool class methodsFor:'interface specs'! |
|
101 |
||
102 |
diffSpec |
|
103 |
"This resource specification was automatically generated |
|
104 |
by the UIPainter of ST/X." |
|
105 |
||
106 |
"Do not manually edit this!! If it is corrupted, |
|
107 |
the UIPainter may not be able to read the specification." |
|
108 |
||
109 |
" |
|
110 |
UIPainter new openOnClass:Tools::TextDiff2Tool andSelector:#diffSpec |
|
111 |
Tools::TextDiff2Tool new openInterface:#diffSpec |
|
112 |
" |
|
113 |
||
114 |
<resource: #canvas> |
|
115 |
||
116 |
^ |
|
117 |
#(FullSpec |
|
118 |
name: diffSpec |
|
119 |
window: |
|
120 |
(WindowSpec |
|
121 |
label: 'Text Diff Tool (for embedding)' |
|
122 |
name: 'Text Diff Tool (for embedding)' |
|
123 |
min: (Point 10 10) |
|
124 |
bounds: (Rectangle 0 0 782 506) |
|
125 |
) |
|
126 |
component: |
|
127 |
(SpecCollection |
|
128 |
collection: ( |
|
129 |
(ViewSpec |
|
130 |
name: '2Labels' |
|
131 |
layout: (LayoutFrame 0 0 0 0 -16 1 30 0) |
|
132 |
component: |
|
133 |
(SpecCollection |
|
134 |
collection: ( |
|
135 |
(UISubSpecification |
|
136 |
name: 'VersionA' |
|
137 |
layout: (LayoutFrame 0 0 0 0 0 0.5 30 0) |
|
138 |
minorKey: versionALabelSpec |
|
139 |
) |
|
140 |
(UISubSpecification |
|
141 |
name: 'VersionB' |
|
142 |
layout: (LayoutFrame 5 0.5 0 0 0 1 30 0) |
|
143 |
minorKey: versionBLabelSpec |
|
144 |
) |
|
145 |
) |
|
146 |
||
147 |
) |
|
148 |
) |
|
149 |
(ArbitraryComponentSpec |
|
150 |
name: 'Diff2TextView' |
|
151 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
152 |
hasHorizontalScrollBar: false |
|
153 |
hasVerticalScrollBar: false |
|
154 |
autoHideScrollBars: false |
|
155 |
hasBorder: false |
|
156 |
component: diffView |
|
157 |
postBuildCallback: postBuildDiffView: |
|
158 |
) |
|
159 |
) |
|
160 |
||
161 |
) |
|
162 |
) |
|
163 |
! |
|
164 |
||
165 |
nothingSpec |
|
166 |
"This resource specification was automatically generated |
|
167 |
by the UIPainter of ST/X." |
|
168 |
||
169 |
"Do not manually edit this!! If it is corrupted, |
|
170 |
the UIPainter may not be able to read the specification." |
|
171 |
||
172 |
" |
|
173 |
UIPainter new openOnClass:Tools::TextDiffTool andSelector:#nothingSpec |
|
174 |
Tools::TextDiffTool new openInterface:#nothingSpec |
|
175 |
" |
|
176 |
||
177 |
<resource: #canvas> |
|
178 |
||
179 |
^ |
|
180 |
#(FullSpec |
|
181 |
name: nothingSpec |
|
182 |
window: |
|
183 |
(WindowSpec |
|
184 |
label: 'NewApplication' |
|
185 |
name: 'NewApplication' |
|
186 |
bounds: (Rectangle 0 0 300 300) |
|
187 |
) |
|
188 |
component: |
|
189 |
(SpecCollection |
|
190 |
collection: ( |
|
191 |
(LabelSpec |
|
192 |
label: 'Nothing selected...' |
|
193 |
name: 'Label1' |
|
194 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
195 |
translateLabel: true |
|
196 |
) |
|
197 |
) |
|
198 |
||
199 |
) |
|
200 |
) |
|
201 |
! |
|
202 |
||
203 |
textAViewSpec |
|
204 |
"This resource specification was automatically generated |
|
205 |
by the UIPainter of ST/X." |
|
206 |
||
207 |
"Do not manually edit this!! If it is corrupted, |
|
208 |
the UIPainter may not be able to read the specification." |
|
209 |
||
210 |
" |
|
211 |
UIPainter new openOnClass:Tools::TextDiffTool andSelector:#textViewSpec |
|
212 |
Tools::TextDiffTool new openInterface:#textViewSpec |
|
213 |
" |
|
214 |
||
215 |
<resource: #canvas> |
|
216 |
||
217 |
^ |
|
218 |
#(FullSpec |
|
219 |
name: 'textAViewSpec' |
|
220 |
window: |
|
221 |
(WindowSpec |
|
222 |
label: 'Text Only' |
|
223 |
name: 'Text Only' |
|
224 |
min: (Point 10 10) |
|
225 |
bounds: (Rectangle 0 0 782 506) |
|
226 |
) |
|
227 |
component: |
|
228 |
(SpecCollection |
|
229 |
collection: ( |
|
230 |
(ArbitraryComponentSpec |
|
231 |
name: 'CodeView' |
|
232 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
233 |
model: textAHolder |
|
234 |
hasHorizontalScrollBar: false |
|
235 |
hasVerticalScrollBar: false |
|
236 |
autoHideScrollBars: false |
|
237 |
hasBorder: false |
|
238 |
component: #'Tools::CodeView2' |
|
239 |
postBuildCallback: postBuildCodeView: |
|
240 |
) |
|
241 |
) |
|
242 |
||
243 |
) |
|
244 |
) |
|
245 |
||
246 |
"Created: / 18-04-2012 / 18:43:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
247 |
! |
|
248 |
||
249 |
textBViewSpec |
|
250 |
"This resource specification was automatically generated |
|
251 |
by the UIPainter of ST/X." |
|
252 |
||
253 |
"Do not manually edit this!! If it is corrupted, |
|
254 |
the UIPainter may not be able to read the specification." |
|
255 |
||
256 |
" |
|
257 |
UIPainter new openOnClass:Tools::TextDiffTool andSelector:#textViewSpec |
|
258 |
Tools::TextDiffTool new openInterface:#textViewSpec |
|
259 |
" |
|
260 |
||
261 |
<resource: #canvas> |
|
262 |
||
263 |
^ |
|
264 |
#(FullSpec |
|
265 |
name: 'textAViewSpec' |
|
266 |
window: |
|
267 |
(WindowSpec |
|
268 |
label: 'Text Only' |
|
269 |
name: 'Text Only' |
|
270 |
min: (Point 10 10) |
|
271 |
bounds: (Rectangle 0 0 782 506) |
|
272 |
) |
|
273 |
component: |
|
274 |
(SpecCollection |
|
275 |
collection: ( |
|
276 |
(ArbitraryComponentSpec |
|
277 |
name: 'CodeView' |
|
278 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
279 |
model: textBHolder |
|
280 |
hasHorizontalScrollBar: false |
|
281 |
hasVerticalScrollBar: false |
|
282 |
autoHideScrollBars: false |
|
283 |
hasBorder: false |
|
284 |
component: #'Tools::CodeView2' |
|
285 |
postBuildCallback: postBuildCodeView: |
|
286 |
) |
|
287 |
) |
|
288 |
||
289 |
) |
|
290 |
) |
|
291 |
||
292 |
"Created: / 18-04-2012 / 18:43:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
293 |
! |
|
294 |
||
295 |
versionAOnlySpec |
|
296 |
"This resource specification was automatically generated |
|
297 |
by the UIPainter of ST/X." |
|
298 |
||
299 |
"Do not manually edit this!! If it is corrupted, |
|
300 |
the UIPainter may not be able to read the specification." |
|
301 |
||
302 |
" |
|
303 |
UIPainter new openOnClass:Tools::TextDiffTool andSelector:#versionAOnlySpec |
|
304 |
Tools::TextDiffTool new openInterface:#versionAOnlySpec |
|
305 |
" |
|
306 |
||
307 |
<resource: #canvas> |
|
308 |
||
309 |
^ |
|
310 |
#(FullSpec |
|
311 |
name: versionAOnlySpec |
|
312 |
window: |
|
313 |
(WindowSpec |
|
314 |
label: 'Version A Only' |
|
315 |
name: 'Version A Only' |
|
316 |
min: (Point 10 10) |
|
317 |
bounds: (Rectangle 0 0 782 506) |
|
318 |
) |
|
319 |
component: |
|
320 |
(SpecCollection |
|
321 |
collection: ( |
|
322 |
(UISubSpecification |
|
323 |
name: 'VersionA' |
|
324 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
325 |
minorKey: versionALabelSpec |
|
326 |
) |
|
327 |
(UISubSpecification |
|
328 |
name: 'Text' |
|
329 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
330 |
minorKey: textAViewSpec |
|
331 |
) |
|
332 |
) |
|
333 |
||
334 |
) |
|
335 |
) |
|
336 |
||
337 |
"Modified: / 18-04-2012 / 18:43:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
338 |
! |
|
339 |
||
340 |
versionBOnlySpec |
|
341 |
"This resource specification was automatically generated |
|
342 |
by the UIPainter of ST/X." |
|
343 |
||
344 |
"Do not manually edit this!! If it is corrupted, |
|
345 |
the UIPainter may not be able to read the specification." |
|
346 |
||
347 |
" |
|
348 |
UIPainter new openOnClass:Tools::TextDiffTool andSelector:#versionBOnlySpec |
|
349 |
Tools::TextDiffTool new openInterface:#versionBOnlySpec |
|
350 |
" |
|
351 |
||
352 |
<resource: #canvas> |
|
353 |
||
354 |
^ |
|
355 |
#(FullSpec |
|
356 |
name: 'versionBOnlySpec' |
|
357 |
window: |
|
358 |
(WindowSpec |
|
359 |
label: 'Version B Only' |
|
360 |
name: 'Version B Only' |
|
361 |
min: (Point 10 10) |
|
362 |
bounds: (Rectangle 0 0 782 506) |
|
363 |
) |
|
364 |
component: |
|
365 |
(SpecCollection |
|
366 |
collection: ( |
|
367 |
(UISubSpecification |
|
368 |
name: 'VersionB' |
|
369 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
370 |
minorKey: versionBLabelSpec |
|
371 |
) |
|
372 |
(UISubSpecification |
|
373 |
name: 'Text' |
|
374 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
375 |
minorKey: textBViewSpec |
|
376 |
) |
|
377 |
) |
|
378 |
||
379 |
) |
|
380 |
) |
|
381 |
||
382 |
"Created: / 19-07-2011 / 10:06:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
383 |
! ! |
|
384 |
||
385 |
!TextDiff2Tool class methodsFor:'plugIn spec'! |
|
386 |
||
387 |
aspectSelectors |
|
388 |
"This resource specification was automatically generated |
|
389 |
by the UIPainter of ST/X." |
|
390 |
||
391 |
"Do not manually edit this. If it is corrupted, |
|
392 |
the UIPainter may not be able to read the specification." |
|
393 |
||
394 |
"Return a description of exported aspects; |
|
395 |
these can be connected to aspects of an embedding application |
|
396 |
(if this app is embedded in a subCanvas)." |
|
397 |
||
398 |
^ #( |
|
399 |
#classHolder |
|
400 |
#codeAspectHolder |
|
401 |
#labelAHolder |
|
402 |
#labelBHolde |
|
403 |
#labelCHolder |
|
404 |
#labelHolder |
|
405 |
#languageHolder |
|
406 |
#showDiffHolder |
|
407 |
#textAHolder |
|
408 |
#textBHolder |
|
409 |
#textCHolder |
|
410 |
). |
|
411 |
||
412 |
! ! |
|
413 |
||
414 |
!TextDiff2Tool methodsFor:'accessing'! |
|
415 |
||
416 |
title: aString |
|
417 |
||
418 |
^self label: aString |
|
419 |
||
420 |
"Created: / 30-08-2011 / 09:45:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
421 |
! ! |
|
422 |
||
423 |
!TextDiff2Tool methodsFor:'aspects'! |
|
424 |
||
425 |
showDiffHolder |
|
426 |
"return/create the 'showDiffHolder' value holder (automatically generated)" |
|
427 |
||
428 |
showDiffHolder isNil ifTrue:[ |
|
429 |
showDiffHolder := ValueHolder with: true. |
|
430 |
showDiffHolder addDependent:self. |
|
431 |
]. |
|
432 |
^ showDiffHolder |
|
433 |
||
434 |
"Modified: / 30-06-2011 / 20:59:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
435 |
! |
|
436 |
||
437 |
showDiffHolder:something |
|
438 |
"set the 'showDiffHolder' value holder (automatically generated)" |
|
439 |
||
440 |
|oldValue newValue| |
|
441 |
||
442 |
showDiffHolder notNil ifTrue:[ |
|
443 |
oldValue := showDiffHolder value. |
|
444 |
showDiffHolder removeDependent:self. |
|
445 |
]. |
|
446 |
showDiffHolder := something. |
|
447 |
showDiffHolder notNil ifTrue:[ |
|
448 |
showDiffHolder addDependent:self. |
|
449 |
]. |
|
450 |
newValue := showDiffHolder value. |
|
451 |
oldValue ~~ newValue ifTrue:[ |
|
452 |
self update:#value with:newValue from:showDiffHolder. |
|
453 |
]. |
|
454 |
! ! |
|
455 |
||
456 |
!TextDiff2Tool methodsFor:'change & update'! |
|
457 |
||
458 |
codeAspect |
|
459 |
||
460 |
^self codeAspectHolder value |
|
461 |
||
462 |
"Created: / 19-07-2011 / 19:07:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
463 |
! |
|
464 |
||
465 |
update:something with:aParameter from:changedObject |
|
466 |
"Invoked when an object that I depend upon sends a change notification." |
|
467 |
||
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
468 |
|realDiffView| |
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
469 |
|
13859 | 470 |
(changedObject == showDiffHolder) ifTrue:[ |
471 |
self updateViews. |
|
15281
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
472 |
^ self. |
13859 | 473 |
]. |
15427
47c25dae9cd6
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15281
diff
changeset
|
474 |
diffView notNil ifTrue:[ |
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
475 |
"/ otherwise, respondsTo does not work. |
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
476 |
realDiffView := diffView scrolledView. |
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
477 |
(realDiffView respondsTo:#leftTextView) ifTrue:[ |
15427
47c25dae9cd6
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15281
diff
changeset
|
478 |
((changedObject == diffView leftTextView modifiedChannel) |
47c25dae9cd6
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15281
diff
changeset
|
479 |
or:[changedObject == diffView rightTextView modifiedChannel]) ifTrue:[ |
47c25dae9cd6
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15281
diff
changeset
|
480 |
self enqueueMessage:#updateDiffFromChangedText for:self arguments:#(). |
47c25dae9cd6
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15281
diff
changeset
|
481 |
^ self. |
47c25dae9cd6
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15281
diff
changeset
|
482 |
] |
47c25dae9cd6
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15281
diff
changeset
|
483 |
]. |
15281
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
484 |
]. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
485 |
|
13859 | 486 |
super update:something with:aParameter from:changedObject |
487 |
||
488 |
"Modified: / 16-03-2012 / 12:36:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
489 |
! |
|
490 |
||
491 |
updateAfterAorBorCChanged |
|
492 |
||
493 |
(textAChanged & textBChanged) ifTrue:[ |
|
494 |
textAChanged := textBChanged := false. |
|
495 |
self updateViews |
|
496 |
]. |
|
497 |
||
498 |
"Created: / 16-03-2012 / 12:37:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
499 |
! |
|
500 |
||
15281
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
501 |
updateDiffFromChangedText |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
502 |
|leftView rightView prevCursorLine1 prevCursorCol1 prevCursorLine2 prevCursorCol2| |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
503 |
|
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
504 |
leftView := diffView leftTextView. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
505 |
rightView := diffView rightTextView. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
506 |
|
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
507 |
prevCursorLine1 := leftView cursorLine. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
508 |
prevCursorCol1 := leftView cursorCol. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
509 |
prevCursorLine2 := rightView cursorLine. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
510 |
prevCursorCol2 := rightView cursorCol. |
13859 | 511 |
|
15281
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
512 |
|
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
513 |
self textA:(leftView contents). |
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
514 |
self textB:(rightView contents). |
15281
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
515 |
leftView modifiedChannel setValue:false. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
516 |
rightView modifiedChannel setValue:false. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
517 |
|
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
518 |
self updateViews. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
519 |
leftView cursorLine:prevCursorLine1 col:prevCursorCol1. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
520 |
rightView cursorLine:prevCursorLine2 col:prevCursorCol2. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
521 |
! |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
522 |
|
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
523 |
updateViews |
13859 | 524 |
| a b | |
15281
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
525 |
|
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
526 |
a := self textA. |
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
527 |
b := self textB. |
13859 | 528 |
|
529 |
self showDiffHolder value ifFalse:[ |
|
530 |
self showTextOnly. |
|
531 |
^ self |
|
532 |
]. |
|
533 |
||
534 |
(a notNil and:[b notNil]) ifTrue:[ |
|
535 |
self showDiff. |
|
536 |
^self |
|
537 |
]. |
|
538 |
a notNil ifTrue:[ |
|
539 |
self showVersionA. |
|
540 |
^self |
|
541 |
]. |
|
542 |
b notNil ifTrue:[ |
|
543 |
self showVersionB. |
|
544 |
^self |
|
545 |
]. |
|
546 |
||
547 |
self showNothing. |
|
548 |
||
549 |
"Created: / 19-07-2011 / 11:29:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
550 |
! ! |
|
551 |
||
552 |
!TextDiff2Tool methodsFor:'hooks'! |
|
553 |
||
554 |
postBuildCodeView:aScrollableView |
|
555 |
||
556 |
codeView := aScrollableView. |
|
557 |
codeView notNil ifTrue:[codeView languageHolder: self languageHolder]. |
|
558 |
codeView notNil ifTrue:[codeView classHolder: self classHolder]. |
|
559 |
||
560 |
"Created: / 19-07-2011 / 10:17:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
561 |
! |
|
562 |
||
563 |
postBuildDiffView:aScrollableView |
|
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
564 |
|textA textB| |
13859 | 565 |
|
566 |
super postBuildDiffView:aScrollableView. |
|
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
567 |
|
13859 | 568 |
diffView notNil ifTrue:[ |
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
569 |
textA := self textA. |
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
570 |
textB := self textB. |
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
571 |
(textA notNil and:[textB notNil]) ifTrue:[ |
13859 | 572 |
diffView scrolledView |
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
573 |
text1: textA |
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
574 |
text2: textB |
15281
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
575 |
]. |
a94d5ca82ecf
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15280
diff
changeset
|
576 |
diffView textViews do:[:each | each modifiedChannel addDependent:self]. |
13859 | 577 |
]. |
578 |
||
579 |
"Created: / 16-03-2012 / 13:30:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
580 |
! ! |
|
581 |
||
582 |
!TextDiff2Tool methodsFor:'initialization'! |
|
583 |
||
584 |
initializeDiffView |
|
585 |
"superclass Tools::TextDiffTool says that I am responsible to implement this method" |
|
586 |
||
15277
f96605ba2467
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
13859
diff
changeset
|
587 |
^ Tools::DiffCodeView2 new |
13859 | 588 |
|
589 |
"Modified: / 16-01-2013 / 11:58:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
590 |
! ! |
|
591 |
||
592 |
!TextDiff2Tool methodsFor:'private'! |
|
593 |
||
594 |
showDiff |
|
595 |
|scrolledView| |
|
596 |
||
597 |
self contentSpecHolder value: #diffSpec. |
|
598 |
||
599 |
diffView isNil ifTrue:[^self]. |
|
600 |
(scrolledView := diffView scrolledView) isNil ifTrue:[^self]. |
|
601 |
scrolledView |
|
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
602 |
text1: self textA |
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
603 |
text2: self textB |
13859 | 604 |
|
605 |
"Created: / 19-07-2011 / 10:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
606 |
"Modified: / 18-11-2011 / 15:01:12 / cg" |
|
607 |
"Modified: / 16-03-2012 / 13:21:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
608 |
! |
|
609 |
||
610 |
showNothing |
|
611 |
||
612 |
self contentSpecHolder value: #nothingSpec |
|
613 |
||
614 |
"Created: / 19-07-2011 / 19:34:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
615 |
! |
|
616 |
||
617 |
showTextOnly |
|
618 |
||
619 |
self contentSpecHolder value: #textViewSpec |
|
620 |
||
621 |
"Created: / 19-07-2011 / 11:39:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
622 |
! |
|
623 |
||
624 |
showVersionA |
|
625 |
||
626 |
self contentSpecHolder value: #versionAOnlySpec |
|
627 |
||
628 |
"Created: / 19-07-2011 / 10:22:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
629 |
! |
|
630 |
||
631 |
showVersionB |
|
632 |
||
633 |
self contentSpecHolder value: #versionBOnlySpec |
|
634 |
||
635 |
"Created: / 19-07-2011 / 10:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
636 |
! ! |
|
637 |
||
638 |
!TextDiff2Tool methodsFor:'testing'! |
|
639 |
||
640 |
isDiff2 |
|
641 |
^true |
|
642 |
||
643 |
"Created: / 16-03-2012 / 15:21:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
644 |
! ! |
|
645 |
||
646 |
!TextDiff2Tool class methodsFor:'documentation'! |
|
647 |
||
648 |
version |
|
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
649 |
^ '$Header$' |
15280
feec24158cac
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15277
diff
changeset
|
650 |
! |
feec24158cac
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15277
diff
changeset
|
651 |
|
feec24158cac
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15277
diff
changeset
|
652 |
version_CVS |
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
653 |
^ '$Id$' |
13859 | 654 |
! |
655 |
||
656 |
version_HG |
|
657 |
||
658 |
^ '$Changeset: <not expanded> $' |
|
659 |
! |
|
660 |
||
661 |
version_SVN |
|
15721
eb434c1f91f4
class: Tools::TextDiff2Tool
Claus Gittinger <cg@exept.de>
parents:
15427
diff
changeset
|
662 |
^ '$Id$' |
13859 | 663 |
! ! |
664 |