author | Claus Gittinger <cg@exept.de> |
Wed, 05 Jun 2019 14:16:59 +0200 | |
changeset 18805 | f6df57c6dbfb |
parent 18768 | cd6d15fb40b4 |
child 19064 | 477a52b53777 |
permissions | -rw-r--r-- |
18768 | 1 |
"{ Encoding: utf8 }" |
2 |
||
13794 | 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:#TextDiff3Tool |
|
19 |
instanceVariableNames:'labelMergedHolder textMergedHolder mergeHolder mergeDataHolder |
|
20 |
mergeIntervalHolder mergeView mergeService' |
|
21 |
classVariableNames:'' |
|
22 |
poolDictionaries:'' |
|
23 |
category:'Interface-Diff' |
|
24 |
! |
|
25 |
||
26 |
CodeViewService subclass:#MergeService |
|
27 |
instanceVariableNames:'dataHolder data sectionIntervalHolder' |
|
28 |
classVariableNames:'' |
|
29 |
poolDictionaries:'' |
|
30 |
privateIn:TextDiff3Tool |
|
31 |
! |
|
32 |
||
33 |
!TextDiff3Tool class methodsFor:'documentation'! |
|
34 |
||
35 |
copyright |
|
36 |
" |
|
37 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
38 |
All Rights Reserved |
|
39 |
||
40 |
This software is furnished under a license and may be used |
|
41 |
only in accordance with the terms of that license and with the |
|
42 |
inclusion of the above copyright notice. This software may not |
|
43 |
be provided or otherwise made available to, or used by, any |
|
44 |
other person. No title to or ownership of the software is |
|
45 |
hereby transferred. |
|
46 |
" |
|
47 |
! |
|
48 |
||
49 |
documentation |
|
50 |
" |
|
51 |
documentation to be added. |
|
52 |
||
53 |
[author:] |
|
54 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
55 |
||
56 |
[instance variables:] |
|
57 |
||
58 |
[class variables:] |
|
59 |
||
60 |
[see also:] |
|
61 |
||
62 |
" |
|
63 |
! |
|
64 |
||
65 |
examples |
|
66 |
" |
|
67 |
Starting the application: |
|
68 |
[exBegin] |
|
69 |
Tools::TextDiff3Tool open |
|
70 |
||
71 |
[exEnd] |
|
72 |
||
73 |
more examples to be added: |
|
74 |
[exBegin] |
|
75 |
... add code fragment for |
|
76 |
... executable example here ... |
|
77 |
[exEnd] |
|
78 |
" |
|
79 |
! ! |
|
80 |
||
81 |
!TextDiff3Tool class methodsFor:'defaults - colors'! |
|
82 |
||
83 |
colorA |
|
84 |
||
85 |
^(Color red:54.1176470588235 green:75.2941176470588 blue:28.6274509803922) lighter |
|
86 |
||
87 |
"Created: / 19-03-2012 / 13:11:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
88 |
! |
|
89 |
||
90 |
colorB |
|
91 |
||
92 |
^(Color red:96.078431372549 green:73.7254901960784 blue:0.0) lighter |
|
93 |
||
94 |
"Created: / 19-03-2012 / 13:11:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
95 |
! |
|
96 |
||
97 |
colorBase |
|
98 |
||
99 |
^(Color red:5.88235294117647 green:58.8235294117647 blue:80.3921568627451) lighter |
|
100 |
||
101 |
"Created: / 19-03-2012 / 13:12:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
102 |
! |
|
103 |
||
104 |
colorConflict |
|
105 |
||
106 |
^Color red |
|
107 |
||
108 |
"Created: / 19-03-2012 / 13:12:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
109 |
! |
|
110 |
||
111 |
colorMerged |
|
112 |
||
113 |
^(Color red:83.921568627451 green:17.2549019607843 blue:85.0980392156863) lighter |
|
114 |
||
115 |
"Created: / 19-03-2012 / 13:11:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
116 |
! ! |
|
117 |
||
118 |
!TextDiff3Tool class methodsFor:'interface specs'! |
|
119 |
||
120 |
diff3Spec |
|
121 |
"This resource specification was automatically generated |
|
122 |
by the UIPainter of ST/X." |
|
123 |
||
124 |
"Do not manually edit this!! If it is corrupted, |
|
125 |
the UIPainter may not be able to read the specification." |
|
126 |
||
127 |
" |
|
128 |
UIPainter new openOnClass:Tools::TextDiff3Tool andSelector:#diff3Spec |
|
129 |
Tools::TextDiff3Tool new openInterface:#diff3Spec |
|
130 |
" |
|
131 |
||
132 |
<resource: #canvas> |
|
133 |
||
134 |
^ |
|
135 |
#(FullSpec |
|
136 |
name: diff3Spec |
|
137 |
window: |
|
138 |
(WindowSpec |
|
139 |
label: 'Text Diff Tool (for embedding)' |
|
140 |
name: 'Text Diff Tool (for embedding)' |
|
141 |
min: (Point 10 10) |
|
142 |
bounds: (Rectangle 0 0 782 506) |
|
143 |
) |
|
144 |
component: |
|
145 |
(SpecCollection |
|
146 |
collection: ( |
|
147 |
(ViewSpec |
|
148 |
name: '3Labels' |
|
149 |
layout: (LayoutFrame 0 0 0 0 -16 1 30 0) |
|
150 |
component: |
|
151 |
(SpecCollection |
|
152 |
collection: ( |
|
153 |
(UISubSpecification |
|
154 |
name: 'VersionC' |
|
155 |
layout: (LayoutFrame 0 0 0 0 0 0.33333 30 0) |
|
156 |
minorKey: versionCLabelSpec |
|
157 |
) |
|
158 |
(UISubSpecification |
|
159 |
name: 'VersionA' |
|
160 |
layout: (LayoutFrame 5 0.3333 0 0 0 0.67 30 0) |
|
161 |
minorKey: versionALabelSpec |
|
162 |
) |
|
163 |
(UISubSpecification |
|
164 |
name: 'VersionB' |
|
165 |
layout: (LayoutFrame 5 0.67 0 0 0 1 30 0) |
|
166 |
minorKey: versionBLabelSpec |
|
167 |
) |
|
168 |
) |
|
169 |
||
170 |
) |
|
171 |
) |
|
172 |
(ArbitraryComponentSpec |
|
173 |
name: 'Diff3TextView' |
|
174 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
175 |
hasHorizontalScrollBar: false |
|
176 |
hasVerticalScrollBar: false |
|
177 |
autoHideScrollBars: false |
|
178 |
hasBorder: false |
|
179 |
component: diffView |
|
180 |
postBuildCallback: postBuildDiffView: |
|
181 |
) |
|
182 |
) |
|
183 |
||
184 |
) |
|
185 |
) |
|
186 |
! |
|
187 |
||
188 |
mergeSpec |
|
189 |
"This resource specification was automatically generated |
|
190 |
by the UIPainter of ST/X." |
|
191 |
||
192 |
"Do not manually edit this!! If it is corrupted, |
|
193 |
the UIPainter may not be able to read the specification." |
|
194 |
||
195 |
" |
|
196 |
UIPainter new openOnClass:Tools::TextDiff3Tool andSelector:#mergeSpec |
|
197 |
Tools::TextDiff3Tool new openInterface:#mergeSpec |
|
198 |
" |
|
199 |
||
200 |
<resource: #canvas> |
|
201 |
||
202 |
^ |
|
203 |
#(FullSpec |
|
204 |
name: mergeSpec |
|
205 |
window: |
|
206 |
(WindowSpec |
|
207 |
label: 'Merge view' |
|
208 |
name: 'Merge view' |
|
209 |
min: (Point 10 10) |
|
210 |
bounds: (Rectangle 0 0 782 506) |
|
211 |
) |
|
212 |
component: |
|
213 |
(SpecCollection |
|
214 |
collection: ( |
|
215 |
(VariableVerticalPanelSpec |
|
216 |
name: 'DiffAndMergePanel' |
|
217 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
218 |
component: |
|
219 |
(SpecCollection |
|
220 |
collection: ( |
|
221 |
(ViewSpec |
|
222 |
name: 'Box1' |
|
223 |
component: |
|
224 |
(SpecCollection |
|
225 |
collection: ( |
|
226 |
(ViewSpec |
|
227 |
name: '3Labels' |
|
228 |
layout: (LayoutFrame 0 0 0 0 -16 1 30 0) |
|
229 |
component: |
|
230 |
(SpecCollection |
|
231 |
collection: ( |
|
232 |
(UISubSpecification |
|
233 |
name: 'VersionC' |
|
234 |
layout: (LayoutFrame 0 0 0 0 0 0.33333 30 0) |
|
235 |
minorKey: versionCLabelSpec |
|
236 |
) |
|
237 |
(UISubSpecification |
|
238 |
name: 'VersionA' |
|
239 |
layout: (LayoutFrame 5 0.3333 0 0 0 0.67 30 0) |
|
240 |
minorKey: versionALabelSpec |
|
241 |
) |
|
242 |
(UISubSpecification |
|
243 |
name: 'VersionB' |
|
244 |
layout: (LayoutFrame 5 0.67 0 0 0 1 30 0) |
|
245 |
minorKey: versionBLabelSpec |
|
246 |
) |
|
247 |
) |
|
248 |
||
249 |
) |
|
250 |
) |
|
251 |
(ArbitraryComponentSpec |
|
252 |
name: 'Diff3TextView' |
|
253 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
254 |
hasHorizontalScrollBar: false |
|
255 |
hasVerticalScrollBar: false |
|
256 |
autoHideScrollBars: false |
|
257 |
hasBorder: false |
|
258 |
component: diffView |
|
259 |
postBuildCallback: postBuildDiffView: |
|
260 |
) |
|
261 |
) |
|
262 |
||
263 |
) |
|
264 |
) |
|
265 |
(TransparentBoxSpec |
|
266 |
name: 'MergeView' |
|
267 |
component: |
|
268 |
(SpecCollection |
|
269 |
collection: ( |
|
270 |
(UISubSpecification |
|
271 |
name: 'MergeLabel' |
|
272 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
273 |
minorKey: versionMergedLabelSpec |
|
274 |
) |
|
275 |
(TextEditorSpec |
|
276 |
name: 'MergeCode' |
|
277 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
278 |
model: textMergedHolder |
|
279 |
hasHorizontalScrollBar: true |
|
280 |
hasVerticalScrollBar: true |
|
281 |
hasKeyboardFocusInitially: false |
|
282 |
viewClassName: 'Tools::CodeView2' |
|
283 |
postBuildCallback: postBuildMergeView: |
|
284 |
) |
|
285 |
) |
|
286 |
||
287 |
) |
|
288 |
) |
|
289 |
) |
|
290 |
||
291 |
) |
|
292 |
handles: (Any 0.5 1.0) |
|
293 |
) |
|
294 |
(MenuPanelSpec |
|
295 |
name: 'ToolBar' |
|
296 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
297 |
menu: toolbarMenuMerge |
|
298 |
textDefault: true |
|
299 |
) |
|
300 |
) |
|
301 |
||
302 |
) |
|
303 |
) |
|
304 |
||
305 |
"Modified: / 17-01-2013 / 20:32:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
306 |
! ! |
|
307 |
||
308 |
!TextDiff3Tool class methodsFor:'interface specs - labels'! |
|
309 |
||
310 |
versionMergedLabelSpec |
|
311 |
"This resource specification was automatically generated |
|
312 |
by the UIPainter of ST/X." |
|
313 |
||
314 |
"Do not manually edit this!! If it is corrupted, |
|
315 |
the UIPainter may not be able to read the specification." |
|
316 |
||
317 |
" |
|
318 |
UIPainter new openOnClass:Tools::TextDiff3Tool andSelector:#versionMergedLabelSpec |
|
319 |
Tools::TextDiff3Tool new openInterface:#versionMergedLabelSpec |
|
320 |
" |
|
321 |
||
322 |
<resource: #canvas> |
|
323 |
||
324 |
^ |
|
325 |
#(FullSpec |
|
326 |
name: versionMergedLabelSpec |
|
327 |
window: |
|
328 |
(WindowSpec |
|
329 |
label: 'Merge' |
|
330 |
name: 'Merge' |
|
331 |
min: (Point 10 10) |
|
332 |
bounds: (Rectangle 0 0 774 30) |
|
333 |
) |
|
334 |
component: |
|
335 |
(SpecCollection |
|
336 |
collection: ( |
|
337 |
(LabelSpec |
|
338 |
label: 'versionMerged24x24' |
|
339 |
name: 'VersionMergedIcon' |
|
340 |
layout: (LayoutFrame 0 0 -12 0.5 27 0 12 0.5) |
|
341 |
hasCharacterOrientedLabel: false |
|
342 |
translateLabel: true |
|
343 |
) |
|
344 |
(LabelSpec |
|
345 |
label: 'Merge' |
|
346 |
name: 'VersionMergeLabel' |
|
347 |
layout: (LayoutFrame 30 0 5 0 157 0 0 1) |
|
348 |
translateLabel: true |
|
349 |
labelChannel: labelMergedHolder |
|
350 |
resizeForLabel: true |
|
351 |
adjust: left |
|
352 |
useDynamicPreferredWidth: true |
|
353 |
usePreferredWidth: true |
|
354 |
) |
|
355 |
) |
|
356 |
||
357 |
) |
|
358 |
) |
|
359 |
! ! |
|
360 |
||
361 |
!TextDiff3Tool class methodsFor:'menu specs'! |
|
362 |
||
363 |
toolbarMenuMerge |
|
364 |
"This resource specification was automatically generated |
|
365 |
by the MenuEditor of ST/X." |
|
366 |
||
367 |
"Do not manually edit this!! If it is corrupted, |
|
368 |
the MenuEditor may not be able to read the specification." |
|
369 |
||
370 |
||
371 |
" |
|
372 |
MenuEditor new openOnClass:Tools::TextDiff3Tool andSelector:#toolbarMenuMerge |
|
373 |
(Menu new fromLiteralArrayEncoding:(Tools::TextDiff3Tool toolbarMenuMerge)) startUp |
|
374 |
" |
|
375 |
||
376 |
<resource: #menu> |
|
377 |
||
378 |
^ |
|
379 |
#(Menu |
|
380 |
( |
|
381 |
(MenuItem |
|
382 |
enabled: canMergeCurrentHolder |
|
383 |
label: 'Use Base for Current Delta' |
|
384 |
itemValue: doMergeCurrentUsingBase |
|
385 |
isButton: true |
|
386 |
labelImage: (ResourceRetriever ToolbarIconLibrary mergeUsingBase24x24) |
|
387 |
) |
|
388 |
(MenuItem |
|
389 |
enabled: canMergeCurrentHolder |
|
390 |
label: 'Use A for Current ' |
|
391 |
itemValue: doMergeCurrentUsingA |
|
392 |
isButton: true |
|
393 |
labelImage: (ResourceRetriever ToolbarIconLibrary mergeUsingA24x24) |
|
394 |
) |
|
395 |
(MenuItem |
|
396 |
enabled: canMergeCurrentHolder |
|
397 |
label: 'Use B for Current ' |
|
398 |
itemValue: doMergeCurrentUsingB |
|
399 |
isButton: true |
|
400 |
labelImage: (ResourceRetriever ToolbarIconLibrary mergeUsingB24x24) |
|
401 |
) |
|
402 |
(MenuItem |
|
403 |
label: 'Use Base Everywhere' |
|
404 |
itemValue: doMergeAllUsingBase |
|
405 |
isButton: true |
|
406 |
startGroup: right |
|
407 |
labelImage: (ResourceRetriever ToolbarIconLibrary mergeUsingBaseAll24x24) |
|
408 |
) |
|
409 |
(MenuItem |
|
410 |
label: 'Use A Everywhere' |
|
411 |
itemValue: doMergeAllUsingA |
|
412 |
isButton: true |
|
413 |
startGroup: right |
|
414 |
labelImage: (ResourceRetriever ToolbarIconLibrary mergeUsingAAll24x24) |
|
415 |
) |
|
416 |
(MenuItem |
|
417 |
label: 'Use Be Everywhere ' |
|
418 |
itemValue: doMergeAllUsingB |
|
419 |
isButton: true |
|
420 |
labelImage: (ResourceRetriever ToolbarIconLibrary mergeUsingBAll24x24) |
|
421 |
) |
|
422 |
(MenuItem |
|
423 |
label: 'Auto Merge' |
|
424 |
itemValue: doMergeAllAuto |
|
425 |
isButton: true |
|
426 |
startGroup: right |
|
427 |
labelImage: (ResourceRetriever ToolbarIconLibrary mergeMerge24x24) |
|
428 |
) |
|
429 |
(MenuItem |
|
430 |
label: 'External Merge' |
|
431 |
itemValue: doMergeAllExternal |
|
432 |
isButton: true |
|
433 |
startGroup: right |
|
434 |
labelImage: (ResourceRetriever ToolbarIconLibrary mergeMergeExternal24x24) |
|
435 |
) |
|
436 |
) |
|
437 |
nil |
|
438 |
nil |
|
439 |
) |
|
440 |
||
441 |
"Modified: / 17-01-2013 / 22:31:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
442 |
! ! |
|
443 |
||
444 |
!TextDiff3Tool class methodsFor:'plugIn spec'! |
|
445 |
||
446 |
aspectSelectors |
|
447 |
"This resource specification was automatically generated |
|
448 |
by the UIPainter of ST/X." |
|
449 |
||
450 |
"Do not manually edit this. If it is corrupted, |
|
451 |
the UIPainter may not be able to read the specification." |
|
452 |
||
453 |
"Return a description of exported aspects; |
|
454 |
these can be connected to aspects of an embedding application |
|
455 |
(if this app is embedded in a subCanvas)." |
|
456 |
||
457 |
^ #( |
|
458 |
#codeAspectHolder |
|
459 |
#labelAHolder |
|
460 |
#labelBHolde |
|
461 |
#labelCHolder |
|
462 |
#labelHolder |
|
463 |
#languageHolder |
|
464 |
#mergeDataHolder |
|
465 |
#mergeHolder |
|
466 |
#textAHolder |
|
467 |
#textBHolder |
|
468 |
#textCHolder |
|
469 |
). |
|
470 |
||
471 |
! ! |
|
472 |
||
473 |
!TextDiff3Tool methodsFor:'accessing'! |
|
474 |
||
475 |
beDiff3Tool |
|
476 |
||
477 |
self mergeHolder value: false |
|
478 |
||
479 |
"Created: / 17-03-2012 / 12:23:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
480 |
! |
|
481 |
||
482 |
beMergeTool |
|
483 |
||
484 |
self mergeHolder value: true |
|
485 |
||
486 |
"Created: / 17-03-2012 / 12:23:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
487 |
! |
|
488 |
||
489 |
mergeData |
|
490 |
||
491 |
^self mergeDataHolder value |
|
492 |
||
493 |
"Created: / 20-03-2012 / 14:17:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
494 |
! ! |
|
495 |
||
496 |
!TextDiff3Tool methodsFor:'aspects'! |
|
497 |
||
498 |
contentSpecHolder |
|
499 |
"return/create the 'contentSpecHolder' value holder (automatically generated)" |
|
500 |
||
501 |
contentSpecHolder isNil ifTrue:[ |
|
502 |
contentSpecHolder := ValueHolder new. |
|
503 |
self mergeHolder value |
|
504 |
ifTrue:[contentSpecHolder setValue: #mergeSpec] |
|
505 |
ifFalse:[contentSpecHolder setValue: #diff3Spec]. |
|
506 |
contentSpecHolder addDependent:self. |
|
507 |
]. |
|
508 |
^ contentSpecHolder |
|
509 |
||
510 |
"Created: / 17-01-2013 / 20:20:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
511 |
! |
|
512 |
||
513 |
diffView |
|
514 |
diffView notNil ifTrue:[ |
|
515 |
self breakPoint: #jv. |
|
516 |
]. |
|
517 |
diffView := self initializeDiffView. |
|
518 |
^diffView |
|
519 |
||
520 |
"Created: / 17-01-2013 / 20:24:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
521 |
! |
|
522 |
||
523 |
mergeDataHolder |
|
524 |
"return/create the 'mergeDataHolder' value holder (automatically generated)" |
|
525 |
||
526 |
mergeDataHolder isNil ifTrue:[ |
|
527 |
mergeDataHolder := ValueHolder new. |
|
528 |
mergeDataHolder addDependent:self. |
|
529 |
]. |
|
530 |
^ mergeDataHolder |
|
531 |
! |
|
532 |
||
533 |
mergeDataHolder:something |
|
534 |
"set the 'mergeDataHolder' value holder (automatically generated)" |
|
535 |
||
536 |
|oldValue newValue| |
|
537 |
||
538 |
mergeDataHolder notNil ifTrue:[ |
|
539 |
oldValue := mergeDataHolder value. |
|
540 |
mergeDataHolder removeDependent:self. |
|
541 |
]. |
|
542 |
mergeDataHolder := something. |
|
543 |
mergeDataHolder notNil ifTrue:[ |
|
544 |
mergeDataHolder addDependent:self. |
|
545 |
]. |
|
546 |
newValue := mergeDataHolder value. |
|
547 |
oldValue ~~ newValue ifTrue:[ |
|
548 |
self update:#value with:newValue from:mergeDataHolder. |
|
549 |
]. |
|
550 |
! |
|
551 |
||
552 |
mergeHolder |
|
553 |
"return/create the 'mergeHolder' value holder (automatically generated)" |
|
554 |
||
555 |
mergeHolder isNil ifTrue:[ |
|
556 |
mergeHolder := ValueHolder with: false. |
|
557 |
mergeHolder addDependent:self. |
|
558 |
]. |
|
559 |
^ mergeHolder |
|
560 |
||
561 |
"Modified: / 16-03-2012 / 13:24:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
562 |
! |
|
563 |
||
564 |
mergeHolder:something |
|
565 |
"set the 'mergeHolder' value holder (automatically generated)" |
|
566 |
||
567 |
|oldValue newValue| |
|
568 |
||
569 |
mergeHolder notNil ifTrue:[ |
|
570 |
oldValue := mergeHolder value. |
|
571 |
mergeHolder removeDependent:self. |
|
572 |
]. |
|
573 |
mergeHolder := something. |
|
574 |
mergeHolder notNil ifTrue:[ |
|
575 |
mergeHolder addDependent:self. |
|
576 |
]. |
|
577 |
newValue := mergeHolder value. |
|
578 |
oldValue ~~ newValue ifTrue:[ |
|
579 |
self update:#value with:newValue from:mergeHolder. |
|
580 |
]. |
|
581 |
! |
|
582 |
||
583 |
mergeIntervalHolder |
|
584 |
"return/create the 'mergeIntervalHolder' value holder (automatically generated)" |
|
585 |
||
586 |
mergeIntervalHolder isNil ifTrue:[ |
|
587 |
mergeIntervalHolder := ValueHolder new. |
|
588 |
mergeIntervalHolder addDependent:self. |
|
589 |
]. |
|
590 |
^ mergeIntervalHolder |
|
591 |
! |
|
592 |
||
593 |
mergeIntervalHolder:something |
|
594 |
"set the 'mergeIntervalHolder' value holder (automatically generated)" |
|
595 |
||
596 |
|oldValue newValue| |
|
597 |
||
598 |
mergeIntervalHolder notNil ifTrue:[ |
|
599 |
oldValue := mergeIntervalHolder value. |
|
600 |
mergeIntervalHolder removeDependent:self. |
|
601 |
]. |
|
602 |
mergeIntervalHolder := something. |
|
603 |
mergeIntervalHolder notNil ifTrue:[ |
|
604 |
mergeIntervalHolder addDependent:self. |
|
605 |
]. |
|
606 |
newValue := mergeIntervalHolder value. |
|
607 |
oldValue ~~ newValue ifTrue:[ |
|
608 |
self update:#value with:newValue from:mergeIntervalHolder. |
|
609 |
]. |
|
610 |
! ! |
|
611 |
||
612 |
!TextDiff3Tool methodsFor:'aspects - queries'! |
|
613 |
||
614 |
canMergeCurrentHolder |
|
18768 | 615 |
^ self builder bindings at:#canMergeCurrentHolder ifAbsentPut:[ |
13794 | 616 |
BlockValue |
18768 | 617 |
with:[:model| model notNil] |
13794 | 618 |
argument: self mergeIntervalHolder |
619 |
] |
|
620 |
||
621 |
"Created: / 30-11-2012 / 13:49:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
18768 | 622 |
"Modified: / 17-05-2019 / 16:07:41 / Stefan Vogel" |
13794 | 623 |
! ! |
624 |
||
625 |
!TextDiff3Tool methodsFor:'aspects-versions'! |
|
626 |
||
627 |
labelMergedHolder |
|
628 |
"return/create the 'labelMergedHolder' value holder (automatically generated)" |
|
629 |
||
630 |
labelMergedHolder isNil ifTrue:[ |
|
631 |
labelMergedHolder := ValueHolder with:'Merge'. |
|
632 |
]. |
|
633 |
^ labelMergedHolder |
|
634 |
||
635 |
"Modified: / 17-03-2012 / 12:36:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
636 |
! |
|
637 |
||
638 |
labelMergedHolder:something |
|
639 |
"set the 'labelMergedHolder' value holder (automatically generated)" |
|
640 |
||
641 |
labelMergedHolder := something. |
|
642 |
! |
|
643 |
||
644 |
textMergedHolder |
|
645 |
"return/create the 'textMergedHolder' value holder (automatically generated)" |
|
646 |
||
647 |
textMergedHolder isNil ifTrue:[ |
|
648 |
textMergedHolder := ValueHolder new. |
|
649 |
]. |
|
650 |
^ textMergedHolder |
|
651 |
! |
|
652 |
||
653 |
textMergedHolder:something |
|
654 |
"set the 'textMergedHolder' value holder (automatically generated)" |
|
655 |
||
656 |
textMergedHolder := something. |
|
657 |
! ! |
|
658 |
||
659 |
!TextDiff3Tool methodsFor:'change & update'! |
|
660 |
||
661 |
update:something with:aParameter from:changedObject |
|
662 |
"Invoked when an object that I depend upon sends a change notification." |
|
663 |
||
664 |
"stub code automatically generated - please change as required" |
|
665 |
||
666 |
changedObject == mergeHolder ifTrue:[ |
|
667 |
self updateViews. |
|
668 |
self updateMergeData. |
|
669 |
self updateCodeViewSynchronization. |
|
670 |
^ self. |
|
671 |
]. |
|
672 |
super update:something with:aParameter from:changedObject |
|
673 |
||
674 |
"Modified: / 19-03-2012 / 14:29:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
675 |
! |
|
676 |
||
677 |
updateAfterAorBorCChanged |
|
678 |
||
679 |
(textAChanged & textBChanged & textCChanged) ifTrue:[ |
|
680 |
textAChanged := textBChanged := textCChanged := false. |
|
681 |
self updateViews. |
|
682 |
self isMerge ifTrue:[ |
|
683 |
self updateMergeData. |
|
684 |
]. |
|
685 |
]. |
|
686 |
||
687 |
"Created: / 16-03-2012 / 15:26:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
688 |
! |
|
689 |
||
690 |
updateCodeViewSynchronization |
|
691 |
||
692 |
diffView isNil ifTrue:[ ^ self ]. |
|
693 |
mergeView isNil ifTrue:[ ^ self ]. |
|
694 |
self isMerge ifTrue:[ |
|
695 |
"/ diffView synchronizeWith: mergeView. |
|
696 |
diffView textViews do:[:e| |
|
697 |
mergeView synchronizeWith: e. |
|
698 |
] |
|
699 |
] ifFalse:[ |
|
700 |
"/ diffView unsynchronizeWith: mergeView. |
|
701 |
diffView textViews do:[:e| |
|
702 |
mergeView unsynchronizeWith: e. |
|
703 |
] |
|
704 |
||
705 |
] |
|
706 |
||
707 |
"Created: / 19-03-2012 / 14:24:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
708 |
! |
|
709 |
||
710 |
updateMergeData |
|
711 |
| data | |
|
712 |
||
713 |
(data := self mergeDataHolder value) isNil ifTrue:[ |
|
714 |
data := TextMergeInfo new. |
|
715 |
data text1: self textC text2: self textA text3: self textB. |
|
716 |
self mergeDataHolder value: data. |
|
717 |
]. |
|
718 |
||
719 |
"Created: / 19-03-2012 / 11:52:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
720 |
! |
|
721 |
||
722 |
updateViews |
|
723 |
||
724 |
self mergeHolder value ifTrue:[ |
|
725 |
self contentSpecHolder value: #mergeSpec |
|
726 |
] ifFalse:[ |
|
727 |
self contentSpecHolder value: #diff3Spec |
|
728 |
]. |
|
729 |
||
730 |
diffView notNil ifTrue:[ |
|
731 |
diffView |
|
15722
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
732 |
text1: self textC |
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
733 |
text2: self textA |
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
734 |
text3: self textB. |
13794 | 735 |
] |
736 |
||
737 |
"Created: / 16-03-2012 / 13:24:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
738 |
! ! |
|
739 |
||
740 |
!TextDiff3Tool methodsFor:'hooks'! |
|
741 |
||
742 |
commonPostBuild |
|
743 |
self updateViews |
|
744 |
||
745 |
"Created: / 16-03-2012 / 13:25:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
746 |
! |
|
747 |
||
748 |
postBuildDiffView:aScrollableView |
|
15722
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
749 |
|textA textB textC| |
13794 | 750 |
|
751 |
super postBuildDiffView:aScrollableView. |
|
15722
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
752 |
|
13794 | 753 |
diffView := aScrollableView scrolledView. |
754 |
diffView notNil ifTrue:[ |
|
15722
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
755 |
textA := self textA. |
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
756 |
textB := self textB. |
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
757 |
textC := self textC. |
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
758 |
(textA notNil and:[textB notNil and:[textC notNil]]) ifTrue:[ |
13794 | 759 |
diffView scrolledView |
15722
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
760 |
text1: textC |
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
761 |
text2: textA |
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
762 |
text3: textB |
13794 | 763 |
|
764 |
]. |
|
765 |
self updateCodeViewSynchronization. |
|
766 |
]. |
|
767 |
||
768 |
"Created: / 16-03-2012 / 13:31:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
769 |
"Modified: / 17-01-2013 / 20:31:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
770 |
! |
|
771 |
||
772 |
postBuildMergeView:aCodeView2 |
|
773 |
||
774 |
mergeView := aCodeView2. |
|
775 |
self setupCodeView: aCodeView2. |
|
776 |
mergeView registerService: |
|
777 |
((mergeService := MergeService new) |
|
778 |
dataHolder: self mergeDataHolder; |
|
779 |
sectionIntervalHolder: self mergeIntervalHolder; |
|
780 |
yourself). |
|
781 |
self updateCodeViewSynchronization. |
|
782 |
||
783 |
"Created: / 19-03-2012 / 11:47:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
784 |
"Modified: / 30-11-2012 / 13:47:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
785 |
! ! |
|
786 |
||
787 |
!TextDiff3Tool methodsFor:'initialization'! |
|
788 |
||
789 |
initializeDiffView |
|
790 |
"superclass Tools::TextDiffTool says that I am responsible to implement this method" |
|
791 |
||
792 |
^ Tools::Diff3CodeView2 new |
|
793 |
||
794 |
"Modified: / 16-01-2013 / 09:52:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
795 |
! ! |
|
796 |
||
797 |
!TextDiff3Tool methodsFor:'menu actions'! |
|
798 |
||
799 |
doMergeAllAuto |
|
800 |
self mergeDataHolder value |
|
801 |
text1:self textC |
|
802 |
text2:self textA |
|
803 |
text3:self textB. |
|
804 |
||
805 |
"Created: / 17-03-2012 / 12:55:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
806 |
! |
|
807 |
||
808 |
doMergeAllExternal |
|
809 |
| left wc right merge | |
|
810 |
||
811 |
left := Filename newTemporary. |
|
812 |
left writingFileDo:[:s|s nextPutAll: self textC ? '']. |
|
813 |
||
814 |
wc := Filename newTemporary. |
|
815 |
wc writingFileDo:[:s|s nextPutAll: self textA ? '']. |
|
816 |
||
817 |
right := Filename newTemporary. |
|
818 |
right writingFileDo:[:s|s nextPutAll: self textB ? '']. |
|
819 |
||
820 |
merge := Filename newTemporary. |
|
821 |
||
822 |
[ |
|
823 |
(OperatingSystem executeCommand: |
|
824 |
('%1 %2 %3 %4 -o %5' |
|
825 |
bindWith: 'kdiff3' |
|
826 |
with: left pathName |
|
827 |
with: wc pathName |
|
828 |
with: right pathName |
|
829 |
with: merge pathName)) ifTrue:[ |
|
830 |
merge exists ifTrue:[ |
|
831 |
self mergeData mergeUsing: merge contents asString |
|
832 |
]. |
|
833 |
] |
|
834 |
] ensure:[ |
|
835 |
left remove. |
|
836 |
wc remove. |
|
837 |
right remove. |
|
838 |
merge exists ifTrue:[merge remove]. |
|
839 |
] |
|
840 |
||
841 |
"Modified: / 16-01-2013 / 10:02:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
842 |
! |
|
843 |
||
844 |
doMergeAllUsingA |
|
845 |
self mergeData mergeUsingA: self textA |
|
846 |
||
847 |
"Created: / 30-11-2012 / 13:33:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
848 |
! |
|
849 |
||
850 |
doMergeAllUsingB |
|
851 |
||
852 |
self mergeData mergeUsingB: self textB |
|
853 |
||
854 |
"Created: / 30-11-2012 / 13:33:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
855 |
! |
|
856 |
||
857 |
doMergeAllUsingBase |
|
858 |
self mergeData mergeUsingBase: self textC |
|
859 |
||
860 |
"Created: / 30-11-2012 / 13:33:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
861 |
! |
|
862 |
||
863 |
doMergeCurrentUsingA |
|
864 |
||
865 |
| interval | |
|
866 |
interval := mergeService sectionInterval. |
|
867 |
interval notNil ifTrue:[ |
|
868 |
self mergeData mergeUsingA: self textA interval: interval |
|
869 |
] |
|
870 |
||
871 |
"Created: / 30-11-2012 / 13:33:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
872 |
! |
|
873 |
||
874 |
doMergeCurrentUsingB |
|
875 |
||
876 |
| interval | |
|
877 |
interval := mergeService sectionInterval. |
|
878 |
interval notNil ifTrue:[ |
|
879 |
self mergeData mergeUsingB: self textB interval: interval |
|
880 |
] |
|
881 |
||
882 |
"Created: / 30-11-2012 / 13:33:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
883 |
! |
|
884 |
||
885 |
doMergeCurrentUsingBase |
|
886 |
||
887 |
| interval | |
|
888 |
interval := mergeService sectionInterval. |
|
889 |
interval notNil ifTrue:[ |
|
890 |
self mergeData mergeUsingBase: self textC interval: interval |
|
891 |
] |
|
892 |
||
893 |
"Created: / 30-11-2012 / 13:34:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
894 |
! ! |
|
895 |
||
896 |
!TextDiff3Tool methodsFor:'testing'! |
|
897 |
||
898 |
isDiff3 |
|
899 |
^true |
|
900 |
||
901 |
"Created: / 16-03-2012 / 15:21:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
902 |
! |
|
903 |
||
904 |
isMerge |
|
905 |
||
906 |
^self mergeHolder value |
|
907 |
||
908 |
"Created: / 19-03-2012 / 11:53:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
909 |
! ! |
|
910 |
||
911 |
!TextDiff3Tool::MergeService class methodsFor:'accessing'! |
|
912 |
||
913 |
label |
|
914 |
"Answers short label - for UI" |
|
915 |
||
916 |
^'Merge Support Service' |
|
917 |
||
918 |
"Created: / 19-03-2012 / 11:48:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
919 |
! ! |
|
920 |
||
921 |
!TextDiff3Tool::MergeService class methodsFor:'queries'! |
|
922 |
||
923 |
isUsefulFor:aCodeView |
|
924 |
"this filters useful services. |
|
925 |
must be redefined to return true in subclasses (but each class must do it only |
|
926 |
for itself - not for subclasses" |
|
927 |
||
928 |
^ self == Tools::TextDiff3Tool::MergeService |
|
929 |
||
930 |
"Created: / 23-08-2013 / 10:56:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
931 |
! ! |
|
932 |
||
933 |
!TextDiff3Tool::MergeService class methodsFor:'testing'! |
|
934 |
||
935 |
isAvailable |
|
936 |
||
937 |
^false "/Should be installed explicitly" |
|
938 |
||
939 |
"Created: / 19-03-2012 / 11:45:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
940 |
! ! |
|
941 |
||
942 |
!TextDiff3Tool::MergeService methodsFor:'accessing'! |
|
943 |
||
944 |
infoAtLine: lineNr |
|
945 |
||
946 |
data isNil ifTrue:[ ^ nil ]. |
|
947 |
^(lineNr between: 1 and: data listInfos size) ifTrue:[ |
|
948 |
data listInfos at: lineNr |
|
949 |
] ifFalse:[ |
|
950 |
nil |
|
951 |
] |
|
952 |
||
953 |
"Created: / 19-03-2012 / 13:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
954 |
"Modified: / 23-08-2013 / 11:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
955 |
! |
|
956 |
||
957 |
sectionInterval |
|
958 |
^ sectionIntervalHolder value |
|
959 |
||
960 |
"Modified: / 30-11-2012 / 13:45:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
961 |
! |
|
962 |
||
963 |
sectionInterval: anObject |
|
964 |
^ self sectionIntervalHolder value: anObject |
|
965 |
||
966 |
"Created: / 30-11-2012 / 13:45:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
967 |
"Modified: / 15-01-2013 / 11:50:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
968 |
! ! |
|
969 |
||
970 |
!TextDiff3Tool::MergeService methodsFor:'aspects'! |
|
971 |
||
972 |
dataHolder |
|
973 |
"return/create the 'dataHolder' value holder (automatically generated)" |
|
974 |
||
975 |
dataHolder isNil ifTrue:[ |
|
976 |
dataHolder := ValueHolder new. |
|
977 |
dataHolder addDependent:self. |
|
978 |
]. |
|
979 |
^ dataHolder |
|
980 |
! |
|
981 |
||
982 |
dataHolder:something |
|
983 |
"set the 'dataHolder' value holder (automatically generated)" |
|
984 |
||
985 |
|oldValue newValue| |
|
986 |
||
987 |
dataHolder notNil ifTrue:[ |
|
988 |
oldValue := dataHolder value. |
|
989 |
dataHolder removeDependent:self. |
|
990 |
]. |
|
991 |
dataHolder := something. |
|
992 |
dataHolder notNil ifTrue:[ |
|
993 |
dataHolder addDependent:self. |
|
994 |
]. |
|
995 |
newValue := dataHolder value. |
|
996 |
oldValue ~~ newValue ifTrue:[ |
|
997 |
self update:#value with:newValue from:dataHolder. |
|
998 |
]. |
|
999 |
! |
|
1000 |
||
1001 |
sectionIntervalHolder |
|
1002 |
"return/create the 'sectionIntervalHolder' value holder (automatically generated)" |
|
1003 |
||
1004 |
sectionIntervalHolder isNil ifTrue:[ |
|
1005 |
sectionIntervalHolder := ValueHolder new. |
|
1006 |
sectionIntervalHolder addDependent:self. |
|
1007 |
]. |
|
1008 |
^ sectionIntervalHolder |
|
1009 |
! |
|
1010 |
||
1011 |
sectionIntervalHolder:something |
|
1012 |
"set the 'sectionIntervalHolder' value holder (automatically generated)" |
|
1013 |
||
1014 |
|oldValue newValue| |
|
1015 |
||
1016 |
sectionIntervalHolder notNil ifTrue:[ |
|
1017 |
oldValue := sectionIntervalHolder value. |
|
1018 |
sectionIntervalHolder removeDependent:self. |
|
1019 |
]. |
|
1020 |
sectionIntervalHolder := something. |
|
1021 |
sectionIntervalHolder notNil ifTrue:[ |
|
1022 |
sectionIntervalHolder addDependent:self. |
|
1023 |
]. |
|
1024 |
newValue := sectionIntervalHolder value. |
|
1025 |
oldValue ~~ newValue ifTrue:[ |
|
1026 |
self update:#value with:newValue from:sectionIntervalHolder. |
|
1027 |
]. |
|
1028 |
! ! |
|
1029 |
||
1030 |
!TextDiff3Tool::MergeService methodsFor:'change & update'! |
|
1031 |
||
1032 |
dataChanged |
|
1033 |
"Merge data has changes, update text view" |
|
1034 |
| changed | |
|
1035 |
||
1036 |
textView isNil ifTrue:[ |
|
1037 |
^ self "/not yet registered |
|
1038 |
]. |
|
1039 |
data isNil ifTrue:[ |
|
1040 |
textView list: #(). |
|
1041 |
^self. |
|
1042 |
]. |
|
1043 |
||
1044 |
"/Collect conflicted lines" |
|
1045 |
changed := data listInfos |
|
1046 |
select:[:info|info isConflict] |
|
1047 |
thenCollect:[:info|info line]. |
|
1048 |
||
1049 |
textView changedLines: changed. |
|
1050 |
textView diffMode: true. |
|
1051 |
textView list: data list. |
|
1052 |
textView invalidate. |
|
1053 |
gutterView invalidate. |
|
1054 |
||
1055 |
"Created: / 19-03-2012 / 12:41:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1056 |
! |
|
1057 |
||
1058 |
dataHolderChanged |
|
1059 |
||
1060 |
data notNil ifTrue:[ |
|
1061 |
data removeDependent: self. |
|
1062 |
]. |
|
1063 |
data := dataHolder value. |
|
1064 |
data notNil ifTrue:[ |
|
1065 |
data addDependent: self. |
|
1066 |
]. |
|
1067 |
self sectionInterval: nil. |
|
1068 |
self dataChanged |
|
1069 |
||
1070 |
"Created: / 19-03-2012 / 11:56:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1071 |
"Modified: / 30-11-2012 / 13:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1072 |
! |
|
1073 |
||
1074 |
update:something with:aParameter from:changedObject |
|
1075 |
"Invoked when an object that I depend upon sends a change notification." |
|
1076 |
||
1077 |
"stub code automatically generated - please change as required" |
|
1078 |
||
1079 |
changedObject == dataHolder ifTrue:[ |
|
1080 |
self dataHolderChanged. |
|
1081 |
^ self. |
|
1082 |
]. |
|
1083 |
changedObject == data ifTrue:[ |
|
1084 |
self dataChanged. |
|
1085 |
^ self. |
|
1086 |
]. |
|
1087 |
||
1088 |
changedObject == sectionIntervalHolder ifTrue:[ |
|
1089 |
gutterView invalidate. |
|
1090 |
^self |
|
1091 |
]. |
|
1092 |
super update:something with:aParameter from:changedObject |
|
1093 |
||
1094 |
"Modified: / 30-11-2012 / 13:45:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1095 |
! |
|
1096 |
||
1097 |
updateSelection: lineNr |
|
1098 |
"For given number, update sectionInterval" |
|
1099 |
||
1100 |
| conflict | |
|
1101 |
lineNr notNil ifTrue:[ |
|
1102 |
conflict := (self infoAtLine: lineNr) conflict. |
|
1103 |
]. |
|
1104 |
lineNr isNil"conflict isNil" ifTrue:[ |
|
1105 |
self sectionInterval: nil |
|
1106 |
] ifFalse:[ |
|
1107 |
| start stop i | |
|
1108 |
i := lineNr - 1. |
|
1109 |
[ i > 0 and:[ (self infoAtLine: i) conflict == conflict ]] |
|
1110 |
whileTrue:[ i := i - 1 ]. |
|
1111 |
start := i + 1. |
|
1112 |
i := lineNr + 1. |
|
1113 |
[ i < (data listInfos size) and:[ (self infoAtLine: i) conflict == conflict ]] |
|
1114 |
whileTrue:[ i := i + 1 ]. |
|
1115 |
stop := i - 1. |
|
1116 |
self sectionInterval: (start to: stop). |
|
1117 |
]. |
|
1118 |
gutterView invalidate. |
|
1119 |
||
1120 |
"Created: / 03-04-2012 / 19:29:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1121 |
"Modified: / 30-11-2012 / 13:45:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1122 |
! ! |
|
1123 |
||
1124 |
!TextDiff3Tool::MergeService methodsFor:'drawing'! |
|
1125 |
||
16603 | 1126 |
drawLine:lineNo in:view atX:x y:yBaseline width:w height:hFont ascent:aFont |
1127 |
from:startCol to:endColOrNil with:fg and:bg |
|
13794 | 1128 |
"Called by both gutterView and textView (well, not yet) to |
1129 |
allow services to draw custom things on text view. |
|
1130 |
Ask JV what the args means if unsure (I'm lazy to document |
|
1131 |
them, now it is just an experiment...)" |
|
1132 |
||
1133 |
| info color sectionInterval | |
|
1134 |
||
1135 |
sectionInterval := self sectionInterval. |
|
1136 |
view == gutterView ifFalse:[ ^ self ]. |
|
16603 | 1137 |
|
13794 | 1138 |
info := self infoAtLine: lineNo. |
1139 |
info notNil ifTrue:[ |
|
1140 |
color := info color. |
|
1141 |
color notNil ifTrue:[ |
|
16603 | 1142 |
view fillRectangleX:x y:yBaseline - hFont |
1143 |
width:8 |
|
1144 |
height:hFont + textView lineSpacing + 5"Magic constant to make it look nicer" |
|
1145 |
color:color. |
|
13794 | 1146 |
]. |
1147 |
]. |
|
1148 |
||
1149 |
(sectionInterval notNil and:[sectionInterval includes: lineNo]) ifTrue:[ |
|
16603 | 1150 |
"Drawing outside annotation area is not nice, but..." |
1151 |
view fillRectangleX:view width - 7 y:yBaseline - hFont |
|
1152 |
width:4 |
|
1153 |
height:hFont + textView lineSpacing + 5"Magic constant to make it look nicer" |
|
1154 |
color:(Color gray). |
|
13794 | 1155 |
] |
1156 |
||
1157 |
"Created: / 19-03-2012 / 13:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1158 |
"Modified: / 30-11-2012 / 13:46:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1159 |
! ! |
|
1160 |
||
1161 |
!TextDiff3Tool::MergeService methodsFor:'event handling'! |
|
1162 |
||
1163 |
buttonPress: button x:x y:y in: view |
|
1164 |
||
1165 |
"Handles an event in given view (a subview of codeView). |
|
1166 |
If the method returns true, it has eaten the event and it will not be processed |
|
1167 |
by the view." |
|
1168 |
||
1169 |
|lineNr| |
|
1170 |
||
1171 |
view == gutterView ifFalse:[ ^ false ]. |
|
1172 |
button == 1 ifFalse:[ ^ false ]. |
|
1173 |
||
1174 |
self updateSelection: (textView yVisibleToLineNr:y). |
|
1175 |
||
1176 |
||
1177 |
^false |
|
1178 |
||
1179 |
"Created: / 03-04-2012 / 19:23:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1180 |
! |
|
1181 |
||
1182 |
linesModifiedFrom: start to: end |
|
1183 |
||
1184 |
start to: end do:[:i| |
|
1185 |
(data listInfos at:i) resolution: #Merged. |
|
1186 |
]. |
|
1187 |
gutterView invalidate. |
|
1188 |
||
1189 |
"Created: / 06-07-2011 / 17:14:36 / jv" |
|
1190 |
"Created: / 20-03-2012 / 22:57:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1191 |
! ! |
|
1192 |
||
1193 |
!TextDiff3Tool::MergeService methodsFor:'registering'! |
|
1194 |
||
1195 |
registerIn: aCodeView |
|
1196 |
||
1197 |
"Installs myself in aCodeView" |
|
1198 |
||
1199 |
super registerIn: aCodeView. |
|
1200 |
self dataChanged. |
|
1201 |
||
1202 |
"Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1203 |
"Created: / 19-03-2012 / 12:52:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1204 |
! ! |
|
1205 |
||
1206 |
!TextDiff3Tool class methodsFor:'documentation'! |
|
1207 |
||
14039
82567b14e97b
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13794
diff
changeset
|
1208 |
version |
15722
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
1209 |
^ '$Header$' |
14039
82567b14e97b
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13794
diff
changeset
|
1210 |
! |
82567b14e97b
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13794
diff
changeset
|
1211 |
|
82567b14e97b
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13794
diff
changeset
|
1212 |
version_CVS |
15722
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
1213 |
^ '$Header$' |
14039
82567b14e97b
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13794
diff
changeset
|
1214 |
! |
82567b14e97b
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13794
diff
changeset
|
1215 |
|
13794 | 1216 |
version_HG |
1217 |
||
1218 |
^ '$Changeset: <not expanded> $' |
|
1219 |
! |
|
1220 |
||
1221 |
version_SVN |
|
15722
34b4f50c2083
class: Tools::TextDiff3Tool
Claus Gittinger <cg@exept.de>
parents:
14039
diff
changeset
|
1222 |
^ '$Id$' |
13794 | 1223 |
! ! |
1224 |