Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java82
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java43
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EObjectContentMergeViewer.java23
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/provider/SingleAttributeChangeNode.java39
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/AbstractEDiffNode.java1
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/provider/AttributeChangeNode.java6
-rw-r--r--plugins/org.eclipse.emf.compare.tests/model/nodes.ecore111
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java18
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java12
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_left.nodes10
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_origin.nodes14
-rw-r--r--plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_right.nodes13
12 files changed, 281 insertions, 91 deletions
diff --git a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java
index 5a5b8768f..843d2b661 100644
--- a/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java
+++ b/plugins/org.eclipse.emf.compare.edit/src/org/eclipse/emf/compare/provider/spec/MatchItemProviderSpec.java
@@ -10,18 +10,23 @@
*******************************************************************************/
package org.eclipse.emf.compare.provider.spec;
+import static com.google.common.base.Predicates.alwaysTrue;
import static com.google.common.base.Predicates.and;
import static com.google.common.base.Predicates.not;
import static com.google.common.collect.Iterables.concat;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.isEmpty;
+import static com.google.common.collect.Lists.newArrayList;
import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.compare.Conflict;
import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.compare.Diff;
@@ -73,7 +78,7 @@ public class MatchItemProviderSpec extends MatchItemProvider {
}
};
- static final Predicate<Diff> CONTAINMENT_REFERENCE_DIFF = new Predicate<Diff>() {
+ static final Predicate<Diff> CONTAINMENT_REFERENCE_CHANGE = new Predicate<Diff>() {
public boolean apply(Diff input) {
if (input instanceof ReferenceChange) {
ReferenceChange referenceChange = (ReferenceChange)input;
@@ -93,8 +98,9 @@ public class MatchItemProviderSpec extends MatchItemProvider {
/**
*
*/
- private static final Predicate<Diff> DIFF_TO_DISPLAY = and(CONFLICTUAL_DIFF_TO_DISPLAY,
- not(CONTAINMENT_REFERENCE_DIFF));
+ private static final Predicate<Diff> DIFF_TO_DISPLAY = alwaysTrue();
+
+ // and(CONFLICTUAL_DIFF_TO_DISPLAY, not(CONTAINMENT_REFERENCE_CHANGE));
/**
*
@@ -158,7 +164,7 @@ public class MatchItemProviderSpec extends MatchItemProvider {
ret = super.getText(object);
}
- return ret;
+ return "M " + ret;
}
/**
@@ -168,7 +174,68 @@ public class MatchItemProviderSpec extends MatchItemProvider {
*/
@Override
public Collection<?> getChildren(Object object) {
- return ImmutableList.copyOf(getChildrenIterable((Match)object));
+ Match match = (Match)object;
+ List<EObject> sub = containmentDifferences(match);
+ Collection<?> children = super.getChildren(object);
+ for (Object child : children) {
+ if (!(child instanceof ReferenceChange)
+ || !((ReferenceChange)child).getReference().isContainment()) {
+ sub.add((EObject)child);
+ }
+ }
+ Iterator<EObject> it = sub.iterator();
+ List<EObject> newSub = newArrayList();
+ while (it.hasNext()) {
+ EObject eObject = it.next();
+ if (eObject instanceof Match) {
+ if (isEmpty(((Match)eObject).getAllDifferences())
+ && containmentDifferences((Match)eObject).isEmpty()) {
+ it.remove();
+ }
+
+ if (containmentDifferences((Match)eObject).size() == 1) {
+ it.remove();
+ newSub.add(containmentDifferences((Match)eObject).iterator().next());
+ }
+ }
+ }
+ ArrayList<EObject> ret = newArrayList(concat(sub, newSub));
+
+ Iterator<EObject> retIt = ret.iterator();
+ while (retIt.hasNext()) {
+ EObject eObject = retIt.next();
+ if (eObject instanceof Diff) {
+ if (((Diff)eObject).getConflict() != null) {
+ if (((Diff)eObject).getConflict().getKind() == ConflictKind.PSEUDO) {
+
+ }
+ }
+ }
+ }
+
+ return ret;
+ // return ImmutableList.copyOf(getChildrenIterable((Match)object));
+ }
+
+ private static List<EObject> containmentDifferences(Match match) {
+ EObject eContainer = match.eContainer();
+ List<EObject> ret = newArrayList();
+ if (eContainer instanceof Match) {
+ EList<Diff> differences = ((Match)eContainer).getDifferences();
+ Iterable<Diff> containmentReferenceChanges = filter(differences, CONTAINMENT_REFERENCE_CHANGE);
+
+ for (Diff containmentReferenceChange : containmentReferenceChanges) {
+ EObject value = ((ReferenceChange)containmentReferenceChange).getValue();
+ if (value == match.getLeft()) {
+ ret.add(containmentReferenceChange);
+ } else if (value == match.getRight()) {
+ ret.add(containmentReferenceChange);
+ } else if (value == match.getOrigin()) {
+ ret.add(containmentReferenceChange);
+ }
+ }
+ }
+ return ret;
}
/**
@@ -195,6 +262,7 @@ public class MatchItemProviderSpec extends MatchItemProvider {
*/
@Override
public boolean hasChildren(Object object) {
- return !isEmpty(getChildrenIterable((Match)object));
+ return !getChildren(object).isEmpty();
+ // return !isEmpty(getChildrenIterable((Match)object));
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
index 149c6ece4..c69eec4fa 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
@@ -563,30 +563,33 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
IStructuredSelection selection = (IStructuredSelection)event.getSelection();
Object firstElement = selection.getFirstElement();
Match match = getComparison().getMatch((EObject)firstElement);
- EObject right = match.getRight();
- EObject origin = match.getOrigin();
- if (selectionProvider == getLeft().getViewer()) {
- getRight().getViewer().setSelection(
- right == null ? StructuredSelection.EMPTY : new StructuredSelection(right), true);
- getAncestor().getViewer().setSelection(
- origin == null ? StructuredSelection.EMPTY : new StructuredSelection(origin),
- true);
- } else {
- EObject left = match.getLeft();
- if (selectionProvider == getRight().getViewer()) {
- getLeft().getViewer().setSelection(
- left == null ? StructuredSelection.EMPTY : new StructuredSelection(left),
+ if (match != null) {
+ EObject right = match.getRight();
+ EObject origin = match.getOrigin();
+ if (selectionProvider == getLeft().getViewer()) {
+ getRight().getViewer().setSelection(
+ right == null ? StructuredSelection.EMPTY : new StructuredSelection(right),
true);
getAncestor().getViewer().setSelection(
origin == null ? StructuredSelection.EMPTY : new StructuredSelection(origin),
true);
- } else if (selectionProvider == getAncestor().getViewer()) {
- getLeft().getViewer().setSelection(
- left == null ? StructuredSelection.EMPTY : new StructuredSelection(left),
- true);
- getRight().getViewer().setSelection(
- right == null ? StructuredSelection.EMPTY : new StructuredSelection(right),
- true);
+ } else {
+ EObject left = match.getLeft();
+ if (selectionProvider == getRight().getViewer()) {
+ getLeft().getViewer().setSelection(
+ left == null ? StructuredSelection.EMPTY : new StructuredSelection(left),
+ true);
+ getAncestor().getViewer().setSelection(
+ origin == null ? StructuredSelection.EMPTY : new StructuredSelection(
+ origin), true);
+ } else if (selectionProvider == getAncestor().getViewer()) {
+ getLeft().getViewer().setSelection(
+ left == null ? StructuredSelection.EMPTY : new StructuredSelection(left),
+ true);
+ getRight().getViewer().setSelection(
+ right == null ? StructuredSelection.EMPTY
+ : new StructuredSelection(right), true);
+ }
}
}
} finally {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EObjectContentMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EObjectContentMergeViewer.java
index 9fa0883ab..dd0e2d902 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EObjectContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EObjectContentMergeViewer.java
@@ -21,6 +21,7 @@ import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.ReferenceChange;
@@ -33,6 +34,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -188,7 +190,7 @@ public class EObjectContentMergeViewer extends EMFCompareContentMergeViewer {
*/
@Override
protected void copy(boolean leftToRight) {
-
+ System.out.println("EObjectContentMergeViewer.copy()");
}
/**
@@ -198,7 +200,14 @@ public class EObjectContentMergeViewer extends EMFCompareContentMergeViewer {
*/
@Override
protected void copyDiffLeftToRight() {
-
+ IStructuredSelection selection = (IStructuredSelection)getLeft().getViewer().getSelection();
+ Object firstElement = selection.getFirstElement();
+ EList<Diff> differences = getComparison().getDifferences((EObject)firstElement);
+ for (Diff diff : differences) {
+ if (diff.getSource() == DifferenceSource.LEFT) {
+ diff.copyLeftToRight();
+ }
+ }
}
/**
@@ -208,8 +217,14 @@ public class EObjectContentMergeViewer extends EMFCompareContentMergeViewer {
*/
@Override
protected void copyDiffRightToLeft() {
- // TODO Auto-generated method stub
-
+ IStructuredSelection selection = (IStructuredSelection)getRight().getViewer().getSelection();
+ Object firstElement = selection.getFirstElement();
+ EList<Diff> differences = getComparison().getDifferences((EObject)firstElement);
+ for (Diff diff : differences) {
+ if (diff.getSource() == DifferenceSource.RIGHT) {
+ diff.copyRightToLeft();
+ }
+ }
}
/**
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/provider/SingleAttributeChangeNode.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/provider/SingleAttributeChangeNode.java
index b57ab5985..6d73b1602 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/provider/SingleAttributeChangeNode.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/provider/SingleAttributeChangeNode.java
@@ -13,9 +13,11 @@ package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.provider;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import org.eclipse.compare.IEditableContent;
import org.eclipse.compare.IStreamContentAccessor;
import org.eclipse.compare.ITypedElement;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.compare.AttributeChange;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
@@ -29,7 +31,7 @@ import org.eclipse.swt.graphics.Image;
*
* @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
*/
-public class SingleAttributeChangeNode implements ITypedElement, IStreamContentAccessor {
+public class SingleAttributeChangeNode implements ITypedElement, IStreamContentAccessor, IEditableContent {
/**
* The EObject to get the value of the EAttribute from.
@@ -41,6 +43,8 @@ public class SingleAttributeChangeNode implements ITypedElement, IStreamContentA
*/
private final EAttribute fEAtribute;
+ private final AttributeChange fAttributeChange;
+
/**
* Creates a new object for the given <code>eObject</code> and <code>eAttribute</code>.
*
@@ -48,10 +52,12 @@ public class SingleAttributeChangeNode implements ITypedElement, IStreamContentA
* The EObject to get the value of the EAttribute from
* @param eAtribute
* The EAttribute to retrieve from the wrapped EObject
+ * @param attributeChange
*/
- public SingleAttributeChangeNode(EObject eObject, EAttribute eAtribute) {
+ public SingleAttributeChangeNode(EObject eObject, EAttribute eAtribute, AttributeChange attributeChange) {
this.fEObject = eObject;
this.fEAtribute = eAtribute;
+ this.fAttributeChange = attributeChange;
}
/**
@@ -93,4 +99,33 @@ public class SingleAttributeChangeNode implements ITypedElement, IStreamContentA
return new ByteArrayInputStream(stringValue.getBytes());
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.compare.IEditableContent#isEditable()
+ */
+ public boolean isEditable() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.compare.IEditableContent#setContent(byte[])
+ */
+ public void setContent(byte[] newContent) {
+ String newValue = new String(newContent);
+ System.out.println("SingleAttributeChangeNode.setContent(" + newValue + ")");
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.compare.IEditableContent#replace(org.eclipse.compare.ITypedElement,
+ * org.eclipse.compare.ITypedElement)
+ */
+ public ITypedElement replace(ITypedElement dest, ITypedElement src) {
+ throw new UnsupportedOperationException(
+ "ITypedElement SingleAttributeChangeNode#replace(ITypedElement, ITypedElement)");
+ }
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/AbstractEDiffNode.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/AbstractEDiffNode.java
index f3c716ef7..7a6cb4673 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/AbstractEDiffNode.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/AbstractEDiffNode.java
@@ -59,6 +59,7 @@ public abstract class AbstractEDiffNode extends AbstractEDiffContainer implement
if (fListener != null) {
Object[] listeners = fListener.getListeners();
for (int i = 0; i < listeners.length; i++) {
+ // TODO: execute in a SafeRunner.
((ICompareInputChangeListener)listeners[i]).compareInputChanged(this);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/provider/AttributeChangeNode.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/provider/AttributeChangeNode.java
index ad56b2394..fe03835e7 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/provider/AttributeChangeNode.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/provider/AttributeChangeNode.java
@@ -68,7 +68,7 @@ public class AttributeChangeNode extends DiffNode {
if (attribute.isMany()) {
// todo
} else {
- ret = new SingleAttributeChangeNode(origin, attribute);
+ ret = new SingleAttributeChangeNode(origin, attribute, getTarget());
}
}
return ret;
@@ -88,7 +88,7 @@ public class AttributeChangeNode extends DiffNode {
if (attribute.isMany()) {
// todo
} else {
- ret = new SingleAttributeChangeNode(left, attribute);
+ ret = new SingleAttributeChangeNode(left, attribute, getTarget());
}
}
return ret;
@@ -108,7 +108,7 @@ public class AttributeChangeNode extends DiffNode {
if (attribute.isMany()) {
// todo
} else {
- ret = new SingleAttributeChangeNode(right, attribute);
+ ret = new SingleAttributeChangeNode(right, attribute, getTarget());
}
}
return ret;
diff --git a/plugins/org.eclipse.emf.compare.tests/model/nodes.ecore b/plugins/org.eclipse.emf.compare.tests/model/nodes.ecore
index 0a9ad7160..8320d5450 100644
--- a/plugins/org.eclipse.emf.compare.tests/model/nodes.ecore
+++ b/plugins/org.eclipse.emf.compare.tests/model/nodes.ecore
@@ -1,55 +1,56 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="nodes" nsURI="http://www.eclipse.org/emf/compare/tests/nodes"
- nsPrefix="nodes">
- <eClassifiers xsi:type="ecore:EClass" name="Node">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- iD="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="containmentRef1" upperBound="-1"
- eType="#//Node" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NodeMultipleContainment" eSuperTypes="#//Node">
- <eStructuralFeatures xsi:type="ecore:EReference" name="containmentRef2" upperBound="-1"
- eType="#//Node" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="containmentRef3" upperBound="-1"
- eType="#//Node" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NodeSingleValueContainment" eSuperTypes="#//Node">
- <eStructuralFeatures xsi:type="ecore:EReference" name="singleValueContainment"
- eType="#//Node" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NodeSingleValueAttribute" eSuperTypes="#//Node">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="singleValuedAttribute"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NodeMultiValuedAttribute" eSuperTypes="#//Node">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="multiValuedAttribute" upperBound="-1"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NodeSingleValueReference" eSuperTypes="#//Node">
- <eStructuralFeatures xsi:type="ecore:EReference" name="singleValuedReference"
- eType="#//Node"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NodeMultiValueReference" eSuperTypes="#//Node">
- <eStructuralFeatures xsi:type="ecore:EReference" name="multiValuedReference" upperBound="-1"
- eType="#//Node"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NodeOppositeRefOneToOne" eSuperTypes="#//Node">
- <eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//NodeOppositeRefOneToOne"
- eOpposite="#//NodeOppositeRefOneToOne/destination"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="destination" eType="#//NodeOppositeRefOneToOne"
- eOpposite="#//NodeOppositeRefOneToOne/source"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NodeOppositeRefOneToMany" eSuperTypes="#//Node">
- <eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//NodeOppositeRefOneToMany"
- eOpposite="#//NodeOppositeRefOneToMany/destination"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="destination" upperBound="-1"
- eType="#//NodeOppositeRefOneToMany" eOpposite="#//NodeOppositeRefOneToMany/source"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NodeOppositeRefManyToMany" eSuperTypes="#//Node">
- <eStructuralFeatures xsi:type="ecore:EReference" name="source" upperBound="-1"
- eType="#//NodeOppositeRefManyToMany" eOpposite="#//NodeOppositeRefManyToMany/destination"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="destination" upperBound="-1"
- eType="#//NodeOppositeRefManyToMany" eOpposite="#//NodeOppositeRefManyToMany/source"/>
- </eClassifiers>
-</ecore:EPackage>
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="nodes"
+ nsURI="http://www.eclipse.org/emf/compare/tests/nodes" nsPrefix="nodes">
+ <eClassifiers xsi:type="ecore:EClass" name="Node">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
+ iD="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="containmentRef1" upperBound="-1"
+ eType="#//Node" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeMultipleContainment" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="containmentRef2" upperBound="-1"
+ eType="#//Node" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="containmentRef3" upperBound="-1"
+ eType="#//Node" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeSingleValueContainment" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="singleValueContainment"
+ eType="#//Node" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeSingleValueAttribute" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="singleValuedAttribute"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeMultiValuedAttribute" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="multiValuedAttribute" upperBound="-1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeSingleValueReference" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="singleValuedReference"
+ eType="#//Node"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeMultiValueReference" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="multiValuedReference" upperBound="-1"
+ eType="#//Node"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeOppositeRefOneToOne" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//NodeOppositeRefOneToOne"
+ eOpposite="#//NodeOppositeRefOneToOne/destination"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="destination" eType="#//NodeOppositeRefOneToOne"
+ eOpposite="#//NodeOppositeRefOneToOne/source"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeOppositeRefOneToMany" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//NodeOppositeRefOneToMany"
+ eOpposite="#//NodeOppositeRefOneToMany/destination"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="destination" upperBound="-1"
+ eType="#//NodeOppositeRefOneToMany" eOpposite="#//NodeOppositeRefOneToMany/source"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NodeOppositeRefManyToMany" eSuperTypes="#//Node">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="source" upperBound="-1"
+ eType="#//NodeOppositeRefManyToMany" eOpposite="#//NodeOppositeRefManyToMany/destination"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="destination" upperBound="-1"
+ eType="#//NodeOppositeRefManyToMany" eOpposite="#//NodeOppositeRefManyToMany/source"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
index 0a851f0e4..b99f6ae2a 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/ConflictDetectionTest.java
@@ -1963,6 +1963,24 @@ public class ConflictDetectionTest {
}
@Test
+ public void testIUseCase() throws IOException {
+ final Resource left = input.getILeft();
+ final Resource origin = input.getIOrigin();
+ final Resource right = input.getIRight();
+
+ final Comparison comparison = EMFCompare.compare(left, right, origin);
+
+ final List<Diff> differences = comparison.getDifferences();
+ final List<Conflict> conflicts = comparison.getConflicts();
+
+ assertSame(Integer.valueOf(5), Integer.valueOf(differences.size()));
+ assertSame(Integer.valueOf(1), Integer.valueOf(conflicts.size()));
+
+ Conflict soleConflict = conflicts.get(0);
+ assertSame(ConflictKind.PSEUDO, soleConflict.getKind());
+ }
+
+ @Test
public void testComplexUseCase() throws IOException {
final Resource left = input.getComplexLeft();
final Resource origin = input.getComplexOrigin();
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java
index 56cb1f184..69ffc79ee 100644
--- a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/ConflictInputData.java
@@ -574,6 +574,18 @@ public class ConflictInputData extends AbstractInputData {
return loadFromClassloader("h2/conflict_h2_right.nodes");
}
+ public Resource getILeft() throws IOException {
+ return loadFromClassloader("i/conflict_i_left.nodes");
+ }
+
+ public Resource getIOrigin() throws IOException {
+ return loadFromClassloader("i/conflict_i_origin.nodes");
+ }
+
+ public Resource getIRight() throws IOException {
+ return loadFromClassloader("i/conflict_i_right.nodes");
+ }
+
public Resource getComplexLeft() throws IOException {
return loadFromClassloader("complex/conflict_complex_left.nodes");
}
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_left.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_left.nodes
new file mode 100644
index 000000000..7c1599908
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_left.nodes
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ASCII"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_rqDnEJRfEeGwLqrAWz-_6w"
+ name="P">
+
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_origin.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_origin.nodes
new file mode 100644
index 000000000..0e617e3c4
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_origin.nodes
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ASCII"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_rqDnEJRfEeGwLqrAWz-_6w"
+ name="P">
+ <containmentRef1 xmi:id="_Np10YJRiEeGwLqrAWz-_6w" name="C">
+ <containmentRef1 xmi:id="_Np11YJRiEeGwLqrAWz-_7w" name="A1"/>
+ <containmentRef1 xmi:id="_Np12YJRiEeGwLqrAWz-_8w" name="A2"/>
+ <containmentRef1 xmi:id="_Np13YJRiEeGwLqrAWz-_9w" name="A3"/>
+ </containmentRef1>
+</nodes:Node>
diff --git a/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_right.nodes b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_right.nodes
new file mode 100644
index 000000000..cd1e0b567
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.tests/src/org/eclipse/emf/compare/tests/conflict/data/i/conflict_i_right.nodes
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ASCII"?>
+<nodes:Node
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:nodes="http://www.eclipse.org/emf/compare/tests/nodes"
+ xmi:id="_rqDnEJRfEeGwLqrAWz-_6w"
+ name="P">
+ <containmentRef1 xmi:id="_Np10YJRiEeGwLqrAWz-_6w" name="C">
+ <containmentRef1 xmi:id="_Np11YJRiEeGwLqrAWz-_7w" name="A1"/>
+ <containmentRef1 xmi:id="_Np12YJRiEeGwLqrAWz-_8w" name="A2"/>
+ </containmentRef1>
+</nodes:Node>

Back to the top