Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlgoubet2012-05-10 12:21:50 +0000
committerlgoubet2012-05-10 14:59:31 +0000
commit4c600b6085f4d4a4a0b796e00a4d8c53509372df (patch)
tree2958cf7d35bac1df536903dfe16f4c621c20ce33
parentd43eff4aaf2c177276c39ccaa9b8cd369ded4a18 (diff)
downloadorg.eclipse.emf.compare-4c600b6085f4d4a4a0b796e00a4d8c53509372df.tar.gz
org.eclipse.emf.compare-4c600b6085f4d4a4a0b796e00a4d8c53509372df.tar.xz
org.eclipse.emf.compare-4c600b6085f4d4a4a0b796e00a4d8c53509372df.zip
Adding the concept of pseudo-conflicts to the metamodel.
-rw-r--r--plugins/org.eclipse.emf.compare.edit/plugin.properties4
-rw-r--r--plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java35
-rw-r--r--plugins/org.eclipse.emf.compare/model/compare.ecore20
-rw-r--r--plugins/org.eclipse.emf.compare/model/compare.genmodel5
-rw-r--r--plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/ComparePackage.java64
-rw-r--r--plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/Conflict.java29
-rw-r--r--plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/ConflictKind.java226
-rw-r--r--plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/CompareFactoryImpl.java26
-rw-r--r--plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ComparePackageImpl.java38
-rw-r--r--plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ConflictImpl.java73
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java22
11 files changed, 529 insertions, 13 deletions
diff --git a/plugins/org.eclipse.emf.compare.edit/plugin.properties b/plugins/org.eclipse.emf.compare.edit/plugin.properties
index 8798701ac..f350f7246 100644
--- a/plugins/org.eclipse.emf.compare.edit/plugin.properties
+++ b/plugins/org.eclipse.emf.compare.edit/plugin.properties
@@ -68,8 +68,10 @@ _UI_DifferenceSource_LEFT_literal = LEFT
_UI_DifferenceSource_RIGHT_literal = RIGHT
_UI_Match_submatches_feature = Submatches
_UI_Diff_source_feature = Source
-_UI_Comparison_equivalences_feature = Equivalences
_UI_MatchResource_left_feature = Left
_UI_MatchResource_right_feature = Right
_UI_MatchResource_origin_feature = Origin
_UI_Diff_equivalence_feature = Equivalence
+_UI_Conflict_kind_feature = Kind
+_UI_ConflictKind_REAL_literal = REAL
+_UI_ConflictKind_PSEUDO_literal = PSEUDO
diff --git a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java
index 846a4ae47..07b62a0ff 100644
--- a/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java
+++ b/plugins/org.eclipse.emf.compare.edit/src-gen/org/eclipse/emf/compare/provider/ConflictItemProvider.java
@@ -20,6 +20,8 @@ import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.compare.ComparePackage;
+import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -27,7 +29,9 @@ import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
/**
* This is the item provider adapter for a {@link org.eclipse.emf.compare.Conflict} object.
@@ -66,12 +70,31 @@ public class ConflictItemProvider extends ItemProviderAdapter implements IEditin
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
+ addKindPropertyDescriptor(object);
addDifferencesPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
+ * This adds a property descriptor for the Kind feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addKindPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Conflict_kind_feature"), //$NON-NLS-1$
+ getString(
+ "_UI_PropertyDescriptor_description", "_UI_Conflict_kind_feature", "_UI_Conflict_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ComparePackage.Literals.CONFLICT__KIND, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
* This adds a property descriptor for the Differences feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -107,7 +130,10 @@ public class ConflictItemProvider extends ItemProviderAdapter implements IEditin
*/
@Override
public String getText(Object object) {
- return getString("_UI_Conflict_type"); //$NON-NLS-1$
+ ConflictKind labelValue = ((Conflict)object).getKind();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ? getString("_UI_Conflict_type") : //$NON-NLS-1$
+ getString("_UI_Conflict_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -120,6 +146,13 @@ public class ConflictItemProvider extends ItemProviderAdapter implements IEditin
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
+
+ switch (notification.getFeatureID(Conflict.class)) {
+ case ComparePackage.CONFLICT__KIND:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false,
+ true));
+ return;
+ }
super.notifyChanged(notification);
}
diff --git a/plugins/org.eclipse.emf.compare/model/compare.ecore b/plugins/org.eclipse.emf.compare/model/compare.ecore
index f18b4f1c5..81d575474 100644
--- a/plugins/org.eclipse.emf.compare/model/compare.ecore
+++ b/plugins/org.eclipse.emf.compare/model/compare.ecore
@@ -283,6 +283,11 @@
<details key="documentation" value="This can be used to retrieve the list of differences that were made in the right element."/>
</eAnnotations>
</eOperations>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1" eType="#//ConflictKind">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Describes the kind of this conflict, whether it is a real conflict or a pseudo-conflict."/>
+ </eAnnotations>
+ </eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="differences" lowerBound="2"
upperBound="-1" eType="#//Diff" eOpposite="#//Diff/conflict">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
@@ -341,6 +346,21 @@
</eAnnotations>
</eLiterals>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="ConflictKind">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Conflicts detected through EMF Compare can be of a number of different types.&#xD;&#xA;&lt;ul>&#xD;&#xA;&#x9;&lt;li>REAL are the conflicts that cannot be merged automatically,&lt;/li>&#xD;&#xA;&#x9;&lt;li>PSEUDO are the &quot;conflicts&quot; that represent the same change made on the two sides, which can thus be automatically merged.&lt;/li>&#xD;&#xA;&lt;/ul>"/>
+ </eAnnotations>
+ <eLiterals name="REAL">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="conflicts that cannot be merged automatically as they represent incompatible differences on the two sides."/>
+ </eAnnotations>
+ </eLiterals>
+ <eLiterals name="PSEUDO" value="1">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="If the same change has been made on the two sides since the common ancestor, these changes will be marked as &quot;pseudo-conflicting&quot; changes : there are changes, but they can be merged automatically."/>
+ </eAnnotations>
+ </eLiterals>
+ </eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="EIterable" instanceClassName="java.lang.Iterable">
<eTypeParameters name="T"/>
</eClassifiers>
diff --git a/plugins/org.eclipse.emf.compare/model/compare.genmodel b/plugins/org.eclipse.emf.compare/model/compare.genmodel
index 45c7a25ea..e5922a1fb 100644
--- a/plugins/org.eclipse.emf.compare/model/compare.genmodel
+++ b/plugins/org.eclipse.emf.compare/model/compare.genmodel
@@ -22,6 +22,10 @@
<genEnumLiterals ecoreEnumLiteral="compare.ecore#//DifferenceSource/LEFT"/>
<genEnumLiterals ecoreEnumLiteral="compare.ecore#//DifferenceSource/RIGHT"/>
</genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="compare.ecore#//ConflictKind">
+ <genEnumLiterals ecoreEnumLiteral="compare.ecore#//ConflictKind/REAL"/>
+ <genEnumLiterals ecoreEnumLiteral="compare.ecore#//ConflictKind/PSEUDO"/>
+ </genEnums>
<genDataTypes ecoreDataType="compare.ecore#//EIterable">
<genTypeParameters ecoreTypeParameter="compare.ecore#//EIterable/T"/>
</genDataTypes>
@@ -83,6 +87,7 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute compare.ecore#//AttributeChange/value"/>
</genClasses>
<genClasses ecoreClass="compare.ecore#//Conflict">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute compare.ecore#//Conflict/kind"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference compare.ecore#//Conflict/differences"/>
<genOperations ecoreOperation="compare.ecore#//Conflict/getLeftDifferences"/>
<genOperations ecoreOperation="compare.ecore#//Conflict/getRightDifferences"/>
diff --git a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/ComparePackage.java b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/ComparePackage.java
index 89615fba7..592afff20 100644
--- a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/ComparePackage.java
+++ b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/ComparePackage.java
@@ -720,13 +720,22 @@ public interface ComparePackage extends EPackage {
int CONFLICT = 7;
/**
+ * The feature id for the '<em><b>Kind</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CONFLICT__KIND = 0;
+
+ /**
* The feature id for the '<em><b>Differences</b></em>' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int CONFLICT__DIFFERENCES = 0;
+ int CONFLICT__DIFFERENCES = 1;
/**
* The number of structural features of the '<em>Conflict</em>' class.
@@ -735,7 +744,7 @@ public interface ComparePackage extends EPackage {
* @generated
* @ordered
*/
- int CONFLICT_FEATURE_COUNT = 1;
+ int CONFLICT_FEATURE_COUNT = 2;
/**
* The meta object id for the '{@link org.eclipse.emf.compare.impl.EquivalenceImpl <em>Equivalence</em>}' class.
@@ -786,6 +795,16 @@ public interface ComparePackage extends EPackage {
int DIFFERENCE_SOURCE = 10;
/**
+ * The meta object id for the '{@link org.eclipse.emf.compare.ConflictKind <em>Conflict Kind</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.ConflictKind
+ * @see org.eclipse.emf.compare.impl.ComparePackageImpl#getConflictKind()
+ * @generated
+ */
+ int CONFLICT_KIND = 11;
+
+ /**
* The meta object id for the '<em>EIterable</em>' data type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -793,7 +812,7 @@ public interface ComparePackage extends EPackage {
* @see org.eclipse.emf.compare.impl.ComparePackageImpl#getEIterable()
* @generated
*/
- int EITERABLE = 11;
+ int EITERABLE = 12;
/**
* Returns the meta object for class '{@link org.eclipse.emf.compare.Comparison <em>Comparison</em>}'.
@@ -1195,6 +1214,17 @@ public interface ComparePackage extends EPackage {
EClass getConflict();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.compare.Conflict#getKind <em>Kind</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Kind</em>'.
+ * @see org.eclipse.emf.compare.Conflict#getKind()
+ * @see #getConflict()
+ * @generated
+ */
+ EAttribute getConflict_Kind();
+
+ /**
* Returns the meta object for the reference list '{@link org.eclipse.emf.compare.Conflict#getDifferences <em>Differences</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1247,6 +1277,16 @@ public interface ComparePackage extends EPackage {
EEnum getDifferenceSource();
/**
+ * Returns the meta object for enum '{@link org.eclipse.emf.compare.ConflictKind <em>Conflict Kind</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Conflict Kind</em>'.
+ * @see org.eclipse.emf.compare.ConflictKind
+ * @generated
+ */
+ EEnum getConflictKind();
+
+ /**
* Returns the meta object for data type '{@link java.lang.Iterable <em>EIterable</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1595,6 +1635,14 @@ public interface ComparePackage extends EPackage {
EClass CONFLICT = eINSTANCE.getConflict();
/**
+ * The meta object literal for the '<em><b>Kind</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute CONFLICT__KIND = eINSTANCE.getConflict_Kind();
+
+ /**
* The meta object literal for the '<em><b>Differences</b></em>' reference list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -1641,6 +1689,16 @@ public interface ComparePackage extends EPackage {
EEnum DIFFERENCE_SOURCE = eINSTANCE.getDifferenceSource();
/**
+ * The meta object literal for the '{@link org.eclipse.emf.compare.ConflictKind <em>Conflict Kind</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.compare.ConflictKind
+ * @see org.eclipse.emf.compare.impl.ComparePackageImpl#getConflictKind()
+ * @generated
+ */
+ EEnum CONFLICT_KIND = eINSTANCE.getConflictKind();
+
+ /**
* The meta object literal for the '<em>EIterable</em>' data type.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/Conflict.java b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/Conflict.java
index 8d31c95fe..16faa5a28 100644
--- a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/Conflict.java
+++ b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/Conflict.java
@@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.EObject;
* <p>
* The following features are supported:
* <ul>
+ * <li>{@link org.eclipse.emf.compare.Conflict#getKind <em>Kind</em>}</li>
* <li>{@link org.eclipse.emf.compare.Conflict#getDifferences <em>Differences</em>}</li>
* </ul>
* </p>
@@ -43,6 +44,34 @@ public interface Conflict extends EObject {
String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
/**
+ * Returns the value of the '<em><b>Kind</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.emf.compare.ConflictKind}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * Describes the kind of this conflict, whether it is a real conflict or a pseudo-conflict.
+ * <!-- end-model-doc -->
+ * @return the value of the '<em>Kind</em>' attribute.
+ * @see org.eclipse.emf.compare.ConflictKind
+ * @see #setKind(ConflictKind)
+ * @see org.eclipse.emf.compare.ComparePackage#getConflict_Kind()
+ * @model required="true"
+ * @generated
+ */
+ ConflictKind getKind();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.compare.Conflict#getKind <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Kind</em>' attribute.
+ * @see org.eclipse.emf.compare.ConflictKind
+ * @see #getKind()
+ * @generated
+ */
+ void setKind(ConflictKind value);
+
+ /**
* Returns the value of the '<em><b>Differences</b></em>' reference list.
* The list contents are of type {@link org.eclipse.emf.compare.Diff}.
* It is bidirectional and its opposite is '{@link org.eclipse.emf.compare.Diff#getConflict <em>Conflict</em>}'.
diff --git a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/ConflictKind.java b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/ConflictKind.java
new file mode 100644
index 000000000..05585907d
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/ConflictKind.java
@@ -0,0 +1,226 @@
+/**
+ * Copyright (c) 2012 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.emf.compare;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Conflict Kind</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * Conflicts detected through EMF Compare can be of a number of different types.
+ * <ul>
+ * <li>REAL are the conflicts that cannot be merged automatically,</li>
+ * <li>PSEUDO are the "conflicts" that represent the same change made on the two sides, which can thus be automatically merged.</li>
+ * </ul>
+ * <!-- end-model-doc -->
+ * @see org.eclipse.emf.compare.ComparePackage#getConflictKind()
+ * @model
+ * @generated
+ */
+public enum ConflictKind implements Enumerator {
+ /**
+ * The '<em><b>REAL</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #REAL_VALUE
+ * @generated
+ * @ordered
+ */
+ REAL(0, "REAL", "REAL"), //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>PSEUDO</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #PSEUDO_VALUE
+ * @generated
+ * @ordered
+ */
+ PSEUDO(1, "PSEUDO", "PSEUDO"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * The '<em><b>REAL</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * conflicts that cannot be merged automatically as they represent incompatible differences on the two sides.
+ * <!-- end-model-doc -->
+ * @see #REAL
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int REAL_VALUE = 0;
+
+ /**
+ * The '<em><b>PSEUDO</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * <!-- begin-model-doc -->
+ * If the same change has been made on the two sides since the common ancestor, these changes will be marked as "pseudo-conflicting" changes : there are changes, but they can be merged automatically.
+ * <!-- end-model-doc -->
+ * @see #PSEUDO
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int PSEUDO_VALUE = 1;
+
+ /**
+ * An array of all the '<em><b>Conflict Kind</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final ConflictKind[] VALUES_ARRAY = new ConflictKind[] {REAL, PSEUDO, };
+
+ /**
+ * A public read-only list of all the '<em><b>Conflict Kind</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<ConflictKind> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Conflict Kind</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static ConflictKind get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ ConflictKind result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Conflict Kind</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static ConflictKind getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ ConflictKind result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Conflict Kind</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static ConflictKind get(int value) {
+ switch (value) {
+ case REAL_VALUE:
+ return REAL;
+ case PSEUDO_VALUE:
+ return PSEUDO;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private ConflictKind(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //ConflictKind
diff --git a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/CompareFactoryImpl.java b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/CompareFactoryImpl.java
index b22e4d8c0..22d26c622 100644
--- a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/CompareFactoryImpl.java
+++ b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/CompareFactoryImpl.java
@@ -115,6 +115,8 @@ public class CompareFactoryImpl extends EFactoryImpl implements CompareFactory {
return createDifferenceKindFromString(eDataType, initialValue);
case ComparePackage.DIFFERENCE_SOURCE:
return createDifferenceSourceFromString(eDataType, initialValue);
+ case ComparePackage.CONFLICT_KIND:
+ return createConflictKindFromString(eDataType, initialValue);
case ComparePackage.EITERABLE:
return createEIterableFromString(eDataType, initialValue);
default:
@@ -134,6 +136,8 @@ public class CompareFactoryImpl extends EFactoryImpl implements CompareFactory {
return convertDifferenceKindToString(eDataType, instanceValue);
case ComparePackage.DIFFERENCE_SOURCE:
return convertDifferenceSourceToString(eDataType, instanceValue);
+ case ComparePackage.CONFLICT_KIND:
+ return convertConflictKindToString(eDataType, instanceValue);
case ComparePackage.EITERABLE:
return convertEIterableToString(eDataType, instanceValue);
default:
@@ -268,6 +272,28 @@ public class CompareFactoryImpl extends EFactoryImpl implements CompareFactory {
* <!-- end-user-doc -->
* @generated
*/
+ public ConflictKind createConflictKindFromString(EDataType eDataType, String initialValue) {
+ ConflictKind result = ConflictKind.get(initialValue);
+ if (result == null)
+ throw new IllegalArgumentException(
+ "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertConflictKindToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public Iterable<?> createEIterableFromString(EDataType eDataType, String initialValue) {
return (Iterable<?>)super.createFromString(initialValue);
}
diff --git a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ComparePackageImpl.java b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ComparePackageImpl.java
index 60883a0df..fbc4e2b92 100644
--- a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ComparePackageImpl.java
+++ b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ComparePackageImpl.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.compare.CompareFactory;
import org.eclipse.emf.compare.ComparePackage;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.DifferenceSource;
@@ -133,6 +134,13 @@ public class ComparePackageImpl extends EPackageImpl implements ComparePackage {
* <!-- end-user-doc -->
* @generated
*/
+ private EEnum conflictKindEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
private EDataType eIterableEDataType = null;
/**
@@ -539,8 +547,17 @@ public class ComparePackageImpl extends EPackageImpl implements ComparePackage {
* <!-- end-user-doc -->
* @generated
*/
+ public EAttribute getConflict_Kind() {
+ return (EAttribute)conflictEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EReference getConflict_Differences() {
- return (EReference)conflictEClass.getEStructuralFeatures().get(0);
+ return (EReference)conflictEClass.getEStructuralFeatures().get(1);
}
/**
@@ -584,6 +601,15 @@ public class ComparePackageImpl extends EPackageImpl implements ComparePackage {
* <!-- end-user-doc -->
* @generated
*/
+ public EEnum getConflictKind() {
+ return conflictKindEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EDataType getEIterable() {
return eIterableEDataType;
}
@@ -661,6 +687,7 @@ public class ComparePackageImpl extends EPackageImpl implements ComparePackage {
createEAttribute(attributeChangeEClass, ATTRIBUTE_CHANGE__VALUE);
conflictEClass = createEClass(CONFLICT);
+ createEAttribute(conflictEClass, CONFLICT__KIND);
createEReference(conflictEClass, CONFLICT__DIFFERENCES);
equivalenceEClass = createEClass(EQUIVALENCE);
@@ -669,6 +696,7 @@ public class ComparePackageImpl extends EPackageImpl implements ComparePackage {
// Create enums
differenceKindEEnum = createEEnum(DIFFERENCE_KIND);
differenceSourceEEnum = createEEnum(DIFFERENCE_SOURCE);
+ conflictKindEEnum = createEEnum(CONFLICT_KIND);
// Create data types
eIterableEDataType = createEDataType(EITERABLE);
@@ -902,6 +930,10 @@ public class ComparePackageImpl extends EPackageImpl implements ComparePackage {
initEClass(conflictEClass, Conflict.class,
"Conflict", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEAttribute(
+ getConflict_Kind(),
+ this.getConflictKind(),
+ "kind", null, 1, 1, Conflict.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(
getConflict_Differences(),
this.getDiff(),
@@ -931,6 +963,10 @@ public class ComparePackageImpl extends EPackageImpl implements ComparePackage {
addEEnumLiteral(differenceSourceEEnum, DifferenceSource.LEFT);
addEEnumLiteral(differenceSourceEEnum, DifferenceSource.RIGHT);
+ initEEnum(conflictKindEEnum, ConflictKind.class, "ConflictKind"); //$NON-NLS-1$
+ addEEnumLiteral(conflictKindEEnum, ConflictKind.REAL);
+ addEEnumLiteral(conflictKindEEnum, ConflictKind.PSEUDO);
+
// Initialize data types
initEDataType(eIterableEDataType, Iterable.class,
"EIterable", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ConflictImpl.java b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ConflictImpl.java
index 5020f819f..1ecba18e2 100644
--- a/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ConflictImpl.java
+++ b/plugins/org.eclipse.emf.compare/src-gen/org/eclipse/emf/compare/impl/ConflictImpl.java
@@ -12,17 +12,20 @@ package org.eclipse.emf.compare.impl;
import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.compare.ComparePackage;
import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
@@ -35,6 +38,7 @@ import org.eclipse.emf.ecore.util.InternalEList;
* <p>
* The following features are implemented:
* <ul>
+ * <li>{@link org.eclipse.emf.compare.impl.ConflictImpl#getKind <em>Kind</em>}</li>
* <li>{@link org.eclipse.emf.compare.impl.ConflictImpl#getDifferences <em>Differences</em>}</li>
* </ul>
* </p>
@@ -50,6 +54,26 @@ public class ConflictImpl extends MinimalEObjectImpl implements Conflict {
public static final String copyright = "Copyright (c) 2012 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation"; //$NON-NLS-1$
/**
+ * The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected static final ConflictKind KIND_EDEFAULT = ConflictKind.REAL;
+
+ /**
+ * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected ConflictKind kind = KIND_EDEFAULT;
+
+ /**
* The cached value of the '{@link #getDifferences() <em>Differences</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -83,6 +107,28 @@ public class ConflictImpl extends MinimalEObjectImpl implements Conflict {
* <!-- end-user-doc -->
* @generated
*/
+ public ConflictKind getKind() {
+ return kind;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setKind(ConflictKind newKind) {
+ ConflictKind oldKind = kind;
+ kind = newKind == null ? KIND_EDEFAULT : newKind;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ComparePackage.CONFLICT__KIND, oldKind,
+ kind));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EList<Diff> getDifferences() {
if (differences == null) {
differences = new EObjectWithInverseResolvingEList<Diff>(Diff.class, this,
@@ -151,6 +197,8 @@ public class ConflictImpl extends MinimalEObjectImpl implements Conflict {
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
+ case ComparePackage.CONFLICT__KIND:
+ return getKind();
case ComparePackage.CONFLICT__DIFFERENCES:
return getDifferences();
}
@@ -166,6 +214,9 @@ public class ConflictImpl extends MinimalEObjectImpl implements Conflict {
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
+ case ComparePackage.CONFLICT__KIND:
+ setKind((ConflictKind)newValue);
+ return;
case ComparePackage.CONFLICT__DIFFERENCES:
getDifferences().clear();
getDifferences().addAll((Collection<? extends Diff>)newValue);
@@ -182,6 +233,9 @@ public class ConflictImpl extends MinimalEObjectImpl implements Conflict {
@Override
public void eUnset(int featureID) {
switch (featureID) {
+ case ComparePackage.CONFLICT__KIND:
+ setKind(KIND_EDEFAULT);
+ return;
case ComparePackage.CONFLICT__DIFFERENCES:
getDifferences().clear();
return;
@@ -197,10 +251,29 @@ public class ConflictImpl extends MinimalEObjectImpl implements Conflict {
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
+ case ComparePackage.CONFLICT__KIND:
+ return kind != KIND_EDEFAULT;
case ComparePackage.CONFLICT__DIFFERENCES:
return differences != null && !differences.isEmpty();
}
return super.eIsSet(featureID);
}
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy())
+ return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (kind: "); //$NON-NLS-1$
+ result.append(kind);
+ result.append(')');
+ return result.toString();
+ }
+
} //ConflictImpl
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java
index 60a9c6703..5c8ef25b2 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java
@@ -22,6 +22,7 @@ import org.eclipse.emf.compare.AttributeChange;
import org.eclipse.emf.compare.CompareFactory;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Conflict;
+import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.DifferenceSource;
@@ -111,14 +112,14 @@ public class DefaultConflictDetector implements IConflictDetector {
final Object candidateChanged = ((ReferenceChange)candidate).getValue();
if (candidateFeature == feature
&& !EqualityHelper.matchingValues(comparison, changedValue, candidateChanged)) {
- conflictOn(comparison, diff, candidate, false);
+ conflictOn(comparison, diff, candidate, ConflictKind.REAL);
}
} else if (candidate instanceof AttributeChange) {
final EStructuralFeature candidateFeature = ((AttributeChange)candidate).getAttribute();
final Object candidateChanged = ((AttributeChange)candidate).getValue();
if (candidateFeature == feature
&& !EqualityHelper.matchingValues(comparison, changedValue, candidateChanged)) {
- conflictOn(comparison, diff, candidate, false);
+ conflictOn(comparison, diff, candidate, ConflictKind.REAL);
}
}
}
@@ -152,7 +153,7 @@ public class DefaultConflictDetector implements IConflictDetector {
}
if (EqualityHelper.matchingValues(comparison, deletedValue, movedValue)) {
- conflictOn(comparison, diff, candidate, false);
+ conflictOn(comparison, diff, candidate, ConflictKind.REAL);
}
}
}
@@ -169,7 +170,7 @@ public class DefaultConflictDetector implements IConflictDetector {
final Diff oppositeDiff = getFirst(candidates, oppositeDiffPredicate);
if (oppositeDiff != null) {
- conflictOn(comparison, diff, oppositeDiff, true);
+ conflictOn(comparison, diff, oppositeDiff, ConflictKind.PSEUDO);
}
} else {
final EObject deletedValue;
@@ -184,7 +185,7 @@ public class DefaultConflictDetector implements IConflictDetector {
for (Diff candidate : candidates) {
// "candidate" is a diff on an Object that has been deleted on the other side
if (candidate.getMatch() == deletedMatch) {
- conflictOn(comparison, diff, candidate, false);
+ conflictOn(comparison, diff, candidate, ConflictKind.REAL);
} else if (candidate instanceof ReferenceChange) {
/*
* The only potential conflict here is if the candidate is a ReferenceChange of either
@@ -193,21 +194,28 @@ public class DefaultConflictDetector implements IConflictDetector {
if (candidate.getKind() == DifferenceKind.ADD
|| candidate.getKind() == DifferenceKind.CHANGE
&& ((ReferenceChange)candidate).getValue() == deletedValue) {
- conflictOn(comparison, diff, candidate, false);
+ conflictOn(comparison, diff, candidate, ConflictKind.REAL);
}
}
}
}
}
- protected void conflictOn(Comparison comparison, Diff diff1, Diff diff2, boolean pseudoConflict) {
+ protected void conflictOn(Comparison comparison, Diff diff1, Diff diff2, ConflictKind kind) {
final Conflict conflict;
if (diff1.getConflict() != null) {
conflict = diff1.getConflict();
+ if (conflict.getKind() == ConflictKind.PSEUDO && conflict.getKind() != kind) {
+ conflict.setKind(kind);
+ }
} else if (diff2.getConflict() != null) {
conflict = diff2.getConflict();
+ if (conflict.getKind() == ConflictKind.PSEUDO && conflict.getKind() != kind) {
+ conflict.setKind(kind);
+ }
} else {
conflict = CompareFactory.eINSTANCE.createConflict();
+ conflict.setKind(kind);
comparison.getConflicts().add(conflict);
}

Back to the top