Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-05-03 10:08:46 +0000
committervlorenzo2012-05-03 10:08:46 +0000
commitd4c4f0799753a9765d7f575f5a194671e7093b58 (patch)
tree61ba15c0103148f4eaf622fce1ca778385d73097 /sandbox
parentea2da33ffcbb7e6d94ac8a9dd46a70c177264770 (diff)
downloadorg.eclipse.papyrus-d4c4f0799753a9765d7f575f5a194671e7093b58.tar.gz
org.eclipse.papyrus-d4c4f0799753a9765d7f575f5a194671e7093b58.tar.xz
org.eclipse.papyrus-d4c4f0799753a9765d7f575f5a194671e7093b58.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 : Corrects some errors for MoveModelElementMerger
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/META-INF/MANIFEST.MF4
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/about.html28
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/build.properties7
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/plugin.pdoc4
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/plugin.properties3
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/commands/CopyXMIIDCommand.java112
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeLeftTargetTransactionalMerger.java8
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeRightTargetTransactionalMerger.java8
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeOrderChangeTransactionalMerger.java10
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/DiffGroupTransactionalMerger.java12
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeLeftTargetTransactionalMerger.java20
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeRightTargetTransactionalMerger.java18
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/MoveModelElementTransactionalMerger.java14
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeLeftTargetTransactionalMerger.java12
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeRightTargetTransactionalMerger.java14
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceOrderChangeTransactionalMerger.java8
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateAttributeTransactionalMerger.java8
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateReferenceTransactionalMerger.java12
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusMergeCommandProvider.java51
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusUMLMergeProvider.java4
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/EObjectComparator.java68
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/MoveWithIndexCommand.java128
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusCompareEObjectCopier.java55
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusEFactory.java171
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusMap.java2
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PositionAdapter.java48
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/TransactionalMergeService.java14
-rw-r--r--sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusCompareMap.java (renamed from sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusMap.java)12
28 files changed, 506 insertions, 349 deletions
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/META-INF/MANIFEST.MF b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/META-INF/MANIFEST.MF
index e3efa5e1236..11fad835f80 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/META-INF/MANIFEST.MF
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/META-INF/MANIFEST.MF
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Payrus UML Merger
+Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.uml.compare.merger;singleton:=true
Bundle-Version: 0.9.0.qualifier
Bundle-Activator: org.eclipse.papyrus.uml.compare.merger.Activator
@@ -19,3 +19,5 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.emf;bundle-version="0.9.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/about.html b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/build.properties b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/build.properties
index 6f20375d6c7..2fe142429ae 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/build.properties
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/build.properties
@@ -2,4 +2,9 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ plugin.pdoc,\
+ build.properties,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/plugin.pdoc b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/plugin.pdoc
new file mode 100644
index 00000000000..955d3907f13
--- /dev/null
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/plugin.pdoc
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<doc:Documentation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:doc="http://www.eclipse.org/papyrus/documentation/plugin/documentation" description="This plugin provides Transactional Merger for the Papyrus Compare Editors.">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/plugin.properties b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/plugin.properties
new file mode 100644
index 00000000000..64c9548b201
--- /dev/null
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/plugin.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.uml.compare.merger
+providerName = Eclipse Modeling Tools
+pluginName = Payrus UML Merger (Incubation) \ No newline at end of file
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/commands/CopyXMIIDCommand.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/commands/CopyXMIIDCommand.java
new file mode 100644
index 00000000000..ac16505bea4
--- /dev/null
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/commands/CopyXMIIDCommand.java
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * 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.compare.merger.internal.commands;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+
+/**
+ *
+ * This command allows to copy the XMI_ID from one EObject to another one, only if they are not owned by the same resource
+ *
+ */
+//TODO should be moved in infra.emf plugin when the problem of the saùme resource will be corrected in Papyrus
+public class CopyXMIIDCommand extends AbstractCommand {
+
+ /**
+ * the EObject which provides the XMI_ID
+ */
+ private final EObject source;
+
+ /**
+ * the EObject which receive the XMI_ID
+ */
+ private final EObject target;
+
+ /**
+ * the initial XMI_ID of the target
+ */
+ private String initialID;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param source
+ * the EObject which provides the XMI_ID
+ * @param target
+ * the EObject which receive the XMI_ID
+ */
+ public CopyXMIIDCommand(final EObject source, final EObject target) {
+ this.source = source;
+ this.target = target;
+ this.initialID = null;
+ setLabel("Copy XMI_ID command"); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.Command#execute()
+ *
+ */
+ public void execute() {
+ final Resource sourceResource = source.eResource();
+ final Resource targetResource = target.eResource();
+ if(sourceResource instanceof XMIResource && targetResource instanceof XMIResource) {
+ //TODO : this test is commented because the result of this command is worse with the test than without...
+ // if(sourceResource != targetResource) {
+ final String xmi_id = EMFHelper.getXMIID(this.source);
+ this.initialID = EMFHelper.getXMIID(target);
+ ((XMIResource)this.target.eResource()).setID(this.target, xmi_id);
+ // }
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.Command#redo()
+ *
+ */
+ public void redo() {
+ execute();
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
+ *
+ * @return
+ */
+ @Override
+ protected boolean prepare() {
+ return true;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#undo()
+ *
+ */
+ @Override
+ public void undo() {
+ final Resource targetResource = target.eResource();
+ if(targetResource instanceof XMIResource) {
+ ((XMIResource)this.target.eResource()).setID(this.target, this.initialID);
+ }
+ }
+
+}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeLeftTargetTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeLeftTargetTransactionalMerger.java
index a9e1bbebab4..2040da3a658 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeLeftTargetTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeLeftTargetTransactionalMerger.java
@@ -74,7 +74,7 @@ public class AttributeChangeLeftTargetTransactionalMerger extends AttributeChang
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for AttributeChangeLeftTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for AttributeChangeLeftTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -86,7 +86,7 @@ public class AttributeChangeLeftTargetTransactionalMerger extends AttributeChang
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for AttributeChangeLeftTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for AttributeChangeLeftTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -134,7 +134,7 @@ public class AttributeChangeLeftTargetTransactionalMerger extends AttributeChang
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -145,7 +145,7 @@ public class AttributeChangeLeftTargetTransactionalMerger extends AttributeChang
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeRightTargetTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeRightTargetTransactionalMerger.java
index be7376dd735..0ea546b29a2 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeRightTargetTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeChangeRightTargetTransactionalMerger.java
@@ -77,7 +77,7 @@ public class AttributeChangeRightTargetTransactionalMerger extends AttributeChan
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for AttributeChangeRightTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for AttributeChangeRightTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -89,7 +89,7 @@ public class AttributeChangeRightTargetTransactionalMerger extends AttributeChan
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for AttributeChangeRightTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for AttributeChangeRightTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -135,7 +135,7 @@ public class AttributeChangeRightTargetTransactionalMerger extends AttributeChan
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -146,7 +146,7 @@ public class AttributeChangeRightTargetTransactionalMerger extends AttributeChan
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeOrderChangeTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeOrderChangeTransactionalMerger.java
index f38d9102074..b1356710b99 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeOrderChangeTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/AttributeOrderChangeTransactionalMerger.java
@@ -80,7 +80,7 @@ public class AttributeOrderChangeTransactionalMerger extends AttributeOrderChang
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for AttributeOrderChangeMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for AttributeOrderChangeMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -92,7 +92,7 @@ public class AttributeOrderChangeTransactionalMerger extends AttributeOrderChang
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for AttributeOrderChangeMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for AttributeOrderChangeMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -205,7 +205,7 @@ public class AttributeOrderChangeTransactionalMerger extends AttributeOrderChang
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -216,7 +216,7 @@ public class AttributeOrderChangeTransactionalMerger extends AttributeOrderChang
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -244,7 +244,7 @@ public class AttributeOrderChangeTransactionalMerger extends AttributeOrderChang
parameterTypes[1] = java.lang.Object.class;
Method m = null;
try {
- m = ReflectHelper.getMethod(AttributeOrderChangeMerger.class, "areDistinctValues", parameterTypes);
+ m = ReflectHelper.getMethod(AttributeOrderChangeMerger.class, "areDistinctValues", parameterTypes); //$NON-NLS-1$
} catch (SecurityException e) {
Activator.log.error(e);
} catch (NoSuchMethodException e) {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/DiffGroupTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/DiffGroupTransactionalMerger.java
index c45903e3c4e..41ebd7fcdde 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/DiffGroupTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/DiffGroupTransactionalMerger.java
@@ -69,7 +69,7 @@ public class DiffGroupTransactionalMerger extends DiffGroupMerger implements ITr
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CDiffGroupMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CDiffGroupMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -81,7 +81,7 @@ public class DiffGroupTransactionalMerger extends DiffGroupMerger implements ITr
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CDiffGroupMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CDiffGroupMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -90,16 +90,16 @@ public class DiffGroupTransactionalMerger extends DiffGroupMerger implements ITr
public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
- throw new UnsupportedOperationException("Not yet supported");
+ throw new UnsupportedOperationException("Not yet supported"); //$NON-NLS-1$
}
public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
- throw new UnsupportedOperationException("Not yet supported");
+ throw new UnsupportedOperationException("Not yet supported"); //$NON-NLS-1$
}
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -110,7 +110,7 @@ public class DiffGroupTransactionalMerger extends DiffGroupMerger implements ITr
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeLeftTargetTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeLeftTargetTransactionalMerger.java
index 837809ca842..921ffedde53 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeLeftTargetTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeLeftTargetTransactionalMerger.java
@@ -35,7 +35,9 @@ 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.infra.emf.commands.AddToResourceCommand;
import org.eclipse.papyrus.uml.compare.merger.Activator;
+import org.eclipse.papyrus.uml.compare.merger.internal.commands.CopyXMIIDCommand;
import org.eclipse.papyrus.uml.compare.merger.internal.provider.PapyrusMergeCommandProvider;
import org.eclipse.papyrus.uml.compare.merger.internal.utils.MergerUtils;
import org.eclipse.papyrus.uml.compare.merger.internal.utils.PapyrusEFactory;
@@ -83,7 +85,7 @@ public class ModelElementChangeLeftTargetTransactionalMerger extends ModelElemen
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CModelElementChangeLeftTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CModelElementChangeLeftTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -95,7 +97,7 @@ public class ModelElementChangeLeftTargetTransactionalMerger extends ModelElemen
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CModelElementChangeLeftTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CModelElementChangeLeftTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -110,7 +112,7 @@ public class ModelElementChangeLeftTargetTransactionalMerger extends ModelElemen
}
public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
- CompoundCommand cmd = new CompoundCommand("Command CModelElementChangeLeftTargetMerger#getDoUndoInTargetCommand");
+ CompoundCommand cmd = new CompoundCommand("Command CModelElementChangeLeftTargetMerger#getDoUndoInTargetCommand"); //$NON-NLS-1$
final ModelElementChangeLeftTarget theDiff = (ModelElementChangeLeftTarget)this.diff;
// we should copy the element to the Origin one.
final EObject origin = theDiff.getRightParent();
@@ -131,20 +133,20 @@ public class ModelElementChangeLeftTargetTransactionalMerger extends ModelElemen
// EFactory.eAdd(origin, ref.getName(), newOne, elementIndex, true);
// setXMIID(newOne, getXMIID(element));
cmd.append(PapyrusEFactory.getEAddCommand(domain, origin, ref.getName(), newOne, elementIndex, true));
- cmd.append(PapyrusMergeCommandProvider.INSTANCE.getSetXMIIDCommand(domain, element, newOne));
+ cmd.append(new CopyXMIIDCommand(element, newOne));
} catch (final FactoryException e) {
Activator.log.error(e);
}
} else if(origin == null && getDiffModel().getRightRoots().size() > 0) {
// getDiffModel().getRightRoots().get(0).eResource().getContents().add(newOne);
- cmd.append(PapyrusMergeCommandProvider.INSTANCE.getAddToResourceCommand(domain, getDiffModel().getRightRoots().get(0).eResource(), newOne));
+ cmd.append(new AddToResourceCommand(getDiffModel().getRightRoots().get(0).eResource(), newOne));
} else if(origin != null) {
// origin.eResource().getContents().add(newOne);
- cmd.append(PapyrusMergeCommandProvider.INSTANCE.getAddToResourceCommand(domain, origin.eResource(), newOne));
+ cmd.append(new AddToResourceCommand(origin.eResource(), newOne));
} else {
// FIXME throw exception : couldn't merge this
}
- cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "", null) {
+ cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -183,7 +185,7 @@ public class ModelElementChangeLeftTargetTransactionalMerger extends ModelElemen
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -194,7 +196,7 @@ public class ModelElementChangeLeftTargetTransactionalMerger extends ModelElemen
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeRightTargetTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeRightTargetTransactionalMerger.java
index 255782066fd..0ac26c95a87 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeRightTargetTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ModelElementChangeRightTargetTransactionalMerger.java
@@ -36,7 +36,9 @@ 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.infra.emf.commands.AddToResourceCommand;
import org.eclipse.papyrus.uml.compare.merger.Activator;
+import org.eclipse.papyrus.uml.compare.merger.internal.commands.CopyXMIIDCommand;
import org.eclipse.papyrus.uml.compare.merger.internal.provider.PapyrusMergeCommandProvider;
import org.eclipse.papyrus.uml.compare.merger.internal.utils.MergerUtils;
import org.eclipse.papyrus.uml.compare.merger.internal.utils.PapyrusEFactory;
@@ -85,7 +87,7 @@ public class ModelElementChangeRightTargetTransactionalMerger extends ModelEleme
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CModelElementChangeRightTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CModelElementChangeRightTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -97,7 +99,7 @@ public class ModelElementChangeRightTargetTransactionalMerger extends ModelEleme
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CModelElementChangeRightTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CModelElementChangeRightTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -105,7 +107,7 @@ public class ModelElementChangeRightTargetTransactionalMerger extends ModelEleme
}
public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
- final CompoundCommand cmd = new CompoundCommand("Command CModelElementChangeRightTargetMerger#getDoApplyInOriginCommand");
+ final CompoundCommand cmd = new CompoundCommand("Command CModelElementChangeRightTargetMerger#getDoApplyInOriginCommand"); //$NON-NLS-1$
final ModelElementChangeRightTarget theDiff = (ModelElementChangeRightTarget)this.diff;
final EObject origin = theDiff.getLeftParent();
final EObject element = theDiff.getRightElement();
@@ -125,14 +127,14 @@ public class ModelElementChangeRightTargetTransactionalMerger extends ModelEleme
// EFactory.eAdd(origin, ref.getName(), newOne, expectedIndex, true);
// setXMIID(newOne, getXMIID(element));
cmd.append(PapyrusEFactory.getEAddCommand(domain, origin, ref.getName(), newOne, expectedIndex, true));
- cmd.append(PapyrusMergeCommandProvider.INSTANCE.getSetXMIIDCommand(domain, element, newOne));
+ cmd.append(new CopyXMIIDCommand(element, newOne));
} catch (final FactoryException e) {
Activator.log.error(e);
}
} else if(origin == null && getDiffModel().getLeftRoots().size() > 0) {
- cmd.append(PapyrusMergeCommandProvider.INSTANCE.getAddToResourceCommand(domain, getDiffModel().getLeftRoots().get(0).eResource(), newOne));
+ cmd.append(new AddToResourceCommand(getDiffModel().getLeftRoots().get(0).eResource(), newOne));
} else if(origin != null) {
- cmd.append(PapyrusMergeCommandProvider.INSTANCE.getAddToResourceCommand(domain, origin.eResource(), newOne));
+ cmd.append(new AddToResourceCommand(origin.eResource(), newOne));
} else {
// FIXME Throw exception : couldn't merge this
}
@@ -180,7 +182,7 @@ public class ModelElementChangeRightTargetTransactionalMerger extends ModelEleme
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -191,7 +193,7 @@ public class ModelElementChangeRightTargetTransactionalMerger extends ModelEleme
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/MoveModelElementTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/MoveModelElementTransactionalMerger.java
index 3dbb56de9ed..4767fe543e3 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/MoveModelElementTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/MoveModelElementTransactionalMerger.java
@@ -81,7 +81,7 @@ public class MoveModelElementTransactionalMerger extends MoveModelElementMerger
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CMoveModelElementMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CMoveModelElementMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -93,7 +93,7 @@ public class MoveModelElementTransactionalMerger extends MoveModelElementMerger
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CMoveModelElementMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CMoveModelElementMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -101,7 +101,7 @@ public class MoveModelElementTransactionalMerger extends MoveModelElementMerger
}
public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
- final CompoundCommand cmd = new CompoundCommand("CMoveModelElementMerger#getDoApplyInOriginCommand");
+ final CompoundCommand cmd = new CompoundCommand("CMoveModelElementMerger#getDoApplyInOriginCommand"); //$NON-NLS-1$
final MoveModelElement theDiff = (MoveModelElement)this.diff;
final EObject leftTarget = theDiff.getLeftTarget();
final EObject leftElement = theDiff.getLeftElement();
@@ -135,7 +135,7 @@ public class MoveModelElementTransactionalMerger extends MoveModelElementMerger
}
public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
- final CompoundCommand cmd = new CompoundCommand("CMoveModelElementMerger#getDoUndoInTargetCommand");
+ final CompoundCommand cmd = new CompoundCommand("CMoveModelElementMerger#getDoUndoInTargetCommand"); //$NON-NLS-1$
final MoveModelElement theDiff = (MoveModelElement)this.diff;
final EObject rightTarget = theDiff.getRightTarget();
final EObject rightElement = theDiff.getRightElement();
@@ -166,7 +166,7 @@ public class MoveModelElementTransactionalMerger extends MoveModelElementMerger
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -177,7 +177,7 @@ public class MoveModelElementTransactionalMerger extends MoveModelElementMerger
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -199,7 +199,7 @@ public class MoveModelElementTransactionalMerger extends MoveModelElementMerger
*/
private Command getPreserveXMIIDCommand(final TransactionalEditingDomain domain, final EObject element, final String id) {
//TODO change for an EMFCommand
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Set XMI Command", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Set XMI Command", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeLeftTargetTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeLeftTargetTransactionalMerger.java
index 35c15157587..64fc3f3c0c7 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeLeftTargetTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeLeftTargetTransactionalMerger.java
@@ -86,7 +86,7 @@ public class ReferenceChangeLeftTargetTransactionalMerger extends ReferenceChang
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CReferenceChangeLeftTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CReferenceChangeLeftTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -98,7 +98,7 @@ public class ReferenceChangeLeftTargetTransactionalMerger extends ReferenceChang
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeLeftTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeLeftTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -107,7 +107,7 @@ public class ReferenceChangeLeftTargetTransactionalMerger extends ReferenceChang
public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
- final CompoundCommand cmd = new CompoundCommand("CReferenceChangeLeftTargetMerger#getDoApplyInOriginCommand");
+ final CompoundCommand cmd = new CompoundCommand("CReferenceChangeLeftTargetMerger#getDoApplyInOriginCommand"); //$NON-NLS-1$
final ReferenceChangeLeftTarget theDiff = (ReferenceChangeLeftTarget)this.diff;
final EObject element = theDiff.getLeftElement();
final EObject leftTarget = theDiff.getLeftTarget();
@@ -165,7 +165,7 @@ public class ReferenceChangeLeftTargetTransactionalMerger extends ReferenceChang
final PapyrusCompareEObjectCopier copier = new PapyrusCompareEObjectCopier(diff);
Command copierCommand = copier.getCopyReferenceValueCommand(domain, reference, element, leftTarget, rightTarget, index);
cmd.append(copierCommand);
- final AbstractTransactionalCommand updateDiffModelCommand = new AbstractTransactionalCommand(domain, "Update Diff Model", null) {
+ final AbstractTransactionalCommand updateDiffModelCommand = new AbstractTransactionalCommand(domain, "Update Diff Model", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -202,7 +202,7 @@ public class ReferenceChangeLeftTargetTransactionalMerger extends ReferenceChang
}
public Command getMergeRequiredDifferencesCommand(final TransactionalEditingDomain domain, final boolean applyInOrigin) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -213,7 +213,7 @@ public class ReferenceChangeLeftTargetTransactionalMerger extends ReferenceChang
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeRightTargetTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeRightTargetTransactionalMerger.java
index e2e1d533104..23dc77c2690 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeRightTargetTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceChangeRightTargetTransactionalMerger.java
@@ -82,7 +82,7 @@ public class ReferenceChangeRightTargetTransactionalMerger extends ReferenceChan
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CReferenceChangeRightTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CReferenceChangeRightTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -94,7 +94,7 @@ public class ReferenceChangeRightTargetTransactionalMerger extends ReferenceChan
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeRightTargetMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeRightTargetMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -102,7 +102,7 @@ public class ReferenceChangeRightTargetTransactionalMerger extends ReferenceChan
}
public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeRightTargetMerger#getDoApplyInOriginCommand");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeRightTargetMerger#getDoApplyInOriginCommand"); //$NON-NLS-1$
final ReferenceChangeRightTarget theDiff = (ReferenceChangeRightTarget)this.diff;
final EReference reference = theDiff.getReference();
final EObject element = theDiff.getLeftElement();
@@ -122,7 +122,7 @@ public class ReferenceChangeRightTargetTransactionalMerger extends ReferenceChan
final PapyrusCompareEObjectCopier copier = new PapyrusCompareEObjectCopier(diff);
cmd.append(copier.getCopyReferenceValueCommand(domain, reference, element, rightTarget, leftTarget, index));
- cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "", null) {
+ cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -160,7 +160,7 @@ public class ReferenceChangeRightTargetTransactionalMerger extends ReferenceChan
}
public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeRightTargetMerger#getDoUndoInTargetCommand");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeRightTargetMerger#getDoUndoInTargetCommand"); //$NON-NLS-1$
final ReferenceChangeRightTarget theDiff = (ReferenceChangeRightTarget)this.diff;
final EObject element = theDiff.getRightElement();
final EObject rightTarget = theDiff.getRightTarget();
@@ -201,7 +201,7 @@ public class ReferenceChangeRightTargetTransactionalMerger extends ReferenceChan
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -212,7 +212,7 @@ public class ReferenceChangeRightTargetTransactionalMerger extends ReferenceChan
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceOrderChangeTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceOrderChangeTransactionalMerger.java
index 31fe2b1e208..31127f77211 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceOrderChangeTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/ReferenceOrderChangeTransactionalMerger.java
@@ -77,7 +77,7 @@ public class ReferenceOrderChangeTransactionalMerger extends ReferenceOrderChang
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CReferenceOrderChangeMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CReferenceOrderChangeMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -89,7 +89,7 @@ public class ReferenceOrderChangeTransactionalMerger extends ReferenceOrderChang
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceOrderChangeMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceOrderChangeMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -138,7 +138,7 @@ public class ReferenceOrderChangeTransactionalMerger extends ReferenceOrderChang
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -149,7 +149,7 @@ public class ReferenceOrderChangeTransactionalMerger extends ReferenceOrderChang
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateAttributeTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateAttributeTransactionalMerger.java
index eeac9f1c515..b6316e9da0b 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateAttributeTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateAttributeTransactionalMerger.java
@@ -74,7 +74,7 @@ public class UpdateAttributeTransactionalMerger extends UpdateAttributeMerger im
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CUpdateAttributeMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CUpdateAttributeMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -86,7 +86,7 @@ public class UpdateAttributeTransactionalMerger extends UpdateAttributeMerger im
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CUpdateAttributeMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CUpdateAttributeMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -123,7 +123,7 @@ public class UpdateAttributeTransactionalMerger extends UpdateAttributeMerger im
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -134,7 +134,7 @@ public class UpdateAttributeTransactionalMerger extends UpdateAttributeMerger im
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateReferenceTransactionalMerger.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateReferenceTransactionalMerger.java
index 12a88ef7dbd..45cdf78407f 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateReferenceTransactionalMerger.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/merger/UpdateReferenceTransactionalMerger.java
@@ -72,7 +72,7 @@ public class UpdateReferenceTransactionalMerger extends UpdateReferenceMerger im
// mergeRequiredDifferences(true);
// doApplyInOrigin();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CUpdateReferenceMerger");
+ CompoundCommand cmd = new CompoundCommand("Apply in Origin Command for CUpdateReferenceMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, true));
cmd.append(getDoApplyInOriginCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -84,7 +84,7 @@ public class UpdateReferenceTransactionalMerger extends UpdateReferenceMerger im
// doUndoInTarget();
// postProcess();
- CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CUpdateReferenceMerger");
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CUpdateReferenceMerger"); //$NON-NLS-1$
cmd.append(getMergeRequiredDifferencesCommand(domain, false));
cmd.append(getDoUndoInTargetCommand(domain));
cmd.append(getPostProcessCommand(domain));
@@ -103,7 +103,7 @@ public class UpdateReferenceTransactionalMerger extends UpdateReferenceMerger im
if(leftTarget == null) {
if(FeatureMapUtil.isMany(element, reference)) {
//TODO : I didn't find an example to test this case.
- throw new UnsupportedOperationException("Not Yet Supported");
+ throw new UnsupportedOperationException("Not Yet Supported"); //$NON-NLS-1$
} else {
final Object value = theDiff.getLeftElement().eGet(reference);
if(value instanceof EObject) {
@@ -134,7 +134,7 @@ public class UpdateReferenceTransactionalMerger extends UpdateReferenceMerger im
if(rightTarget == null) {
if(FeatureMapUtil.isMany(element, reference)) {
//TODO : I didn't find an example to test this case.
- throw new UnsupportedOperationException("Not Yet Supported");
+ throw new UnsupportedOperationException("Not Yet Supported"); //$NON-NLS-1$
} else {
final Object value = theDiff.getRightElement().eGet(reference);
if(value instanceof EObject) {
@@ -155,7 +155,7 @@ public class UpdateReferenceTransactionalMerger extends UpdateReferenceMerger im
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) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -166,7 +166,7 @@ public class UpdateReferenceTransactionalMerger extends UpdateReferenceMerger im
}
public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusMergeCommandProvider.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusMergeCommandProvider.java
index f2cde5653ac..0f59728ea35 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusMergeCommandProvider.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusMergeCommandProvider.java
@@ -13,25 +13,17 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.compare.merger.internal.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.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.xmi.XMIResource;
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;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.uml.compare.merger.internal.utils.MoveWithIndexCommand;
@@ -79,49 +71,6 @@ public class PapyrusMergeCommandProvider {
}
- /**
- * Returns the command to set the id of the source object to the new object. This command do something, only if the source and the target aren't
- * owned by the same resource
- *
- * @param domain
- * @param sourceElement
- * @param targetElement
- * @return
- * the command to set the id of the source object to the new object
- */
- public Command getSetXMIIDCommand(final TransactionalEditingDomain domain, final EObject sourceElement, final EObject targetElement) {
- //TODO change for an EMFCommand
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Set XMI Command", null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- final Resource sourceResource = sourceElement.eResource();
- final Resource targetResource = targetElement.eResource();
- if(sourceElement != null && targetElement != null && sourceResource instanceof XMIResource && targetResource instanceof XMIResource) {
- //TODO : this test is commented because the result of this command is worse with the test than without...
- // if(sourceResource != targetResource) {
- final String xmi_id = EMFHelper.getXMIID(sourceElement);
- ((XMIResource)targetElement.eResource()).setID(sourceElement, xmi_id);
- // }
- }
- return CommandResult.newOKCommandResult();
- }
- });
-
- }
-
- public Command getAddToResourceCommand(final TransactionalEditingDomain domain, final Resource res, final EObject eobjectToAdd) {
- //TODO change for an EMFCommand
- return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Add EObject to Resource Command", null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- res.getContents().add(eobjectToAdd);
- return CommandResult.newOKCommandResult();
- }
- });
- }
-
//TODO elementToEdit and targetContainer are the same
public Command getMoveWithIndexCommand(final TransactionalEditingDomain domain, final EObject elementToEdit, final EObject targetContainer, final EReference targetFeature, final EObject elementToMove, final int index, final boolean reorder) {
final IEditCommandRequest request = new MoveWithIndexRequest(domain, targetContainer, targetFeature, elementToMove, index, reorder);
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusUMLMergeProvider.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusUMLMergeProvider.java
index 0ab6ecd0071..b5fb46c6ddc 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusUMLMergeProvider.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/provider/PapyrusUMLMergeProvider.java
@@ -42,7 +42,7 @@ import org.eclipse.papyrus.uml.compare.merger.internal.merger.ReferenceChangeRig
import org.eclipse.papyrus.uml.compare.merger.internal.merger.ReferenceOrderChangeTransactionalMerger;
import org.eclipse.papyrus.uml.compare.merger.internal.merger.UpdateAttributeTransactionalMerger;
import org.eclipse.papyrus.uml.compare.merger.internal.merger.UpdateReferenceTransactionalMerger;
-import org.eclipse.papyrus.uml.compare.merger.utils.PapyrusMap;
+import org.eclipse.papyrus.uml.compare.merger.utils.PapyrusCompareMap;
public class PapyrusUMLMergeProvider implements IMergerProvider {
@@ -60,7 +60,7 @@ public class PapyrusUMLMergeProvider implements IMergerProvider {
*/
public Map<Class<? extends DiffElement>, Class<? extends IMerger>> getMergers() {
if(mergerTypes == null) {
- mergerTypes = new PapyrusMap<Class<? extends DiffElement>, Class<? extends IMerger>>();
+ mergerTypes = new PapyrusCompareMap<Class<? extends DiffElement>, Class<? extends IMerger>>();
mergerTypes.put(DiffGroup.class, DiffGroupTransactionalMerger.class);
mergerTypes.put(ModelElementChangeRightTarget.class, ModelElementChangeRightTargetTransactionalMerger.class);
mergerTypes.put(ModelElementChangeLeftTarget.class, ModelElementChangeLeftTargetTransactionalMerger.class);
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/EObjectComparator.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/EObjectComparator.java
deleted file mode 100644
index 090cfd8cb0b..00000000000
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/EObjectComparator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*****************************************************************************
- * 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.compare.merger.internal.utils;
-
-import java.util.Comparator;
-import java.util.Iterator;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.ecore.EObject;
-
-/**
- *
- * This class allows to compare EObject using the PositionAdapter.
- *
- *
- */
-public class EObjectComparator<T> implements Comparator<T> {
-
- /**
- *
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- *
- * @param o1
- * @param o2
- * @return
- */
- public int compare(final T o1, final T o2) {
- if(o1 instanceof EObject && o2 instanceof EObject) {
- final int position1 = getWantedPosition((EObject)o1);
- final int position2 = getWantedPosition((EObject)o2);
- if(position1 != -1 && position2 != -1) {
- return position1 - position2;
- }
- }
- return 0;
- }
-
- /**
- *
- * @param obj1
- * an EObject
- * @return
- * the wanted position for this object
- */
- private int getWantedPosition(final EObject obj1) {
- final Iterator<Adapter> adapters = obj1.eAdapters().iterator();
- int expectedIndex = -1;
- while(expectedIndex == -1 && adapters.hasNext()) {
- final Adapter adapter = adapters.next();
- if(adapter instanceof PositionAdapter) {
- expectedIndex = ((PositionAdapter)adapter).getExpectedIndex();
- }
- }
- return expectedIndex;
- }
-
-}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/MoveWithIndexCommand.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/MoveWithIndexCommand.java
index 358de8f604c..7cda719ebec 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/MoveWithIndexCommand.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/MoveWithIndexCommand.java
@@ -13,13 +13,18 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.compare.merger.internal.utils;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.util.FeatureMapUtil;
@@ -64,7 +69,7 @@ public class MoveWithIndexCommand extends MoveElementsCommand {
if(FeatureMapUtil.isMany(getTargetContainer(), feature)) {
if(shouldReorder()) {
//we attach the real position to the object
- PapyrusEFactory.attachRealPositionEAdapter(element, index);
+ attachRealPositionEAdapter(element, index);
}
final Object value = getTargetContainer().eGet(feature);
if(value instanceof List<?>) {
@@ -75,19 +80,19 @@ public class MoveWithIndexCommand extends MoveElementsCommand {
final List values = ((List<?>)getTargetContainer().eGet(feature));
values.add(element);
if(shouldReorder()) {
- PapyrusEFactory.reorderList(values);
+ reorderList(values);
}
} else {
((List)value).add(index, element);
if(shouldReorder()) {
- PapyrusEFactory.reorderList((List)value);
+ reorderList((List)value);
}
}
} else {
((Collection)getTargetContainer().eGet(feature)).add(element);
if(shouldReorder()) {
- PapyrusEFactory.reorderList((List)((Collection)getTargetContainer().eGet(feature)));
+ reorderList((List)((Collection)getTargetContainer().eGet(feature)));
}
}
} else {
@@ -133,4 +138,119 @@ public class MoveWithIndexCommand extends MoveElementsCommand {
}
return shouldReoder;
}
+
+ /**
+ * Duplicate code from EFactory
+ * If we could not merge a given object at its expected position in a list, we'll attach an Adapter to it
+ * in order to "remember" that "expected" position. That will allow us to reorder the list later on if
+ * need be.
+ *
+ * @param object
+ * The object on which to attach an Adapter.
+ * @param expectedPosition
+ * The expected position of <code>object</code> in its list.
+ */
+ private void attachRealPositionEAdapter(final Object object, final int expectedPosition) {
+ if(object instanceof EObject) {
+ ((EObject)object).eAdapters().add(new PositionAdapter(expectedPosition));
+ }
+ }
+
+ /**
+ * Reorders the given list if it contains EObjects associated with a PositionAdapter which are not located
+ * at their expected positions.
+ *
+ * @param list
+ * The list that is to be reordered.
+ * @param <T>
+ * type of the list's elements.
+ */
+ private <T> void reorderList(final List<T> list) {
+ List<T> newList = new ArrayList<T>(list);
+ Collections.sort(newList, new EObjectComparator());
+ for(int i = 0; i < list.size(); i++) {
+ int oldIndex = list.indexOf(newList.get(i));
+ list.add(i, list.remove(oldIndex));
+ }
+ return;
+ }
+
+ /**
+ * duplicate code from Efactory
+ * This adapter will be used to remember the accurate position of an EObject in its target list.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+ private static class PositionAdapter extends AdapterImpl {
+
+ /** The index at which we expect to find this object. */
+ private final int expectedIndex;
+
+ /**
+ * Creates our adapter.
+ *
+ * @param index
+ * The index at which we expect to find this object.
+ */
+ public PositionAdapter(final int index) {
+ this.expectedIndex = index;
+ }
+
+ /**
+ * Returns the index at which we expect to find this object.
+ *
+ * @return The index at which we expect to find this object.
+ */
+ public int getExpectedIndex() {
+ return expectedIndex;
+ }
+ }
+
+ /**
+ *
+ * This class allows to compare EObject using the PositionAdapter.
+ *
+ *
+ */
+ private static class EObjectComparator<T> implements Comparator<T> {
+
+ /**
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ public int compare(final T o1, final T o2) {
+ if(o1 instanceof EObject && o2 instanceof EObject) {
+ final int position1 = getWantedPosition((EObject)o1);
+ final int position2 = getWantedPosition((EObject)o2);
+ if(position1 != -1 && position2 != -1) {
+ return position1 - position2;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @param obj1
+ * an EObject
+ * @return
+ * the wanted position for this object
+ */
+ private int getWantedPosition(final EObject obj1) {
+ final Iterator<Adapter> adapters = obj1.eAdapters().iterator();
+ int expectedIndex = -1;
+ while(expectedIndex == -1 && adapters.hasNext()) {
+ final Adapter adapter = adapters.next();
+ if(adapter instanceof PositionAdapter) {
+ expectedIndex = ((PositionAdapter)adapter).getExpectedIndex();
+ }
+ }
+ return expectedIndex;
+ }
+
+ }
}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusCompareEObjectCopier.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusCompareEObjectCopier.java
index 3a7933102f4..0ce42bf0c21 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusCompareEObjectCopier.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusCompareEObjectCopier.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.compare.merger.internal.utils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
@@ -23,6 +24,7 @@ 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.notify.Adapter;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.diff.merge.EMFCompareEObjectCopier;
@@ -78,7 +80,7 @@ public class PapyrusCompareEObjectCopier {
// handleLinkedResourceDependencyChange(matchedValue);
// actualValue = get(matchedValue);
//TODO
- throw new UnsupportedOperationException("Not yet supported");
+ throw new UnsupportedOperationException("Not yet supported"); //$NON-NLS-1$
}
if(matchedValue != null) {
this.copier.put(actualValue, matchedValue);
@@ -99,7 +101,7 @@ public class PapyrusCompareEObjectCopier {
}
private Command getCopyValueReferenceCommand(final TransactionalEditingDomain domain, final EReference targetReference, final EObject target, final EObject value, final int index) {
- final Command copyValueCommand = new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "", null) {
+ final Command copyValueCommand = new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "", null) { //$NON-NLS-1$
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
@@ -296,4 +298,53 @@ public class PapyrusCompareEObjectCopier {
}
}
+ /**
+ *
+ * This class allows to compare EObject using the PositionAdapter.
+ *
+ *
+ */
+ private class EObjectComparator<T> implements Comparator<T> {
+
+ /**
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ public int compare(final T o1, final T o2) {
+ if(o1 instanceof EObject && o2 instanceof EObject) {
+ final int position1 = getWantedPosition((EObject)o1);
+ final int position2 = getWantedPosition((EObject)o2);
+ if(position1 != -1 && position2 != -1) {
+ return position1 - position2;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @param obj1
+ * an EObject
+ * @return
+ * the wanted position for this object
+ */
+ private int getWantedPosition(final EObject obj1) {
+ final Iterator<Adapter> adapters = obj1.eAdapters().iterator();
+ int expectedIndex = -1;
+ while(expectedIndex == -1 && adapters.hasNext()) {
+ final Adapter adapter = adapters.next();
+ if(adapter instanceof PositionAdapter) {
+ expectedIndex = ((PositionAdapter)adapter).getExpectedIndex();
+ }
+ }
+ return expectedIndex;
+ }
+
+ }
+
+
}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusEFactory.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusEFactory.java
index be07605dcf3..85c201ff26a 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusEFactory.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusEFactory.java
@@ -13,14 +13,16 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.compare.merger.internal.utils;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.compare.EMFCompareMessages;
import org.eclipse.emf.compare.FactoryException;
import org.eclipse.emf.compare.util.EFactory;
@@ -29,8 +31,6 @@ import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.uml.compare.merger.Activator;
import org.eclipse.papyrus.uml.compare.merger.internal.provider.PapyrusMergeCommandProvider;
//TODO : merge with thepapyrus table command factory?
/**
@@ -38,6 +38,11 @@ import org.eclipse.papyrus.uml.compare.merger.internal.provider.PapyrusMergeComm
* This class is adapted from {@link EFactory}
*
*/
+/**
+ *
+ * This class is adapted from {@link EFactory}
+ *
+ */
public class PapyrusEFactory {
@@ -172,57 +177,6 @@ public class PapyrusEFactory {
return EFactory.eStructuralFeature(object, name);
}
-
-
- // /**
- // * If we could not merge a given object at its expected position in a list, we'll attach an Adapter to it
- // * in order to "remember" that "expected" position. That will allow us to reorder the list later on if
- // * need be.
- // *
- // * @param object
- // * The object on which to attach an Adapter.
- // * @param expectedPosition
- // * The expected position of <code>object</code> in its list.
- // */
- // public static void attachRealPositionEAdapter(final Object object, final int expectedPosition) {
- // Class<?> myClass = null;
- // try {
- // myClass = Class.forName("org.eclipse.emf.compare.util.EFactory");
- // } catch (ClassNotFoundException e2) {
- // // TODO Auto-generated catch block
- // e2.printStackTrace();
- // }
- // Class[] parameterTypes = new Class[2];
- // parameterTypes[0] = java.lang.Object.class;
- // parameterTypes[1] = Integer.TYPE;
- // Method m = null;
- //
- // try {
- // m = myClass.getDeclaredMethod("attachRealPositionEAdapter", parameterTypes);
- // } catch (SecurityException e1) {
- // // TODO Auto-generated catch block
- // e1.printStackTrace();
- // } catch (NoSuchMethodException e1) {
- // // TODO Auto-generated catch block
- // e1.printStackTrace();
- // }
- // m.setAccessible(true);
- // Object[] parameters = new Object[2];
- // parameters[0] = object;
- // parameters[1] = expectedPosition;
- //
- // Object result = null;
- // try {
- // result = m.invoke(myClass, parameters);
- // } catch (IllegalArgumentException e) {
- // Activator.log.error(e);
- // } catch (IllegalAccessException e) {
- // Activator.log.error(e);
- // } catch (InvocationTargetException e) {
- // Activator.log.error(e);
- // }
- // }
-
/**
* Duplicate code from EFactory
* If we could not merge a given object at its expected position in a list, we'll attach an Adapter to it
@@ -234,7 +188,7 @@ public class PapyrusEFactory {
* @param expectedPosition
* The expected position of <code>object</code> in its list.
*/
- public static void attachRealPositionEAdapter(final Object object, final int expectedPosition) {
+ private static void attachRealPositionEAdapter(final Object object, final int expectedPosition) {
if(object instanceof EObject) {
((EObject)object).eAdapters().add(new PositionAdapter(expectedPosition));
}
@@ -249,7 +203,7 @@ public class PapyrusEFactory {
* @param <T>
* type of the list's elements.
*/
- public static <T> void reorderList(final List<T> list) {
+ private static <T> void reorderList(final List<T> list) {
List<T> newList = new ArrayList<T>(list);
Collections.sort(newList, new EObjectComparator());
for(int i=0;i<list.size();i++){
@@ -261,41 +215,82 @@ public class PapyrusEFactory {
/**
- * This method should never been called, except by copyCollection;
- * This method allows to invoke the clone method on Cloneable object.
+ * duplicate code from Efactory
+ * This adapter will be used to remember the accurate position of an EObject in its target list.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+ private static class PositionAdapter extends AdapterImpl {
+
+ /** The index at which we expect to find this object. */
+ private final int expectedIndex;
+
+ /**
+ * Creates our adapter.
+ *
+ * @param index
+ * The index at which we expect to find this object.
+ */
+ public PositionAdapter(final int index) {
+ this.expectedIndex = index;
+ }
+
+ /**
+ * Returns the index at which we expect to find this object.
+ *
+ * @return The index at which we expect to find this object.
+ */
+ public int getExpectedIndex() {
+ return expectedIndex;
+ }
+ }
+
+ /**
+ *
+ * This class allows to compare EObject using the PositionAdapter.
+ *
*
- * @param cloneable
- * a cloneable object
- * @return
- * a copy of the cloned object
- * @throws UnsupportedOperationException
- * used when the object is {@link Cloneable}, but not implemented (like LinkedList...)
*/
- private static Object clone(final Cloneable cloneable) throws UnsupportedOperationException {
- Class<?> cloneableClass = cloneable.getClass();
- Method cloneMethod = null;
- Object newValue = null;
- try {
- cloneMethod = cloneableClass.getMethod("clone", new Class[0]);
- } catch (SecurityException e) {
- Activator.log.error(e);
- } catch (NoSuchMethodException e) {
- Activator.log.error(e);
+ private static class EObjectComparator<T> implements Comparator<T> {
+
+ /**
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ public int compare(final T o1, final T o2) {
+ if(o1 instanceof EObject && o2 instanceof EObject) {
+ final int position1 = getWantedPosition((EObject)o1);
+ final int position2 = getWantedPosition((EObject)o2);
+ if(position1 != -1 && position2 != -1) {
+ return position1 - position2;
+ }
+ }
+ return 0;
}
- cloneMethod.setAccessible(true);
- try {
- newValue = cloneMethod.invoke(cloneable, new Object[0]);
- } catch (IllegalArgumentException e) {
- Activator.log.error(e);
- } catch (IllegalAccessException e) {
- Activator.log.error(e);
- } catch (InvocationTargetException e) {
- Activator.log.error(e);
- } catch (UnsupportedOperationException e) {
- Activator.log.error(NLS.bind("I can't clone this object : {0}", cloneableClass), e);
- throw e;
+
+ /**
+ *
+ * @param obj1
+ * an EObject
+ * @return
+ * the wanted position for this object
+ */
+ private int getWantedPosition(final EObject obj1) {
+ final Iterator<Adapter> adapters = obj1.eAdapters().iterator();
+ int expectedIndex = -1;
+ while(expectedIndex == -1 && adapters.hasNext()) {
+ final Adapter adapter = adapters.next();
+ if(adapter instanceof PositionAdapter) {
+ expectedIndex = ((PositionAdapter)adapter).getExpectedIndex();
+ }
+ }
+ return expectedIndex;
}
- return newValue;
+
}
}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusMap.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusMap.java
index 037d9e822ba..dc8db9c169c 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusMap.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PapyrusMap.java
@@ -97,7 +97,7 @@ public class PapyrusMap<K, V> extends HashMap<K, V> {
public V get(final Object key) {
V obj = super.get(key);
if(obj == null) {
- Activator.log.error("The following element is unknown in the map : " + key, new NullPointerException());
+ Activator.log.error("The following element is unknown in the map : " + key, new NullPointerException()); //$NON-NLS-1$
}
return obj;
}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PositionAdapter.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PositionAdapter.java
deleted file mode 100644
index 74dc5fdf07f..00000000000
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/PositionAdapter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*****************************************************************************
- * 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.compare.merger.internal.utils;
-
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-
-
- /**
- * duplicate code from Efactory
- * This adapter will be used to remember the accurate position of an EObject in its target list.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class PositionAdapter extends AdapterImpl {
-
- /** The index at which we expect to find this object. */
- private final int expectedIndex;
-
- /**
- * Creates our adapter.
- *
- * @param index
- * The index at which we expect to find this object.
- */
- public PositionAdapter(final int index) {
- this.expectedIndex = index;
- }
-
- /**
- * Returns the index at which we expect to find this object.
- *
- * @return The index at which we expect to find this object.
- */
- public int getExpectedIndex() {
- return expectedIndex;
- }
-}
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/TransactionalMergeService.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/TransactionalMergeService.java
index b1bc5a649da..3bbc589bd23 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/TransactionalMergeService.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/internal/utils/TransactionalMergeService.java
@@ -72,7 +72,7 @@ public class TransactionalMergeService {
Class<?>[] parameterTypes = new Class[1];
parameterTypes[0] = IMergeListener.class;
try {
- addMergeListenerMethod = ReflectHelper.getMethod(MergeService.class, "addMergeListener", parameterTypes);
+ addMergeListenerMethod = ReflectHelper.getMethod(MergeService.class, "addMergeListener", parameterTypes); //$NON-NLS-1$
} catch (SecurityException e) {
Activator.log.error(e);
} catch (NoSuchMethodException e) {
@@ -158,7 +158,7 @@ public class TransactionalMergeService {
// }
public static Command getMergeCommand(final TransactionalEditingDomain domain, final DiffElement element, final boolean leftToRight) {
- CompoundCommand cmd = new CompoundCommand("MergeCommand");
+ CompoundCommand cmd = new CompoundCommand("MergeCommand"); //$NON-NLS-1$
cmd.append(new FireMergeOperationStartCommand(element, getMergeListeners()));
cmd.append(getDoMergeCommand(domain, element, leftToRight));
cmd.append(new FireMergeOperationEndCommand(element, getMergeListeners()));
@@ -193,7 +193,7 @@ public class TransactionalMergeService {
// }
private static Command getDoMergeCommand(final TransactionalEditingDomain domain, final DiffElement element, final boolean leftToRight) {
- final CompoundCommand cmd = new CompoundCommand("DoMergeCommand");
+ final CompoundCommand cmd = new CompoundCommand("DoMergeCommand"); //$NON-NLS-1$
cmd.append(new FireMergeDiffStartCommand(element, getMergeListeners()));
final IMerger merger;
if(element instanceof ConflictingDiffElement) {
@@ -208,7 +208,7 @@ public class TransactionalMergeService {
cmd.append(((ITransactionalMerger)merger).getApplyInOriginCommand(domain));
}
} else {
- throw new UnsupportedOperationException(NLS.bind("I can't found the Papyrus Merger for {0}.", element));
+ throw new UnsupportedOperationException(NLS.bind("I can't found the Papyrus Merger for {0}.", element)); //$NON-NLS-1$
}
cmd.append(new FireMergeDiffEndCommand(element, getMergeListeners()));
@@ -239,7 +239,7 @@ public class TransactionalMergeService {
// }
public static Command getMergeCommand(final TransactionalEditingDomain domain, final List<DiffElement> elements, final boolean leftToRight) {
- final CompoundCommand cmd = new CompoundCommand("MergeCommand");
+ final CompoundCommand cmd = new CompoundCommand("MergeCommand"); //$NON-NLS-1$
cmd.append(new FireMergeOperationStartCommand(elements, getMergeListeners()));
for(DiffElement element : new ArrayList<DiffElement>(elements)) {
// we might remove the diff from the list before merging it
@@ -264,7 +264,7 @@ public class TransactionalMergeService {
Class<?>[] parameterTypes = new Class[1];
parameterTypes[0] = IMergeListener.class;
try {
- removeMergeListenerMethod = ReflectHelper.getMethod(MergeService.class, "removeMergeListener", parameterTypes);
+ removeMergeListenerMethod = ReflectHelper.getMethod(MergeService.class, "removeMergeListener", parameterTypes); //$NON-NLS-1$
} catch (SecurityException e) {
Activator.log.error(e);
} catch (NoSuchMethodException e) {
@@ -291,7 +291,7 @@ public class TransactionalMergeService {
List<IMergeListener> listeners = null;
Field myField = null;
try {
- myField = MergeService.class.getDeclaredField("MERGE_LISTENERS");
+ myField = MergeService.class.getDeclaredField("MERGE_LISTENERS"); //$NON-NLS-1$
} catch (SecurityException e) {
Activator.log.error(e);
} catch (NoSuchFieldException e) {
diff --git a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusMap.java b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusCompareMap.java
index 8f50000990c..281e1ed927d 100644
--- a/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusMap.java
+++ b/sandbox/UMLCompareMergerExample/org.eclipse.papyrus.uml.compare.merger/src/org/eclipse/papyrus/uml/compare/merger/utils/PapyrusCompareMap.java
@@ -26,7 +26,7 @@ import org.eclipse.papyrus.uml.compare.merger.Activator;
* @param <K>
* @param <V>
*/
-public class PapyrusMap<K, V> extends HashMap<K, V> {
+public class PapyrusCompareMap<K, V> extends HashMap<K, V> {
/**
*
@@ -45,7 +45,7 @@ public class PapyrusMap<K, V> extends HashMap<K, V> {
* if the initial capacity is negative
* or the load factor is nonpositive.
*/
- public PapyrusMap(final int initialCapacity, final float loadFactor) {
+ public PapyrusCompareMap(final int initialCapacity, final float loadFactor) {
super(initialCapacity, loadFactor);
}
@@ -58,7 +58,7 @@ public class PapyrusMap<K, V> extends HashMap<K, V> {
* @throws IllegalArgumentException
* if the initial capacity is negative.
*/
- public PapyrusMap(final int initialCapacity) {
+ public PapyrusCompareMap(final int initialCapacity) {
super(initialCapacity);
}
@@ -66,7 +66,7 @@ public class PapyrusMap<K, V> extends HashMap<K, V> {
* Constructs an empty <tt>HashMap</tt> with the default initial capacity
* (16) and the default load factor (0.75).
*/
- public PapyrusMap() {
+ public PapyrusCompareMap() {
super();
}
@@ -81,7 +81,7 @@ public class PapyrusMap<K, V> extends HashMap<K, V> {
* @throws NullPointerException
* if the specified map is null.
*/
- public PapyrusMap(final Map<? extends K, ? extends V> m) {
+ public PapyrusCompareMap(final Map<? extends K, ? extends V> m) {
super(m);
}
@@ -97,7 +97,7 @@ public class PapyrusMap<K, V> extends HashMap<K, V> {
public V get(final Object key) {
V obj = super.get(key);
if(obj == null) {
- Activator.log.error("The following element is unknown in the map : " + key, new NullPointerException());
+ Activator.log.error("The following element is unknown in the map : " + key, new NullPointerException()); //$NON-NLS-1$
}
return obj;
}

Back to the top