Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-04-30 05:53:22 -0400
committervlorenzo2012-04-30 05:53:22 -0400
commitc9c9149cf5cc8846b5e6d0ab33fcb095eb24ed36 (patch)
tree605bf6272da256a3eb56f8285fe73ad3a8929bdb /sandbox/UMLCompareMergerExample
parent8135688d9519dbfe224499dbc7a32892f769980f (diff)
downloadorg.eclipse.papyrus-c9c9149cf5cc8846b5e6d0ab33fcb095eb24ed36.tar.gz
org.eclipse.papyrus-c9c9149cf5cc8846b5e6d0ab33fcb095eb24ed36.tar.xz
org.eclipse.papyrus-c9c9149cf5cc8846b5e6d0ab33fcb095eb24ed36.zip
342163: [Usability] Papyrus merge should use the service edit of Papyrus
https://bugs.eclipse.org/bugs/show_bug.cgi?id=342163 A save of my work
Diffstat (limited to 'sandbox/UMLCompareMergerExample')
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/CUpdateReferenceMerger.java130
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/MergeCommandProvider.java230
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusMergeCommandProvider.java11
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusUMLMergeProvider.java24
4 files changed, 151 insertions, 244 deletions
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/CUpdateReferenceMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/CUpdateReferenceMerger.java
index dcc6b0acfae..ba5c33a76c1 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/CUpdateReferenceMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/CUpdateReferenceMerger.java
@@ -1,26 +1,140 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * 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:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.merger.provider;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
import org.eclipse.emf.compare.diff.internal.merge.impl.UpdateReferenceMerger;
+import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.uml.compare.merger.utils.MergerUtils;
-public class CUpdateReferenceMerger extends UpdateReferenceMerger {
+public class CUpdateReferenceMerger extends UpdateReferenceMerger implements ICommandMerger {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.IMerger#applyInOrigin()
+ */
@Override
- public void doUndoInTarget() {
+ public void applyInOrigin() {
if(MergerUtils.usePapyrusMerger()) {
- throw new UnsupportedOperationException();
+ final TransactionalEditingDomain domain = MergerUtils.getEditingDomain();
+ final Command cmd = getApplyInOriginCommand(domain);
+ if(cmd.canExecute()) {
+ domain.getCommandStack().execute(cmd);
+ }
} else {
- super.doUndoInTarget();
+ super.applyInOrigin();
}
}
@Override
- public void doApplyInOrigin() {
+ public void undoInTarget() {
if(MergerUtils.usePapyrusMerger()) {
- throw new UnsupportedOperationException();
+ final TransactionalEditingDomain domain = MergerUtils.getEditingDomain();
+ final Command cmd = getUndoInTargetCommand(domain);
+ if(cmd.canExecute()) {
+ domain.getCommandStack().execute(cmd);
+ }
} else {
- super.doApplyInOrigin();
+ super.undoInTarget();
}
}
-}
+
+ public Command getApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ // mergeRequiredDifferences(true);
+ // doApplyInOrigin();
+ // postProcess();
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CUpdateReferenceMerger");
+ cmd.append(getMergeRequiredDifferencesCommand(domain, true));
+ cmd.append(getDoApplyInOriginCommand(domain));
+ cmd.append(getPostProcessCommand(domain));
+ return cmd;
+ }
+
+ public Command getUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ // mergeRequiredDifferences(false);
+ // doUndoInTarget();
+ // postProcess();
+
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CUpdateReferenceMerger");
+ cmd.append(getMergeRequiredDifferencesCommand(domain, false));
+ cmd.append(getDoUndoInTargetCommand(domain));
+ cmd.append(getPostProcessCommand(domain));
+ return cmd;
+ }
+
+
+ public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ final UpdateReference theDiff = (UpdateReference)this.diff;
+ final EReference reference = theDiff.getReference();
+ final EObject element = theDiff.getLeftElement();
+ final EObject leftTarget = (EObject)theDiff.getRightElement().eGet(reference);
+ final EObject matchedLeftTarget = theDiff.getLeftTarget();
+
+ if(leftTarget == null) {
+ // We're unsetting the value, no need to copy
+ //TODO
+ cmd = UnexecutableCommand.INSTANCE;
+ // element.eUnset(reference);
+ } else {
+ //TODO
+ cmd = UnexecutableCommand.INSTANCE;
+ // MergeService.getCopier(diff).copyReferenceValue(reference, element, leftTarget,
+ // matchedLeftTarget, -1);
+ }
+ return cmd;
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ // TODO
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ public Command getMergeRequiredDifferencesCommand(final TransactionalEditingDomain domain, final boolean applyInOrigin) {
+ // TODO the super method mergeRequiredDifferences should be rewritten to use cmd too
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ CUpdateReferenceMerger.this.mergeRequiredDifferences(applyInOrigin);
+ return null;
+ }
+ });
+ }
+
+ public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ CUpdateReferenceMerger.this.postProcess();
+ return null;
+ }
+ });
+ }
+}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/MergeCommandProvider.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/MergeCommandProvider.java
deleted file mode 100644
index 81adf206780..00000000000
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/MergeCommandProvider.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- *
- * 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.merger.provider;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChange;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.AttributeOrderChange;
-import org.eclipse.emf.compare.diff.metamodel.ConflictingDiffElement;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChange;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChange;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceOrderChange;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDependencyChange;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDependencyChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDependencyChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDiff;
-import org.eclipse.emf.compare.diff.metamodel.UpdateAttribute;
-import org.eclipse.emf.compare.diff.metamodel.UpdateContainmentFeature;
-import org.eclipse.emf.compare.diff.metamodel.UpdateModelElement;
-import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
-import org.eclipse.emf.compare.diff.metamodel.impl.AttributeChangeImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-
-
-public class MergeCommandProvider {//TODO create an interface?
-
- public Command getMergeCommand(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain, final EObject elementToDestroy) {
- Command cmd = null;
- if(diffElement instanceof AttributeChangeImpl) {
- cmd = getMergeCommandForAttributeChange(container, confirmationRequired, (AttributeChange)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ConflictingDiffElement) {
- cmd = getMergeCommandForConflictingDiffElement(container, confirmationRequired, (ConflictingDiffElement)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof DiffGroup) {
- cmd = getMergeCommandForDiffGroup(container, confirmationRequired, (DiffGroup)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ModelElementChange) {
- cmd = getMergeCommandForModelElementChange(container, confirmationRequired, (ModelElementChange)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ReferenceChange) {
- cmd = getMergeCommandForReferenceChange(container, confirmationRequired, (ReferenceChange)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ResourceDiff) {
- cmd = getMergeCommandForResourceDiff(container, confirmationRequired, (ResourceDiff)diffElement, leftToRight, editingDomain);
- } else {
- //TODO log an error;
- }
- return cmd;
- }
-
- protected Command getMergeCommandForAttributeChange(final Object container, final boolean confirmationRequired, final AttributeChange diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof AttributeChangeLeftTarget) {
- cmd = getMergeCommandForAttributeChangeLeftTarget(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof AttributeChangeRightTarget) {
- cmd = getMergeCommandForAttributeChangeRightTarget(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof AttributeOrderChange) {
- cmd = getMergeCommandForAttributeOrderChange(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof UpdateAttribute) {
- cmd = getMergeCommandForUpdateAttribute(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForAttributeChangeLeftTarget(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {//TODO
- return null;
- }
-
- protected Command getMergeCommandForAttributeChangeRightTarget(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForAttributeOrderChange(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {//TODO
- return null;
- }
-
- protected Command getMergeCommandForUpdateAttribute(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForConflictingDiffElement(final Object container, final boolean confirmationRequired, final ConflictingDiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForDiffGroup(final Object container, final boolean confirmationRequired, final DiffGroup diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForModelElementChange(final Object container, final boolean confirmationRequired, final ModelElementChange diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof ModelElementChangeLeftTarget) {
- cmd = getMergeCommandForModelElementChangeLeftTarget(container, confirmationRequired, (ModelElementChangeLeftTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ModelElementChangeRightTarget) {
- cmd = getMergeCommandForModelElementChangeRightTarget(container, confirmationRequired, (ModelElementChangeRightTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof UpdateModelElement) {
- cmd = getMergeCommandForUpdateModelElement(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForModelElementChangeLeftTarget(final Object container, final boolean confirmationRequired, final ModelElementChangeLeftTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
-
- return null;
- }
-
- protected Command getMergeCommandForModelElementChangeRightTarget(final Object container, final boolean confirmationRequired, final ModelElementChangeRightTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForUpdateModelElement(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof MoveModelElement) {
- cmd = getMergeCommandForMoveModelElement(container, confirmationRequired, (MoveModelElement)diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForMoveModelElement(final Object container, final boolean confirmationRequired, final MoveModelElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof UpdateContainmentFeature) {
- cmd = getMergeCommandForUpdateContainmentFeature(container, confirmationRequired, (UpdateContainmentFeature)diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
-
- }
-
- protected Command getMergeCommandForUpdateContainmentFeature(final Object container, final boolean confirmationRequired, final UpdateContainmentFeature diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForReferenceChange(final Object container, final boolean confirmationRequired, final ReferenceChange diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {//TODO
- Command cmd = null;
- if(diffElement instanceof ReferenceChangeLeftTarget) {
- cmd = getMergeCommandForReferenceChangeLeftTarget(container, confirmationRequired, (ReferenceChangeLeftTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ReferenceChangeRightTarget) {
- cmd = getMergeCommandForReferenceChangeRightTarget(container, confirmationRequired, (ReferenceChangeRightTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ReferenceOrderChange) {
- cmd = getMergeCommandForReferenceOrderChange(container, confirmationRequired, (ReferenceOrderChange)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof UpdateReference) {
- cmd = getMergeCommandForUpdateReference(container, confirmationRequired, (UpdateReference)diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForReferenceChangeLeftTarget(final Object container, final boolean confirmationRequired, final ReferenceChangeLeftTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForReferenceChangeRightTarget(final Object container, final boolean confirmationRequired, final ReferenceChangeRightTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForReferenceOrderChange(final Object container, final boolean confirmationRequired, final ReferenceOrderChange diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForUpdateReference(final Object container, final boolean confirmationRequired, final UpdateReference diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForResourceDiff(final Object container, final boolean confirmationRequired, final ResourceDiff diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof ResourceDependencyChange) {
- cmd = getMergeCommandForResourceDependencyChange(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForResourceDependencyChange(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {//TODO
- Command cmd = null;
- if(diffElement instanceof ResourceDependencyChangeLeftTarget) {
- cmd = getMergeCommandForResourceDependencyChangeLeftTarget(container, confirmationRequired, (ResourceDependencyChangeLeftTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ResourceDependencyChangeRightTarget) {
- cmd = getMergeCommandForResourceDependencyChangeRightTarget(container, confirmationRequired, (ResourceDependencyChangeRightTarget)diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForResourceDependencyChangeLeftTarget(final Object container, final boolean confirmationRequired, final ResourceDependencyChangeLeftTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForResourceDependencyChangeRightTarget(final Object container, final boolean confirmationRequired, final ResourceDependencyChangeRightTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
-}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusMergeCommandProvider.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusMergeCommandProvider.java
index 6f4a970b807..4f726dbb340 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusMergeCommandProvider.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusMergeCommandProvider.java
@@ -26,6 +26,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
@@ -66,6 +67,11 @@ public class PapyrusMergeCommandProvider {
return null;
}
+ public Command getDestroyReferenceCommand(final TransactionalEditingDomain editingDomain, final EObject container, final EReference containingFeature, final EObject referencedObject, final boolean confirmationRequired) {
+ final IEditCommandRequest request = new DestroyReferenceRequest(editingDomain, container, containingFeature, referencedObject, confirmationRequired);
+ return getCommand(container, request);
+ }
+
public Command getSetCommand(final TransactionalEditingDomain domain, final EObject element, final EStructuralFeature feature, final Object value) {
final IEditCommandRequest request = new SetRequest(domain, element, feature, value);
return getCommand(element, request);
@@ -76,7 +82,7 @@ public class PapyrusMergeCommandProvider {
return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Set XMI Command", null) {
@Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
if(element != null && element.eResource() instanceof XMIResource) {
((XMIResource)element.eResource()).setID(element, id);
}
@@ -91,7 +97,7 @@ public class PapyrusMergeCommandProvider {
return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Add EObject to Resource Command", null) {
@Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
res.getContents().add(eobjectToAdd);
return CommandResult.newOKCommandResult();
}
@@ -103,4 +109,5 @@ public class PapyrusMergeCommandProvider {
final IEditCommandRequest request = new MoveWithIndexRequest(domain, targetContainer, targetFeature, elementToMove, index);
return getCommand(elementToEdit, request);
}
+
}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusUMLMergeProvider.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusUMLMergeProvider.java
index 116cdea5e03..a80630364b5 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusUMLMergeProvider.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/merger/provider/PapyrusUMLMergeProvider.java
@@ -1,3 +1,16 @@
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * 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:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.merger.provider;
import java.util.Map;
@@ -20,7 +33,8 @@ import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
import org.eclipse.papyrus.uml.compare.merger.utils.PapyrusMap;
-public class PapyrusUMLMergeProvider implements IMergerProvider{
+public class PapyrusUMLMergeProvider implements IMergerProvider {
+
/**
* This map keeps a bridge between a given {@link DiffElement}'s class and the most accurate merger's
* class for that particular {@link DiffElement}.
@@ -33,9 +47,9 @@ public class PapyrusUMLMergeProvider implements IMergerProvider{
* @see org.eclipse.emf.compare.diff.merge.IMergerProvider#getMergers()
*/
public Map<Class<? extends DiffElement>, Class<? extends IMerger>> getMergers() {
- if (mergerTypes == null) {
+ if(mergerTypes == null) {
mergerTypes = new PapyrusMap<Class<? extends DiffElement>, Class<? extends IMerger>>();
-// mergerTypes.put(DiffGroup.class, CDiffGroupMerger.class);//we needn't of the specific DiffGroup
+ mergerTypes.put(DiffGroup.class, CDiffGroupMerger.class);
mergerTypes.put(ModelElementChangeRightTarget.class, CModelElementChangeRightTargetMerger.class);
mergerTypes.put(ModelElementChangeLeftTarget.class, CModelElementChangeLeftTargetMerger.class);
mergerTypes.put(MoveModelElement.class, CMoveModelElementMerger.class);
@@ -47,9 +61,11 @@ public class PapyrusUMLMergeProvider implements IMergerProvider{
mergerTypes.put(UpdateAttribute.class, CUpdateAttributeMerger.class);
mergerTypes.put(ReferenceOrderChange.class, CReferenceOrderChangeMerger.class);
mergerTypes.put(AttributeOrderChange.class, CAttributeOrderChangeMerger.class);
+ //DiffExtensionMerger : not used for the moment
+ //DefaultExtensionMerger : not used for the moment
}
return mergerTypes;
}
-
+
}

Back to the top