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