diff options
author | Cedric Notot | 2012-10-04 17:04:11 +0000 |
---|---|---|
committer | Cedric Notot | 2012-10-04 17:32:59 +0000 |
commit | 463d6270115fe6a3e09f033ded856d921487f6ad (patch) | |
tree | d043c3b2e074d1930db19c6fb43f2a6b5b813fe2 | |
parent | 2345bfd0559e1220460d0d6da4b2a0c6c750430a (diff) | |
download | org.eclipse.emf.compare-463d6270115fe6a3e09f033ded856d921487f6ad.tar.gz org.eclipse.emf.compare-463d6270115fe6a3e09f033ded856d921487f6ad.tar.xz org.eclipse.emf.compare-463d6270115fe6a3e09f033ded856d921487f6ad.zip |
refactoring
13 files changed, 297 insertions, 85 deletions
diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/impl/UMLComparePackageImpl.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/impl/UMLComparePackageImpl.java index c3c8baa5c..83d61295a 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/impl/UMLComparePackageImpl.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/impl/UMLComparePackageImpl.java @@ -461,7 +461,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac umlDiffEClass.getESuperTypes().add(theComparePackage.getDiff());
// Initialize classes and features; add operations and parameters
- initEClass(associationChangeEClass, AssociationChange.class, "AssociationChangeSpec", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEClass(associationChangeEClass, AssociationChange.class, "AssociationChange", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
initEClass(dependencyChangeEClass, DependencyChange.class, "DependencyChange", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/impl/UMLDiffImpl.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/impl/UMLDiffImpl.java index f57598e56..fb635c4ed 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/impl/UMLDiffImpl.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/impl/UMLDiffImpl.java @@ -46,9 +46,9 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { protected EObject discriminant;
/**
- * The cached value of the '{@link #getEReference() <em>EReference</em>}' reference. <!-- begin-user-doc
+ * The cached value of the '{@link #getEReference() <em>EReference</em>}' reference.
+ * <!-- begin-user-doc
* --> <!-- end-user-doc -->
- *
* @see #getEReference()
* @generated
* @ordered
@@ -57,7 +57,6 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
protected UMLDiffImpl() {
@@ -66,7 +65,6 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
@Override
@@ -76,7 +74,6 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
public EObject getDiscriminant() {
@@ -84,10 +81,8 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { InternalEObject oldDiscriminant = (InternalEObject)discriminant;
discriminant = eResolveProxy(oldDiscriminant);
if (discriminant != oldDiscriminant) {
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.RESOLVE,
- UMLComparePackage.UML_DIFF__DISCRIMINANT, oldDiscriminant, discriminant));
- }
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, UMLComparePackage.UML_DIFF__DISCRIMINANT, oldDiscriminant, discriminant));
}
}
return discriminant;
@@ -95,7 +90,6 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
public EObject basicGetDiscriminant() {
@@ -104,21 +98,17 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
public void setDiscriminant(EObject newDiscriminant) {
EObject oldDiscriminant = discriminant;
discriminant = newDiscriminant;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, UMLComparePackage.UML_DIFF__DISCRIMINANT,
- oldDiscriminant, discriminant));
- }
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, UMLComparePackage.UML_DIFF__DISCRIMINANT, oldDiscriminant, discriminant));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
public EReference getEReference() {
@@ -126,10 +116,8 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { InternalEObject oldEReference = (InternalEObject)eReference;
eReference = (EReference)eResolveProxy(oldEReference);
if (eReference != oldEReference) {
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.RESOLVE,
- UMLComparePackage.UML_DIFF__EREFERENCE, oldEReference, eReference));
- }
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, UMLComparePackage.UML_DIFF__EREFERENCE, oldEReference, eReference));
}
}
return eReference;
@@ -137,7 +125,6 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
public EReference basicGetEReference() {
@@ -146,35 +133,27 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
public void setEReference(EReference newEReference) {
EReference oldEReference = eReference;
eReference = newEReference;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, UMLComparePackage.UML_DIFF__EREFERENCE,
- oldEReference, eReference));
- }
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, UMLComparePackage.UML_DIFF__EREFERENCE, oldEReference, eReference));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case UMLComparePackage.UML_DIFF__DISCRIMINANT:
- if (resolve) {
- return getDiscriminant();
- }
+ if (resolve) return getDiscriminant();
return basicGetDiscriminant();
case UMLComparePackage.UML_DIFF__EREFERENCE:
- if (resolve) {
- return getEReference();
- }
+ if (resolve) return getEReference();
return basicGetEReference();
}
return super.eGet(featureID, resolve, coreType);
@@ -182,7 +161,6 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
@Override
@@ -200,7 +178,6 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
@Override
@@ -218,7 +195,6 @@ public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
* @generated
*/
@Override
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/AbstractDiffExtensionFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/AbstractDiffExtensionFactory.java index 0f7199da0..d5d6968e8 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/AbstractDiffExtensionFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/AbstractDiffExtensionFactory.java @@ -11,30 +11,278 @@ package org.eclipse.emf.compare.uml2.diff.internal.extension; import com.google.common.base.Predicate; +import com.google.common.collect.Iterators; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; +import org.eclipse.emf.compare.AttributeChange; import org.eclipse.emf.compare.Comparison; import org.eclipse.emf.compare.Diff; +import org.eclipse.emf.compare.DifferenceKind; import org.eclipse.emf.compare.Match; +import org.eclipse.emf.compare.ReferenceChange; +import org.eclipse.emf.compare.ResourceAttachmentChange; import org.eclipse.emf.compare.uml2.UMLDiff; +import org.eclipse.emf.compare.util.CompareSwitch; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EStructuralFeature.Setting; +import org.eclipse.uml2.common.util.UML2Util; /** * Factory for the difference extensions. */ public abstract class AbstractDiffExtensionFactory implements IDiffExtensionFactory { + private final Predicate<Diff> REFINING_PREDICATE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + return isPartOfRefiningDifference(diff); + } + }; + + private final Predicate<Diff> REQUIRES_ADD_DISCRIMINANT_PREDICATE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + return getExtensionKind().isInstance(diff) + && ((UMLDiff)diff).getKind().equals(DifferenceKind.ADD); + } + }; + + private final Predicate<Diff> REQUIRES_CHANGE_DISCRIMINANT_PREDICATE = new Predicate<Diff>() { + public boolean apply(Diff diff) { + return getExtensionKind().isInstance(diff) + && ((UMLDiff)diff).getKind().equals(DifferenceKind.CHANGE); + } + }; + + private CompareSwitch<DifferenceKind> differenceKindCompareSwitch = new CompareSwitch<DifferenceKind>() { + + @Override + public DifferenceKind caseAttributeChange(AttributeChange object) { + if (isRelatedToAnExtensionAdd(object)) { + return DifferenceKind.ADD; + } else if (isRelatedToAnExtensionDelete(object)) { + return DifferenceKind.DELETE; + } else if (isRelatedToAnExtensionChange(object)) { + return DifferenceKind.CHANGE; + } else if (isRelatedToAnExtensionMove(object)) { + return DifferenceKind.MOVE; + } else { + return super.caseAttributeChange(object); + } + } + + @Override + public DifferenceKind caseReferenceChange(ReferenceChange object) { + if (isRelatedToAnExtensionAdd(object)) { + return DifferenceKind.ADD; + } else if (isRelatedToAnExtensionDelete(object)) { + return DifferenceKind.DELETE; + } else if (isRelatedToAnExtensionChange(object)) { + return DifferenceKind.CHANGE; + } else if (isRelatedToAnExtensionMove(object)) { + return DifferenceKind.MOVE; + } else { + return super.caseReferenceChange(object); + } + } + + @Override + public DifferenceKind caseResourceAttachmentChange(ResourceAttachmentChange object) { + if (isRelatedToAnExtensionAdd(object)) { + return DifferenceKind.ADD; + } else if (isRelatedToAnExtensionDelete(object)) { + return DifferenceKind.DELETE; + } else if (isRelatedToAnExtensionChange(object)) { + return DifferenceKind.CHANGE; + } else if (isRelatedToAnExtensionMove(object)) { + return DifferenceKind.MOVE; + } else { + return super.caseResourceAttachmentChange(object); + } + } + }; + + /** + * {@inheritDoc} + * + * @see org.eclipse.emf.compare.uml2.diff.internal.extension.IDiffExtensionFactory#handles(org.eclipse.emf.compare.diff.metamodel.DiffElement) + */ + public boolean handles(Diff input) { + return getRelatedExtensionKind(input) != null && !isExtensionAlreadyExist(input) + && !isChangeOnAddOrDelete(input); + } + /** * {@inheritDoc} * - * @see org.eclipse.emf.compare.uml2.diff.internal.extension.IDiffExtensionFactory#getParentDiff(org.eclipse.emf.compare.diff.metamodel.DiffElement) + * @see org.eclipse.emf.compare.uml2.diff.internal.extension.IDiffExtensionFactory#create(org.eclipse.emf. + * compare.diff.metamodel.DiffElement) */ + public Diff create(Diff input) { + + final UMLDiff ret = createExtension(); + + final EObject discriminant = getDiscriminantFromDiff(input); + + final DifferenceKind extensionKind = getRelatedExtensionKind(input); + + if (discriminant != null) { + if (extensionKind == DifferenceKind.DELETE) { + ret.getRefinedBy().add(input); + } else { + fillRefiningDifferences(input.getMatch().getComparison(), ret, discriminant); + } + } + + ret.setDiscriminant(discriminant); + ret.setKind(extensionKind); + if (extensionKind == DifferenceKind.ADD || extensionKind == DifferenceKind.DELETE) { + if (input instanceof ReferenceChange) { + ret.setEReference(((ReferenceChange)input).getReference()); + } + } + + return ret; + } + + protected void fillRefiningDifferences(final Comparison comparison, final UMLDiff diffExtension, + final EObject discriminant) { + // Find Diffs through ComparePackage.Literals.REFERENCE_CHANGE__VALUE + for (EObject elt : getPotentialChangedValuesFromDiscriminant(discriminant)) { + beRefinedByCrossReferences(comparison, elt, diffExtension, REFINING_PREDICATE); + } + } + + public void fillRequiredDifferences(Comparison comparison, UMLDiff extension) { + if (getExtensionKind().isInstance(extension)) { + final EObject discriminant = extension.getDiscriminant(); + if (discriminant != null) { + if (extension.getKind().equals(DifferenceKind.CHANGE)) { + extension.getRequires() + .addAll(findCrossReferences(comparison, discriminant, + REQUIRES_ADD_DISCRIMINANT_PREDICATE)); + } else if (extension.getKind().equals(DifferenceKind.DELETE)) { + extension.getRequires().addAll( + findCrossReferences(comparison, discriminant, + REQUIRES_CHANGE_DISCRIMINANT_PREDICATE)); + } + } + } + } + public Match getParentMatch(Diff input) { + if (getRelatedExtensionKind(input) == DifferenceKind.CHANGE) { + final EObject discriminant = getDiscriminantFromDiff(input); + if (discriminant != null) { + final Match match = input.getMatch().getComparison().getMatch(discriminant); + if (match.eContainer() instanceof Match) { + return (Match)match.eContainer(); + } else { + return match; + } + } + } return input.getMatch(); } + protected abstract UMLDiff createExtension(); + + protected boolean isPartOfRefiningDifference(Diff diff) { + return diff instanceof ReferenceChange && getRelatedExtensionKind(diff) == DifferenceKind.CHANGE; + } + + private boolean isExtensionAlreadyExist(Diff input) { + for (Diff diff : input.getRefines()) { + if (diff instanceof UMLDiff + && ((UMLDiff)diff).getDiscriminant().equals(getDiscriminantFromDiff(input))) { + return true; + } + } + return false; + } + + private boolean isChangeOnAddOrDelete(Diff input) { + if (getRelatedExtensionKind(input) == DifferenceKind.CHANGE) { + final List<Diff> differences = input.getMatch().getComparison().getDifferences(); + differences.remove(input); + for (Diff diff : differences) { + if ((getRelatedExtensionKind(diff) == DifferenceKind.ADD || getRelatedExtensionKind(diff) == DifferenceKind.DELETE) + && getDiscriminantFromDiff(diff) == getDiscriminantFromDiff(input)) { + return true; + } + } + } + return false; + } + + protected abstract EObject getDiscriminantFromDiff(Diff input); + + protected abstract List<EObject> getPotentialChangedValuesFromDiscriminant(EObject discriminant); + + protected DifferenceKind getRelatedExtensionKind(Diff input) { + return differenceKindCompareSwitch.doSwitch(input); + } + + protected boolean isRelatedToAnExtensionAdd(ReferenceChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionDelete(ReferenceChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionChange(ReferenceChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionMove(ReferenceChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionAdd(AttributeChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionDelete(AttributeChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionChange(AttributeChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionMove(AttributeChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionAdd(ResourceAttachmentChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionDelete(ResourceAttachmentChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionChange(ResourceAttachmentChange input) { + return false; + } + + protected boolean isRelatedToAnExtensionMove(ResourceAttachmentChange input) { + return false; + } + + protected Setting getInverseReferences(EObject object, Predicate<EStructuralFeature.Setting> predicate) { + final Iterator<EStructuralFeature.Setting> crossReferences = UML2Util.getInverseReferences(object) + .iterator(); + try { + return Iterators.find(crossReferences, predicate); + } catch (Exception e) { + return null; + } + } + /** * Find the cross references of the given model object, through the specified feature, with a cross * referencer and a predicate. @@ -83,13 +331,4 @@ public abstract class AbstractDiffExtensionFactory implements IDiffExtensionFact } } - /** - * {@inheritDoc} - * - * @see org.eclipse.emf.compare.uml2.diff.internal.extension.IDiffExtensionFactory#fillRequiredDifferences(org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension) - */ - public void fillRequiredDifferences(Comparison comparison, UMLDiff extension) { - // Default behavior - } - } diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLAssociationChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLAssociationChangeFactory.java index 5b6f9331f..18d67c27d 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLAssociationChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLAssociationChangeFactory.java @@ -19,7 +19,7 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.uml2.AssociationChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.uml2.uml.Association;
@@ -29,7 +29,7 @@ import org.eclipse.uml2.uml.UMLPackage; /**
* Factory for UMLAssociationChangeLeftTarget.
*/
-public class UMLAssociationChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLAssociationChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return AssociationChange.class;
@@ -47,7 +47,7 @@ public class UMLAssociationChangeFactory extends UMLAbstractDiffExtensionFactory if (kind == DifferenceKind.ADD || kind == DifferenceKind.DELETE) {
result = ((ReferenceChange)input).getValue();
} else if (kind == DifferenceKind.CHANGE) {
- final EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject container = MatchUtil.getContainer(input);
if (container instanceof Property) {
result = ((Property)container).getAssociation();
}
@@ -89,7 +89,7 @@ public class UMLAssociationChangeFactory extends UMLAbstractDiffExtensionFactory @Override
protected boolean isRelatedToAnExtensionChange(ReferenceChange input) {
- final EObject diffContainer = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject diffContainer = MatchUtil.getContainer(input);
return isAssociationPropertyChange(input, diffContainer)
|| isAssociationPropertyCardinalityChange(input, diffContainer);
}
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLDependencyChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLDependencyChangeFactory.java index 4f5a101f9..752c86426 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLDependencyChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLDependencyChangeFactory.java @@ -19,14 +19,14 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.uml2.DependencyChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.uml2.uml.Dependency;
import org.eclipse.uml2.uml.UMLPackage;
-public class UMLDependencyChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLDependencyChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return DependencyChange.class;
@@ -54,7 +54,7 @@ public class UMLDependencyChangeFactory extends UMLAbstractDiffExtensionFactory if (kind == DifferenceKind.ADD || kind == DifferenceKind.DELETE) {
result = ((ReferenceChange)input).getValue();
} else if (kind == DifferenceKind.CHANGE) {
- final EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject container = MatchUtil.getContainer(input);
if (container instanceof Dependency) {
result = container;
}
@@ -75,8 +75,7 @@ public class UMLDependencyChangeFactory extends UMLAbstractDiffExtensionFactory protected boolean isRelatedToAnExtensionChange(ReferenceChange input) {
return (input.getReference().equals(UMLPackage.Literals.DEPENDENCY__CLIENT) || input.getReference()
.equals(UMLPackage.Literals.DEPENDENCY__SUPPLIER))
- && getManagedConcreteDiscriminantKind().contains(
- MatchUtil.getContainer(input.getMatch().getComparison(), input).eClass());
+ && getManagedConcreteDiscriminantKind().contains(MatchUtil.getContainer(input).eClass());
}
@Override
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLGeneralizationSetChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLGeneralizationSetChangeFactory.java index b8c4e8298..bbf6960e0 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLGeneralizationSetChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/clazz/UMLGeneralizationSetChangeFactory.java @@ -19,7 +19,7 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.uml2.GeneralizationSetChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.uml2.uml.GeneralizationSet;
@@ -28,7 +28,7 @@ import org.eclipse.uml2.uml.UMLPackage; /**
* Factory for UMLGeneralizationSetChangeLeftTarget.
*/
-public class UMLGeneralizationSetChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLGeneralizationSetChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return GeneralizationSetChange.class;
@@ -46,7 +46,7 @@ public class UMLGeneralizationSetChangeFactory extends UMLAbstractDiffExtensionF if (kind == DifferenceKind.ADD || kind == DifferenceKind.DELETE) {
result = ((ReferenceChange)input).getValue();
} else if (kind == DifferenceKind.CHANGE) {
- final EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject container = MatchUtil.getContainer(input);
if (container instanceof GeneralizationSet) {
result = container;
}
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/profile/UMLProfileApplicationChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/profile/UMLProfileApplicationChangeFactory.java index 2a05d7de5..e5b6c2153 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/profile/UMLProfileApplicationChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/profile/UMLProfileApplicationChangeFactory.java @@ -23,7 +23,7 @@ import org.eclipse.emf.compare.uml2.ProfileApplicationChange; import org.eclipse.emf.compare.uml2.StereotypeApplicationChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.compare.utils.ReferenceUtil;
import org.eclipse.emf.ecore.EAnnotation;
@@ -40,7 +40,7 @@ import org.eclipse.uml2.uml.internal.impl.ProfileApplicationImpl; *
* @author <a href="mailto:cedric.notot@obeo.fr">Cedric Notot</a>
*/
-public class UMLProfileApplicationChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLProfileApplicationChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return ProfileApplicationChange.class;
@@ -58,7 +58,7 @@ public class UMLProfileApplicationChangeFactory extends UMLAbstractDiffExtension if (kind == DifferenceKind.ADD || kind == DifferenceKind.DELETE) {
return ((ReferenceChange)input).getValue();
} else if (kind == DifferenceKind.CHANGE) {
- final EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject container = MatchUtil.getContainer(input);
return getDiscriminantForChanges(container);
}
return result;
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/profile/UMLStereotypeApplicationChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/profile/UMLStereotypeApplicationChangeFactory.java index a653b9910..be1ee2fce 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/profile/UMLStereotypeApplicationChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/profile/UMLStereotypeApplicationChangeFactory.java @@ -25,7 +25,7 @@ import org.eclipse.emf.compare.uml2.ProfileApplicationChange; import org.eclipse.emf.compare.uml2.StereotypeApplicationChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.compare.utils.ReferenceUtil;
import org.eclipse.emf.ecore.EObject;
@@ -46,7 +46,7 @@ import org.eclipse.uml2.uml.util.UMLUtil; *
* @author <a href="mailto:cedric.notot@obeo.fr">Cedric Notot</a>
*/
-public class UMLStereotypeApplicationChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLStereotypeApplicationChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return StereotypeApplicationChange.class;
@@ -68,7 +68,7 @@ public class UMLStereotypeApplicationChangeFactory extends UMLAbstractDiffExtens return MatchUtil.getContainer(input);
}
} else if (kind == DifferenceKind.CHANGE) {
- return MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ return MatchUtil.getContainer(input);
}
return result;
}
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLExecutionSpecificationChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLExecutionSpecificationChangeFactory.java index 0052cba3c..697e61ab9 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLExecutionSpecificationChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLExecutionSpecificationChangeFactory.java @@ -19,7 +19,7 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.uml2.ExecutionSpecificationChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
@@ -30,7 +30,7 @@ import org.eclipse.uml2.uml.UMLPackage; /**
* Factory for UMLExecutionSpecificationChangeLeft.
*/
-public class UMLExecutionSpecificationChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLExecutionSpecificationChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return ExecutionSpecificationChange.class;
@@ -48,7 +48,7 @@ public class UMLExecutionSpecificationChangeFactory extends UMLAbstractDiffExten if (kind == DifferenceKind.ADD || kind == DifferenceKind.DELETE) {
result = ((ReferenceChange)input).getValue();
} else if (kind == DifferenceKind.CHANGE) {
- final EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject container = MatchUtil.getContainer(input);
if (container instanceof ExecutionSpecification) {
result = container;
} else if (container instanceof ExecutionOccurrenceSpecification) {
@@ -82,7 +82,7 @@ public class UMLExecutionSpecificationChangeFactory extends UMLAbstractDiffExten return ((input.getReference().equals(UMLPackage.Literals.EXECUTION_SPECIFICATION__START)
|| input.getReference().equals(UMLPackage.Literals.EXECUTION_SPECIFICATION__FINISH) || input
.getReference().equals(UMLPackage.Literals.INTERACTION_FRAGMENT__COVERED)) && getManagedConcreteDiscriminantKind()
- .contains(MatchUtil.getContainer(input.getMatch().getComparison(), input).eClass()));
+ .contains(MatchUtil.getContainer(input).eClass()));
}
@Override
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLIntervalConstraintChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLIntervalConstraintChangeFactory.java index d6f3ad23a..6ebfe6bb4 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLIntervalConstraintChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLIntervalConstraintChangeFactory.java @@ -21,7 +21,7 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.uml2.IntervalConstraintChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
@@ -35,7 +35,7 @@ import org.eclipse.uml2.uml.ValueSpecification; /**
* Factory for UMLIntervalConstraintChangeLeftTarget.
*/
-public class UMLIntervalConstraintChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLIntervalConstraintChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return IntervalConstraintChange.class;
@@ -53,7 +53,7 @@ public class UMLIntervalConstraintChangeFactory extends UMLAbstractDiffExtension if (kind == DifferenceKind.ADD || kind == DifferenceKind.DELETE) {
result = ((ReferenceChange)input).getValue();
} else if (kind == DifferenceKind.CHANGE) {
- final EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject container = MatchUtil.getContainer(input);
result = getIntervalContraint(container);
}
return result;
@@ -106,8 +106,7 @@ public class UMLIntervalConstraintChangeFactory extends UMLAbstractDiffExtension || input.getReference().equals(UMLPackage.Literals.INTERVAL__MIN)
|| input.getReference().equals(UMLPackage.Literals.INTERVAL__MAX) || input.getReference()
.equals(UMLPackage.Literals.TIME_EXPRESSION__EXPR))
- && getManagedConcreteDiscriminantKind().contains(
- MatchUtil.getContainer(input.getMatch().getComparison(), input).eClass());
+ && getManagedConcreteDiscriminantKind().contains(MatchUtil.getContainer(input).eClass());
}
@Override
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLMessageChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLMessageChangeFactory.java index 3eaa0a5ef..cc73f44ea 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLMessageChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/sequence/UMLMessageChangeFactory.java @@ -19,7 +19,7 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.uml2.MessageChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
@@ -32,7 +32,7 @@ import org.eclipse.uml2.uml.UMLPackage; /**
* Factory for UMLGeneralizationSetChangeLeftTarget.
*/
-public class UMLMessageChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLMessageChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return MessageChange.class;
@@ -50,7 +50,7 @@ public class UMLMessageChangeFactory extends UMLAbstractDiffExtensionFactory { if (kind == DifferenceKind.ADD || kind == DifferenceKind.DELETE) {
result = ((ReferenceChange)input).getValue();
} else if (kind == DifferenceKind.CHANGE) {
- final EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject container = MatchUtil.getContainer(input);
if (container instanceof Message) {
result = container;
} else if (container instanceof MessageOccurrenceSpecification) {
@@ -90,8 +90,7 @@ public class UMLMessageChangeFactory extends UMLAbstractDiffExtensionFactory { return (input.getReference().equals(UMLPackage.Literals.MESSAGE__RECEIVE_EVENT)
|| input.getReference().equals(UMLPackage.Literals.MESSAGE__SEND_EVENT) || input
.getReference().equals(UMLPackage.Literals.INTERACTION_FRAGMENT__COVERED))
- && getManagedConcreteDiscriminantKind().contains(
- MatchUtil.getContainer(input.getMatch().getComparison(), input).eClass());
+ && getManagedConcreteDiscriminantKind().contains(MatchUtil.getContainer(input).eClass());
}
@Override
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/usecase/UMLExtendChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/usecase/UMLExtendChangeFactory.java index 73d90e38b..e50fd65d6 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/usecase/UMLExtendChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/usecase/UMLExtendChangeFactory.java @@ -19,7 +19,7 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.uml2.ExtendChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.uml2.uml.Extend;
@@ -28,7 +28,7 @@ import org.eclipse.uml2.uml.UMLPackage; /**
* Factory for UMLExtendChangeLeftTarget.
*/
-public class UMLExtendChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLExtendChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return ExtendChange.class;
@@ -46,7 +46,7 @@ public class UMLExtendChangeFactory extends UMLAbstractDiffExtensionFactory { if (kind == DifferenceKind.ADD || kind == DifferenceKind.DELETE) {
result = ((ReferenceChange)input).getValue();
} else if (kind == DifferenceKind.CHANGE) {
- final EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject container = MatchUtil.getContainer(input);
if (container instanceof Extend) {
result = container;
}
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/usecase/UMLIncludeChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/usecase/UMLIncludeChangeFactory.java index e113822ec..0bbae714a 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/usecase/UMLIncludeChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/diff/internal/extension/usecase/UMLIncludeChangeFactory.java @@ -19,7 +19,7 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.uml2.IncludeChange;
import org.eclipse.emf.compare.uml2.UMLCompareFactory;
import org.eclipse.emf.compare.uml2.UMLDiff;
-import org.eclipse.emf.compare.uml2.diff.internal.extension.UMLAbstractDiffExtensionFactory;
+import org.eclipse.emf.compare.uml2.diff.internal.extension.AbstractDiffExtensionFactory;
import org.eclipse.emf.compare.utils.MatchUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.uml2.uml.Include;
@@ -28,7 +28,7 @@ import org.eclipse.uml2.uml.UMLPackage; /**
* Factory for UMLExtendChangeLeftTarget.
*/
-public class UMLIncludeChangeFactory extends UMLAbstractDiffExtensionFactory {
+public class UMLIncludeChangeFactory extends AbstractDiffExtensionFactory {
public Class<? extends UMLDiff> getExtensionKind() {
return IncludeChange.class;
@@ -46,7 +46,7 @@ public class UMLIncludeChangeFactory extends UMLAbstractDiffExtensionFactory { if (kind == DifferenceKind.ADD || kind == DifferenceKind.DELETE) {
result = ((ReferenceChange)input).getValue();
} else if (kind == DifferenceKind.CHANGE) {
- final EObject container = MatchUtil.getContainer(input.getMatch().getComparison(), input);
+ final EObject container = MatchUtil.getContainer(input);
if (container instanceof Include) {
result = container;
}
|