author | Claus Gittinger <cg@exept.de> |
Tue, 16 Jan 2018 22:26:58 +0100 | |
changeset 1183 | 8af078552bae |
parent 898 | 644218968740 |
permissions | -rw-r--r-- |
645 | 1 |
" |
2 |
Copyright (c) 2007-2010 Jan Vrany |
|
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
4 |
||
5 |
Permission is hereby granted, free of charge, to any person |
|
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
25 |
" |
|
26 |
"{ Package: 'stx:libsvn' }" |
|
27 |
||
28 |
"{ NameSpace: SVN }" |
|
29 |
||
30 |
DiffViewApp subclass:#MergeViewApp |
|
31 |
instanceVariableNames:'mergeHolder diff' |
|
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'SVN-UI-Browsers-Diff' |
|
35 |
! |
|
36 |
||
37 |
!MergeViewApp class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
41 |
Copyright (c) 2007-2010 Jan Vrany |
|
42 |
Copyright (c) 2009-2010 eXept Software AG |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
52 |
||
53 |
The above copyright notice and this permission notice shall be |
|
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
64 |
||
65 |
" |
|
66 |
! ! |
|
67 |
||
68 |
!MergeViewApp class methodsFor:'interface specs'! |
|
69 |
||
70 |
diffSpec_Merge |
|
71 |
"This resource specification was automatically generated |
|
72 |
by the UIPainter of ST/X." |
|
73 |
||
74 |
"Do not manually edit this!! If it is corrupted, |
|
75 |
the UIPainter may not be able to read the specification." |
|
76 |
||
77 |
" |
|
78 |
UIPainter new openOnClass:SVN::MergeViewApp andSelector:#diffSpec_Merge |
|
79 |
SVN::MergeViewApp new openInterface:#diffSpec_Merge |
|
80 |
" |
|
81 |
||
82 |
<resource: #canvas> |
|
83 |
||
84 |
^ |
|
85 |
#(FullSpec |
|
86 |
name: #'diffSpec_Merge' |
|
87 |
window: |
|
88 |
(WindowSpec |
|
89 |
label: 'Merge view' |
|
90 |
name: 'Merge view' |
|
91 |
min: (Point 10 10) |
|
92 |
bounds: (Rectangle 0 0 782 506) |
|
93 |
) |
|
94 |
component: |
|
95 |
(SpecCollection |
|
96 |
collection: ( |
|
97 |
(VariableVerticalPanelSpec |
|
98 |
name: 'DiffAndMergePanel' |
|
99 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
100 |
component: |
|
101 |
(SpecCollection |
|
102 |
collection: ( |
|
103 |
(UISubSpecification |
|
104 |
name: 'DiffView' |
|
105 |
minorKey: #'diffSpec_ThreeWay' |
|
106 |
) |
|
107 |
(TransparentBoxSpec |
|
108 |
name: 'MergeView' |
|
109 |
component: |
|
110 |
(SpecCollection |
|
111 |
collection: ( |
|
112 |
(UISubSpecification |
|
113 |
name: 'MergeLabel' |
|
114 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
115 |
minorKey: versionMergedLabelSpec |
|
116 |
) |
|
117 |
(TextEditorSpec |
|
118 |
name: 'MergeCode' |
|
119 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
|
120 |
model: mergeHolder |
|
121 |
hasHorizontalScrollBar: true |
|
122 |
hasVerticalScrollBar: true |
|
123 |
acceptCallBack: mergeAccepted |
|
124 |
hasKeyboardFocusInitially: false |
|
125 |
) |
|
126 |
) |
|
127 |
||
128 |
) |
|
129 |
) |
|
130 |
) |
|
131 |
||
132 |
) |
|
133 |
handles: (Any 0.5 1.0) |
|
134 |
) |
|
135 |
) |
|
136 |
||
137 |
) |
|
138 |
) |
|
139 |
! ! |
|
140 |
||
141 |
!MergeViewApp class methodsFor:'interface specs - labels'! |
|
142 |
||
143 |
versionMergedLabelSpec |
|
144 |
"This resource specification was automatically generated |
|
145 |
by the UIPainter of ST/X." |
|
146 |
||
147 |
"Do not manually edit this!! If it is corrupted, |
|
148 |
the UIPainter may not be able to read the specification." |
|
149 |
||
150 |
" |
|
151 |
UIPainter new openOnClass:SVN::MergeViewApp andSelector:#versionMergedLabelSpec |
|
152 |
SVN::MergeViewApp new openInterface:#versionMergedLabelSpec |
|
153 |
" |
|
154 |
||
155 |
<resource: #canvas> |
|
156 |
||
157 |
^ |
|
158 |
#(FullSpec |
|
159 |
name: versionMergedLabelSpec |
|
160 |
window: |
|
161 |
(WindowSpec |
|
162 |
label: 'Version Merge' |
|
163 |
name: 'Version Merge' |
|
164 |
min: (Point 10 10) |
|
165 |
bounds: (Rectangle 0 0 592 30) |
|
166 |
) |
|
167 |
component: |
|
168 |
(SpecCollection |
|
169 |
collection: ( |
|
170 |
(LabelSpec |
|
171 |
name: 'ResolveLabel' |
|
172 |
layout: (LayoutFrame 105 0 5 0 300 0 0 1) |
|
173 |
labelChannel: versionMergedLabelAspect |
|
174 |
adjust: left |
|
175 |
) |
|
176 |
(LabelSpec |
|
177 |
label: 'sphereGray24x24' |
|
178 |
name: 'VersionAIcon' |
|
179 |
layout: (LayoutFrame 0 0 -12 0.5 27 0 12 0.5) |
|
180 |
hasCharacterOrientedLabel: false |
|
181 |
translateLabel: true |
|
182 |
) |
|
183 |
(LabelSpec |
|
184 |
label: 'Resolution:' |
|
185 |
name: 'ResolutionLabel' |
|
186 |
layout: (LayoutFrame 30 0 5 0 100 0 0 1.0) |
|
187 |
translateLabel: true |
|
188 |
adjust: right |
|
189 |
) |
|
190 |
(ActionButtonSpec |
|
191 |
label: 'Resolve' |
|
192 |
name: 'Resolve' |
|
193 |
layout: (LayoutFrame -200 1 5 0 -5 1 -5 1) |
|
194 |
translateLabel: true |
|
195 |
model: mergeMenuOpen |
|
196 |
) |
|
197 |
) |
|
198 |
||
199 |
) |
|
200 |
) |
|
201 |
! ! |
|
202 |
||
203 |
!MergeViewApp class methodsFor:'menu specs'! |
|
204 |
||
205 |
mergeMenu |
|
206 |
"This resource specification was automatically generated |
|
207 |
by the MenuEditor of ST/X." |
|
208 |
||
209 |
"Do not manually edit this!! If it is corrupted, |
|
210 |
the MenuEditor may not be able to read the specification." |
|
211 |
||
212 |
" |
|
213 |
MenuEditor new openOnClass:SVN::MergeViewApp andSelector:#mergeMenu |
|
214 |
(Menu new fromLiteralArrayEncoding:(SVN::MergeViewApp mergeMenu)) startUp |
|
215 |
" |
|
216 |
||
217 |
<resource: #menu> |
|
218 |
||
219 |
^ |
|
220 |
#(Menu |
|
221 |
( |
|
222 |
(MenuItem |
|
223 |
label: 'Unresolve' |
|
224 |
itemValue: mergeMenuUseNone |
|
225 |
translateLabel: true |
|
226 |
) |
|
227 |
(MenuItem |
|
228 |
label: 'Resolve using A' |
|
229 |
itemValue: mergeMenuUseB |
|
230 |
nameKey: ResolveUsingA |
|
231 |
translateLabel: true |
|
232 |
labelImage: (ResourceRetriever #'SVN::IconLibrary' versionA16x16 'Resolve using A') |
|
233 |
) |
|
234 |
(MenuItem |
|
235 |
label: 'Resolve using B' |
|
236 |
itemValue: mergeMenuUseB |
|
237 |
nameKey: ResolveUsingB |
|
238 |
translateLabel: true |
|
239 |
labelImage: (ResourceRetriever #'SVN::IconLibrary' versionB16x16 'Resolve using B') |
|
240 |
) |
|
241 |
(MenuItem |
|
242 |
label: 'Resolve using Base' |
|
243 |
itemValue: mergeMenuUseBase |
|
244 |
nameKey: ResolveUsingBase |
|
245 |
translateLabel: true |
|
246 |
labelImage: (ResourceRetriever #'SVN::IconLibrary' versionBase16x16 'Resolve using Base') |
|
247 |
) |
|
248 |
(MenuItem |
|
249 |
label: 'Resolve using external tool' |
|
250 |
itemValue: mergeMenuUseExternalTool |
|
251 |
translateLabel: true |
|
252 |
) |
|
253 |
(MenuItem |
|
254 |
label: '-' |
|
255 |
) |
|
256 |
(MenuItem |
|
257 |
enabled: hasSelection |
|
258 |
label: 'Inspect' |
|
259 |
itemValue: mergeMenuInspect |
|
260 |
translateLabel: true |
|
261 |
) |
|
262 |
) |
|
263 |
nil |
|
264 |
nil |
|
265 |
) |
|
266 |
! ! |
|
267 |
||
898
644218968740
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
645
diff
changeset
|
268 |
!MergeViewApp class methodsFor:'others'! |
644218968740
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
645
diff
changeset
|
269 |
|
644218968740
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
645
diff
changeset
|
270 |
version_CVS |
644218968740
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
645
diff
changeset
|
271 |
^ '$Header$' |
644218968740
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
645
diff
changeset
|
272 |
! ! |
644218968740
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
645
diff
changeset
|
273 |
|
645 | 274 |
!MergeViewApp class methodsFor:'plugIn spec'! |
275 |
||
276 |
aspectSelectors |
|
277 |
"This resource specification was automatically generated |
|
278 |
by the UIPainter of ST/X." |
|
279 |
||
280 |
"Do not manually edit this. If it is corrupted, |
|
281 |
the UIPainter may not be able to read the specification." |
|
282 |
||
283 |
"Return a description of exported aspects; |
|
284 |
these can be connected to aspects of an embedding application |
|
285 |
(if this app is embedded in a subCanvas)." |
|
286 |
||
287 |
^ #( |
|
288 |
#diffHolder |
|
289 |
). |
|
290 |
||
291 |
! ! |
|
292 |
||
293 |
!MergeViewApp methodsFor:'aspects'! |
|
294 |
||
295 |
mergeHolder |
|
296 |
mergeHolder ifNil: |
|
297 |
[mergeHolder := ValueHolder new]. |
|
298 |
^mergeHolder |
|
299 |
||
300 |
"Modified: / 23-11-2009 / 22:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
301 |
! |
|
302 |
||
303 |
versionMergedLabelAspect |
|
304 |
<resource: #uiAspect> |
|
305 |
||
306 |
| holder | |
|
307 |
||
308 |
(holder := builder bindingAt:#versionMergedLabelAspect) isNil ifTrue:[ |
|
309 |
holder := (AspectAdaptor forAspect: #versionMergedLabel) |
|
310 |
subjectChannel: self diffHolder. |
|
311 |
builder aspectAt:#versionMergedLabelAspect put:holder. |
|
312 |
]. |
|
313 |
^ holder. |
|
314 |
! ! |
|
315 |
||
316 |
!MergeViewApp methodsFor:'callbacks'! |
|
317 |
||
318 |
mergeAccepted |
|
319 |
||
320 |
self diffHolder value versionMerged source: |
|
321 |
self mergeHolder value. |
|
322 |
self updateResolution |
|
323 |
||
324 |
"Created: / 24-11-2009 / 12:21:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
325 |
! ! |
|
326 |
||
327 |
!MergeViewApp methodsFor:'change & update'! |
|
328 |
||
329 |
diffChanged |
|
330 |
||
331 |
diff ifNotNil:[diff removeDependent: self]. |
|
332 |
diff := self diffitem. |
|
333 |
diff ifNotNil:[diff addDependent: self]. |
|
334 |
||
335 |
super diffChanged. |
|
336 |
self resolutionChanged |
|
337 |
||
338 |
"Created: / 23-11-2009 / 22:13:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
339 |
"Modified: / 24-11-2009 / 07:13:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
340 |
! |
|
341 |
||
342 |
resolutionChanged |
|
343 |
||
344 |
| source | |
|
345 |
source := diff |
|
346 |
ifNil: |
|
347 |
[''] |
|
348 |
ifNotNil: |
|
349 |
[diff merged |
|
350 |
ifTrue:[diff versionMerged source] |
|
351 |
ifFalse:['<Merge Conflict>' asText colorizeAllWith:Color red]]. |
|
352 |
self mergeHolder value: source. |
|
353 |
self versionMergedLabelAspect changed: #value |
|
354 |
||
355 |
"Created: / 24-11-2009 / 09:48:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
356 |
"Modified: / 24-11-2009 / 13:01:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
357 |
! |
|
358 |
||
359 |
update: aspect with: param from: sender |
|
360 |
||
361 |
aspect == #resolution ifTrue:[^self resolutionChanged]. |
|
362 |
^super update: aspect with: param from: sender |
|
363 |
! ! |
|
364 |
||
365 |
!MergeViewApp methodsFor:'menu actions'! |
|
366 |
||
367 |
mergeMenuInspect |
|
368 |
||
369 |
diff inspect |
|
370 |
! |
|
371 |
||
372 |
mergeMenuOpen |
|
373 |
||
374 |
(Menu decodeFromLiteralArray: (self menuFor: #mergeMenu)) |
|
375 |
receiver: self; |
|
376 |
startUp |
|
377 |
! |
|
378 |
||
379 |
mergeMenuUseExternalTool |
|
380 |
|externalMerge | |
|
381 |
||
382 |
||
383 |
externalMerge := KDiff3 new. |
|
384 |
externalMerge |
|
385 |
labelA:diff versionBaseLabel; |
|
386 |
textA:diff versionBase source; |
|
387 |
labelB:diff versionBLabel; |
|
388 |
textB:diff versionB source; |
|
389 |
labelC:diff versionALabel; |
|
390 |
textC:diff versionA source. |
|
391 |
externalMerge merge. |
|
392 |
externalMerge textMerged ifNotNil: |
|
393 |
[diff versionMerged:(diff versionAorB copy source:externalMerge textMerged)] |
|
394 |
! |
|
395 |
||
396 |
mergeMenuUseNone |
|
397 |
||
398 |
diff versionMerged: nil |
|
399 |
! |
|
400 |
||
401 |
mergeMenuUseVersionA |
|
402 |
||
403 |
diff versionMerged: diff versionA copy |
|
404 |
! |
|
405 |
||
406 |
mergeMenuUseVersionB |
|
407 |
||
408 |
diff versionMerged: diff versionB copy |
|
409 |
! |
|
410 |
||
411 |
mergeMenuUseVersionBase |
|
412 |
||
413 |
diff versionMerged: diff versionBase copy |
|
414 |
! ! |
|
415 |
||
416 |
!MergeViewApp methodsFor:'private'! |
|
417 |
||
418 |
resolutionListEntryFor: change label: label |
|
419 |
||
420 |
^LabelAndIcon new |
|
421 |
model: change; |
|
422 |
string: label |
|
423 |
||
424 |
"Created: / 24-11-2009 / 07:16:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
425 |
! ! |
|
426 |
||
427 |
!MergeViewApp class methodsFor:'documentation'! |
|
428 |
||
429 |
version |
|
430 |
^ '$Header$' |
|
431 |
! |
|
432 |
||
433 |
version_SVN |
|
898
644218968740
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
645
diff
changeset
|
434 |
^ '§Id: SVN__MergeViewApp.st 363 2011-08-08 13:49:48Z vranyj1 §' |
645 | 435 |
! ! |