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 |
|
|
268 |
!MergeViewApp class methodsFor:'plugIn spec'!
|
|
269 |
|
|
270 |
aspectSelectors
|
|
271 |
"This resource specification was automatically generated
|
|
272 |
by the UIPainter of ST/X."
|
|
273 |
|
|
274 |
"Do not manually edit this. If it is corrupted,
|
|
275 |
the UIPainter may not be able to read the specification."
|
|
276 |
|
|
277 |
"Return a description of exported aspects;
|
|
278 |
these can be connected to aspects of an embedding application
|
|
279 |
(if this app is embedded in a subCanvas)."
|
|
280 |
|
|
281 |
^ #(
|
|
282 |
#diffHolder
|
|
283 |
).
|
|
284 |
|
|
285 |
! !
|
|
286 |
|
|
287 |
!MergeViewApp methodsFor:'aspects'!
|
|
288 |
|
|
289 |
mergeHolder
|
|
290 |
mergeHolder ifNil:
|
|
291 |
[mergeHolder := ValueHolder new].
|
|
292 |
^mergeHolder
|
|
293 |
|
|
294 |
"Modified: / 23-11-2009 / 22:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
295 |
!
|
|
296 |
|
|
297 |
versionMergedLabelAspect
|
|
298 |
<resource: #uiAspect>
|
|
299 |
|
|
300 |
| holder |
|
|
301 |
|
|
302 |
(holder := builder bindingAt:#versionMergedLabelAspect) isNil ifTrue:[
|
|
303 |
holder := (AspectAdaptor forAspect: #versionMergedLabel)
|
|
304 |
subjectChannel: self diffHolder.
|
|
305 |
builder aspectAt:#versionMergedLabelAspect put:holder.
|
|
306 |
].
|
|
307 |
^ holder.
|
|
308 |
! !
|
|
309 |
|
|
310 |
!MergeViewApp methodsFor:'callbacks'!
|
|
311 |
|
|
312 |
mergeAccepted
|
|
313 |
|
|
314 |
self diffHolder value versionMerged source:
|
|
315 |
self mergeHolder value.
|
|
316 |
self updateResolution
|
|
317 |
|
|
318 |
"Created: / 24-11-2009 / 12:21:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
319 |
! !
|
|
320 |
|
|
321 |
!MergeViewApp methodsFor:'change & update'!
|
|
322 |
|
|
323 |
diffChanged
|
|
324 |
|
|
325 |
diff ifNotNil:[diff removeDependent: self].
|
|
326 |
diff := self diffitem.
|
|
327 |
diff ifNotNil:[diff addDependent: self].
|
|
328 |
|
|
329 |
super diffChanged.
|
|
330 |
self resolutionChanged
|
|
331 |
|
|
332 |
"Created: / 23-11-2009 / 22:13:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
333 |
"Modified: / 24-11-2009 / 07:13:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
334 |
!
|
|
335 |
|
|
336 |
resolutionChanged
|
|
337 |
|
|
338 |
| source |
|
|
339 |
source := diff
|
|
340 |
ifNil:
|
|
341 |
['']
|
|
342 |
ifNotNil:
|
|
343 |
[diff merged
|
|
344 |
ifTrue:[diff versionMerged source]
|
|
345 |
ifFalse:['<Merge Conflict>' asText colorizeAllWith:Color red]].
|
|
346 |
self mergeHolder value: source.
|
|
347 |
self versionMergedLabelAspect changed: #value
|
|
348 |
|
|
349 |
"Created: / 24-11-2009 / 09:48:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
350 |
"Modified: / 24-11-2009 / 13:01:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
351 |
!
|
|
352 |
|
|
353 |
update: aspect with: param from: sender
|
|
354 |
|
|
355 |
aspect == #resolution ifTrue:[^self resolutionChanged].
|
|
356 |
^super update: aspect with: param from: sender
|
|
357 |
! !
|
|
358 |
|
|
359 |
!MergeViewApp methodsFor:'menu actions'!
|
|
360 |
|
|
361 |
mergeMenuInspect
|
|
362 |
|
|
363 |
diff inspect
|
|
364 |
!
|
|
365 |
|
|
366 |
mergeMenuOpen
|
|
367 |
|
|
368 |
(Menu decodeFromLiteralArray: (self menuFor: #mergeMenu))
|
|
369 |
receiver: self;
|
|
370 |
startUp
|
|
371 |
!
|
|
372 |
|
|
373 |
mergeMenuUseExternalTool
|
|
374 |
|externalMerge |
|
|
375 |
|
|
376 |
|
|
377 |
externalMerge := KDiff3 new.
|
|
378 |
externalMerge
|
|
379 |
labelA:diff versionBaseLabel;
|
|
380 |
textA:diff versionBase source;
|
|
381 |
labelB:diff versionBLabel;
|
|
382 |
textB:diff versionB source;
|
|
383 |
labelC:diff versionALabel;
|
|
384 |
textC:diff versionA source.
|
|
385 |
externalMerge merge.
|
|
386 |
externalMerge textMerged ifNotNil:
|
|
387 |
[diff versionMerged:(diff versionAorB copy source:externalMerge textMerged)]
|
|
388 |
!
|
|
389 |
|
|
390 |
mergeMenuUseNone
|
|
391 |
|
|
392 |
diff versionMerged: nil
|
|
393 |
!
|
|
394 |
|
|
395 |
mergeMenuUseVersionA
|
|
396 |
|
|
397 |
diff versionMerged: diff versionA copy
|
|
398 |
!
|
|
399 |
|
|
400 |
mergeMenuUseVersionB
|
|
401 |
|
|
402 |
diff versionMerged: diff versionB copy
|
|
403 |
!
|
|
404 |
|
|
405 |
mergeMenuUseVersionBase
|
|
406 |
|
|
407 |
diff versionMerged: diff versionBase copy
|
|
408 |
! !
|
|
409 |
|
|
410 |
!MergeViewApp methodsFor:'private'!
|
|
411 |
|
|
412 |
resolutionListEntryFor: change label: label
|
|
413 |
|
|
414 |
^LabelAndIcon new
|
|
415 |
model: change;
|
|
416 |
string: label
|
|
417 |
|
|
418 |
"Created: / 24-11-2009 / 07:16:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
419 |
! !
|
|
420 |
|
|
421 |
!MergeViewApp class methodsFor:'documentation'!
|
|
422 |
|
|
423 |
version
|
|
424 |
^ '$Header$'
|
|
425 |
!
|
|
426 |
|
|
427 |
version_CVS
|
|
428 |
^ '$Header$'
|
|
429 |
!
|
|
430 |
|
|
431 |
version_SVN
|
|
432 |
^ '§Id: SVN__MergeViewApp.st 350 2011-07-07 18:42:56Z vranyj1 §'
|
|
433 |
! !
|