[533536] [CDO] refactor generator

Bug: 533536

Change-Id: Ib2fbfd05f028785f5c5fbf31ea83b4c635f03755
Signed-off-by: Thomas Guiu <thomas.guiu@soyatec.com>
diff --git a/portfolio/org.eclipse.egf.portfolio.genchain.cdo/.project b/portfolio/org.eclipse.egf.portfolio.genchain.cdo/.project
index 7504959..ae60a30 100644
--- a/portfolio/org.eclipse.egf.portfolio.genchain.cdo/.project
+++ b/portfolio/org.eclipse.egf.portfolio.genchain.cdo/.project
@@ -6,7 +6,7 @@
 	</projects>

 	<buildSpec>

 		<buildCommand>

-			<name>org.eclipse.jdt.core.javabuilder</name>

+			<name>org.eclipse.egf.pattern.ui.PatternBuilder</name>

 			<arguments>

 			</arguments>

 		</buildCommand>

@@ -20,9 +20,15 @@
 			<arguments>

 			</arguments>

 		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.jdt.core.javabuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

 	</buildSpec>

 	<natures>

-		<nature>org.eclipse.pde.PluginNature</nature>

 		<nature>org.eclipse.jdt.core.javanature</nature>

+		<nature>org.eclipse.pde.PluginNature</nature>

+		<nature>org.eclipse.egf.core.EGFNature</nature>

 	</natures>

 </projectDescription>

diff --git a/portfolio/org.eclipse.egf.portfolio.genchain.cdo/build.properties b/portfolio/org.eclipse.egf.portfolio.genchain.cdo/build.properties
index 9af3059..5293ff4 100644
--- a/portfolio/org.eclipse.egf.portfolio.genchain.cdo/build.properties
+++ b/portfolio/org.eclipse.egf.portfolio.genchain.cdo/build.properties
@@ -17,3 +17,4 @@
                plugin.properties,\

                plugin.xml,\

                templates/

+output.. = bin/

diff --git a/portfolio/org.eclipse.egf.portfolio.genchain.cdo/src/org/eclipse/egf/portfolio/genchain/cdo/CdoGenerationExtension.java b/portfolio/org.eclipse.egf.portfolio.genchain.cdo/src/org/eclipse/egf/portfolio/genchain/cdo/CdoGenerationExtension.java
index efdfa12..b662752 100644
--- a/portfolio/org.eclipse.egf.portfolio.genchain.cdo/src/org/eclipse/egf/portfolio/genchain/cdo/CdoGenerationExtension.java
+++ b/portfolio/org.eclipse.egf.portfolio.genchain.cdo/src/org/eclipse/egf/portfolio/genchain/cdo/CdoGenerationExtension.java
@@ -1,3 +1,17 @@
+/**
+ * <copyright>
+ *
+ *  Copyright (c) 2018 Thales Corporate Services S.A.S.
+ *  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:
+ *      Thales Corporate Services S.A.S - initial API and implementation
+ * 
+ * </copyright>
+ */
 package org.eclipse.egf.portfolio.genchain.cdo;
 
 import java.util.ArrayList;
@@ -33,13 +47,17 @@
 		List<Substitution> substitutions = new ArrayList<Substitution>();
 		final Substitution substitution = PatternFactory.eINSTANCE.createSubstitution();
 		substitutions.add(substitution);
-		Pattern pattern = (Pattern) set.getEObject(PATTERN_CDO, true);
+		Pattern pattern = (Pattern) set.getEObject(getCdoPattern(), true);
 		substitution.getReplacement().add(pattern);
 		return substitutions;
 	}
 
+	protected CdoGeneration doCreateEcoreElement() {
+		return CdoExtensionFactory.eINSTANCE.createCdoGeneration();
+	}
+
 	public EcoreElement createEcoreElement(Map<String, String> properties) {
-		CdoGeneration elt = CdoExtensionFactory.eINSTANCE.createCdoGeneration();
+		CdoGeneration elt = doCreateEcoreElement();
 		String modelPath = properties.get(MODEL_PATH);
 		elt.setModelPath(modelPath);
 		return elt;
@@ -49,6 +67,10 @@
 	protected void computeDefaultProperties(Map<String, String> context) {
 		properties.put(CdoExtensionPackage.eINSTANCE.getCdoGeneration_CdoSuffix(), "cdo");
 		properties.put(CdoExtensionPackage.eINSTANCE.getCdoGeneration_FeatureDelegation(), "Dynamic");
+	}
+
+	protected URI getCdoPattern() {
+		return PATTERN_CDO;
 	};
 
 }