Bug 578837 - [CDO] Support EMF Compare UML2 customizations

Change-Id: If0dc8266e98375a2041698f394f56801ead5a35f
Signed-off-by: Sebastien Revol <sebastien.revol@cea.fr>
Signed-off-by: Eike Stepper <stepper@esc-net.de>
diff --git a/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/.classpath b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/.classpath
new file mode 100644
index 0000000..e801ebf
--- /dev/null
+++ b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/.project b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/.project
new file mode 100644
index 0000000..6dd81ed
--- /dev/null
+++ b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.emf.compare.uml2.cdo</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/.settings/org.eclipse.jdt.core.prefs b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..c9545f0
--- /dev/null
+++ b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,9 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.compliance=11
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
diff --git a/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/META-INF/MANIFEST.MF b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..061d9a7
--- /dev/null
+++ b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CDO specific UML2 comparison customizations
+Bundle-SymbolicName: org.eclipse.emf.compare.uml2.cdo;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Automatic-Module-Name: org.eclipse.emf.compare.uml2.cdo
+Bundle-RequiredExecutionEnvironment: JavaSE-11
+Bundle-Vendor: Eclipse Modeling Poject
+Require-Bundle: org.eclipse.emf.cdo.compare;bundle-version="[4.5.1,5.0.0)",
+ org.eclipse.emf.compare.uml2;bundle-version="[2.6.1,3.0.0)",
+ org.eclipse.emf.compare.rcp;bundle-version="[2.5.2,3.0.0)"
+Import-Package: com.google.common.base;version="[27.0.0,30.2.0)",
+ com.google.common.collect;version="[27.0.0,30.2.0)"
diff --git a/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/about.html b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/about.html
new file mode 100644
index 0000000..997c5a2
--- /dev/null
+++ b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/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>November 30, 2017</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 2.0 (&quot;EPL&quot;).  A copy of the EPL is available 
+at <a href="https://www.eclipse.org/legal/epl-2.0/">https://www.eclipse.org/legal/epl-2.0/</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/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/build.properties b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/build.properties
new file mode 100644
index 0000000..e5a949c
--- /dev/null
+++ b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               about.html
+src.includes = about.html
diff --git a/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/plugin.xml b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/plugin.xml
new file mode 100644
index 0000000..cfc2936
--- /dev/null
+++ b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/plugin.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+   <extension point="org.eclipse.emf.compare.rcp.matchEngine">
+      <engineFactory
+            class="org.eclipse.emf.compare.uml2.cdo.UMLCDOMatchEngine$Factory"
+            label="UML CDO-specific match engine"
+            description="This match engine adds base elements in the match tree when only the stereotype application is changed"
+            ranking="20"/>
+   </extension>
+
+</plugin>
diff --git a/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/pom.xml b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/pom.xml
new file mode 100644
index 0000000..a9e2bbb
--- /dev/null
+++ b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/pom.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<!-- Parent of this POM -->
+	<parent>
+		<groupId>org.eclipse.papyrus.cdo</groupId>
+		<artifactId>compare</artifactId>
+		<version>1.2.0-SNAPSHOT</version>
+	</parent>
+
+	<!-- Project POM -->
+	<artifactId>org.eclipse.emf.compare.uml2.cdo</artifactId>
+	<version>1.0.0-SNAPSHOT</version>
+	<packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
diff --git a/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/src/org/eclipse/emf/compare/uml2/cdo/UMLCDOMatchEngine.java b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/src/org/eclipse/emf/compare/uml2/cdo/UMLCDOMatchEngine.java
new file mode 100644
index 0000000..290e950
--- /dev/null
+++ b/cdo/bundles/compare/org.eclipse.emf.compare.uml2.cdo/src/org/eclipse/emf/compare/uml2/cdo/UMLCDOMatchEngine.java
@@ -0,0 +1,183 @@
+/*****************************************************************************
+ * Copyright (c) 2022 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *   CEA LIST - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.emf.compare.uml2.cdo;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.cdo.CDOElement;
+import org.eclipse.emf.cdo.compare.CDOCompare.CDOMatchEngine;
+import org.eclipse.emf.cdo.compare.CDOCompare.CDOMatcher;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.compare.CompareFactory;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.match.IComparisonFactory;
+import org.eclipse.emf.compare.match.eobject.IEObjectMatcher;
+import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Specialization of {@link CDOMatchEngine}.
+ * In practice this engine includes UML base Elements of StereotypeApplication objects in the
+ * CDO minimal Match tree. This allows the support of existing UML post processors such as StereotypedElementChangePostProcessor that make
+ * the assumption the match tree always contains the UML base elements associated to stereotype application changes. 
+ */
+public class UMLCDOMatchEngine extends CDOMatchEngine {
+
+	public UMLCDOMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory) {
+		super(matcher, comparisonFactory);
+	}
+
+	/**
+	 *The addition of the UML base elements is triggered as an immediate post processing of the default CDO matching step.
+	 */
+	@Override
+	public Comparison match(IComparisonScope scope, Monitor monitor) {
+		Comparison result = super.match(scope, monitor);
+		matchUMLBaseElements(scope, result, monitor);
+
+		return result;
+	}
+
+
+	/**
+	 * This method walk through the existing Match tree and finds changes of stereotype applications whose base UML Element are not
+	 * already included in the Match tree. A new match tree is created for those base elements only, and it is then merged with the 
+	 * original match tree. If new UML elements have been added in the Match tree, the {@link IComparisonScope} nsURI list 
+	 * is updated with UML nsURI to trigger related post processors. 
+	 * @param scope the original scope to update with UML nsURI if new elements have to be added.
+	 * @param comparison the comparison to update
+	 */
+	public void matchUMLBaseElements(IComparisonScope scope, Comparison comparison, Monitor monitor) {
+		Set<EObject> leftElements = new HashSet<>();
+		Set<EObject> rightElements = new HashSet<>();
+		Set<EObject> originElements = new HashSet<>();
+		Comparison tempComparison = CompareFactory.eINSTANCE.createComparison();
+
+		CDOMatcher matcher = (CDOMatcher) getEObjectMatcher();
+
+		for (Match match : comparison.getMatches()) {
+			collectBaseElementAndParents(match, leftElements, rightElements, originElements);
+		
+			for (Match subMatch : match.getAllSubmatches()) {
+				collectBaseElementAndParents(subMatch, leftElements, rightElements, originElements);
+			}
+
+			matcher.createMatches(tempComparison, leftElements.iterator(), rightElements.iterator(), originElements.iterator(), monitor);
+		}
+		
+		if (!tempComparison.getMatches().isEmpty()) {
+			mergeMatches(comparison, tempComparison);
+			scope.getNsURIs().add(UMLPackage.eNS_URI);
+		}
+	}
+
+	/**
+	 * This method takes the root of the new match trees and tries to find if a Match already exists for the parent 
+	 * of those root objects. If yes, the new match trees is added as a submatch of the parent Match, else the match tree
+	 * is added a new match tree in the receiving comparison
+	 */
+	private void mergeMatches(Comparison receivingComparison, Comparison newComparison) {
+		Map<Match, List<Match>> matchToReceiver = new HashMap<>();
+		for (Match match : newComparison.getMatches()) {
+			EObject matchRootObject = match.getLeft();
+			if (matchRootObject == null) {
+				matchRootObject = match.getRight();
+			}
+			if (matchRootObject == null) {
+				matchRootObject = match.getOrigin();
+			}
+
+			if (matchRootObject != null) {
+				EObject parent = getParentOf(matchRootObject);
+				Match parentMatch = null;
+				if (parent != null) {
+					parentMatch = receivingComparison.getMatch(parent);
+				}
+				if (parentMatch != null) {
+					matchToReceiver.put(match, parentMatch.getSubmatches());
+				} else {
+					matchToReceiver.put(match, receivingComparison.getMatches());
+				}
+			}
+		}
+
+		for (Map.Entry<Match, List<Match>> entry : matchToReceiver.entrySet()) {
+			entry.getValue().add(entry.getKey());
+		}
+
+	}
+
+	protected EObject getParentOf(EObject eObject) {
+		return CDOElement.getParentOf(eObject);
+	}
+
+	private void collectBaseElementAndParents(Match match, Set<EObject> leftElements, Set<EObject> rightElements,
+			Set<EObject> originElements) {
+		
+		Comparison comparison = match.getComparison();
+		addBaseElementAndParents(leftElements, comparison, match.getLeft());
+		addBaseElementAndParents(rightElements, comparison, match.getRight());
+		addBaseElementAndParents(originElements, comparison, match.getOrigin());
+	}
+
+
+	/**
+	 * This method tries to find if the {@link EObject} application parameters is a stereotype application with a base_XXX eReference.
+	 * If yes, the base element and all its parents which not already in the original Match tree are added in the receivingSetOfElements.
+	 */
+	private void addBaseElementAndParents(Set<EObject> receivingSetOfElements, Comparison comparison, EObject application) {
+		if (application != null && !(application instanceof Element)) {
+			@SuppressWarnings("restriction")
+			Element baseElement = org.eclipse.emf.compare.uml2.internal.postprocessor.util.UMLCompareUtil.getBaseElement(application);
+			if (baseElement != null && comparison.getMatch(baseElement) == null) {
+				receivingSetOfElements.add(baseElement);
+
+				EObject container = getParentOf(baseElement);
+				Match containerMatch = null;
+				// we also add in the element to match the owning tree of the base element
+				// until we find an existing match in the parent objects
+				while (container != null && containerMatch == null) {
+					containerMatch = comparison.getMatch(container);
+					// if there is not an existing match for the container,
+					// we have to have create a new one for it...
+					if (containerMatch == null) {
+						receivingSetOfElements.add(container);
+					}
+					container = getParentOf(container);
+				}
+			}
+		}
+	}
+
+
+	public static class Factory extends CDOMatchEngine.Factory {
+		
+		/**
+		 * Default factory used the EMF Compare extension point
+		 */
+		public Factory() {
+		}
+	
+		protected CDOMatchEngine createMatchEngine(IEObjectMatcher matcher, IComparisonFactory comparisonFactory) {
+			return new UMLCDOMatchEngine(matcher, comparisonFactory);
+		};
+	}
+}
\ No newline at end of file
diff --git a/cdo/bundles/compare/pom.xml b/cdo/bundles/compare/pom.xml
new file mode 100644
index 0000000..61b9e68
--- /dev/null
+++ b/cdo/bundles/compare/pom.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.eclipse.papyrus.cdo</groupId>
+		<artifactId>org.eclipse.papyrus.cdo-bundles</artifactId>
+		<version>1.2.0-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>compare</artifactId>
+	
+	<modules>
+		<module>org.eclipse.emf.compare.uml2.cdo</module>
+	</modules>
+	
+	<packaging>pom</packaging>
+</project>
diff --git a/cdo/bundles/pom.xml b/cdo/bundles/pom.xml
index 96fcc34..1ce8102 100755
--- a/cdo/bundles/pom.xml
+++ b/cdo/bundles/pom.xml
@@ -37,6 +37,7 @@
 		<module>org.eclipse.papyrus.infra.textedit.cdo</module>
     
 		<module>uml</module>
+		<module>compare</module>
 	</modules>
 	
 </project>
\ No newline at end of file
diff --git a/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/.project b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/.project
new file mode 100644
index 0000000..f53ef10
--- /dev/null
+++ b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.emf.compare.uml2.cdo.feature</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.pde.FeatureBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.FeatureNature</nature>
+	</natures>
+</projectDescription>
diff --git a/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/build.properties b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/build.properties
new file mode 100644
index 0000000..b3a611b
--- /dev/null
+++ b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/build.properties
@@ -0,0 +1,2 @@
+bin.includes = feature.xml,\
+               feature.properties
diff --git a/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/feature.properties b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/feature.properties
new file mode 100644
index 0000000..0a3b469
--- /dev/null
+++ b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/feature.properties
@@ -0,0 +1,35 @@
+###############################################################################
+#  Copyright (c) 2022 CEA LIST.
+#
+#  All rights reserved. This program and the accompanying materials
+#  are made available under the terms of the Eclipse Public License 2.0
+#  which accompanies this distribution, and is available at
+#  https://www.eclipse.org/legal/epl-2.0/
+#
+#  SPDX-License-Identifier: EPL-2.0
+#
+#  Contributors:
+#  		CEA LIST - Initial API and implementation
+###############################################################################
+# NLS_MESSAGEFORMAT_VAR
+
+# "featureName" property - name of the feature
+featureName=EMFCompare specialization for UML2 models stored in CDO
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse Modeling Project 
+
+# description property - text of the "Feature Description"
+description=Feature regrouping CDO specific customization of EMF compare extension for UML.
+################ end of description property ##################################
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2022 CEA LIST.\n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License 2.0\n\
+which accompanies this distribution, and is available at\n\
+https://www.eclipse.org/legal/epl-2.0/\n\
+\n\
+SPDX-License-Identifier: EPL-2.0\n
+################ end of copyright property ####################################
diff --git a/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/feature.xml b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/feature.xml
new file mode 100644
index 0000000..ef05f02
--- /dev/null
+++ b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/feature.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+      id="org.eclipse.emf.compare.uml2.cdo.feature"
+      label="%featureName"
+      version="1.0.0.qualifier"
+      provider-name="%providerName"
+      license-feature="org.eclipse.license"
+      license-feature-version="2.0.2">
+
+   <description url="https://eclipse.org/papyrus/">
+      %description
+   </description>
+
+   <copyright>
+      %copyright
+   </copyright>
+
+   <license url="%licenseURL">
+      %license
+   </license>
+
+   <requires>
+      <import plugin="org.eclipse.emf.cdo.compare" version="4.5.1" match="compatible"/>
+      <import plugin="org.eclipse.emf.compare.uml2" version="2.6.1" match="compatible"/>
+      <import plugin="org.eclipse.emf.compare.rcp" version="2.5.2" match="greaterOrEqual"/>
+   </requires>
+
+   <plugin
+         id="org.eclipse.emf.compare.uml2.cdo"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+</feature>
diff --git a/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/pom.xml b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/pom.xml
new file mode 100644
index 0000000..55c63ff
--- /dev/null
+++ b/cdo/features/org.eclipse.emf.compare.uml2.cdo.feature/pom.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	
+	<!-- Parent of this POM -->
+	<parent>
+		<groupId>org.eclipse.papyrus.cdo</groupId>
+		<artifactId>org.eclipse.papyrus.cdo-features</artifactId>
+		<version>1.2.0-SNAPSHOT</version>
+	</parent>
+	
+	<!-- Project POM -->
+	<artifactId>org.eclipse.emf.compare.uml2.cdo.feature</artifactId>
+	<groupId>org.eclipse.papyrus</groupId>
+	<version>1.0.0-SNAPSHOT</version>
+	<packaging>eclipse-feature</packaging>
+</project>
\ No newline at end of file
diff --git a/cdo/features/pom.xml b/cdo/features/pom.xml
index 8308ad3..768541e 100755
--- a/cdo/features/pom.xml
+++ b/cdo/features/pom.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 
@@ -16,6 +17,7 @@
 
 	<!-- Children modules to build -->
 	<modules>
+		<module>org.eclipse.emf.compare.uml2.cdo.feature</module>
 		<module>org.eclipse.papyrus.cdo.feature</module>
 		<module>org.eclipse.papyrus.cdo.models.feature</module>
 		<module>org.eclipse.papyrus.cdo.infra.textedit.feature</module>	
diff --git a/cdo/releng/org.eclipse.papyrus.cdo.p2/category.xml b/cdo/releng/org.eclipse.papyrus.cdo.p2/category.xml
index ca1a4e5..7e56c2e 100755
--- a/cdo/releng/org.eclipse.papyrus.cdo.p2/category.xml
+++ b/cdo/releng/org.eclipse.papyrus.cdo.p2/category.xml
@@ -6,6 +6,12 @@
    <feature url="features/org.eclipse.papyrus.cdo.feature.source_1.3.0.qualifier.jar" id="org.eclipse.papyrus.cdo.feature.source" version="1.3.0.qualifier">
       <category name="org.eclipse.papyrus.collaborativemodeling"/>
    </feature>
+   <feature url="features/org.eclipse.emf.compare.uml2.cdo.feature_1.0.0.qualifier.jar" id="org.eclipse.emf.compare.uml2.cdo.feature" version="1.0.0.qualifier">
+      <category name="org.eclipse.papyrus.collaborativemodeling"/>
+   </feature>
+   <feature url="features/org.eclipse.emf.compare.uml2.cdo.feature.source_1.0.0.qualifier.jar" id="org.eclipse.emf.compare.uml2.cdo.feature.source" version="1.0.0.qualifier">
+      <category name="org.eclipse.papyrus.collaborativemodeling"/>
+   </feature>
    <feature url="features/org.eclipse.papyrus.cdo.models.feature_1.0.0.qualifier.jar" id="org.eclipse.papyrus.cdo.models.feature" version="1.0.0.qualifier">
       <category name="org.eclipse.papyrus.collaborativemodeling.models"/>
    </feature>
diff --git a/cdo/releng/org.eclipse.papyrus.cdo.p2/pom.xml b/cdo/releng/org.eclipse.papyrus.cdo.p2/pom.xml
index 7560192..10307e9 100755
--- a/cdo/releng/org.eclipse.papyrus.cdo.p2/pom.xml
+++ b/cdo/releng/org.eclipse.papyrus.cdo.p2/pom.xml
@@ -59,7 +59,7 @@
 							<!-- p2 update site transitive dependencies repositories -->
 							<associateSites>
 								<!-- CDO update site  -->
-								<site>https://download.eclipse.org/modeling/emf/cdo/drops/R20210826-0457</site>
+								<site>https://download.eclipse.org/modeling/emf/cdo/updates/releases/latest/</site>
 							</associateSites>
 						</configuration>
 					</execution>
diff --git a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.nightly.targetplatform/org.eclipse.papyrus.cdo.nightly.targetplatform.target b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.nightly.targetplatform/org.eclipse.papyrus.cdo.nightly.targetplatform.target
index 95d2428..ff8721e 100755
--- a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.nightly.targetplatform/org.eclipse.papyrus.cdo.nightly.targetplatform.target
+++ b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.nightly.targetplatform/org.eclipse.papyrus.cdo.nightly.targetplatform.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="CollaborativeModeling CDO - Papyrus Nightly" sequenceNumber="1645527115">
+<target name="CollaborativeModeling CDO - Papyrus Nightly" sequenceNumber="1645538925">
   <locations>
     <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
       <unit id="org.eclipse.papyrus.sdk.feature.feature.group" version="0.0.0"/>
@@ -22,6 +22,8 @@
       <unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
       <unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
       <unit id="org.eclipse.uml2.sdk.feature.group" version="0.0.0"/>
+      <unit id="org.eclipse.emf.compare.feature.group" version="0.0.0"/>
+      <unit id="org.eclipse.emf.compare.uml2.feature.group" version="0.0.0"/>
       <repository id="eclipse" location="https://download.eclipse.org/releases/latest/"/>
     </location>
     <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
diff --git a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.nightly.targetplatform/org.eclipse.papyrus.cdo.nightly.targetplatform.tpd b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.nightly.targetplatform/org.eclipse.papyrus.cdo.nightly.targetplatform.tpd
index 34ec0eb..ae34e7f 100755
--- a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.nightly.targetplatform/org.eclipse.papyrus.cdo.nightly.targetplatform.tpd
+++ b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.nightly.targetplatform/org.eclipse.papyrus.cdo.nightly.targetplatform.tpd
@@ -23,6 +23,8 @@
 	org.eclipse.sdk.feature.group lazy
 	org.eclipse.emf.sdk.feature.group lazy
 	org.eclipse.uml2.sdk.feature.group lazy
+	org.eclipse.emf.compare.feature.group lazy
+    org.eclipse.emf.compare.uml2.feature.group lazy
 }
 
 // manual update 
diff --git a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.target b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.target
index cad2088..ad41c3c 100755
--- a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.target
+++ b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.target
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="CollaborativeModeling CDO - Papyrus latest release" sequenceNumber="1645527123">
+<target name="CollaborativeModeling CDO - Papyrus latest release" sequenceNumber="1645538925">
   <locations>
     <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
       <unit id="org.eclipse.papyrus.sdk.feature.feature.group" version="0.0.0"/>
@@ -22,6 +22,8 @@
       <unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
       <unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
       <unit id="org.eclipse.uml2.sdk.feature.group" version="0.0.0"/>
+      <unit id="org.eclipse.emf.compare.feature.group" version="0.0.0"/>
+      <unit id="org.eclipse.emf.compare.uml2.feature.group" version="0.0.0"/>
       <repository id="eclipse" location="https://download.eclipse.org/releases/latest/"/>
     </location>
     <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
diff --git a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.tpd b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.tpd
index bcb86b9..0df7425 100755
--- a/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.tpd
+++ b/cdo/releng/targetplatforms/org.eclipse.papyrus.cdo.targetplatform/org.eclipse.papyrus.cdo.targetplatform.tpd
@@ -23,6 +23,8 @@
 	org.eclipse.sdk.feature.group lazy
 	org.eclipse.emf.sdk.feature.group lazy
 	org.eclipse.uml2.sdk.feature.group lazy
+	org.eclipse.emf.compare.feature.group lazy
+    org.eclipse.emf.compare.uml2.feature.group lazy
 }
 
 // manual update