diff options
author | Axel Richard | 2014-02-17 10:34:24 +0000 |
---|---|---|
committer | Axel Richard | 2014-02-17 10:49:25 +0000 |
commit | 5f8f9ebf62e0b88208e2de510bc7f8edfaac0966 (patch) | |
tree | 811f1d5db8b2ea6100692b37ad2bf9d14fa9e975 | |
parent | b77be69bacff7eae5932744e4db195a62d382517 (diff) | |
download | org.eclipse.emf.compare-5f8f9ebf62e0b88208e2de510bc7f8edfaac0966.tar.gz org.eclipse.emf.compare-5f8f9ebf62e0b88208e2de510bc7f8edfaac0966.tar.xz org.eclipse.emf.compare-5f8f9ebf62e0b88208e2de510bc7f8edfaac0966.zip |
[418163] Manage display and merge of UML Stereotype Properties
Manage display and merge of Stereotype Attribute & Reference changes
Bug: 418163
Change-Id: I52fa6a0fb1f2c5566a8a16f57c0ac280a0701601
46 files changed, 1803 insertions, 547 deletions
diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/icons/full/obj16/StereotypeAttributeChange.gif b/plugins/org.eclipse.emf.compare.uml2.edit/icons/full/obj16/StereotypeAttributeChange.gif Binary files differnew file mode 100644 index 000000000..a26660ec2 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.edit/icons/full/obj16/StereotypeAttributeChange.gif diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/plugin.properties b/plugins/org.eclipse.emf.compare.uml2.edit/plugin.properties index 4855cd48e..32b12ea2b 100644 --- a/plugins/org.eclipse.emf.compare.uml2.edit/plugin.properties +++ b/plugins/org.eclipse.emf.compare.uml2.edit/plugin.properties @@ -161,3 +161,4 @@ _UI_UMLDiff_discriminant_feature = Discriminant _UI_IncludeChange_type = Include Change _UI_UMLDiff_eReference_feature = EReference _UI_DirectedRelationshipChange_type = Directed Relationship Change +_UI_StereotypeAttributeChange_type = Stereotype Attribute Change diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/StereotypePropertyChangeItemProvider.java b/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/StereotypeAttributeChangeItemProvider.java index 347c2eccb..e754f72f9 100644 --- a/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/StereotypePropertyChangeItemProvider.java +++ b/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/StereotypeAttributeChangeItemProvider.java @@ -19,10 +19,8 @@ import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.compare.DifferenceKind;
-import org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange;
-import org.eclipse.emf.compare.uml2.internal.UMLComparePackage;
+import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemColorProvider;
import org.eclipse.emf.edit.provider.IItemFontProvider;
@@ -33,12 +31,12 @@ import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
/**
- * This is the item provider adapter for a {@link org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange} object.
+ * This is the item provider adapter for a {@link org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
-public class StereotypePropertyChangeItemProvider
+public class StereotypeAttributeChangeItemProvider
extends UMLDiffItemProvider
implements
IEditingDomainItemProvider,
@@ -54,7 +52,7 @@ public class StereotypePropertyChangeItemProvider * <!-- end-user-doc -->
* @generated
*/
- public StereotypePropertyChangeItemProvider(AdapterFactory adapterFactory) {
+ public StereotypeAttributeChangeItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
@@ -69,42 +67,19 @@ public class StereotypePropertyChangeItemProvider if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
- addStereotypePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
- * This adds a property descriptor for the Stereotype feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addStereotypePropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_StereotypePropertyChange_stereotype_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_StereotypePropertyChange_stereotype_feature", "_UI_StereotypePropertyChange_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- UMLComparePackage.Literals.STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE,
- true,
- false,
- true,
- null,
- null,
- null));
- }
-
- /**
- * This returns StereotypePropertyChange.gif.
+ * This returns StereotypeAttributeChange.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/StereotypePropertyChange")); //$NON-NLS-1$
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/StereotypeAttributeChange")); //$NON-NLS-1$
}
/**
@@ -115,11 +90,11 @@ public class StereotypePropertyChangeItemProvider */
@Override
public String getText(Object object) {
- DifferenceKind labelValue = ((StereotypePropertyChange)object).getKind();
+ DifferenceKind labelValue = ((StereotypeAttributeChange)object).getKind();
String label = labelValue == null ? null : labelValue.toString();
return label == null || label.length() == 0 ?
- getString("_UI_StereotypePropertyChange_type") : //$NON-NLS-1$
- getString("_UI_StereotypePropertyChange_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ getString("_UI_StereotypeAttributeChange_type") : //$NON-NLS-1$
+ getString("_UI_StereotypeAttributeChange_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/UMLCompareItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/UMLCompareItemProviderAdapterFactory.java index 685527e00..f98d32180 100644 --- a/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/UMLCompareItemProviderAdapterFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2.edit/src-gen/org/eclipse/emf/compare/uml2/internal/provider/UMLCompareItemProviderAdapterFactory.java @@ -217,25 +217,26 @@ public class UMLCompareItemProviderAdapterFactory extends UMLCompareAdapterFacto } /** - * This keeps track of the one adapter used for all {@link org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange} instances. - * <!-- begin-user-doc - * --> <!-- end-user-doc --> + * This keeps track of the one adapter used for all {@link org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> * @generated */ - protected StereotypePropertyChangeItemProvider stereotypePropertyChangeItemProvider; + protected StereotypeAttributeChangeItemProvider stereotypeAttributeChangeItemProvider; /** - * This creates an adapter for a {@link org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange}. - * <!-- begin-user-doc --> <!-- end-user-doc --> + * This creates an adapter for a {@link org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> * @generated */ @Override - public Adapter createStereotypePropertyChangeAdapter() { - if (stereotypePropertyChangeItemProvider == null) { - stereotypePropertyChangeItemProvider = new StereotypePropertyChangeItemProvider(this); + public Adapter createStereotypeAttributeChangeAdapter() { + if (stereotypeAttributeChangeItemProvider == null) { + stereotypeAttributeChangeItemProvider = new StereotypeAttributeChangeItemProvider(this); } - return stereotypePropertyChangeItemProvider; + return stereotypeAttributeChangeItemProvider; } /** @@ -428,7 +429,7 @@ public class UMLCompareItemProviderAdapterFactory extends UMLCompareAdapterFacto if (executionSpecificationChangeItemProvider != null) executionSpecificationChangeItemProvider.dispose(); if (intervalConstraintChangeItemProvider != null) intervalConstraintChangeItemProvider.dispose(); if (messageChangeItemProvider != null) messageChangeItemProvider.dispose(); - if (stereotypePropertyChangeItemProvider != null) stereotypePropertyChangeItemProvider.dispose(); + if (stereotypeAttributeChangeItemProvider != null) stereotypeAttributeChangeItemProvider.dispose(); if (stereotypeApplicationChangeItemProvider != null) stereotypeApplicationChangeItemProvider.dispose(); if (stereotypeReferenceChangeItemProvider != null) stereotypeReferenceChangeItemProvider.dispose(); if (profileApplicationChangeItemProvider != null) profileApplicationChangeItemProvider.dispose(); diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/StereotypeAttributeChangeCustomItemProvider.java b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/StereotypeAttributeChangeCustomItemProvider.java new file mode 100644 index 000000000..371e35cb7 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/StereotypeAttributeChangeCustomItemProvider.java @@ -0,0 +1,89 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.uml2.internal.provider.custom;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.provider.ExtendedAdapterFactoryItemDelegator;
+import org.eclipse.emf.compare.provider.utils.ComposedStyledString;
+import org.eclipse.emf.compare.provider.utils.IStyledString;
+import org.eclipse.emf.compare.provider.utils.IStyledString.Style;
+import org.eclipse.emf.compare.uml2.internal.UMLDiff;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.uml.NamedElement;
+
+/**
+ * Item Provider for Stereotype Property Change.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class StereotypeAttributeChangeCustomItemProvider extends UMLDiffCustomItemProvider {
+
+ /** The item delegator to reuse root adapter factory (if any). */
+ private final ExtendedAdapterFactoryItemDelegator itemDelegator;
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ *
+ * @param adapterFactory
+ * the adapter factory to use.
+ */
+ public StereotypeAttributeChangeCustomItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ itemDelegator = new ExtendedAdapterFactoryItemDelegator(getRootAdapterFactory());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.provider.IItemStyledLabelProvider#getStyledText(java.lang.Object)
+ */
+ @Override
+ public IStyledString.IComposedStyledString getStyledText(Object object) {
+ final UMLDiff umlDiff = (UMLDiff)object;
+
+ EObject discriminant = umlDiff.getDiscriminant();
+
+ final ComposedStyledString stereotypeText = new ComposedStyledString();
+ final String prefix = "Stereotype Property ";
+ if (discriminant instanceof NamedElement) {
+ stereotypeText.append(prefix + ((NamedElement)discriminant).getName() + ' ');
+ } else if (discriminant instanceof EAttribute) {
+ stereotypeText.append(prefix + ((EAttribute)discriminant).getName() + ' ');
+ } else {
+ // Can't really do more
+ stereotypeText.append(prefix);
+ }
+
+ final String action;
+ switch (umlDiff.getKind()) {
+ case ADD:
+ action = "add"; //$NON-NLS-1$
+ break;
+ case DELETE:
+ action = "remove"; //$NON-NLS-1$
+ break;
+ case CHANGE:
+ action = "changed"; //$NON-NLS-1$
+ break;
+ case MOVE:
+ action = "moved"; //$NON-NLS-1$
+ break;
+ default:
+ throw new IllegalStateException("Unsupported " + DifferenceKind.class.getSimpleName() //$NON-NLS-1$
+ + " value: " + umlDiff.getKind()); //$NON-NLS-1$
+ }
+
+ return stereotypeText.append(" [stereotype attribute " + action + "]", Style.DECORATIONS_STYLER);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/StereotypeReferenceChangeCustomItemProvider.java b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/StereotypeReferenceChangeCustomItemProvider.java new file mode 100644 index 000000000..1e86a0ec2 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/StereotypeReferenceChangeCustomItemProvider.java @@ -0,0 +1,69 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.uml2.internal.provider.custom;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.provider.ExtendedAdapterFactoryItemDelegator;
+import org.eclipse.emf.compare.provider.utils.ComposedStyledString;
+import org.eclipse.emf.compare.provider.utils.IStyledString;
+import org.eclipse.emf.compare.provider.utils.IStyledString.Style;
+import org.eclipse.emf.compare.uml2.internal.UMLDiff;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.uml2.uml.NamedElement;
+
+/**
+ * Item Provider for Stereotype Property Change.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class StereotypeReferenceChangeCustomItemProvider extends UMLDiffCustomItemProvider {
+
+ /** The item delegator to reuse root adapter factory (if any). */
+ private final ExtendedAdapterFactoryItemDelegator itemDelegator;
+
+ /**
+ * This constructs an instance from a factory and a notifier.
+ *
+ * @param adapterFactory
+ * the adapter factory to use.
+ */
+ public StereotypeReferenceChangeCustomItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ itemDelegator = new ExtendedAdapterFactoryItemDelegator(getRootAdapterFactory());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.provider.IItemStyledLabelProvider#getStyledText(java.lang.Object)
+ */
+ @Override
+ public IStyledString.IComposedStyledString getStyledText(Object object) {
+ final UMLDiff umlDiff = (UMLDiff)object;
+
+ EObject discriminant = umlDiff.getDiscriminant();
+
+ final ComposedStyledString stereotypeText = new ComposedStyledString();
+ final String prefix = "Stereotype Property ";
+ if (discriminant instanceof NamedElement) {
+ stereotypeText.append(prefix + ((NamedElement)discriminant).getName() + ' ');
+ } else if (discriminant instanceof EReference) {
+ stereotypeText.append(prefix + ((EReference)discriminant).getName() + ' ');
+ } else {
+ // Can't really do more
+ stereotypeText.append(prefix);
+ }
+
+ return stereotypeText.append(" [stereotype reference changed]", Style.DECORATIONS_STYLER);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/UMLCompareCustomItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/UMLCompareCustomItemProviderAdapterFactory.java index c5221e9ac..ea28c9a83 100644 --- a/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/UMLCompareCustomItemProviderAdapterFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2.edit/src/org/eclipse/emf/compare/uml2/internal/provider/custom/UMLCompareCustomItemProviderAdapterFactory.java @@ -57,6 +57,18 @@ public class UMLCompareCustomItemProviderAdapterFactory extends UMLCompareAdapte private StereotypeApplicationChangeCustomItemProvider stereotypeApplicationChangeExtendedItemProvider;
/**
+ * This keeps track of the one adapter used for all + * {@link org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange} instances.
+ */
+ private StereotypeAttributeChangeCustomItemProvider stereotypeAttributeChangeExtendedItemProvider;
+
+ /**
+ * This keeps track of the one adapter used for all
+ * {@link org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange} instances.
+ */
+ private StereotypeReferenceChangeCustomItemProvider stereotypeReferenceChangeExtendedItemProvider; +
+ /**
* This keeps track of the one adapter used for all {@link org.eclipse.emf.compare.uml2.internal.UMLDiff}
* instances.
*/
@@ -87,6 +99,36 @@ public class UMLCompareCustomItemProviderAdapterFactory extends UMLCompareAdapte /**
* {@inheritDoc}
+ * + * @see org.eclipse.emf.compare.uml2.internal.util.UMLCompareAdapterFactory#createStereotypeAttributeChangeAdapter()
+ */
+ @Override
+ public Adapter createStereotypeAttributeChangeAdapter() {
+ if (stereotypeAttributeChangeExtendedItemProvider == null) {
+ stereotypeAttributeChangeExtendedItemProvider = new StereotypeAttributeChangeCustomItemProvider(
+ this);
+ }
+
+ return stereotypeAttributeChangeExtendedItemProvider;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.util.UMLCompareAdapterFactory#createStereotypeReferenceChangeAdapter()
+ */
+ @Override
+ public Adapter createStereotypeReferenceChangeAdapter() {
+ if (stereotypeReferenceChangeExtendedItemProvider == null) {
+ stereotypeReferenceChangeExtendedItemProvider = new StereotypeReferenceChangeCustomItemProvider(
+ this);
+ }
+
+ return stereotypeReferenceChangeExtendedItemProvider; + }
+
+ /**
+ * {@inheritDoc}
*
* @see org.eclipse.emf.compare.uml2.internal.util.UMLCompareAdapterFactory#createUMLDiffAdapter()
*/
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/META-INF/MANIFEST.MF index 14d2d9e80..8599add75 100644 --- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/META-INF/MANIFEST.MF @@ -5,7 +5,8 @@ Bundle-SymbolicName: org.eclipse.emf.compare.uml2.rcp.ui;singleton:=true Bundle-Version: 2.2.0.qualifier Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.emf.compare.uml2.edit;bundle-version="2.0.1", +Require-Bundle: org.eclipse.emf.edit.ui;bundle-version="2.5.0", + org.eclipse.emf.compare.uml2.edit;bundle-version="2.0.1", org.eclipse.emf.compare;bundle-version="2.0.1", org.eclipse.swt;bundle-version="3.5.0", org.eclipse.emf.compare.rcp.ui;bundle-version="2.0.1", diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/plugin.xml b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/plugin.xml index fa4218ead..70865e6fa 100644 --- a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/plugin.xml +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/plugin.xml @@ -7,6 +7,26 @@ class="org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.factory.UMLStereotypeApplicationChangeFeatureAccessorFactory"
ranking="25">
</factory>
+ <factory
+ class="org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.factory.UMLStereotypeStringAttributeChangeAccessorFactory"
+ ranking="25">
+ </factory>
+ <factory
+ class="org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.factory.UMLStereotypeSingleAttributeChangeAccessorFactory"
+ ranking="25">
+ </factory>
+ <factory
+ class="org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.factory.UMLStereotypeManyAttributeChangeAccessorFactory"
+ ranking="25">
+ </factory>
+ <factory
+ class="org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.factory.UMLStereotypeSingleReferenceChangeAccessorFactory"
+ ranking="25">
+ </factory>
+ <factory
+ class="org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.factory.UMLStereotypeManyReferenceChangeAccessorFactory"
+ ranking="25">
+ </factory>
</extension>
<extension
point="org.eclipse.emf.compare.rcp.ui.filters">
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/UMLStereotypeManyStructuralFeatureChangeAccessor.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/UMLStereotypeManyStructuralFeatureChangeAccessor.java new file mode 100644 index 000000000..c3b727d42 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/UMLStereotypeManyStructuralFeatureChangeAccessor.java @@ -0,0 +1,141 @@ +/*******************************************************************************
+ * Copyright (c) 2013, 2014 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.uml2.rcp.ui.internal.accessor;
+
+import static com.google.common.collect.Iterables.filter;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableList;
+
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.ManyStructuralFeatureAccessorImpl;
+import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide;
+import org.eclipse.emf.compare.uml2.internal.UMLDiff;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * Case of stereotype many structural feature (attribute/reference) changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeManyStructuralFeatureChangeAccessor extends ManyStructuralFeatureAccessorImpl {
+
+ /**
+ * Creates a specialized accessor for the stereotype application differences.
+ *
+ * @param adapterFactory
+ * The adapter factory used by the accessor.
+ * @param diff
+ * The diff for which we need an accessor.
+ * @param side
+ * The side on which this accessor will be used.
+ */
+ public UMLStereotypeManyStructuralFeatureChangeAccessor(AdapterFactory adapterFactory, UMLDiff diff,
+ MergeViewerSide side) {
+ super(adapterFactory, diff, side);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.AbstractStructuralFeatureAccessor#getAffectedFeature(org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ protected ImmutableList<Diff> computeDifferences() {
+ Match match = getInitialDiff().getMatch();
+ List<Diff> siblingDifferences = match.getDifferences();
+ EStructuralFeature affectedFeature = getAffectedFeature(getInitialDiff());
+ return ImmutableList.copyOf(filter(siblingDifferences, onFeature(getStructuralFeature().getName(),
+ affectedFeature)));
+ }
+
+ /**
+ * This can be used to check that a given {@code affectedFeature} matches the given {@code featureName}.
+ *
+ * @param featureName
+ * Name of the feature on which we expect a change.
+ * @param affectedFeature
+ * The affected feature.
+ * @return The created predicate.
+ */
+ private static Predicate<? super Diff> onFeature(final String featureName,
+ final EStructuralFeature affectedFeature) {
+ return new Predicate<Diff>() {
+ public boolean apply(Diff input) {
+ return featureName.equals(affectedFeature.getName());
+ }
+ };
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.AbstractStructuralFeatureAccessor#getAffectedFeature(org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ protected EStructuralFeature getAffectedFeature(Diff diff) {
+ return (EStructuralFeature)((UMLDiff)diff).getDiscriminant();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.UMLStereotypeManyStructuralFeatureChangeAccessor#getEObject(org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.IMergeViewer.MergeViewerSide)
+ */
+ @Override
+ public EObject getEObject(MergeViewerSide side) {
+ Diff refined = getInitialDiff().getRefinedBy().get(0);
+ final EObject eObject;
+ switch (side) {
+ case ANCESTOR:
+ eObject = refined.getMatch().getOrigin();
+ break;
+ case LEFT:
+ eObject = refined.getMatch().getLeft();
+ break;
+ case RIGHT:
+ eObject = refined.getMatch().getRight();
+ break;
+ default:
+ throw new IllegalStateException();
+ }
+ return eObject;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.ManyStructuralFeatureAccessorImpl#getValueFromDiff(org.eclipse.emf.compare.Diff,
+ * org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.IMergeViewer.MergeViewerSide)
+ */
+ @Override
+ protected Object getValueFromDiff(Diff diff, MergeViewerSide side) {
+ Diff refined = diff.getRefinedBy().get(0);
+ return super.getValueFromDiff(refined, side);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.ManyStructuralFeatureAccessorImpl#findInsertionIndex(org.eclipse.emf.compare.Diff,
+ * boolean)
+ */
+ @Override
+ protected int findInsertionIndex(Diff diff, boolean rightToLeft) {
+ Diff refined = diff.getRefinedBy().get(0);
+ return super.findInsertionIndex(refined, rightToLeft);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/UMLStereotypeSingleStructuralFeatureChangeAccessor.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/UMLStereotypeSingleStructuralFeatureChangeAccessor.java new file mode 100644 index 000000000..bea9a966b --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/UMLStereotypeSingleStructuralFeatureChangeAccessor.java @@ -0,0 +1,77 @@ +/*******************************************************************************
+ * Copyright (c) 2013, 2014 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.uml2.rcp.ui.internal.accessor;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.SingleStructuralFeatureAccessorImpl;
+import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide;
+import org.eclipse.emf.compare.uml2.internal.UMLDiff;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * Case of stereotype single structural feature (attribute/reference) changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeSingleStructuralFeatureChangeAccessor extends SingleStructuralFeatureAccessorImpl {
+
+ /**
+ * Creates a specialized accessor for the stereotype application differences.
+ *
+ * @param adapterFactory
+ * The adapter factory used by the accessor.
+ * @param diff
+ * The diff for which we need an accessor.
+ * @param side
+ * The side on which this accessor will be used.
+ */
+ public UMLStereotypeSingleStructuralFeatureChangeAccessor(AdapterFactory adapterFactory, UMLDiff diff,
+ MergeViewerSide side) {
+ super(adapterFactory, diff, side);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.AbstractStructuralFeatureAccessor#getAffectedFeature(org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ protected EStructuralFeature getAffectedFeature(Diff diff) {
+ return (EStructuralFeature)((UMLDiff)diff).getDiscriminant();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.UMLStereotypeSingleStructuralFeatureChangeAccessor#getEObject(org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.IMergeViewer.MergeViewerSide)
+ */
+ @Override
+ public EObject getEObject(MergeViewerSide side) {
+ Diff refined = getInitialDiff().getRefinedBy().get(0);
+ final EObject eObject;
+ switch (side) {
+ case ANCESTOR:
+ eObject = refined.getMatch().getOrigin();
+ break;
+ case LEFT:
+ eObject = refined.getMatch().getLeft();
+ break;
+ case RIGHT:
+ eObject = refined.getMatch().getRight();
+ break;
+ default:
+ throw new IllegalStateException();
+ }
+ return eObject;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/UMLStereotypeStringAttributeChangeAccessor.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/UMLStereotypeStringAttributeChangeAccessor.java new file mode 100644 index 000000000..2c032b688 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/UMLStereotypeStringAttributeChangeAccessor.java @@ -0,0 +1,131 @@ +/*******************************************************************************
+ * Copyright (c) 2013, 2014 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.uml2.rcp.ui.internal.accessor;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.IStreamContentAccessor;
+import org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.ITypedElement;
+import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.TypeConstants;
+import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange;
+import org.eclipse.emf.compare.utils.ReferenceUtil;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Case of stereotype string attribute changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeStringAttributeChangeAccessor implements ITypedElement, IStreamContentAccessor {
+
+ /** The EObject to get the value of the EAttribute from. */
+ protected final EObject fEObject;
+
+ /** The EAttribute to retrieve from the wrapped EObject. */
+ protected final EAttribute fAttribute;
+
+ /** The comparison object. */
+ protected final Comparison fComparison;
+
+ /**
+ * Constructor.
+ *
+ * @param eObject
+ * the EObject to get the value of the EAttribute from.
+ * @param propertyChange
+ * the {@link StereotypeAttributeChange} concerned by the accessor.
+ */
+ public UMLStereotypeStringAttributeChangeAccessor(EObject eObject,
+ StereotypeAttributeChange propertyChange) {
+ this.fEObject = eObject;
+ this.fAttribute = (EAttribute)propertyChange.getDiscriminant();
+ this.fComparison = propertyChange.getMatch().getComparison();
+ }
+
+ /**
+ * Returns the comparison object.
+ *
+ * @return the fComparison
+ */
+ public Comparison getComparison() {
+ return fComparison;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.compare.IStreamContentAccessor#getContents()
+ */
+ public InputStream getContents() throws CoreException {
+ Object value = ReferenceUtil.safeEGet(getEObject(), getEAtribute());
+ String stringValue = EcoreUtil.convertToString(getEAtribute().getEAttributeType(), value);
+ // Assume that the platform locale is appropriate.
+ if (stringValue != null) {
+ return new ByteArrayInputStream(stringValue.getBytes());
+ } else {
+ return new ByteArrayInputStream(new byte[0]);
+ }
+ }
+
+ /**
+ * Returns the EObject to get the value of the EAttribute from.
+ *
+ * @return the fEObject
+ */
+ protected final EObject getEObject() {
+ return fEObject;
+ }
+
+ /**
+ * Returns the EAttribute to retrieve from the wrapped EObject.
+ *
+ * @return the fEAttribute
+ */
+ protected final EAttribute getEAtribute() {
+ return fAttribute;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.wrapper.compare.ITypedElement#getName()
+ */
+ public String getName() {
+ return this.getClass().getName();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.wrapper.compare.ITypedElement#getImage()
+ */
+ public Image getImage() {
+ return ExtendedImageRegistry.getInstance().getImage(
+ EcoreEditPlugin.getPlugin().getImage("full/obj16/EAttribute")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.wrapper.compare.ITypedElement#getType()
+ */
+ public String getType() {
+ return TypeConstants.TYPE_ETEXT_DIFF;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeManyAttributeChangeAccessorFactory.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeManyAttributeChangeAccessorFactory.java new file mode 100644 index 000000000..12005a188 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeManyAttributeChangeAccessorFactory.java @@ -0,0 +1,81 @@ +/*******************************************************************************
+ * Copyright (c) 2013, 2014 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.uml2.rcp.ui.internal.accessor.factory;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.ITypedElement;
+import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.factory.impl.ManyStructuralFeatureAccessorFactory;
+import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide;
+import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange;
+import org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.UMLStereotypeManyStructuralFeatureChangeAccessor;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * This will be in charge of creating the accessor for stereotype many attribute changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeManyAttributeChangeAccessorFactory extends ManyStructuralFeatureAccessorFactory {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#isFactoryFor(java.lang.Object)
+ */
+ @Override
+ public boolean isFactoryFor(Object target) {
+ if (target instanceof StereotypeAttributeChange) {
+ EObject discriminant = ((StereotypeAttributeChange)target).getDiscriminant();
+ if (discriminant instanceof EAttribute) {
+ EAttribute attribute = (EAttribute)discriminant;
+ return attribute.isMany();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createLeft(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createLeft(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeManyStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeAttributeChange)target, MergeViewerSide.LEFT);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createRight(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createRight(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeManyStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeAttributeChange)target, MergeViewerSide.RIGHT);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createAncestor(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createAncestor(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeManyStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeAttributeChange)target, MergeViewerSide.ANCESTOR);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeManyReferenceChangeAccessorFactory.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeManyReferenceChangeAccessorFactory.java new file mode 100644 index 000000000..941734662 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeManyReferenceChangeAccessorFactory.java @@ -0,0 +1,81 @@ +/*******************************************************************************
+ * Copyright (c) 2013, 2014 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.uml2.rcp.ui.internal.accessor.factory;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.ITypedElement;
+import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.factory.impl.ManyStructuralFeatureAccessorFactory;
+import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide;
+import org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange;
+import org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.UMLStereotypeManyStructuralFeatureChangeAccessor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * This will be in charge of creating the accessor for stereotype many reference changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeManyReferenceChangeAccessorFactory extends ManyStructuralFeatureAccessorFactory {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#isFactoryFor(java.lang.Object)
+ */
+ @Override
+ public boolean isFactoryFor(Object target) {
+ if (target instanceof StereotypeReferenceChange) {
+ EObject discriminant = ((StereotypeReferenceChange)target).getDiscriminant();
+ if (discriminant instanceof EReference) {
+ EReference ref = (EReference)discriminant;
+ return ref.isMany();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createLeft(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createLeft(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeManyStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeReferenceChange)target, MergeViewerSide.LEFT);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createRight(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createRight(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeManyStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeReferenceChange)target, MergeViewerSide.RIGHT);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createAncestor(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createAncestor(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeManyStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeReferenceChange)target, MergeViewerSide.ANCESTOR);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeSingleAttributeChangeAccessorFactory.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeSingleAttributeChangeAccessorFactory.java new file mode 100644 index 000000000..3f0df8d3c --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeSingleAttributeChangeAccessorFactory.java @@ -0,0 +1,82 @@ +/*******************************************************************************
+ * Copyright (c) 2013, 2014 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.uml2.rcp.ui.internal.accessor.factory;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.ITypedElement;
+import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.factory.impl.SingleStructuralFeatureAccessorFactory;
+import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide;
+import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange;
+import org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.UMLStereotypeSingleStructuralFeatureChangeAccessor;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * This will be in charge of creating the accessor for stereotype single attribute changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeSingleAttributeChangeAccessorFactory extends SingleStructuralFeatureAccessorFactory {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#isFactoryFor(java.lang.Object)
+ */
+ @Override
+ public boolean isFactoryFor(Object target) {
+ if (target instanceof StereotypeAttributeChange) {
+ EObject discriminant = ((StereotypeAttributeChange)target).getDiscriminant();
+ if (discriminant instanceof EAttribute) {
+ EAttribute attribute = (EAttribute)discriminant;
+ return !(attribute.getEAttributeType().getInstanceClass() == String.class)
+ && !attribute.isMany();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createLeft(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createLeft(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeSingleStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeAttributeChange)target, MergeViewerSide.LEFT);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createRight(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createRight(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeSingleStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeAttributeChange)target, MergeViewerSide.RIGHT);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createAncestor(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createAncestor(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeSingleStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeAttributeChange)target, MergeViewerSide.ANCESTOR);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeSingleReferenceChangeAccessorFactory.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeSingleReferenceChangeAccessorFactory.java new file mode 100644 index 000000000..b09a29fff --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeSingleReferenceChangeAccessorFactory.java @@ -0,0 +1,81 @@ +/*******************************************************************************
+ * Copyright (c) 2013, 2014 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.uml2.rcp.ui.internal.accessor.factory;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.ITypedElement;
+import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.factory.impl.SingleStructuralFeatureAccessorFactory;
+import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide;
+import org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange;
+import org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.UMLStereotypeSingleStructuralFeatureChangeAccessor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * This will be in charge of creating the accessor for stereotype single reference changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeSingleReferenceChangeAccessorFactory extends SingleStructuralFeatureAccessorFactory {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#isFactoryFor(java.lang.Object)
+ */
+ @Override
+ public boolean isFactoryFor(Object target) {
+ if (target instanceof StereotypeReferenceChange) {
+ EObject discriminant = ((StereotypeReferenceChange)target).getDiscriminant();
+ if (discriminant instanceof EReference) {
+ EReference ref = (EReference)discriminant;
+ return !ref.isMany();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createLeft(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createLeft(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeSingleStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeReferenceChange)target, MergeViewerSide.LEFT);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createRight(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createRight(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeSingleStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeReferenceChange)target, MergeViewerSide.RIGHT);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createAncestor(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createAncestor(AdapterFactory adapterFactory, Object target) {
+ return new UMLStereotypeSingleStructuralFeatureChangeAccessor(adapterFactory,
+ (StereotypeReferenceChange)target, MergeViewerSide.ANCESTOR);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeStringAttributeChangeAccessorFactory.java b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeStringAttributeChangeAccessorFactory.java new file mode 100644 index 000000000..23e07785d --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.rcp.ui/src/org/eclipse/emf/compare/uml2/rcp/ui/internal/accessor/factory/UMLStereotypeStringAttributeChangeAccessorFactory.java @@ -0,0 +1,101 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.uml2.rcp.ui.internal.accessor.factory;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.ITypedElement;
+import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.factory.impl.StringAttributeChangeAccessorFactory;
+import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange;
+import org.eclipse.emf.compare.uml2.rcp.ui.internal.accessor.UMLStereotypeStringAttributeChangeAccessor;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * This will be in charge of creating the accessor for stereotype property changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeStringAttributeChangeAccessorFactory extends StringAttributeChangeAccessorFactory {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#isFactoryFor(java.lang.Object)
+ */
+ @Override
+ public boolean isFactoryFor(Object target) {
+ if (target instanceof StereotypeAttributeChange) {
+ EObject discriminant = ((StereotypeAttributeChange)target).getDiscriminant();
+ if (discriminant instanceof EAttribute) {
+ EAttribute attribute = (EAttribute)discriminant;
+ return attribute.getEAttributeType().getInstanceClass() == String.class
+ && !attribute.isMany();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createLeft(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createLeft(AdapterFactory adapterFactory, Object target) {
+ StereotypeAttributeChange change = (StereotypeAttributeChange)target;
+ Diff refined = change.getRefinedBy().get(0);
+ EObject left = refined.getMatch().getLeft();
+ if (left != null) {
+ return new UMLStereotypeStringAttributeChangeAccessor(left, (StereotypeAttributeChange)target);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createRight(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createRight(AdapterFactory adapterFactory, Object target) {
+ StereotypeAttributeChange change = (StereotypeAttributeChange)target;
+ Diff refined = change.getRefinedBy().get(0);
+ EObject right = refined.getMatch().getRight();
+ if (right != null) {
+ return new UMLStereotypeStringAttributeChangeAccessor(right, (StereotypeAttributeChange)target);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.IAccessorFactory#createAncestor(org.eclipse.emf.common.notify.AdapterFactory,
+ * java.lang.Object)
+ */
+ @Override
+ public ITypedElement createAncestor(AdapterFactory adapterFactory, Object target) {
+ StereotypeAttributeChange change = (StereotypeAttributeChange)target;
+ Diff refined = change.getRefinedBy().get(0);
+ EObject origin = refined.getMatch().getOrigin();
+ if (origin != null) {
+ return new UMLStereotypeStringAttributeChangeAccessor(origin, (StereotypeAttributeChange)target);
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLTest.java index 8a1a8d35e..17d9a53ca 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLTest.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/AbstractUMLTest.java @@ -10,6 +10,8 @@ */ package org.eclipse.emf.compare.uml2.tests; +import static com.google.common.collect.Iterators.all; +import static org.eclipse.emf.compare.utils.EMFComparePredicates.hasConflict; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -28,6 +30,7 @@ import org.eclipse.emf.common.util.EList; import org.eclipse.emf.compare.AttributeChange; import org.eclipse.emf.compare.ComparePackage; import org.eclipse.emf.compare.Comparison; +import org.eclipse.emf.compare.ConflictKind; import org.eclipse.emf.compare.Diff; import org.eclipse.emf.compare.EMFCompare; import org.eclipse.emf.compare.EMFCompare.Builder; @@ -201,25 +204,45 @@ public abstract class AbstractUMLTest { protected abstract AbstractUMLInputData getInput(); protected void testMergeLeftToRight(Notifier left, Notifier right, Notifier origin) { + testMergeLeftToRight(left, right, origin, false); + } + + protected void testMergeRightToLeft(Notifier left, Notifier right, Notifier origin) { + testMergeRightToLeft(left, right, origin, false); + } + + protected void testMergeLeftToRight(Notifier left, Notifier right, Notifier origin, boolean pseudoAllowed) { final IComparisonScope scope = new DefaultComparisonScope(left, right, origin); final Comparison comparisonBefore = getCompare().compare(scope); - EList<Diff> differences = comparisonBefore.getDifferences(); + EList<Diff> differencesBefore = comparisonBefore.getDifferences(); final IBatchMerger merger = new BatchMerger(mergerRegistry); - merger.copyAllLeftToRight(differences, new BasicMonitor()); + merger.copyAllLeftToRight(differencesBefore, new BasicMonitor()); final Comparison comparisonAfter = getCompare().compare(scope); - assertTrue("Comparison#getDifferences() must be empty after copyAllLeftToRight", comparisonAfter - .getDifferences().isEmpty()); + EList<Diff> differencesAfter = comparisonAfter.getDifferences(); + final boolean diffs; + if (pseudoAllowed) { + diffs = all(differencesAfter.iterator(), hasConflict(ConflictKind.PSEUDO)); + } else { + diffs = differencesAfter.isEmpty(); + } + assertTrue("Comparison#getDifferences() must be empty after copyAllLeftToRight", diffs); } - protected void testMergeRightToLeft(Notifier left, Notifier right, Notifier origin) { + protected void testMergeRightToLeft(Notifier left, Notifier right, Notifier origin, boolean pseudoAllowed) { final IComparisonScope scope = new DefaultComparisonScope(left, right, origin); final Comparison comparisonBefore = getCompare().compare(scope); - EList<Diff> differences = comparisonBefore.getDifferences(); + EList<Diff> differencesBefore = comparisonBefore.getDifferences(); final IBatchMerger merger = new BatchMerger(mergerRegistry); - merger.copyAllRightToLeft(differences, new BasicMonitor()); + merger.copyAllRightToLeft(differencesBefore, new BasicMonitor()); final Comparison comparisonAfter = getCompare().compare(scope); - assertTrue("Comparison#getDifferences() must be empty after copyAllRightToLeft", comparisonAfter - .getDifferences().isEmpty()); + EList<Diff> differencesAfter = comparisonAfter.getDifferences(); + final boolean diffs; + if (pseudoAllowed) { + diffs = all(differencesAfter.iterator(), hasConflict(ConflictKind.PSEUDO)); + } else { + diffs = differencesAfter.isEmpty(); + } + assertTrue("Comparison#getDifferences() must be empty after copyAllRightToLeft", diffs); } protected void testIntersections(Comparison comparison) { diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/DynamicStereotypeTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/DynamicStereotypeTest.java index df9b0639a..68eeb6a68 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/DynamicStereotypeTest.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/DynamicStereotypeTest.java @@ -1,3 +1,13 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.uml2.tests.stereotypes;
import static com.google.common.base.Predicates.and;
@@ -14,6 +24,7 @@ import static org.eclipse.emf.compare.utils.EMFComparePredicates.valueNameMatche import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
+import com.google.common.collect.UnmodifiableIterator;
import java.io.IOException;
import java.util.List;
@@ -26,6 +37,8 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.ResourceAttachmentChange;
import org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange;
import org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange;
+import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange;
+import org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange;
import org.eclipse.emf.compare.uml2.tests.AbstractDynamicProfileTest;
import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
import org.eclipse.emf.compare.uml2.tests.stereotypes.data.dynamic.DynamicStereotypeInputData;
@@ -519,6 +532,19 @@ public class DynamicStereotypeTest extends AbstractDynamicProfileTest { testMergeLeftToRight(left, right, left);
}
+ @Test
+ public void testA110UseCase3way() throws IOException {
+ final Resource left = input.getA11Left();
+ final Resource right = input.getA11Right();
+ final Resource ancestor = input.getA11Ancestor();
+
+ final Comparison comparison = compare(left, right, ancestor);
+ testAB11(comparison);
+
+ testMergeRightToLeft(left, right, ancestor, true);
+ testMergeLeftToRight(left, right, ancestor, true);
+ }
+
private void testAB1(TestKind kind, final Comparison comparison) {
final List<Diff> differences = comparison.getDifferences();
@@ -864,8 +890,8 @@ public class DynamicStereotypeTest extends AbstractDynamicProfileTest { private void testAB5(TestKind kind, final Comparison comparison) {
final List<Diff> differences = comparison.getDifferences();
- // We should have no less and no more than 3 differences
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+ // We should have no less and no more than 4 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
Predicate<? super Diff> changeAttributeDescription1 = null;
Predicate<? super Diff> changeAttributeDescription2 = null;
@@ -877,15 +903,23 @@ public class DynamicStereotypeTest extends AbstractDynamicProfileTest { final Diff changeAttribute1 = Iterators.find(differences.iterator(), changeAttributeDescription1);
final Diff changeAttribute2 = Iterators.find(differences.iterator(), changeAttributeDescription2);
- final Diff changeUMLStereotypeApplication = Iterators.find(differences.iterator(), and(
- instanceOf(StereotypeApplicationChange.class), ofKind(DifferenceKind.CHANGE)));
+ final UnmodifiableIterator<Diff> changeUMLStereotypeProperties = Iterators.filter(differences
+ .iterator(), and(instanceOf(StereotypeAttributeChange.class), ofKind(DifferenceKind.CHANGE)));
+
+ assertTrue(changeUMLStereotypeProperties.hasNext());
+ final Diff changeUMLStereotypeProperty1 = changeUMLStereotypeProperties.next();
+ assertTrue(changeUMLStereotypeProperties.hasNext());
+ final Diff changeUMLStereotypeProperty2 = changeUMLStereotypeProperties.next();
+
assertNotNull(changeAttribute1);
assertNotNull(changeAttribute2);
- assertNotNull(changeUMLStereotypeApplication);
+ assertNotNull(changeUMLStereotypeProperty1);
+ assertNotNull(changeUMLStereotypeProperty2);
- assertSame(Integer.valueOf(2), Integer.valueOf(changeUMLStereotypeApplication.getRefinedBy().size()));
- assertTrue(changeUMLStereotypeApplication.getRefinedBy().contains(changeAttribute1));
- assertTrue(changeUMLStereotypeApplication.getRefinedBy().contains(changeAttribute2));
+ assertSame(Integer.valueOf(1), Integer.valueOf(changeUMLStereotypeProperty1.getRefinedBy().size()));
+ assertTrue(changeUMLStereotypeProperty1.getRefinedBy().contains(changeAttribute1));
+ assertSame(Integer.valueOf(1), Integer.valueOf(changeUMLStereotypeProperty2.getRefinedBy().size()));
+ assertTrue(changeUMLStereotypeProperty2.getRefinedBy().contains(changeAttribute2));
testIntersections(comparison);
@@ -907,7 +941,7 @@ public class DynamicStereotypeTest extends AbstractDynamicProfileTest { addStereotypeRefDescription = and(instanceOf(ReferenceChange.class),
ofKind(DifferenceKind.DELETE), onFeature("manyValuedReference"));
}
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeReferenceChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff addStereotypeRef = Iterators.find(differences.iterator(), addStereotypeRefDescription);
@@ -935,7 +969,7 @@ public class DynamicStereotypeTest extends AbstractDynamicProfileTest { moveStereotypeRefDescription = and(instanceOf(ReferenceChange.class), ofKind(DifferenceKind.MOVE),
onFeature("manyValuedReference"));
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeReferenceChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff moveStereotypeRef = Iterators.find(differences.iterator(), moveStereotypeRefDescription);
@@ -970,7 +1004,7 @@ public class DynamicStereotypeTest extends AbstractDynamicProfileTest { ofKind(DifferenceKind.CHANGE), onFeature("singleValuedReference"),
valueNameMatches("class1"));
}
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeReferenceChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff changeStereotypeRef = Iterators.find(differences.iterator(),
@@ -999,7 +1033,7 @@ public class DynamicStereotypeTest extends AbstractDynamicProfileTest { changeStereotypeRefDescription = and(instanceOf(ReferenceChange.class),
ofKind(DifferenceKind.CHANGE), onFeature("singleValuedReference"), valueNameMatches("class0"));
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeReferenceChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff changeStereotypeRef = Iterators.find(differences.iterator(),
@@ -1033,7 +1067,33 @@ public class DynamicStereotypeTest extends AbstractDynamicProfileTest { ofKind(DifferenceKind.CHANGE), onFeature("singleValuedAttribute"), valueIs("oldValue"));
}
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeAttributeChange.class),
+ ofKind(DifferenceKind.CHANGE));
+
+ final Diff changeStereotypeRef = Iterators.find(differences.iterator(),
+ changeStereotypeRefDescription);
+ final Diff changeUMLStereotype = Iterators.find(differences.iterator(),
+ changeUMLStereotypeDescription);
+
+ assertNotNull(changeStereotypeRef);
+ assertNotNull(changeUMLStereotype);
+
+ assertSame(Integer.valueOf(1), Integer.valueOf(changeUMLStereotype.getRefinedBy().size()));
+ assertTrue(changeUMLStereotype.getRefinedBy().contains(changeStereotypeRef));
+
+ testIntersections(comparison);
+ }
+
+ private void testAB11(final Comparison comparison) {
+ final List<Diff> differences = comparison.getDifferences();
+ // We should have no less and no more than 2 differences
+ assertSame(Integer.valueOf(2), Integer.valueOf(differences.size()));
+
+ Predicate<? super Diff> changeStereotypeRefDescription = null;
+ Predicate<? super Diff> changeUMLStereotypeDescription = null;
+
+ changeStereotypeRefDescription = and(instanceOf(AttributeChange.class), ofKind(DifferenceKind.CHANGE));
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeAttributeChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff changeStereotypeRef = Iterators.find(differences.iterator(),
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/StaticStereotypeTest.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/StaticStereotypeTest.java index a1283fa4e..dad4413a1 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/StaticStereotypeTest.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/StaticStereotypeTest.java @@ -1,3 +1,13 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.uml2.tests.stereotypes;
import static com.google.common.base.Predicates.and;
@@ -14,6 +24,7 @@ import static org.eclipse.emf.compare.utils.EMFComparePredicates.valueNameMatche import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
+import com.google.common.collect.UnmodifiableIterator;
import java.io.IOException;
import java.util.List;
@@ -26,6 +37,8 @@ import org.eclipse.emf.compare.ReferenceChange; import org.eclipse.emf.compare.ResourceAttachmentChange;
import org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange;
import org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange;
+import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange;
+import org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange;
import org.eclipse.emf.compare.uml2.tests.AbstractStaticProfileTest;
import org.eclipse.emf.compare.uml2.tests.AbstractUMLInputData;
import org.eclipse.emf.compare.uml2.tests.stereotypes.data.static_.StaticStereotypeInputData;
@@ -1021,8 +1034,8 @@ public class StaticStereotypeTest extends AbstractStaticProfileTest { private void testAB5(TestKind kind, final Comparison comparison) {
final List<Diff> differences = comparison.getDifferences();
- // We should have no less and no more than 3 differences
- assertSame(Integer.valueOf(3), Integer.valueOf(differences.size()));
+ // We should have no less and no more than 4 differences
+ assertSame(Integer.valueOf(4), Integer.valueOf(differences.size()));
Predicate<? super Diff> changeAttributeDescription1 = null;
Predicate<? super Diff> changeAttributeDescription2 = null;
@@ -1034,15 +1047,23 @@ public class StaticStereotypeTest extends AbstractStaticProfileTest { final Diff changeAttribute1 = Iterators.find(differences.iterator(), changeAttributeDescription1);
final Diff changeAttribute2 = Iterators.find(differences.iterator(), changeAttributeDescription2);
- final Diff changeUMLStereotypeApplication = Iterators.find(differences.iterator(), and(
- instanceOf(StereotypeApplicationChange.class), ofKind(DifferenceKind.CHANGE)));
+ final UnmodifiableIterator<Diff> changeUMLStereotypeProperties = Iterators.filter(differences
+ .iterator(), and(instanceOf(StereotypeAttributeChange.class), ofKind(DifferenceKind.CHANGE)));
+
+ assertTrue(changeUMLStereotypeProperties.hasNext());
+ final Diff changeUMLStereotypeProperty1 = changeUMLStereotypeProperties.next();
+ assertTrue(changeUMLStereotypeProperties.hasNext());
+ final Diff changeUMLStereotypeProperty2 = changeUMLStereotypeProperties.next();
+
assertNotNull(changeAttribute1);
assertNotNull(changeAttribute2);
- assertNotNull(changeUMLStereotypeApplication);
+ assertNotNull(changeUMLStereotypeProperty1);
+ assertNotNull(changeUMLStereotypeProperty2);
- assertSame(Integer.valueOf(2), Integer.valueOf(changeUMLStereotypeApplication.getRefinedBy().size()));
- assertTrue(changeUMLStereotypeApplication.getRefinedBy().contains(changeAttribute1));
- assertTrue(changeUMLStereotypeApplication.getRefinedBy().contains(changeAttribute2));
+ assertSame(Integer.valueOf(1), Integer.valueOf(changeUMLStereotypeProperty1.getRefinedBy().size()));
+ assertTrue(changeUMLStereotypeProperty1.getRefinedBy().contains(changeAttribute1));
+ assertSame(Integer.valueOf(1), Integer.valueOf(changeUMLStereotypeProperty2.getRefinedBy().size()));
+ assertTrue(changeUMLStereotypeProperty2.getRefinedBy().contains(changeAttribute2));
testIntersections(comparison);
@@ -1064,7 +1085,7 @@ public class StaticStereotypeTest extends AbstractStaticProfileTest { addStereotypeRefDescription = and(instanceOf(ReferenceChange.class),
ofKind(DifferenceKind.DELETE), onFeature("manyValuedReference"));
}
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeReferenceChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff addStereotypeRef = Iterators.find(differences.iterator(), addStereotypeRefDescription);
@@ -1091,7 +1112,7 @@ public class StaticStereotypeTest extends AbstractStaticProfileTest { moveStereotypeRefDescription = and(instanceOf(ReferenceChange.class), ofKind(DifferenceKind.MOVE),
onFeature("manyValuedReference"));
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeReferenceChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff moveStereotypeRef = Iterators.find(differences.iterator(), moveStereotypeRefDescription);
@@ -1125,7 +1146,7 @@ public class StaticStereotypeTest extends AbstractStaticProfileTest { ofKind(DifferenceKind.CHANGE), onFeature("singleValuedReference"),
valueNameMatches("class1"));
}
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeReferenceChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff changeStereotypeRef = Iterators.find(differences.iterator(),
@@ -1154,7 +1175,7 @@ public class StaticStereotypeTest extends AbstractStaticProfileTest { changeStereotypeRefDescription = and(instanceOf(ReferenceChange.class),
ofKind(DifferenceKind.CHANGE), onFeature("singleValuedReference"), valueNameMatches("class0"));
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeReferenceChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff changeStereotypeRef = Iterators.find(differences.iterator(),
@@ -1188,7 +1209,7 @@ public class StaticStereotypeTest extends AbstractStaticProfileTest { ofKind(DifferenceKind.CHANGE), onFeature("singleValuedAttribute"), valueIs("oldValue"));
}
- changeUMLStereotypeDescription = and(instanceOf(StereotypeApplicationChange.class),
+ changeUMLStereotypeDescription = and(instanceOf(StereotypeAttributeChange.class),
ofKind(DifferenceKind.CHANGE));
final Diff changeStereotypeRef = Iterators.find(differences.iterator(),
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/DynamicStereotypeInputData.java b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/DynamicStereotypeInputData.java index 6c616f5c1..0e1a3f909 100644 --- a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/DynamicStereotypeInputData.java +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/DynamicStereotypeInputData.java @@ -87,4 +87,16 @@ public class DynamicStereotypeInputData extends AbstractUMLInputData { return loadFromClassLoader("a10/right.uml"); //$NON-NLS-1$
}
+ public Resource getA11Left() throws IOException {
+ return loadFromClassLoader("a11/left.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA11Right() throws IOException {
+ return loadFromClassLoader("a11/right.uml"); //$NON-NLS-1$
+ }
+
+ public Resource getA11Ancestor() throws IOException {
+ return loadFromClassLoader("a11/ancestor.uml"); //$NON-NLS-1$
+ }
+
}
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/ancestor.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/ancestor.uml new file mode 100644 index 000000000..3a2ea9cfb --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/ancestor.uml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/5" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/5 pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA">
+ <uml:Model xmi:id="_94mkoHxsEeCJOrA24Ue2iw" name="aModel">
+ <packagedElement xmi:type="uml:Package" xmi:id="_BYEVIHxtEeCJOrA24Ue2iw" name="aPack">
+ <packagedElement xmi:type="uml:Class" xmi:id="_C4IZsHxtEeCJOrA24Ue2iw" name="aClass"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_lWjJoEt7EeOhavcmtA3PkA" name="anotherClass">
+ <ownedAttribute xmi:id="_LLxCUEt8EeOhavcmtA3PkA"/>
+ </packagedElement>
+ <profileApplication xmi:id="_GzuskHxtEeCJOrA24Ue2iw">
+ <eAnnotations xmi:id="_Gzxv4HxtEeCJOrA24Ue2iw" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
+ </profileApplication>
+ </packagedElement>
+ </uml:Model>
+ <Ecore:EAttribute xmi:id="_M56mMEt8EeOhavcmtA3PkA" base_Property="_LLxCUEt8EeOhavcmtA3PkA" attributeName="att1"/>
+</xmi:XMI>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/left.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/left.uml new file mode 100644 index 000000000..3a2ea9cfb --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/left.uml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/5" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/5 pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA">
+ <uml:Model xmi:id="_94mkoHxsEeCJOrA24Ue2iw" name="aModel">
+ <packagedElement xmi:type="uml:Package" xmi:id="_BYEVIHxtEeCJOrA24Ue2iw" name="aPack">
+ <packagedElement xmi:type="uml:Class" xmi:id="_C4IZsHxtEeCJOrA24Ue2iw" name="aClass"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_lWjJoEt7EeOhavcmtA3PkA" name="anotherClass">
+ <ownedAttribute xmi:id="_LLxCUEt8EeOhavcmtA3PkA"/>
+ </packagedElement>
+ <profileApplication xmi:id="_GzuskHxtEeCJOrA24Ue2iw">
+ <eAnnotations xmi:id="_Gzxv4HxtEeCJOrA24Ue2iw" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
+ </profileApplication>
+ </packagedElement>
+ </uml:Model>
+ <Ecore:EAttribute xmi:id="_M56mMEt8EeOhavcmtA3PkA" base_Property="_LLxCUEt8EeOhavcmtA3PkA" attributeName="att1"/>
+</xmi:XMI>
diff --git a/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/right.uml b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/right.uml new file mode 100644 index 000000000..2b0c44e45 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2.tests/src/org/eclipse/emf/compare/uml2/tests/stereotypes/data/dynamic/a11/right.uml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Ecore="http://www.eclipse.org/uml2/schemas/Ecore/5" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/uml2/schemas/Ecore/5 pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA">
+ <uml:Model xmi:id="_94mkoHxsEeCJOrA24Ue2iw" name="aModel">
+ <packagedElement xmi:type="uml:Package" xmi:id="_BYEVIHxtEeCJOrA24Ue2iw" name="aPack">
+ <packagedElement xmi:type="uml:Class" xmi:id="_C4IZsHxtEeCJOrA24Ue2iw" name="aClass"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_lWjJoEt7EeOhavcmtA3PkA" name="anotherClass">
+ <ownedAttribute xmi:id="_LLxCUEt8EeOhavcmtA3PkA"/>
+ </packagedElement>
+ <profileApplication xmi:id="_GzuskHxtEeCJOrA24Ue2iw">
+ <eAnnotations xmi:id="_Gzxv4HxtEeCJOrA24Ue2iw" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML_PROFILES/Ecore.profile.uml#_z1OFcHjqEdy8S4Cr8Rc_NA"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML_PROFILES/Ecore.profile.uml#_0"/>
+ </profileApplication>
+ </packagedElement>
+ </uml:Model>
+ <Ecore:EAttribute xmi:id="_M56mMEt8EeOhavcmtA3PkA" visibility="ReadWrite" base_Property="_LLxCUEt8EeOhavcmtA3PkA" attributeName="att1"/>
+</xmi:XMI>
diff --git a/plugins/org.eclipse.emf.compare.uml2/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare.uml2/META-INF/MANIFEST.MF index 0e5f4c67b..2a63edfea 100644 --- a/plugins/org.eclipse.emf.compare.uml2/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare.uml2/META-INF/MANIFEST.MF @@ -32,8 +32,10 @@ Export-Package: org.eclipse.emf.compare.uml2.internal; org.eclipse.emf.compare.uml2.internal.postprocessor.extension.clazz;x-internal:=true, org.eclipse.emf.compare.uml2.internal.postprocessor.extension.profile;x-internal:=true, org.eclipse.emf.compare.uml2.internal.postprocessor.extension.sequence;x-internal:=true, + org.eclipse.emf.compare.uml2.internal.postprocessor.extension.stereotype;x-internal:=true, org.eclipse.emf.compare.uml2.internal.postprocessor.extension.usecase;x-internal:=true, org.eclipse.emf.compare.uml2.internal.postprocessor.util;x-internal:=true, + org.eclipse.emf.compare.uml2.internal.spec;x-internal:=true, org.eclipse.emf.compare.uml2.internal.util; x-friends:="org.eclipse.emf.compare.uml2.edit, org.eclipse.emf.compare.uml2.rcp, diff --git a/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.ecore b/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.ecore index 6634ae1eb..ecc899b2a 100644 --- a/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.ecore +++ b/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.ecore @@ -7,9 +7,7 @@ <eClassifiers xsi:type="ecore:EClass" name="ExecutionSpecificationChange" eSuperTypes="#//UMLDiff"/>
<eClassifiers xsi:type="ecore:EClass" name="IntervalConstraintChange" eSuperTypes="#//UMLDiff"/>
<eClassifiers xsi:type="ecore:EClass" name="MessageChange" eSuperTypes="#//UMLDiff"/>
- <eClassifiers xsi:type="ecore:EClass" name="StereotypePropertyChange" eSuperTypes="#//UMLDiff">
- <eStructuralFeatures xsi:type="ecore:EReference" name="stereotype" eType="ecore:EClass platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Stereotype"/>
- </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="StereotypeAttributeChange" eSuperTypes="#//UMLDiff"/>
<eClassifiers xsi:type="ecore:EClass" name="StereotypeApplicationChange" eSuperTypes="#//UMLDiff">
<eStructuralFeatures xsi:type="ecore:EReference" name="stereotype" eType="ecore:EClass platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Stereotype"/>
</eClassifiers>
diff --git a/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.genmodel b/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.genmodel index c9af0a670..24206ae06 100644 --- a/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.genmodel +++ b/plugins/org.eclipse.emf.compare.uml2/model/uml2compare.genmodel @@ -18,9 +18,7 @@ <genClasses ecoreClass="uml2compare.ecore#//ExecutionSpecificationChange"/>
<genClasses ecoreClass="uml2compare.ecore#//IntervalConstraintChange"/>
<genClasses ecoreClass="uml2compare.ecore#//MessageChange"/>
- <genClasses ecoreClass="uml2compare.ecore#//StereotypePropertyChange">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference uml2compare.ecore#//StereotypePropertyChange/stereotype"/>
- </genClasses>
+ <genClasses ecoreClass="uml2compare.ecore#//StereotypeAttributeChange"/>
<genClasses ecoreClass="uml2compare.ecore#//StereotypeApplicationChange">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference uml2compare.ecore#//StereotypeApplicationChange/stereotype"/>
</genClasses>
diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/StereotypeAttributeChange.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/StereotypeAttributeChange.java new file mode 100644 index 000000000..a9c924458 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/StereotypeAttributeChange.java @@ -0,0 +1,25 @@ +/**
+ * 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.uml2.internal;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Stereotype Attribute Change</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.UMLComparePackage#getStereotypeAttributeChange()
+ * @model
+ * @generated
+ */
+public interface StereotypeAttributeChange extends UMLDiff {
+} // StereotypeAttributeChange
diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/StereotypePropertyChange.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/StereotypePropertyChange.java deleted file mode 100644 index 21a4a1549..000000000 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/StereotypePropertyChange.java +++ /dev/null @@ -1,58 +0,0 @@ -/**
- * 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.uml2.internal;
-
-import org.eclipse.uml2.uml.Stereotype;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Stereotype Property Change</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange#getStereotype <em>Stereotype</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.emf.compare.uml2.internal.UMLComparePackage#getStereotypePropertyChange()
- * @model
- * @generated
- */
-public interface StereotypePropertyChange extends UMLDiff {
- /**
- * Returns the value of the '<em><b>Stereotype</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Stereotype</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Stereotype</em>' reference.
- * @see #setStereotype(Stereotype)
- * @see org.eclipse.emf.compare.uml2.internal.UMLComparePackage#getStereotypePropertyChange_Stereotype()
- * @model
- * @generated
- */
- Stereotype getStereotype();
-
- /**
- * Sets the value of the '{@link org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange#getStereotype <em>Stereotype</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Stereotype</em>' reference.
- * @see #getStereotype()
- * @generated
- */
- void setStereotype(Stereotype value);
-
-} // StereotypePropertyChange
diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLCompareFactory.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLCompareFactory.java index ca5ebe371..ca5e46779 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLCompareFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLCompareFactory.java @@ -84,13 +84,13 @@ public interface UMLCompareFactory extends EFactory { MessageChange createMessageChange();
/**
- * Returns a new object of class '<em>Stereotype Property Change</em>'.
+ * Returns a new object of class '<em>Stereotype Attribute Change</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @return a new object of class '<em>Stereotype Property Change</em>'.
+ * @return a new object of class '<em>Stereotype Attribute Change</em>'.
* @generated
*/
- StereotypePropertyChange createStereotypePropertyChange();
+ StereotypeAttributeChange createStereotypeAttributeChange();
/**
* Returns a new object of class '<em>Stereotype Application Change</em>'.
diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLComparePackage.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLComparePackage.java index 8f4ee7fa3..86a79684d 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLComparePackage.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/UMLComparePackage.java @@ -1142,14 +1142,14 @@ public interface UMLComparePackage extends EPackage { int MESSAGE_CHANGE_FEATURE_COUNT = UML_DIFF_FEATURE_COUNT + 0; /** - * The meta object id for the '{@link org.eclipse.emf.compare.uml2.internal.impl.StereotypePropertyChangeImpl <em>Stereotype Property Change</em>}' class. + * The meta object id for the '{@link org.eclipse.emf.compare.uml2.internal.impl.StereotypeAttributeChangeImpl <em>Stereotype Attribute Change</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see org.eclipse.emf.compare.uml2.internal.impl.StereotypePropertyChangeImpl - * @see org.eclipse.emf.compare.uml2.internal.impl.UMLComparePackageImpl#getStereotypePropertyChange() + * @see org.eclipse.emf.compare.uml2.internal.impl.StereotypeAttributeChangeImpl + * @see org.eclipse.emf.compare.uml2.internal.impl.UMLComparePackageImpl#getStereotypeAttributeChange() * @generated */ - int STEREOTYPE_PROPERTY_CHANGE = 6; + int STEREOTYPE_ATTRIBUTE_CHANGE = 6; /** * The feature id for the '<em><b>Match</b></em>' container reference. @@ -1158,7 +1158,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__MATCH = UML_DIFF__MATCH; + int STEREOTYPE_ATTRIBUTE_CHANGE__MATCH = UML_DIFF__MATCH; /** * The feature id for the '<em><b>Requires</b></em>' reference list. @@ -1167,7 +1167,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__REQUIRES = UML_DIFF__REQUIRES; + int STEREOTYPE_ATTRIBUTE_CHANGE__REQUIRES = UML_DIFF__REQUIRES; /** * The feature id for the '<em><b>Required By</b></em>' reference list. @@ -1176,7 +1176,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__REQUIRED_BY = UML_DIFF__REQUIRED_BY; + int STEREOTYPE_ATTRIBUTE_CHANGE__REQUIRED_BY = UML_DIFF__REQUIRED_BY; /** * The feature id for the '<em><b>Implies</b></em>' reference list. @@ -1185,7 +1185,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__IMPLIES = UML_DIFF__IMPLIES; + int STEREOTYPE_ATTRIBUTE_CHANGE__IMPLIES = UML_DIFF__IMPLIES; /** * The feature id for the '<em><b>Implied By</b></em>' reference list. @@ -1194,7 +1194,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__IMPLIED_BY = UML_DIFF__IMPLIED_BY; + int STEREOTYPE_ATTRIBUTE_CHANGE__IMPLIED_BY = UML_DIFF__IMPLIED_BY; /** * The feature id for the '<em><b>Refines</b></em>' reference list. @@ -1203,7 +1203,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__REFINES = UML_DIFF__REFINES; + int STEREOTYPE_ATTRIBUTE_CHANGE__REFINES = UML_DIFF__REFINES; /** * The feature id for the '<em><b>Refined By</b></em>' reference list. @@ -1212,7 +1212,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__REFINED_BY = UML_DIFF__REFINED_BY; + int STEREOTYPE_ATTRIBUTE_CHANGE__REFINED_BY = UML_DIFF__REFINED_BY; /** * The feature id for the '<em><b>Prime Refining</b></em>' reference. @@ -1221,7 +1221,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__PRIME_REFINING = UML_DIFF__PRIME_REFINING; + int STEREOTYPE_ATTRIBUTE_CHANGE__PRIME_REFINING = UML_DIFF__PRIME_REFINING; /** * The feature id for the '<em><b>Kind</b></em>' attribute. @@ -1230,7 +1230,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__KIND = UML_DIFF__KIND; + int STEREOTYPE_ATTRIBUTE_CHANGE__KIND = UML_DIFF__KIND; /** * The feature id for the '<em><b>Source</b></em>' attribute. @@ -1239,7 +1239,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__SOURCE = UML_DIFF__SOURCE; + int STEREOTYPE_ATTRIBUTE_CHANGE__SOURCE = UML_DIFF__SOURCE; /** * The feature id for the '<em><b>State</b></em>' attribute. @@ -1248,7 +1248,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__STATE = UML_DIFF__STATE; + int STEREOTYPE_ATTRIBUTE_CHANGE__STATE = UML_DIFF__STATE; /** * The feature id for the '<em><b>Equivalence</b></em>' reference. @@ -1257,7 +1257,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__EQUIVALENCE = UML_DIFF__EQUIVALENCE; + int STEREOTYPE_ATTRIBUTE_CHANGE__EQUIVALENCE = UML_DIFF__EQUIVALENCE; /** * The feature id for the '<em><b>Conflict</b></em>' reference. @@ -1266,7 +1266,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__CONFLICT = UML_DIFF__CONFLICT; + int STEREOTYPE_ATTRIBUTE_CHANGE__CONFLICT = UML_DIFF__CONFLICT; /** * The feature id for the '<em><b>Discriminant</b></em>' reference. @@ -1275,7 +1275,7 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__DISCRIMINANT = UML_DIFF__DISCRIMINANT; + int STEREOTYPE_ATTRIBUTE_CHANGE__DISCRIMINANT = UML_DIFF__DISCRIMINANT; /** * The feature id for the '<em><b>EReference</b></em>' reference. @@ -1284,25 +1284,16 @@ public interface UMLComparePackage extends EPackage { * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__EREFERENCE = UML_DIFF__EREFERENCE; + int STEREOTYPE_ATTRIBUTE_CHANGE__EREFERENCE = UML_DIFF__EREFERENCE; /** - * The feature id for the '<em><b>Stereotype</b></em>' reference. + * The number of structural features of the '<em>Stereotype Attribute Change</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE = UML_DIFF_FEATURE_COUNT + 0; - - /** - * The number of structural features of the '<em>Stereotype Property Change</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STEREOTYPE_PROPERTY_CHANGE_FEATURE_COUNT = UML_DIFF_FEATURE_COUNT + 1; + int STEREOTYPE_ATTRIBUTE_CHANGE_FEATURE_COUNT = UML_DIFF_FEATURE_COUNT + 0; /** * The meta object id for the '{@link org.eclipse.emf.compare.uml2.internal.impl.StereotypeApplicationChangeImpl <em>Stereotype Application Change</em>}' class. @@ -2001,25 +1992,14 @@ public interface UMLComparePackage extends EPackage { EClass getMessageChange(); /** - * Returns the meta object for class '{@link org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange <em>Stereotype Property Change</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Stereotype Property Change</em>'. - * @see org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange - * @generated - */ - EClass getStereotypePropertyChange(); - - /** - * Returns the meta object for the reference '{@link org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange#getStereotype <em>Stereotype</em>}'. + * Returns the meta object for class '{@link org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange <em>Stereotype Attribute Change</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for the reference '<em>Stereotype</em>'. - * @see org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange#getStereotype() - * @see #getStereotypePropertyChange() + * @return the meta object for class '<em>Stereotype Attribute Change</em>'. + * @see org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange * @generated */ - EReference getStereotypePropertyChange_Stereotype(); + EClass getStereotypeAttributeChange(); /** * Returns the meta object for class '{@link org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange <em>Stereotype Application Change</em>}'. @@ -2200,22 +2180,14 @@ public interface UMLComparePackage extends EPackage { EClass MESSAGE_CHANGE = eINSTANCE.getMessageChange(); /** - * The meta object literal for the '{@link org.eclipse.emf.compare.uml2.internal.impl.StereotypePropertyChangeImpl <em>Stereotype Property Change</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.compare.uml2.internal.impl.StereotypePropertyChangeImpl - * @see org.eclipse.emf.compare.uml2.internal.impl.UMLComparePackageImpl#getStereotypePropertyChange() - * @generated - */ - EClass STEREOTYPE_PROPERTY_CHANGE = eINSTANCE.getStereotypePropertyChange(); - - /** - * The meta object literal for the '<em><b>Stereotype</b></em>' reference feature. + * The meta object literal for the '{@link org.eclipse.emf.compare.uml2.internal.impl.StereotypeAttributeChangeImpl <em>Stereotype Attribute Change</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> + * @see org.eclipse.emf.compare.uml2.internal.impl.StereotypeAttributeChangeImpl + * @see org.eclipse.emf.compare.uml2.internal.impl.UMLComparePackageImpl#getStereotypeAttributeChange() * @generated */ - EReference STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE = eINSTANCE.getStereotypePropertyChange_Stereotype(); + EClass STEREOTYPE_ATTRIBUTE_CHANGE = eINSTANCE.getStereotypeAttributeChange(); /** * The meta object literal for the '{@link org.eclipse.emf.compare.uml2.internal.impl.StereotypeApplicationChangeImpl <em>Stereotype Application Change</em>}' class. diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/StereotypeAttributeChangeImpl.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/StereotypeAttributeChangeImpl.java new file mode 100644 index 000000000..9bb55cbd6 --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/StereotypeAttributeChangeImpl.java @@ -0,0 +1,49 @@ +/**
+ * 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.uml2.internal.impl;
+
+import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange;
+import org.eclipse.emf.compare.uml2.internal.UMLComparePackage;
+
+import org.eclipse.emf.compare.uml2.internal.spec.UMLDiffSpec;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Stereotype Attribute Change</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * </p>
+ *
+ * @generated
+ */
+public class StereotypeAttributeChangeImpl extends UMLDiffSpec implements StereotypeAttributeChange {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StereotypeAttributeChangeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return UMLComparePackage.Literals.STEREOTYPE_ATTRIBUTE_CHANGE;
+ }
+
+} //StereotypeAttributeChangeImpl
diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/StereotypePropertyChangeImpl.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/StereotypePropertyChangeImpl.java deleted file mode 100644 index 9be1750fe..000000000 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/StereotypePropertyChangeImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -/**
- * 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.uml2.internal.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange;
-import org.eclipse.emf.compare.uml2.internal.UMLComparePackage;
-import org.eclipse.emf.compare.uml2.internal.spec.UMLDiffSpec;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.uml2.uml.Stereotype;
-
-/**
- * <!-- begin-user-doc --> An implementation of the model object '<em><b>Stereotype Property Change</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.compare.uml2.internal.impl.StereotypePropertyChangeImpl#getStereotype <em>Stereotype</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class StereotypePropertyChangeImpl extends UMLDiffSpec implements StereotypePropertyChange {
- /**
- * The cached value of the '{@link #getStereotype() <em>Stereotype</em>}' reference.
- * <!-- begin-user-doc
- * --> <!-- end-user-doc -->
- * @see #getStereotype()
- * @generated
- * @ordered
- */
- protected Stereotype stereotype;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- protected StereotypePropertyChangeImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return UMLComparePackage.Literals.STEREOTYPE_PROPERTY_CHANGE;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public Stereotype getStereotype() {
- if (stereotype != null && stereotype.eIsProxy()) {
- InternalEObject oldStereotype = (InternalEObject)stereotype;
- stereotype = (Stereotype)eResolveProxy(oldStereotype);
- if (stereotype != oldStereotype) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, UMLComparePackage.STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE, oldStereotype, stereotype));
- }
- }
- return stereotype;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public Stereotype basicGetStereotype() {
- return stereotype;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public void setStereotype(Stereotype newStereotype) {
- Stereotype oldStereotype = stereotype;
- stereotype = newStereotype;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, UMLComparePackage.STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE, oldStereotype, stereotype));
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case UMLComparePackage.STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE:
- if (resolve) return getStereotype();
- return basicGetStereotype();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case UMLComparePackage.STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE:
- setStereotype((Stereotype)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case UMLComparePackage.STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE:
- setStereotype((Stereotype)null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case UMLComparePackage.STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE:
- return stereotype != null;
- }
- return super.eIsSet(featureID);
- }
-
-} // StereotypePropertyChangeImpl
diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLCompareFactoryImpl.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLCompareFactoryImpl.java index a5539c935..e92bbca97 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLCompareFactoryImpl.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLCompareFactoryImpl.java @@ -19,7 +19,7 @@ import org.eclipse.emf.compare.uml2.internal.IntervalConstraintChange; import org.eclipse.emf.compare.uml2.internal.MessageChange; import org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange; import org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange; -import org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange; +import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange; import org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange; import org.eclipse.emf.compare.uml2.internal.UMLCompareFactory; import org.eclipse.emf.compare.uml2.internal.UMLComparePackage; @@ -74,7 +74,7 @@ public class UMLCompareFactoryImpl extends EFactoryImpl implements UMLCompareFac case UMLComparePackage.EXECUTION_SPECIFICATION_CHANGE: return createExecutionSpecificationChange(); case UMLComparePackage.INTERVAL_CONSTRAINT_CHANGE: return createIntervalConstraintChange(); case UMLComparePackage.MESSAGE_CHANGE: return createMessageChange(); - case UMLComparePackage.STEREOTYPE_PROPERTY_CHANGE: return createStereotypePropertyChange(); + case UMLComparePackage.STEREOTYPE_ATTRIBUTE_CHANGE: return createStereotypeAttributeChange(); case UMLComparePackage.STEREOTYPE_APPLICATION_CHANGE: return createStereotypeApplicationChange(); case UMLComparePackage.STEREOTYPE_REFERENCE_CHANGE: return createStereotypeReferenceChange(); case UMLComparePackage.PROFILE_APPLICATION_CHANGE: return createProfileApplicationChange(); @@ -139,12 +139,13 @@ public class UMLCompareFactoryImpl extends EFactoryImpl implements UMLCompareFac } /** - * <!-- begin-user-doc --> <!-- end-user-doc --> + * <!-- begin-user-doc --> + * <!-- end-user-doc --> * @generated */ - public StereotypePropertyChange createStereotypePropertyChange() { - StereotypePropertyChangeImpl stereotypePropertyChange = new StereotypePropertyChangeImpl(); - return stereotypePropertyChange; + public StereotypeAttributeChange createStereotypeAttributeChange() { + StereotypeAttributeChangeImpl stereotypeAttributeChange = new StereotypeAttributeChangeImpl(); + return stereotypeAttributeChange; } /** diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLComparePackageImpl.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLComparePackageImpl.java index dea695358..463a82a86 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLComparePackageImpl.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/impl/UMLComparePackageImpl.java @@ -20,7 +20,7 @@ import org.eclipse.emf.compare.uml2.internal.IntervalConstraintChange; import org.eclipse.emf.compare.uml2.internal.MessageChange; import org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange; import org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange; -import org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange; +import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange; import org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange; import org.eclipse.emf.compare.uml2.internal.UMLCompareFactory; import org.eclipse.emf.compare.uml2.internal.UMLComparePackage; @@ -74,10 +74,11 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac private EClass messageChangeEClass = null; /** - * <!-- begin-user-doc --> <!-- end-user-doc --> + * <!-- begin-user-doc --> + * <!-- end-user-doc --> * @generated */ - private EClass stereotypePropertyChangeEClass = null; + private EClass stereotypeAttributeChangeEClass = null; /** * <!-- begin-user-doc --> <!-- end-user-doc --> @@ -220,19 +221,12 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac } /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * @generated - */ - public EClass getStereotypePropertyChange() { - return stereotypePropertyChangeEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> + * <!-- begin-user-doc --> + * <!-- end-user-doc --> * @generated */ - public EReference getStereotypePropertyChange_Stereotype() { - return (EReference)stereotypePropertyChangeEClass.getEStructuralFeatures().get(0); + public EClass getStereotypeAttributeChange() { + return stereotypeAttributeChangeEClass; } /** @@ -344,8 +338,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac messageChangeEClass = createEClass(MESSAGE_CHANGE); - stereotypePropertyChangeEClass = createEClass(STEREOTYPE_PROPERTY_CHANGE); - createEReference(stereotypePropertyChangeEClass, STEREOTYPE_PROPERTY_CHANGE__STEREOTYPE); + stereotypeAttributeChangeEClass = createEClass(STEREOTYPE_ATTRIBUTE_CHANGE); stereotypeApplicationChangeEClass = createEClass(STEREOTYPE_APPLICATION_CHANGE); createEReference(stereotypeApplicationChangeEClass, STEREOTYPE_APPLICATION_CHANGE__STEREOTYPE); @@ -399,7 +392,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac executionSpecificationChangeEClass.getESuperTypes().add(this.getUMLDiff()); intervalConstraintChangeEClass.getESuperTypes().add(this.getUMLDiff()); messageChangeEClass.getESuperTypes().add(this.getUMLDiff()); - stereotypePropertyChangeEClass.getESuperTypes().add(this.getUMLDiff()); + stereotypeAttributeChangeEClass.getESuperTypes().add(this.getUMLDiff()); stereotypeApplicationChangeEClass.getESuperTypes().add(this.getUMLDiff()); stereotypeReferenceChangeEClass.getESuperTypes().add(this.getUMLDiff()); profileApplicationChangeEClass.getESuperTypes().add(this.getUMLDiff()); @@ -419,8 +412,7 @@ public class UMLComparePackageImpl extends EPackageImpl implements UMLComparePac initEClass(messageChangeEClass, MessageChange.class, "MessageChange", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEClass(stereotypePropertyChangeEClass, StereotypePropertyChange.class, "StereotypePropertyChange", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getStereotypePropertyChange_Stereotype(), theUMLPackage.getStereotype(), null, "stereotype", null, 0, 1, StereotypePropertyChange.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEClass(stereotypeAttributeChangeEClass, StereotypeAttributeChange.class, "StereotypeAttributeChange", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEClass(stereotypeApplicationChangeEClass, StereotypeApplicationChange.class, "StereotypeApplicationChange", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEReference(getStereotypeApplicationChange_Stereotype(), theUMLPackage.getStereotype(), null, "stereotype", null, 0, 1, StereotypeApplicationChange.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareAdapterFactory.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareAdapterFactory.java index bf6ddc36a..33cb1abac 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareAdapterFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareAdapterFactory.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2012, 2014 Obeo. + * Copyright (c) 2012, 2013 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 @@ -14,39 +14,26 @@ import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; import org.eclipse.emf.compare.Diff; -import org.eclipse.emf.compare.uml2.internal.AssociationChange; -import org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange; -import org.eclipse.emf.compare.uml2.internal.ExecutionSpecificationChange; -import org.eclipse.emf.compare.uml2.internal.ExtendChange; -import org.eclipse.emf.compare.uml2.internal.GeneralizationSetChange; -import org.eclipse.emf.compare.uml2.internal.IntervalConstraintChange; -import org.eclipse.emf.compare.uml2.internal.MessageChange; -import org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange; -import org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange; -import org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange; -import org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange; -import org.eclipse.emf.compare.uml2.internal.UMLComparePackage; -import org.eclipse.emf.compare.uml2.internal.UMLDiff; +import org.eclipse.emf.compare.uml2.internal.*; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides an adapter * <code>createXXX</code> method for each class of the model. <!-- end-user-doc --> - * * @see org.eclipse.emf.compare.uml2.internal.UMLComparePackage * @generated */ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { /** - * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc --> - * + * The cached model package. + * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ protected static UMLComparePackage modelPackage; /** - * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- end-user-doc --> - * + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public UMLCompareAdapterFactory() { @@ -56,10 +43,10 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Returns whether this factory is applicable for the type of the object. <!-- begin-user-doc --> This + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> This * implementation returns <code>true</code> if the object is either the model's package or is an instance * object of the model. <!-- end-user-doc --> - * * @return whether this factory is applicable for the type of the object. * @generated */ @@ -75,88 +62,74 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * The switch that delegates to the <code>createXXX</code> methods. <!-- begin-user-doc --> <!-- + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> <!-- * end-user-doc --> - * * @generated */ protected UMLCompareSwitch<Adapter> modelSwitch = new UMLCompareSwitch<Adapter>() { - @Override - public Adapter caseAssociationChange(AssociationChange object) { - return createAssociationChangeAdapter(); - } - - @Override - public Adapter caseExtendChange(ExtendChange object) { - return createExtendChangeAdapter(); - } - - @Override - public Adapter caseGeneralizationSetChange(GeneralizationSetChange object) { - return createGeneralizationSetChangeAdapter(); - } - - @Override - public Adapter caseExecutionSpecificationChange(ExecutionSpecificationChange object) { - return createExecutionSpecificationChangeAdapter(); - } - - @Override - public Adapter caseIntervalConstraintChange(IntervalConstraintChange object) { - return createIntervalConstraintChangeAdapter(); - } - - @Override - public Adapter caseMessageChange(MessageChange object) { - return createMessageChangeAdapter(); - } - - @Override - public Adapter caseStereotypePropertyChange(StereotypePropertyChange object) { - return createStereotypePropertyChangeAdapter(); - } - - @Override - public Adapter caseStereotypeApplicationChange(StereotypeApplicationChange object) { - return createStereotypeApplicationChangeAdapter(); - } - - @Override - public Adapter caseStereotypeReferenceChange(StereotypeReferenceChange object) { - return createStereotypeReferenceChangeAdapter(); - } - - @Override - public Adapter caseProfileApplicationChange(ProfileApplicationChange object) { - return createProfileApplicationChangeAdapter(); - } - - @Override - public Adapter caseDirectedRelationshipChange(DirectedRelationshipChange object) { - return createDirectedRelationshipChangeAdapter(); - } - - @Override - public Adapter caseUMLDiff(UMLDiff object) { - return createUMLDiffAdapter(); - } - - @Override - public Adapter caseDiff(Diff object) { - return createDiffAdapter(); - } - - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; + @Override + public Adapter caseAssociationChange(AssociationChange object) { + return createAssociationChangeAdapter(); + } + @Override + public Adapter caseExtendChange(ExtendChange object) { + return createExtendChangeAdapter(); + } + @Override + public Adapter caseGeneralizationSetChange(GeneralizationSetChange object) { + return createGeneralizationSetChangeAdapter(); + } + @Override + public Adapter caseExecutionSpecificationChange(ExecutionSpecificationChange object) { + return createExecutionSpecificationChangeAdapter(); + } + @Override + public Adapter caseIntervalConstraintChange(IntervalConstraintChange object) { + return createIntervalConstraintChangeAdapter(); + } + @Override + public Adapter caseMessageChange(MessageChange object) { + return createMessageChangeAdapter(); + } + @Override + public Adapter caseStereotypeAttributeChange(StereotypeAttributeChange object) { + return createStereotypeAttributeChangeAdapter(); + } + @Override + public Adapter caseStereotypeApplicationChange(StereotypeApplicationChange object) { + return createStereotypeApplicationChangeAdapter(); + } + @Override + public Adapter caseStereotypeReferenceChange(StereotypeReferenceChange object) { + return createStereotypeReferenceChangeAdapter(); + } + @Override + public Adapter caseProfileApplicationChange(ProfileApplicationChange object) { + return createProfileApplicationChangeAdapter(); + } + @Override + public Adapter caseDirectedRelationshipChange(DirectedRelationshipChange object) { + return createDirectedRelationshipChangeAdapter(); + } + @Override + public Adapter caseUMLDiff(UMLDiff object) { + return createUMLDiffAdapter(); + } + @Override + public Adapter caseDiff(Diff object) { + return createDiffAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; /** - * Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param target - * the object to adapt. + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @param target the object to adapt. * @return the adapter for the <code>target</code>. * @generated */ @@ -180,11 +153,10 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.compare.uml2.internal.ExtendChange <em>Extend Change</em>}'. <!-- begin-user-doc + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.ExtendChange <em>Extend Change</em>}'. + * <!-- begin-user-doc * --> This default implementation returns null so that we can easily ignore cases; it's useful to ignore * a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * * @return the new adapter. * @see org.eclipse.emf.compare.uml2.internal.ExtendChange * @generated @@ -194,12 +166,10 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.compare.uml2.internal.GeneralizationSetChange - * <em>Generalization Set Change</em>}'. <!-- begin-user-doc --> This default implementation returns null + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.GeneralizationSetChange <em>Generalization Set Change</em>}'. + * <!-- begin-user-doc --> This default implementation returns null * so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the * cases anyway. <!-- end-user-doc --> - * * @return the new adapter. * @see org.eclipse.emf.compare.uml2.internal.GeneralizationSetChange * @generated @@ -209,12 +179,10 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.compare.uml2.internal.ExecutionSpecificationChange - * <em>Execution Specification Change</em>}'. <!-- begin-user-doc --> This default implementation returns + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.ExecutionSpecificationChange <em>Execution Specification Change</em>}'. + * <!-- begin-user-doc --> This default implementation returns * null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all * the cases anyway. <!-- end-user-doc --> - * * @return the new adapter. * @see org.eclipse.emf.compare.uml2.internal.ExecutionSpecificationChange * @generated @@ -224,12 +192,10 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.compare.uml2.internal.IntervalConstraintChange - * <em>Interval Constraint Change</em>}'. <!-- begin-user-doc --> This default implementation returns null + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.IntervalConstraintChange <em>Interval Constraint Change</em>}'. + * <!-- begin-user-doc --> This default implementation returns null * so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the * cases anyway. <!-- end-user-doc --> - * * @return the new adapter. * @see org.eclipse.emf.compare.uml2.internal.IntervalConstraintChange * @generated @@ -253,27 +219,23 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange - * <em>Stereotype Property Change</em>}'. <!-- begin-user-doc --> This default implementation returns null + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange <em>Stereotype Attribute Change</em>}'. + * <!-- begin-user-doc --> This default implementation returns null * so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the * cases anyway. <!-- end-user-doc --> - * * @return the new adapter. - * @see org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange + * @see org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange * @generated */ - public Adapter createStereotypePropertyChangeAdapter() { + public Adapter createStereotypeAttributeChangeAdapter() { return null; } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange - * <em>Stereotype Application Change</em>}'. <!-- begin-user-doc --> This default implementation returns + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange <em>Stereotype Application Change</em>}'. + * <!-- begin-user-doc --> This default implementation returns * null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all * the cases anyway. <!-- end-user-doc --> - * * @return the new adapter. * @see org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange * @generated @@ -283,12 +245,10 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange - * <em>Stereotype Reference Change</em>}'. <!-- begin-user-doc --> This default implementation returns + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange <em>Stereotype Reference Change</em>}'. + * <!-- begin-user-doc --> This default implementation returns * null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all * the cases anyway. <!-- end-user-doc --> - * * @return the new adapter. * @see org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange * @generated @@ -298,12 +258,10 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange - * <em>Profile Application Change</em>}'. <!-- begin-user-doc --> This default implementation returns null + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange <em>Profile Application Change</em>}'. + * <!-- begin-user-doc --> This default implementation returns null * so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the * cases anyway. <!-- end-user-doc --> - * * @return the new adapter. * @see org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange * @generated @@ -313,12 +271,10 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange - * <em>Directed Relationship Change</em>}'. <!-- begin-user-doc --> This default implementation returns + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange <em>Directed Relationship Change</em>}'. + * <!-- begin-user-doc --> This default implementation returns * null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all * the cases anyway. <!-- end-user-doc --> - * * @return the new adapter. * @see org.eclipse.emf.compare.uml2.internal.DirectedRelationshipChange * @generated @@ -328,11 +284,10 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.UMLDiff - * <em>UML Diff</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can + * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.uml2.internal.UMLDiff <em>UML Diff</em>}'. + * <!-- begin-user-doc --> This default implementation returns null so that we can * easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> - * * @return the new adapter. * @see org.eclipse.emf.compare.uml2.internal.UMLDiff * @generated @@ -355,9 +310,9 @@ public class UMLCompareAdapterFactory extends AdapterFactoryImpl { } /** - * Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> This default implementation returns * null. <!-- end-user-doc --> - * * @return the new adapter. * @generated */ diff --git a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareSwitch.java b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareSwitch.java index e16264d7b..97481b91e 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareSwitch.java +++ b/plugins/org.eclipse.emf.compare.uml2/src-gen/org/eclipse/emf/compare/uml2/internal/util/UMLCompareSwitch.java @@ -22,7 +22,7 @@ import org.eclipse.emf.compare.uml2.internal.IntervalConstraintChange; import org.eclipse.emf.compare.uml2.internal.MessageChange; import org.eclipse.emf.compare.uml2.internal.ProfileApplicationChange; import org.eclipse.emf.compare.uml2.internal.StereotypeApplicationChange; -import org.eclipse.emf.compare.uml2.internal.StereotypePropertyChange; +import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange; import org.eclipse.emf.compare.uml2.internal.StereotypeReferenceChange; import org.eclipse.emf.compare.uml2.internal.UMLComparePackage; import org.eclipse.emf.compare.uml2.internal.UMLDiff; @@ -141,11 +141,11 @@ public class UMLCompareSwitch<T> { if (result == null) result = defaultCase(theEObject); return result; } - case UMLComparePackage.STEREOTYPE_PROPERTY_CHANGE: { - StereotypePropertyChange stereotypePropertyChange = (StereotypePropertyChange)theEObject; - T result = caseStereotypePropertyChange(stereotypePropertyChange); - if (result == null) result = caseUMLDiff(stereotypePropertyChange); - if (result == null) result = caseDiff(stereotypePropertyChange); + case UMLComparePackage.STEREOTYPE_ATTRIBUTE_CHANGE: { + StereotypeAttributeChange stereotypeAttributeChange = (StereotypeAttributeChange)theEObject; + T result = caseStereotypeAttributeChange(stereotypeAttributeChange); + if (result == null) result = caseUMLDiff(stereotypeAttributeChange); + if (result == null) result = caseDiff(stereotypeAttributeChange); if (result == null) result = defaultCase(theEObject); return result; } @@ -277,15 +277,17 @@ public class UMLCompareSwitch<T> { } /** - * Returns the result of interpreting the object as an instance of '<em>Stereotype Property Change</em>'. - * <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate - * the switch. <!-- end-user-doc --> + * Returns the result of interpreting the object as an instance of '<em>Stereotype Attribute Change</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Stereotype Property Change</em>'. + * @return the result of interpreting the object as an instance of '<em>Stereotype Attribute Change</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ - public T caseStereotypePropertyChange(StereotypePropertyChange object) { + public T caseStereotypeAttributeChange(StereotypeAttributeChange object) { return null; } diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/AbstractUMLChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/AbstractUMLChangeFactory.java index f7632e8ec..e6b74e9bc 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/AbstractUMLChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/AbstractUMLChangeFactory.java @@ -556,7 +556,7 @@ public abstract class AbstractUMLChangeFactory extends AbstractChangeFactory { * The difference. * @return True if it is related to a CHANGE in an ADD/DELETE. */ - private boolean isChangeOnAddOrDelete(Diff input) { + protected boolean isChangeOnAddOrDelete(Diff input) { if (getRelatedExtensionKind(input) == DifferenceKind.CHANGE) { final Comparison comparison = input.getMatch().getComparison(); final EObject discriminant = getDiscriminant(input); @@ -581,8 +581,9 @@ public abstract class AbstractUMLChangeFactory extends AbstractChangeFactory { */ private boolean isChangeOnAddOrDelete(Diff input, final Comparison comparison, final EObject discriminant) { boolean result = false; - if (Iterables.any(comparison.getMatch(discriminant).getDifferences(), - instanceOf(ResourceAttachmentChange.class))) { + Match match = comparison.getMatch(discriminant); + if (match != null + && Iterables.any(match.getDifferences(), instanceOf(ResourceAttachmentChange.class))) { result = true; } if (!result) { diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/UMLPostProcessor.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/UMLPostProcessor.java index 5b8042a50..5773d9867 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/UMLPostProcessor.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/UMLPostProcessor.java @@ -18,8 +18,8 @@ import com.google.common.base.Predicate; import com.google.common.collect.Collections2;
import java.util.Collection;
-import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -245,7 +245,7 @@ public class UMLPostProcessor implements IPostProcessor { final Map<Class<? extends Diff>, IChangeFactory> mapUml2ExtensionFactories = UMLExtensionFactoryRegistry
.createExtensionFactories();
- uml2ExtensionFactories = new HashSet<IChangeFactory>(mapUml2ExtensionFactories.values());
+ uml2ExtensionFactories = new LinkedHashSet<IChangeFactory>(mapUml2ExtensionFactories.values());
// Creation of the UML difference extensions
for (Diff diff : comparison.getDifferences()) {
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/UMLExtensionFactoryRegistry.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/UMLExtensionFactoryRegistry.java index 2ed01b213..9f19a0d90 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/UMLExtensionFactoryRegistry.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/UMLExtensionFactoryRegistry.java @@ -12,7 +12,7 @@ package org.eclipse.emf.compare.uml2.internal.postprocessor.extension; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -21,10 +21,12 @@ import org.eclipse.emf.compare.internal.postprocessor.factories.IChangeFactory; import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.clazz.UMLAssociationChangeFactory; import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.clazz.UMLGeneralizationSetChangeFactory; import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.profile.UMLProfileApplicationChangeFactory; -import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.profile.UMLStereotypeApplicationChangeFactory; import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.sequence.UMLExecutionSpecificationChangeFactory; import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.sequence.UMLIntervalConstraintChangeFactory; import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.sequence.UMLMessageChangeFactory; +import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.stereotype.UMLStereotypeApplicationChangeFactory; +import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.stereotype.UMLStereotypeAttributeChangeFactory; +import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.stereotype.UMLStereotypeReferenceChangeFactory; import org.eclipse.emf.compare.uml2.internal.postprocessor.extension.usecase.UMLExtendChangeFactory; /** @@ -48,7 +50,7 @@ public final class UMLExtensionFactoryRegistry { * @return an unmodifiable set of all {@link IDiffExtensionFactory}. */ public static Map<Class<? extends Diff>, IChangeFactory> createExtensionFactories() { - final Map<Class<? extends Diff>, IChangeFactory> dataset = new HashMap<Class<? extends Diff>, IChangeFactory>(); + final Map<Class<? extends Diff>, IChangeFactory> dataset = new LinkedHashMap<Class<? extends Diff>, IChangeFactory>(); List<IChangeFactory> factories = new ArrayList<IChangeFactory>(); factories.add(new UMLAssociationChangeFactory()); @@ -59,6 +61,8 @@ public final class UMLExtensionFactoryRegistry { factories.add(new UMLExecutionSpecificationChangeFactory()); factories.add(new UMLIntervalConstraintChangeFactory()); factories.add(new UMLProfileApplicationChangeFactory()); + factories.add(new UMLStereotypeAttributeChangeFactory()); + factories.add(new UMLStereotypeReferenceChangeFactory()); factories.add(new UMLStereotypeApplicationChangeFactory()); for (IChangeFactory iDiffExtensionFactory : factories) { diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/profile/UMLStereotypeApplicationChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/stereotype/UMLStereotypeApplicationChangeFactory.java index 3fbd17a7a..663b81607 100644 --- a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/profile/UMLStereotypeApplicationChangeFactory.java +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/stereotype/UMLStereotypeApplicationChangeFactory.java @@ -8,7 +8,7 @@ * Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.uml2.internal.postprocessor.extension.profile;
+package org.eclipse.emf.compare.uml2.internal.postprocessor.extension.stereotype;
import static com.google.common.base.Predicates.instanceOf;
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/stereotype/UMLStereotypeAttributeChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/stereotype/UMLStereotypeAttributeChangeFactory.java new file mode 100644 index 000000000..d7f4cd78e --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/stereotype/UMLStereotypeAttributeChangeFactory.java @@ -0,0 +1,155 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.uml2.internal.postprocessor.extension.stereotype;
+
+import static com.google.common.base.Predicates.instanceOf;
+
+import com.google.common.collect.Iterables;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.compare.AttributeChange;
+import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.uml2.internal.StereotypeAttributeChange;
+import org.eclipse.emf.compare.uml2.internal.UMLCompareFactory;
+import org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory;
+import org.eclipse.emf.compare.uml2.internal.postprocessor.util.UMLCompareUtil;
+import org.eclipse.emf.compare.utils.MatchUtil;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreSwitch;
+import org.eclipse.emf.ecore.util.Switch;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * Factory for stereotype string property changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeAttributeChangeFactory extends AbstractUMLChangeFactory {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#handles(org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ public boolean handles(Diff input) {
+ if (input instanceof AttributeChange) {
+ return super.handles(input);
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#getDiscriminantsGetter()
+ */
+ @Override
+ protected Switch<Set<EObject>> getDiscriminantsGetter() {
+ return new EcoreSwitch<Set<EObject>>() {
+ @Override
+ public Set<EObject> defaultCase(EObject object) {
+ Set<EObject> result = new HashSet<EObject>();
+ if (object.eContainer() == null) {
+ result.add(object);
+ } else {
+ return defaultCaseForDiscriminantsGetter(this, object);
+ }
+ return result;
+ }
+ };
+
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#getDiscriminant(org.eclipse
+ * .emf.compare.Diff)
+ */
+ @Override
+ protected EObject getDiscriminant(Diff input) {
+ final EObject discriminant;
+ if (input instanceof AttributeChange) {
+ discriminant = ((AttributeChange)input).getAttribute();
+ } else {
+ discriminant = Iterables.find(getDiscriminants(input), instanceOf(EObject.class), null);
+ }
+ return discriminant;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.internal.postprocessor.factories.AbstractChangeFactory#createExtension()
+ */
+ @Override
+ public Diff createExtension() {
+ return UMLCompareFactory.eINSTANCE.createStereotypeAttributeChange();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.internal.postprocessor.factories.AbstractChangeFactory#getExtensionKind()
+ */
+ @Override
+ public Class<? extends Diff> getExtensionKind() {
+ return StereotypeAttributeChange.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.internal.postprocessor.factories.AbstractChangeFactory#isRelatedToAnExtensionChange(org.eclipse.emf.compare.AttributeChange)
+ */
+ @Override
+ protected boolean isRelatedToAnExtensionChange(AttributeChange input) {
+ return UMLCompareUtil.getBaseElement(MatchUtil.getContainer(input.getMatch().getComparison(), input)) != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#setRefiningChanges(org.eclipse.emf.compare.Diff,
+ * org.eclipse.emf.compare.DifferenceKind, org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ public void setRefiningChanges(Diff extension, DifferenceKind extensionKind, Diff refiningDiff) {
+ extension.getRefinedBy().add(refiningDiff);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#getParentMatch(org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ public Match getParentMatch(Diff input) {
+ Match match = input.getMatch();
+ if (match != null) {
+ EObject object = match.getLeft();
+ if (object == null) {
+ object = match.getRight();
+ }
+ if (object == null) {
+ object = match.getOrigin();
+ }
+ final Element element = UMLCompareUtil.getBaseElement(object);
+ match = match.getComparison().getMatch(element);
+ }
+ return match;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/stereotype/UMLStereotypeReferenceChangeFactory.java b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/stereotype/UMLStereotypeReferenceChangeFactory.java new file mode 100644 index 000000000..c4415d3ef --- /dev/null +++ b/plugins/org.eclipse.emf.compare.uml2/src/org/eclipse/emf/compare/uml2/internal/postprocessor/extension/stereotype/UMLStereotypeReferenceChangeFactory.java @@ -0,0 +1,155 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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.uml2.internal.postprocessor.extension.stereotype;
+
+import static com.google.common.base.Predicates.instanceOf;
+
+import com.google.common.collect.Iterables;
+
+import java.util.HashSet;
+import java.util.Set;
+
+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.uml2.internal.StereotypeReferenceChange;
+import org.eclipse.emf.compare.uml2.internal.UMLCompareFactory;
+import org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory;
+import org.eclipse.emf.compare.uml2.internal.postprocessor.util.UMLCompareUtil;
+import org.eclipse.emf.compare.utils.MatchUtil;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreSwitch;
+import org.eclipse.emf.ecore.util.Switch;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * Factory for stereotype reference changes.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class UMLStereotypeReferenceChangeFactory extends AbstractUMLChangeFactory {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#handles(org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ public boolean handles(Diff input) {
+ if (input instanceof ReferenceChange) {
+ return super.handles(input);
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#getDiscriminantsGetter()
+ */
+ @Override
+ protected Switch<Set<EObject>> getDiscriminantsGetter() {
+ return new EcoreSwitch<Set<EObject>>() {
+ @Override
+ public Set<EObject> defaultCase(EObject object) {
+ Set<EObject> result = new HashSet<EObject>();
+ if (object.eContainer() == null) {
+ result.add(object);
+ } else {
+ return defaultCaseForDiscriminantsGetter(this, object);
+ }
+ return result;
+ }
+ };
+
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#getDiscriminant(org.eclipse
+ * .emf.compare.Diff)
+ */
+ @Override
+ protected EObject getDiscriminant(Diff input) {
+ final EObject discriminant;
+ if (input instanceof ReferenceChange) {
+ discriminant = ((ReferenceChange)input).getReference();
+ } else {
+ discriminant = Iterables.find(getDiscriminants(input), instanceOf(EObject.class), null);
+ }
+ return discriminant;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.internal.postprocessor.factories.AbstractChangeFactory#createExtension()
+ */
+ @Override
+ public Diff createExtension() {
+ return UMLCompareFactory.eINSTANCE.createStereotypeReferenceChange();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.internal.postprocessor.factories.AbstractChangeFactory#getExtensionKind()
+ */
+ @Override
+ public Class<? extends Diff> getExtensionKind() {
+ return StereotypeReferenceChange.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.internal.postprocessor.factories.AbstractChangeFactory#isRelatedToAnExtensionChange(org.eclipse.emf.compare.ReferenceChange)
+ */
+ @Override
+ protected boolean isRelatedToAnExtensionChange(ReferenceChange input) {
+ return UMLCompareUtil.getBaseElement(MatchUtil.getContainer(input.getMatch().getComparison(), input)) != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#setRefiningChanges(org.eclipse.emf.compare.Diff,
+ * org.eclipse.emf.compare.DifferenceKind, org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ public void setRefiningChanges(Diff extension, DifferenceKind extensionKind, Diff refiningDiff) {
+ extension.getRefinedBy().add(refiningDiff);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.uml2.internal.postprocessor.AbstractUMLChangeFactory#getParentMatch(org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ public Match getParentMatch(Diff input) {
+ Match match = input.getMatch();
+ if (match != null) {
+ EObject object = match.getLeft();
+ if (object == null) {
+ object = match.getRight();
+ }
+ if (object == null) {
+ object = match.getOrigin();
+ }
+ final Element element = UMLCompareUtil.getBaseElement(object);
+ match = match.getComparison().getMatch(element);
+ }
+ return match;
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/AttributeChangeMerger.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/AttributeChangeMerger.java index 896537cc9..308577d78 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/AttributeChangeMerger.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/AttributeChangeMerger.java @@ -23,8 +23,12 @@ import org.eclipse.emf.compare.Diff; import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.internal.utils.DiffUtil;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.DynamicEObjectImpl;
/**
* This specific implementation of {@link AbstractMerger} will be used to merge attribute changes.
@@ -355,8 +359,18 @@ public class AttributeChangeMerger extends AbstractMerger { } else {
originContainer = match.getLeft();
}
- - final Object targetValue = safeEGet(originContainer, attribute); +
+ final Object targetValue;
+ final Object value = safeEGet(originContainer, attribute);
+
+ // Case of change of EnumLiteral of an attribute of a DynamicEObject : we need to retrieve the
+ // EnumLiteral instance of the target which is not the same than the source.
+ if (expectedContainer instanceof DynamicEObjectImpl && value instanceof EEnumLiteral) {
+ targetValue = ((EEnum)((EEnumLiteral)safeEGet(expectedContainer, attribute)).eContainer())
+ .getEEnumLiteral(((ENamedElement)value).getName());
+ } else {
+ targetValue = value;
+ }
// Though not the "default value", we consider that an empty string is an unset attribute.
final Object defaultValue = attribute.getDefaultValue();
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/ReferenceChangeMerger.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/ReferenceChangeMerger.java index aa833b797..56b1c00b4 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/ReferenceChangeMerger.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/ReferenceChangeMerger.java @@ -86,7 +86,7 @@ public class ReferenceChangeMerger extends AbstractMerger { container = referenceChange.getMatch().getRight();
}
// Is it an unset?
- if (container != null) {
+ if (container != null) { final EObject leftValue = (EObject)safeEGet(container, referenceChange.getReference()); if (leftValue == null) {
// Value has been unset in the right, and we are merging towards right.
@@ -137,7 +137,7 @@ public class ReferenceChangeMerger extends AbstractMerger { } else {
container = referenceChange.getMatch().getRight();
}
- // Is it an unset?
+ // Is it an unset? if (container != null) { final EObject leftValue = (EObject)safeEGet(container, referenceChange.getReference()); if (leftValue == null) {
@@ -500,7 +500,7 @@ public class ReferenceChangeMerger extends AbstractMerger { if (originContainer == null || !safeEIsSet(targetContainer, reference)
|| !safeEIsSet(originContainer, reference)) {
- targetContainer.eUnset(reference);
+ targetContainer.eUnset(reference); } else { final EObject originalValue = (EObject)safeEGet(originContainer, reference); final Match valueMatch = match.getComparison().getMatch(originalValue);
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/ReferenceUtil.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/ReferenceUtil.java index 18c05b375..a73496963 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/ReferenceUtil.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/utils/ReferenceUtil.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2014 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
|