blob: b04da1a0f90d4fc25f15b860341aabbbda095915 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*******************************************************************************
* Copyright (c) 2006, 2011 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.infra.emf.compare.merger;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.compare.diff.merge.DefaultMerger;
import org.eclipse.emf.compare.diff.merge.service.MergeService;
import org.eclipse.emf.compare.diff.metamodel.DiffElement;
/**
* This merger will handle DiffGroup merging by recursively create mergers on each of its contents.
*
* @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
*/
public class DiffGroupMerger extends DefaultMerger {
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.compare.diff.merge.DefaultMerger#applyInOrigin()
*/
@Override
public void applyInOrigin() {
// Creates a temporary list to avoid ConcurentModificationExceptions
final List<DiffElement> subDiffs = new ArrayList<DiffElement>(diff.getSubDiffElements());
MergeService.merge(subDiffs, false);
}
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.compare.diff.merge.DefaultMerger#undoInTarget()
*/
@Override
public void undoInTarget() {
// Creates a temporary list to avoid ConcurentModificationExceptions
final List<DiffElement> subDiffs = new ArrayList<DiffElement>(diff.getSubDiffElements());
MergeService.merge(subDiffs, true);
}
}
|