509132 - [Initial Commit]

-working on codev

Change-Id: I8146fff8d13f23a604982ac73b0ed97bafa97248
Signed-off-by: Francois Le Fevre <francois.le-fevre@cea.fr>
diff --git a/codegen/.gitignore b/codegen/.gitignore
new file mode 100644
index 0000000..bbdfc34
--- /dev/null
+++ b/codegen/.gitignore
@@ -0,0 +1,2 @@
+/bin/
+*.md.html
diff --git a/codegen/.project b/codegen/.project
new file mode 100644
index 0000000..51c6988
--- /dev/null
+++ b/codegen/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.efm.modeling.codegen</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>
diff --git a/codegen/.settings/org.eclipse.core.resources.prefs b/codegen/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/codegen/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/codegen/.settings/org.eclipse.m2e.core.prefs b/codegen/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/codegen/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/codegen/about.html b/codegen/about.html
new file mode 100644
index 0000000..d35d5ae
--- /dev/null
+++ b/codegen/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/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.classpath b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.classpath
new file mode 100644
index 0000000..43b9862
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.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-1.8"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.gitignore b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.gitignore
new file mode 100644
index 0000000..bbdfc34
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.gitignore
@@ -0,0 +1,2 @@
+/bin/
+*.md.html
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.project b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.project
new file mode 100644
index 0000000..de8434b
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>org.eclipse.efm.formalml.concretesyntax.m2t</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>

+		<buildCommand>

+			<name>org.eclipse.m2e.core.maven2Builder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.m2e.core.maven2Nature</nature>

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

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

+	</natures>

+</projectDescription>

diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.settings/org.eclipse.core.resources.prefs b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.settings/org.eclipse.jdt.core.prefs b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..295926d
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1

+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled

+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8

+org.eclipse.jdt.core.compiler.compliance=1.8

+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

+org.eclipse.jdt.core.compiler.source=1.8

diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.settings/org.eclipse.m2e.core.prefs b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/META-INF/MANIFEST.MF b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c01d795
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.efm.formalml.concretesyntax.m2t
+Bundle-Version: 0.0.1.qualifier
+Bundle-Activator: org.eclipse.efm.formalml.concretesyntax.m2t.Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.uml2.uml,
+ org.eclipse.efm.formalml
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.efm.formalml.concretesyntax.m2t.factory,
+ org.eclipse.efm.formalml.concretesyntax.m2t.util
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/about.html b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/about.html
new file mode 100644
index 0000000..d35d5ae
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/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/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/build.properties b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/build.properties
new file mode 100644
index 0000000..c7556b7
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/build.properties
@@ -0,0 +1,14 @@
+###############################################################################

+# Copyright (c) 2016 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:

+#     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation

+###############################################################################

+source.. = src/

+output.. = bin/

+bin.includes = META-INF/,\

+               .

diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/pom.xml b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/pom.xml
new file mode 100644
index 0000000..96fab03
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/pom.xml
@@ -0,0 +1,14 @@
+<?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.efm</groupId>
+		<artifactId>org.eclipse.efm.modeling.codegen</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+	</parent>
+	<artifactId>org.eclipse.efm.formalml.concretesyntax.m2t</artifactId>
+	<packaging>eclipse-plugin</packaging>
+	<name>org.eclipse.efm.formalml.concretesyntax.m2t</name>
+	<description>This plug-in contains the XXXXXXXXX.</description>
+</project>
\ No newline at end of file
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/Activator.java b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/Activator.java
new file mode 100644
index 0000000..3dde40e
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/Activator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************

+ * Copyright (c) 2016 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:

+ *     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.efm.formalml.concretesyntax.m2t;

+

+import org.eclipse.ui.plugin.AbstractUIPlugin;

+import org.osgi.framework.BundleContext;

+

+/**

+ * The activator class controls the plug-in life cycle

+ */

+public class Activator extends AbstractUIPlugin {

+

+	// The plug-in ID

+	public static final String PLUGIN_ID = "org.eclipse.efm.formalml.concretesyntax.m2t"; //$NON-NLS-1$

+

+	// The shared instance

+	private static Activator plugin;

+	

+	/**

+	 * The constructor

+	 */

+	public Activator() {

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)

+	 */

+	public void start(BundleContext context) throws Exception {

+		super.start(context);

+		plugin = this;

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)

+	 */

+	public void stop(BundleContext context) throws Exception {

+		plugin = null;

+		super.stop(context);

+	}

+

+	/**

+	 * Returns the shared instance

+	 *

+	 * @return the shared instance

+	 */

+	public static Activator getDefault() {

+		return plugin;

+	}

+

+}

diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/AbstractCodeGenerator.java b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/AbstractCodeGenerator.java
new file mode 100644
index 0000000..925ae9c
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/AbstractCodeGenerator.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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:
+ *     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.efm.formalml.concretesyntax.m2t.factory;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.efm.formalml.concretesyntax.m2t.util.SimpleLogger;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+
+public abstract class AbstractCodeGenerator {
+
+	/**
+	 * MainCodeGenerator Supervisor
+	 */
+	protected MainCodeGenerator fSupervisor;
+
+	/**
+	 * LOGGER
+	 */
+	protected SimpleLogger LOGGER;
+
+	/**
+	 * Constructor
+	 */
+	public AbstractCodeGenerator() {
+		super();
+
+		fSupervisor = null;
+
+		this.LOGGER = new SimpleLogger();
+	}
+
+
+	/**
+	 * Constructor
+	 * @param supervisor
+	 */
+	public AbstractCodeGenerator(MainCodeGenerator supervisor) {
+		super();
+
+		this.fSupervisor = supervisor;
+
+		this.LOGGER = supervisor.LOGGER;
+	}
+
+
+	/**
+	 *Init Util, LOGGER, ...
+	 * @return false if initialization is failed
+	 */
+	public boolean reset() {
+		return LOGGER.reset();
+	}
+
+	public void log(IStatus aStatus) {
+		LOGGER.log(aStatus);
+	}
+
+	/**
+	 * GETTER
+	 * Reort Logger
+	 */
+	public SimpleLogger getReportLogger() {
+		return LOGGER;
+	}
+
+	/**
+	 * Error/warning reporting
+	 */
+	public void report() {
+		LOGGER.report();
+	}
+
+
+	public void performTransformError(
+			AbstractCodeGenerator context, Element element) {
+		if( element instanceof NamedElement ) {
+			LOGGER.error( ( new StringBuffer(context.getClass().getSimpleName()) )
+				.append( ":> unexpected " )
+				.append( element.getClass().getSimpleName() )
+				.append( ' ' )
+				.append( ((NamedElement)element).getQualifiedName() )
+				.toString() );
+		}
+		else {
+			LOGGER.error( ( new StringBuffer(context.getClass().getSimpleName()) )
+				.append( ":> unexpected " )
+				.append( element.getClass().getSimpleName() )
+				.append( ' ' )
+				.append( element.toString() )
+				.toString() );
+		}
+	}
+
+
+}
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/ClassCodeGenerator.java b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/ClassCodeGenerator.java
new file mode 100644
index 0000000..ba8c4c9
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/ClassCodeGenerator.java
@@ -0,0 +1,1019 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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:
+ *     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.efm.formalml.concretesyntax.m2t.factory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.efm.formalml.Configuration;
+import org.eclipse.efm.formalml.FormalBlock;
+import org.eclipse.efm.formalml.Part;
+import org.eclipse.efm.formalml.concretesyntax.m2t.util.PrettyPrintWriter;
+import org.eclipse.efm.formalml.util.StereotypeUtil;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.InstanceSpecification;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.StateMachine;
+import org.eclipse.uml2.uml.StructuredClassifier;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+public class ClassCodeGenerator extends AbstractCodeGenerator {
+
+	/**
+	 * Constructor
+	 */
+	public ClassCodeGenerator(MainCodeGenerator supervisor) {
+		super(supervisor);
+	}
+
+
+	/**
+	 * performTransform dispatcher for any element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void performTransformImpl(Element element, PrettyPrintWriter writer) {
+		if( element instanceof Class ) {
+			transformClassDefinition((Class)element, writer);
+		}
+
+		else if( element instanceof Model ) {
+			transformFormalModel((Model)element, writer);
+		}
+
+		else {
+			performTransformError(this, element);
+		}
+	}
+
+
+	////////////////////////////////////////////////////////////////////////////
+	// Tools for Model transformation
+	////////////////////////////////////////////////////////////////////////////
+
+	public boolean isPart(Property element) {
+		if( StereotypeUtil.getPart(element) != null ) {
+			return( true );
+		}
+		else {
+			return( isUmlPart(element) );
+		}
+	}
+
+	public boolean isUmlPart(Property element) {
+		if( !(element instanceof Port)
+			&& (element.getType() instanceof Class) ) {
+
+			EObject container = element.eContainer();
+
+			if( container instanceof StructuredClassifier ) {
+				StructuredClassifier stClass = (StructuredClassifier) container;
+				return( stClass.getParts().contains(element) );
+				}
+			}
+
+		return( false );
+	}
+
+	public boolean isBlockFormalContextDefinition(Class element) {
+		if( (StereotypeUtil.getConfiguration(element) != null) ) {
+			return( true );
+		}
+		else {
+			return( false );
+		}
+	}
+
+
+	public boolean isBlock(Class element) {
+		if( (StereotypeUtil.getBlock(element) != null) ) {
+			return( true );
+		}
+		else {
+			for( Behavior itBehavior : element.getOwnedBehaviors() ) {
+				if( itBehavior instanceof StateMachine ) {
+					return( true );
+				}
+			}
+
+			return( false );
+		}
+	}
+
+
+	public void collectElement(Package packageElement,
+			List<NamedElement> properties, List<Class> machinesAsBlock,
+			List<Property> blockInstances,
+			ArrayList<Class> machinesAsFormalContext) {
+		for( PackageableElement itPE : packageElement.getPackagedElements() ) {
+			if( itPE instanceof Property ) {
+				Property itProperty = (Property)itPE;
+
+				if( isPart(itProperty) ) {
+					blockInstances.add( itProperty );
+				}
+				else{
+					properties.add( itProperty );
+				}
+			}
+			else if( itPE instanceof DataType ) {
+				properties.add( itPE );
+			}
+			else if( itPE instanceof Signal ) {
+				properties.add( itPE );
+			}
+
+			else if( itPE instanceof Class ) {
+				Class itClass = (Class) itPE;
+
+				if( isBlockFormalContextDefinition(itClass) ) {
+					if( machinesAsFormalContext != null ) {
+						machinesAsFormalContext.add( itClass );
+					}
+					else {
+						System.out.println(
+								"Unexpected a null< machinesAsFormalContext > !");
+					}
+				}
+				else if( isBlock(itClass) ) {
+					machinesAsBlock.add( itClass );
+				}
+				else {
+				}
+			}
+			else if( itPE instanceof Package ) {
+				collectElement((Package)itPE, properties, machinesAsBlock,
+						blockInstances, machinesAsFormalContext);
+			}
+			else {
+			}
+		}
+	}
+
+
+	public void collectElement(Class pack,
+			List<NamedElement> properties, List<Class> machinesAsBlock,
+			List<Property> blockInstances,
+			List<Behavior> blockBehaviors,
+			ArrayList<Class> machinesAsFormalContext) {
+		for( Property itAttribute : pack.getOwnedAttributes() ) {
+			if( isPart(itAttribute) ) {
+				blockInstances.add( itAttribute );
+			}
+			else{
+				properties.add( itAttribute );
+			}
+		}
+
+		for( Behavior itBehavior : pack.getOwnedBehaviors() ) {
+			if( itBehavior instanceof StateMachine ) {
+				blockBehaviors.add(itBehavior);
+
+				collectElement(itBehavior, properties, machinesAsBlock,
+						blockInstances, machinesAsFormalContext);
+			}
+		}
+	}
+
+
+	public void collectElement(PackageableElement pack,
+			List<NamedElement> properties, List<Class> machinesAsBlock,
+			List<Property> blockInstances,
+			ArrayList<Class> machinesAsFormalContext) {
+		if( pack instanceof Package ) {
+			collectElement(pack, properties, machinesAsBlock,
+					blockInstances, machinesAsFormalContext);
+		}
+		else if( pack instanceof Property ) {
+			Property itProperty = (Property) pack;
+
+			if( isPart(itProperty) ) {
+				blockInstances.add( itProperty );
+			}
+			else{
+				properties.add( itProperty );
+			}
+		}
+		else if( pack instanceof DataType ) {
+			properties.add( pack );
+		}
+		else if( pack instanceof Signal ) {
+			properties.add( pack );
+		}
+
+		else if( pack instanceof Class ) {
+			Class itClass = (Class) pack;
+
+			if( isBlockFormalContextDefinition(itClass) ) {
+				if( machinesAsFormalContext != null ) {
+					machinesAsFormalContext.add( itClass );
+				}
+				else {
+					System.out.println(
+							"Unexpected a null< machinesAsFormalContext > !");
+				}
+			}
+			else if( isBlock(itClass) ) {
+				machinesAsBlock.add( itClass );
+			}
+			else {
+				for( Property itProperty : itClass.getOwnedAttributes() ) {
+					if( StereotypeUtil.getPart(itProperty) != null ) {
+
+						blockInstances.add( (Property)itProperty );
+					}
+				}
+			}
+		}
+	}
+
+
+	/**
+	 * performTransform a Model element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformFormalModel(
+			Model element, PrettyPrintWriter writer) {
+		fSupervisor.isSystemSerilization = true;
+
+		ArrayList<NamedElement> properties = new ArrayList<NamedElement>();
+		ArrayList<Class> machinesAsBlock = new ArrayList<Class>();
+		ArrayList<Property> blockInstances = new ArrayList<Property>();
+
+		ArrayList<Class> machinesAsFormalContext = new ArrayList<Class>();
+
+		collectElement(element, properties, machinesAsBlock,
+				blockInstances, machinesAsFormalContext);
+
+		writer.appendTabEol2("@xlia< system , 1.0 >:");
+
+
+		writer.appendTabEol("//!!FML:gen< FormalModel >");
+
+		writer.appendTab("system ")
+			.append(element.getName())
+			.appendEol2(" {");
+
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		// Section property
+		//
+		writer.appendTabEol("@property:");
+		for( Element property : properties ) {
+			fSupervisor.performTransform(property, writer2);
+		}
+
+		// Section machine
+		//
+		if( ! machinesAsBlock.isEmpty() ) {
+			writer.appendEolTab_Eol("@machine:");
+			for( Class clazz : machinesAsBlock ) {
+//				transformClassBlock(clazz, writer2);
+				transformClassDefinition(clazz, writer2);
+			}
+
+			for( Class clazz : machinesAsFormalContext ) {
+				transformClassFormalContext(clazz, writer2);
+			}
+		}
+		// Section instance statemachine
+		// ERROR
+		if( ! blockInstances.isEmpty() ) {
+			writer.appendEolTab_Eol("@instance:");
+			for( Property instance : blockInstances ) {
+				transformPropertyFormalPart(instance, writer2);
+			}
+		}
+
+
+		int instancesFormalContextCount = machinesAsFormalContext.size();
+		if( instancesFormalContextCount > 0 ) {
+			// Section moe
+			//
+			writer.appendEolTab_Eol("@moe:");
+
+			// Section init
+			//
+			writer.appendTab2Eol("@init{" +
+					((instancesFormalContextCount > 1) ? " |and|" : "") );
+			for( Class ctxClass : machinesAsFormalContext ) {
+				writer.appendTab3("init ")
+					.append(ctxClass.getName())
+					.appendEol(";");
+			}
+			writer.appendTab2Eol2("}");
+
+			// Section schedule
+			//
+			writer.appendTab2Eol("@schedule{" +
+					((instancesFormalContextCount > 1) ? " |i|" : "") );
+			for( Class ctxClass : machinesAsFormalContext ) {
+				writer.appendTab3("run ")
+					.append(ctxClass.getName())
+					.appendEol(";");
+			}
+			writer.appendTab2Eol2("}");
+		}
+
+		writer.append("} // end system from Mode")
+			.appendEol(element.getName());
+
+		fSupervisor.isSystemSerilization = false;
+	}
+
+	/**
+	 * performTransform a Class as System element (a Configuration Class to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformClassSystemDefinition(
+			Class element, PrettyPrintWriter writer) {
+		fSupervisor.isSystemSerilization = true;
+
+		// Pour retrouver le modèle de plus haut niveau à partir de element
+		Model modelSystem = element.getModel();
+
+		ArrayList<NamedElement> properties = new ArrayList<NamedElement>();
+		ArrayList<Class> machinesAsBlock = new ArrayList<Class>();
+		ArrayList<Property> blockInstances = new ArrayList<Property>();
+		ArrayList<Behavior> behaviors = new ArrayList<Behavior>();
+
+		collectElement(modelSystem, properties,
+				machinesAsBlock, blockInstances, null);
+
+		collectElement(element, properties,
+				machinesAsBlock, blockInstances, behaviors, null);
+
+		writer.appendTabEol2("@xlia< system , 1.0 >:");
+
+		Configuration elementFormalContext =
+				StereotypeUtil.getConfiguration(element);
+
+		writer.appendTab();
+		if( elementFormalContext.isTimed() ) {
+			writer.append("timed ");
+		}
+		if( elementFormalContext.isInput_enabled() ) {
+			writer.append("input_enabled ");
+		}
+		writer.append("system< and > ")
+			.append(element.getName())
+			.appendEol2(" {");
+
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		// Section property
+		//
+		writer.appendTabEol("@property:");
+		for( Element property : properties ) {
+			fSupervisor.performTransform(property, writer2);
+		}
+
+		// Section machine
+		//
+		if( ! machinesAsBlock.isEmpty() ) {
+			writer.appendEolTab_Eol("@machine:");
+			for( Class clazz : machinesAsBlock ) {
+//				transformClassBlock(clazz, writer2);
+				transformClassDefinition(clazz, writer2);
+			}
+		}
+
+		// Section instance statemachine
+		//
+		writer.appendEolTab_Eol("@instance:");
+		for( Property instance : blockInstances ) {
+			transformPropertyFormalPart(instance, writer2);
+		}
+
+		// Section moe
+		//
+		writer.appendEolTab_Eol("@moe:");
+
+		transformClassMoeDefinition(
+				StereotypeUtil.getBlock(element),
+				behaviors, blockInstances, writer2);
+
+		// Connect
+		//
+		writer.appendTabEol("@com:");
+		for( Connector itConnector : element.getOwnedConnectors() ) {
+			fSupervisor.transformConnector(itConnector, writer2);
+		}
+		writer.append("} // end system ")
+			.appendEol(element.getName());
+
+		fSupervisor.isSystemSerilization = false;
+	}
+
+
+	/**
+	 * performTransform a Class element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformClassDefinition(
+			Class element, PrettyPrintWriter writer) {
+		if( StereotypeUtil.getConfiguration(element) != null ) {
+			transformClassSystemDefinition(element, writer);
+		}
+		else if( StereotypeUtil.getBlock(element) != null ) {
+			transformClassBlock((Class)element, writer);
+		}
+		else {
+			transformClassUnspecifyDefinition(element, writer);
+		}
+	}
+
+	/**
+	 * performTransform a Class as Block Definition element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformClassBlock(
+			Class element, PrettyPrintWriter writer) {
+		ArrayList<NamedElement> properties = new ArrayList<NamedElement>();
+		ArrayList<Class> machinesAsBlock = new ArrayList<Class>();
+		ArrayList<Property> blockInstances = new ArrayList<Property>();
+		ArrayList<Behavior> behaviors = new ArrayList<Behavior>();
+
+		collectElement(element, properties,
+				machinesAsBlock, blockInstances, behaviors, null);
+
+
+		writer.appendTabEol("//!!FML:gen< Block >");
+
+		writer.appendTab("model machine ")
+			.append(element.getName())
+			.appendEol2(" {");
+
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		// Section property
+		//
+		writer.appendTabEol("@property:");
+
+		writer.appendTab2("public buffer fifo<*> buffer_")
+				.append(element.getName())
+				.appendEol2(";");
+
+		transformClassContentDefinition(element, writer,
+				properties, machinesAsBlock, blockInstances, behaviors);
+
+		// Section moe
+		//
+		writer.appendEolTab_Eol("@moe:");
+
+		transformClassMoeDefinition(
+				StereotypeUtil.getBlock(element),
+				behaviors, blockInstances, writer2);
+
+		writer.appendTab("} // end model machine ")
+			.appendEol2(element.getName());
+	}
+
+
+	/**
+	 * performTransform a Class as Test Context element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformClassFormalContext(
+			Class element, PrettyPrintWriter writer) {
+		ArrayList<NamedElement> properties = new ArrayList<NamedElement>();
+		ArrayList<Class> machinesAsBlock = new ArrayList<Class>();
+		ArrayList<Property> blockInstances = new ArrayList<Property>();
+		ArrayList<Behavior> behaviors = new ArrayList<Behavior>();
+
+		collectElement(element, properties,
+				machinesAsBlock, blockInstances, behaviors, null);
+
+		Configuration elementFormalContext =
+				StereotypeUtil.getConfiguration(element);
+
+		writer.appendTabEol("//!!FML:gen< Configuration >");
+
+		writer.appendTab();
+		if( elementFormalContext.isTimed() ) {
+			writer.append("timed ");
+		}
+		if( elementFormalContext.isInput_enabled() ) {
+			writer.append("input_enabled ");
+		}
+		writer.append("machine< and > ")
+			.append(element.getName())
+			.appendEol2(" {");
+
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		// Section property
+		//
+		writer.appendTabEol("@property:");
+
+		writer.appendTab2("public buffer fifo<*> buffer_")
+				.append(element.getName())
+				.appendEol2(";");
+
+		transformClassContentDefinition(element, writer,
+				properties, machinesAsBlock, blockInstances, behaviors);
+
+		// Section moe
+		//
+		writer.appendEolTab_Eol("@moe:");
+
+		transformClassMoeDefinition(
+				elementFormalContext, behaviors, blockInstances, writer2);
+
+		writer.appendTab("} // end machine ")
+			.appendEol2(element.getName());
+	}
+
+	/**
+	 * performTransform the Content of a Class Block Definition element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformClassContentDefinition(
+			Class element, PrettyPrintWriter writer,
+			ArrayList<NamedElement> properties,
+			ArrayList<Class> machinesAsBlock,
+			ArrayList<Property> blockInstances,
+			ArrayList<Behavior> behaviors) {
+
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		// Section property
+		//
+		for( Element property : properties ) {
+			fSupervisor.performTransform(property, writer2);
+		}
+
+		// Section routine
+		//
+		if( ! element.getOperations().isEmpty() ) {
+			writer.appendEolTab("@routine:");
+			for( Operation itOp : element.getOperations() ) {
+				writer.appendEol();
+				fSupervisor.transformOperation(itOp, writer2);
+			}
+		}
+
+		// Section machine
+		//
+		if( ! machinesAsBlock.isEmpty() ) {
+			writer.appendEolTab_Eol("@machine:");
+			for( Class clazz : machinesAsBlock ) {
+//				transformClassBlock(clazz, writer2);
+				transformClassDefinition(clazz, writer2);
+			}
+		}
+
+		// Section instance
+		//
+		if( ! blockInstances.isEmpty() ) {
+			writer.appendEolTab_Eol("@instance:");
+			for( Property instance : blockInstances ) {
+				transformPropertyFormalPart(instance, writer2);
+			}
+		}
+
+		// Section behavior / statemachine region
+		//
+		if( ! behaviors.isEmpty() ) {
+			writer.appendEolTab_Eol("@behavior:");
+			for( Behavior itBehavior : behaviors ) {
+				fSupervisor.performTransformBehavior(itBehavior, writer2);
+			}
+		}
+
+		// Connect
+		//
+		EList<Connector> connectors = element.getOwnedConnectors();
+		if( ! connectors.isEmpty() ) {
+			writer.appendEolTab_Eol("@com:");
+			for( Connector itConnector : connectors ) {
+				fSupervisor.transformConnector(itConnector, writer2);
+			}
+		}
+	}
+
+	/**
+	 * performTransform the MOE of a Class Block Definition element to a writer
+	 * @param block
+	 * @param blockInstances
+	 * @param writer
+	 */
+	public void transformClassMoeDefinition(
+			FormalBlock block, ArrayList<Behavior> behaviors,
+			List<Property> blockInstances, PrettyPrintWriter writer) {
+		int blockInstancesCount = blockInstances.size();
+		int behaviorCount = behaviors.size();
+
+		Part formalPart;
+
+		if( behaviorCount > 0 ) {
+			if( block.getBase_Class().getClassifierBehavior() == null ) {
+				LOGGER.error( ( new StringBuffer(this.getClass().getSimpleName()) )
+					.append( ":> unexpected Block Class " )
+					.append( block.getBase_Class().getQualifiedName() )
+					.append( " with ownedBehavior, without classifierBehavior" )
+					.toString() );
+			}
+		}
+
+
+		// Section init
+		//
+		writer.appendTab("@init{");
+
+// TODO MIGRATION
+//		Behavior initBehavior = block.getInitBehavior();
+
+		Behavior initBehavior = null;
+
+		if( initBehavior == null ) {
+			if( blockInstancesCount > 0 ) {
+				writer.appendEol( ((blockInstancesCount > 1) ? " |and|" : "") );
+
+				for( Property inst : blockInstances ) {
+					formalPart = StereotypeUtil.getPart(inst);
+					if( formalPart != null ) {
+						for( InstanceSpecification instance : formalPart.getInstance() ) {
+							writer.appendTab3("init ")
+								.append(instance.getName())
+								.appendEol(";");
+						}
+					}
+					else if( StereotypeUtil.getPart(inst) != null ) {
+						writer.appendTab2("init ")
+							.append(inst.getName())
+							.appendEol(";");
+					}
+					else {
+						writer.appendTab2("init ")
+						.append(inst.getName())
+						.appendEol(";");
+					}
+				}
+			}
+			else if( behaviorCount > 0 ) {
+				writer.appendEol( ((behaviorCount > 1) ? " |and|" : "") );
+				for( Behavior behavior : behaviors ) {
+					writer.appendTab2("init ")
+						.append(behavior.getName())
+						.appendEol(";");
+				}
+			}
+		}
+
+// TODO MIGRATION
+//		else if( initBehavior instanceof OpaqueBehavior ) {
+//			writer.appendEol();
+//			fSupervisor.transformOpaqueBehaviorBody(
+//					(OpaqueBehavior)initBehavior, writer.itab2());
+//		}
+//		else {
+//			writer.appendEol();
+//			fSupervisor.performTransform(initBehavior, writer.itab2());
+//		}
+		writer.appendTabEol2("}");
+
+		// Section schedule
+		//
+		writer.appendTab("@schedule{");
+
+		Class block_base_Class = block.getBase_Class();
+		if (block_base_Class !=null){
+			Behavior scheduleBehavior = block_base_Class.getClassifierBehavior();
+
+			if( scheduleBehavior != null && scheduleBehavior instanceof StateMachine ) {
+				writer.appendEolTab2("run ")
+					.append(scheduleBehavior.getName())
+					.appendEol(";");
+			}
+		}
+
+		else {
+			boolean isLibrarybehavior = true;
+
+//			if( scheduleBehavior instanceof InterleavingScheduler ) {
+//				writer.appendEol("|i|");
+//			}
+//			else if( scheduleBehavior instanceof SequenceScheduler ) {
+//				writer.appendEol("|;;|");
+//			}
+//			else
+			{
+//				isLibrarybehavior = false;
+				writer.appendEol("|i|");
+			}
+
+			if( isLibrarybehavior ) {
+				if( blockInstancesCount > 0 ) {
+					for( Property inst : blockInstances ) {
+						formalPart = StereotypeUtil.getPart(inst);
+						if( formalPart != null ) {
+							for( InstanceSpecification instance : formalPart.getInstance() ) {
+								writer.appendTab3("run ")
+									.append(instance.getName())
+									.appendEol(";");
+							}
+						}
+						else if( StereotypeUtil.getPart(inst) != null ) {
+							writer.appendTab2("run ")
+								.append(inst.getName())
+								.appendEol(";");
+						}
+						else {
+							writer.appendTab2("run ")
+							.append(inst.getName())
+							.appendEol(";");
+						}
+					}
+				}
+				else if( behaviorCount > 0 ) {
+					for( Behavior behavior : behaviors ) {
+						writer.appendTab2("run ")
+							.append(behavior.getName())
+							.appendEol(";");
+					}
+				}
+			}
+			//FIXME: scheduleBehavior is not in scope here !
+//			else if( scheduleBehavior instanceof OpaqueBehavior ) {
+//				writer.appendEol();
+//				fSupervisor.transformOpaqueBehaviorBody(
+//						(OpaqueBehavior)scheduleBehavior, writer.itab2());
+//			}
+//			else {
+//				writer.appendEol();
+//				fSupervisor.performTransform(scheduleBehavior, writer.itab2());
+//			}
+		}
+		writer.appendTabEol2("}");
+	}
+
+
+	/**
+	 * performTransform an Unspecify Class element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformClassUnspecifyDefinition(
+			Class element, PrettyPrintWriter writer) {
+		ArrayList<NamedElement> properties = new ArrayList<NamedElement>();
+		ArrayList<Class> machinesAsBlock = new ArrayList<Class>();
+		ArrayList<Property> blockInstances = new ArrayList<Property>();
+		ArrayList<Behavior> behaviors = new ArrayList<Behavior>();
+
+		collectElement(element, properties,
+				machinesAsBlock, blockInstances, behaviors, null);
+
+		writer.appendTab("machine ")
+			.append(element.getName())
+			.appendEol2(" {");
+
+		// Section property
+		//
+		writer.appendTabEol("@property:");
+
+		writer.appendTab2("public buffer fifo<*> buffer_")
+				.append(element.getName())
+				.appendEol2(";");
+
+
+		transformClassContentDefinition(element, writer,
+				properties, machinesAsBlock, blockInstances, behaviors);
+
+
+		// Section moe
+		//
+		int blockInstancesCount = blockInstances.size();
+		int behaviorCount = behaviors.size();
+
+		if( (blockInstancesCount + behaviorCount) > 0 ) {
+			// Section moe
+			//
+			writer.appendEolTab_Eol("@moe:");
+
+			Part formalPart;
+
+			// Section init
+			//
+			writer.appendTab2("@init{");
+			if( blockInstancesCount > 0 ) {
+				writer.appendEol( ((blockInstancesCount > 1) ? " |and|" : "") );
+				for( Property inst : blockInstances ) {
+					formalPart = StereotypeUtil.getPart(inst);
+					if( formalPart != null ) {
+						for( InstanceSpecification instance : formalPart.getInstance() ) {
+							writer.appendTab3("init ")
+								.append(instance.getName())
+								.appendEol(";");
+						}
+					}
+					else if( StereotypeUtil.getPart(inst) != null ) {
+						writer.appendTab3("init ")
+							.append(inst.getName())
+							.appendEol(";");
+					}
+					else {
+						writer.appendTab3("init ")
+						.append(inst.getName())
+						.appendEol(";");
+					}
+				}
+			}
+			else if( behaviorCount > 0 ) {
+				writer.appendEol( ((behaviorCount > 1) ? " |and|" : "") );
+				for( Behavior behavior : behaviors ) {
+					writer.appendTab3("init ")
+						.append(behavior.getName())
+						.appendEol(";");
+				}
+			}
+			writer.appendTab2Eol2("}");
+
+			// Section schedule
+			//
+			writer.appendTab2("@schedule{");
+			if( blockInstancesCount > 0 ) {
+				writer.appendEol( ((blockInstancesCount > 1) ? " |i|" : "") );
+				for( Property inst : blockInstances ) {
+					formalPart = StereotypeUtil.getPart(inst);
+					if( formalPart != null ) {
+						for( InstanceSpecification instance : formalPart.getInstance() ) {
+							writer.appendTab3("run ")
+								.append(instance.getName())
+								.appendEol(";");
+						}
+					}
+					else if( StereotypeUtil.getPart(inst) != null ) {
+						writer.appendTab3("run ")
+							.append(inst.getName())
+							.appendEol(";");
+					}
+					else {
+						writer.appendTab3("run ")
+						.append(inst.getName())
+						.appendEol(";");
+					}
+				}
+			}
+			else if( behaviorCount > 0 ) {
+				writer.appendEol( ((behaviorCount > 1) ? " |i|" : "") );
+				for( Behavior behavior : behaviors ) {
+					writer.appendTab3("run ")
+						.append(behavior.getName())
+						.appendEol(";");
+				}
+			}
+			writer.appendTab2Eol2("}");
+		}
+
+		writer.appendTab("} // end machine ")
+			.appendEol2(element.getName());
+	}
+
+
+	/**
+	 * performTransform a Property as Class Block Instance element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformPropertyFormalPart(
+			Property element, PrettyPrintWriter writer) {
+
+		writer.appendTabEol("//!!FML:gen< Part >");
+
+		Part formalPart = StereotypeUtil.getPart(element);
+
+		if( formalPart != null ) {
+
+			Configuration parent_context = StereotypeUtil.getConfiguration(element);
+
+			EList<Property> environmental_properties;
+			if (parent_context != null && parent_context.getEnv() != null) {
+				environmental_properties = parent_context.getEnv();
+			} else {
+				environmental_properties = new BasicEList.UnmodifiableEList<Property>(0, null);
+			}
+
+			String comment_on_part = "";
+			if (environmental_properties.contains(formalPart.getBase_Property())) {
+				comment_on_part = " /* in formal context 'environment' */";
+			}
+
+			if( formalPart.getInstance().isEmpty() ) {
+				writer.appendTab( element.getVisibility().toString() )
+					.append(" instance machine< ")
+					.append(element.getType().getName());
+
+				ValueSpecification lowerMultiplicity = element.getLowerValue();
+				ValueSpecification upperMultiplicity = element.getUpperValue();
+				if( (lowerMultiplicity != null) || (upperMultiplicity != null) ) {
+					writer.append(" , multiplicity:( init:");
+					if( lowerMultiplicity != null ) {
+						fSupervisor.transformValueSpecification(lowerMultiplicity, writer);
+					}
+					else {
+						writer.append("1");
+
+					}
+					if( (upperMultiplicity != null) &&
+						( upperMultiplicity.unlimitedValue() > 0 ) ) {
+						writer.append(" , max:");
+						fSupervisor.transformValueSpecification(upperMultiplicity, writer);
+					}
+					writer.append(")");
+				}
+
+				writer.append(" > ")
+					.append(element.getName())
+					.append(";")
+					.appendEol(comment_on_part);
+			}
+			else {
+				for( InstanceSpecification instance : formalPart.getInstance() ) {
+					writer.appendTab( element.getVisibility().toString() )
+						.append(" instance machine< ")
+						.append(element.getType().getName())
+						.append(" > ")
+						.append(instance.getName())
+						.append(";")
+						.appendEol(comment_on_part);
+				}
+			}
+		}
+		else {
+			writer.appendTab("/* UNSPECIFY INSTANCE */ instance machine< ")
+				.append(element.getVisibility().toString())
+				.append(" ")
+				.append(element.getType().getName())
+				.append(" > ")
+				.append(element.getName())
+				.appendEol("; */ formal part is null */");
+		}
+	}
+
+	public void transformPropertyDefinition(
+			Property element, PrettyPrintWriter writer) {
+
+		writer.appendTab( element.getVisibility().toString() )
+			.append(" var machine /*< ") 	// it lacked "var" keyword when declaring "machine"
+										// type properties for a "struct" data type
+			//.append(" machine< ")
+			.append(element.getType().getName())
+			.append(" >*/ ")
+			.append(element.getName())
+			.appendEol(";");
+	}
+
+
+	/**
+	 * performTransform a Property as Environment element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformPropertyEnvironment(
+			Property element, PrettyPrintWriter writer) {
+		if( fSupervisor.isSystemSerilization ) {
+			//BUFFERIZATION
+		}
+		else  {
+			writer.appendTab("instance environment ")
+//				.append(element.getType().getName())
+				.append(element.getName())
+				.appendEol(";");
+		}
+	}
+
+}
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/DataTypeCodeGenerator.java b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/DataTypeCodeGenerator.java
new file mode 100644
index 0000000..5800b88
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/DataTypeCodeGenerator.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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:
+ *     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.efm.formalml.concretesyntax.m2t.factory;
+
+import org.eclipse.efm.formalml.concretesyntax.m2t.util.PrettyPrintWriter;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.MultiplicityElement;
+import org.eclipse.uml2.uml.PrimitiveType;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.TypedElement;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+public class DataTypeCodeGenerator extends AbstractCodeGenerator {
+
+	/**
+	 * Constructor
+	 */
+	public DataTypeCodeGenerator(MainCodeGenerator supervisor) {
+		super(supervisor);
+	}
+
+
+	/**
+	 * performTransform dispatcher for any element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void performTransformImpl(Element element, PrettyPrintWriter writer) {
+		if( element instanceof Enumeration ) {
+			transformEnumeration((Enumeration)element, writer);
+		}
+
+		else if( element instanceof EnumerationLiteral ) {
+			transformEnumerationLiteral((EnumerationLiteral)element, writer);
+		}
+
+		else if( element instanceof DataType ) {
+			transformDataType((DataType)element, writer);
+		}
+
+		else {
+			performTransformError(this, element);
+		}
+	}
+
+
+	/**
+	 * performTransform an Enumeration element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformEnumeration(
+			Enumeration element, PrettyPrintWriter writer) {
+		writer.appendTab(element.getVisibility().toString())
+			.append(" type ")
+			.append(element.getName())
+			.appendEol(" enum {");
+		boolean firstElt = true;
+		for( EnumerationLiteral literal : ((Enumeration)element).getOwnedLiterals() ) {
+			if(  firstElt ) {
+				writer.appendTab2(literal.getName());
+				firstElt = false;
+			}
+			else {
+				writer.appendEol(",")
+				.appendTab2(literal.getName());
+			}
+		}
+		writer.appendEolTab_Eol("}");
+	}
+
+	/**
+	 * performTransform an Enumeration Literal element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformEnumerationLiteral(
+			EnumerationLiteral element, PrettyPrintWriter writer) {
+		writer.appendTab(element.getVisibility().toString())
+			.append(' ')
+			.append(element.getName());
+
+		ValueSpecification value = element.getSpecification();
+		if( value != null ) {
+			writer.append(" = ");
+			fSupervisor.transformValueSpecification(value, writer);
+		}
+
+		writer.appendEol();
+	}
+
+	/**
+	 * performTransform a DataType as StructuredType element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformStructuredType(
+			DataType element, PrettyPrintWriter writer) {
+		writer.appendTab(element.getVisibility().toString())
+			.append(" type ")
+			.append(element.getName())
+			.appendEol(" struct {");
+
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		for( Property itProperty : element.getOwnedAttributes() ) {
+			fSupervisor.transformProperty(itProperty, writer2);
+		}
+		writer.appendTabEol("}");
+	}
+
+	/**
+	 * performTransform a DataType element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformDataType(
+			DataType element, PrettyPrintWriter writer) {
+		if( element instanceof Enumeration ) {
+			transformEnumeration((Enumeration)element, writer);
+		}
+		else if( element.getOwnedAttributes().size() >= 1 ) {
+			transformStructuredType(element, writer);
+		}
+		else {
+			writer.appendTab("dataType");
+			if( element.getName() != null ) {
+				writer.append(' ')
+					.append(element.getName());
+			}
+			writer.appendEol(" { /* TODO */ }");
+		}
+	}
+
+
+	/**
+	 * performTransform type name of a TypedElement element to a string
+	 * @param element
+	 * @return
+	 */
+	public String typeName(TypedElement element) {
+		String typeString;
+
+		if( element.getType() == null ) {
+			typeString = "null<type>";
+		}
+		else {
+			typeString = element.getType().getName();
+
+			if( element.getType() instanceof PrimitiveType ) {
+				typeString = typeString.toLowerCase();
+			}
+			else if( element.getType() instanceof Class ){
+				typeString = "machine" + "/*< " + typeString + " >*/";
+			}
+
+			if( element instanceof MultiplicityElement ) {
+				MultiplicityElement multElem = (MultiplicityElement)element;
+				if( ( multElem.getLower() == 1 ) &&
+						( multElem.getUpper() == 1 ) ) {
+					// Cas basique
+					//
+					// rien à faire
+				}
+				else if( ( multElem.getLower() == multElem.getUpper() ) &&
+						 ( multElem.getLower() != 0 ) &&
+					 	 ( multElem.getLower() != -1 ) ) {
+					// Cas tableau
+					//
+					typeString = typeString + "[" + multElem.getLower() + "]";
+				}
+				else if( //( element.getLower() == 0 ) &&
+						( multElem.getUpper() == -1 ) ) {
+					// Cas vector
+					//
+					typeString = "vector< " + typeString + " >";
+				}
+				else {
+					typeString = "??? " + typeString;
+				}
+			}
+		}
+		return typeString;
+	}
+
+}
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/MainCodeGenerator.java b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/MainCodeGenerator.java
new file mode 100644
index 0000000..e7ed0d4
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/MainCodeGenerator.java
@@ -0,0 +1,885 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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:
+ *     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.efm.formalml.concretesyntax.m2t.factory;
+
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringWriter;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.efm.formalml.Configuration;
+import org.eclipse.efm.formalml.DirectedPort;
+import org.eclipse.efm.formalml.concretesyntax.m2t.util.PrettyPrintWriter;
+import org.eclipse.efm.formalml.util.StereotypeUtil;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.uml.Activity;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.ConnectableElement;
+import org.eclipse.uml2.uml.Connector;
+import org.eclipse.uml2.uml.ConnectorEnd;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.Expression;
+import org.eclipse.uml2.uml.FinalState;
+import org.eclipse.uml2.uml.Interaction;
+import org.eclipse.uml2.uml.LiteralBoolean;
+import org.eclipse.uml2.uml.LiteralInteger;
+import org.eclipse.uml2.uml.LiteralReal;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.OpaqueBehavior;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.ParameterDirectionKind;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Pseudostate;
+import org.eclipse.uml2.uml.Region;
+import org.eclipse.uml2.uml.Signal;
+import org.eclipse.uml2.uml.State;
+import org.eclipse.uml2.uml.StateMachine;
+import org.eclipse.uml2.uml.Transition;
+import org.eclipse.uml2.uml.ValueSpecification;
+import org.eclipse.uml2.uml.Vertex;
+
+public class MainCodeGenerator extends AbstractCodeGenerator {
+
+	private static final String STD_ENV_TYPE_NAME = "Env";
+
+	/**
+	 * Main System Serilization Flag
+	 */
+	public boolean isSystemSerilization = false;
+
+	/**
+	 * show Transition Section Flag
+	 * section list: @trigger, @guard, @tguard, @effect
+	 */
+	public boolean showTransitionSection = false;
+
+	/**
+	 * Co-Codegenfactory for Class Element
+	 */
+	public ClassCodeGenerator fClassFactory;
+
+	/**
+	 * Co-Codegenfactory for DataType Element
+	 */
+	public DataTypeCodeGenerator fDataTypeFactory;
+
+	/**
+	 * Co-Codegenfactory for Statemachine Element
+	 */
+	public StatemachineCodeGenerator fStatemachineFactory;
+
+
+	/**
+	 * Constructor
+	 */
+	public MainCodeGenerator() {
+		super();
+
+		this.fClassFactory = new ClassCodeGenerator(this);
+
+		this.fDataTypeFactory = new DataTypeCodeGenerator(this);
+
+		this.fStatemachineFactory = new StatemachineCodeGenerator(this);
+	}
+
+
+	/**
+	 * performTransform any element to a string
+	 * @param element
+	 * @return
+	 */
+	public String performTransform(EObject element) {
+		isSystemSerilization = false;
+
+		if( element instanceof Element ) {
+			StringWriter buffer = new StringWriter();
+			PrettyPrintWriter writer = new PrettyPrintWriter(buffer);
+
+			performTransform((Element)element, writer);
+
+			return( buffer.toString() );
+		}
+
+		else if( element != null ) {
+			return( element.toString() );
+		}
+		else {
+			return null;
+		}
+	}
+
+	/**
+	 * performTransform any element to a file
+	 * @param element
+	 * @param filePath
+	 * @return
+	 */
+	public boolean performTransform(EObject element, IPath filePath) {
+		isSystemSerilization = false;
+
+		if( element instanceof Element ) {
+			FileWriter buffer;
+			try {
+				buffer = new FileWriter(filePath.toOSString());
+
+				PrettyPrintWriter writer = new PrettyPrintWriter(buffer);
+
+				performTransform((Element)element, writer);
+
+				writer.close();
+
+				return( true );
+
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return( false );
+	}
+
+
+	/**
+	 * performTransform dispatcher for any element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void performTransform(Element element, PrettyPrintWriter writer) {
+
+		// StatemachineFactory
+		if( element instanceof StateMachine ) {
+			fStatemachineFactory.transformStatemachine((StateMachine)element, writer);
+		}
+
+		else if( element instanceof Region ) {
+			fStatemachineFactory.transformRegion((Region)element, writer);
+		}
+
+		else if( element instanceof Pseudostate ) {
+			fStatemachineFactory.transformPseudostate((Pseudostate)element, writer);
+		}
+		else if( element instanceof FinalState ) {
+			fStatemachineFactory.transformFinalState((FinalState)element, writer);
+		}
+		else if( element instanceof State ) {
+			fStatemachineFactory.transformState((State)element, writer);
+		}
+		else if( element instanceof Vertex ) {
+			fStatemachineFactory.transformVertexContent((Vertex)element, writer);
+		}
+		else if( element instanceof Transition ) {
+			fStatemachineFactory.transformTransition((Transition)element, writer);
+		}
+
+		// This Factory
+		else if( element instanceof OpaqueBehavior ) {
+			transformOpaqueBehavior((OpaqueBehavior)element, writer);
+		}
+
+		// ClassFactory
+		else if( element instanceof Class ) {
+			fClassFactory.transformClassDefinition((Class)element, writer);
+		}
+
+		else if( element instanceof Model ) {
+			fClassFactory.transformFormalModel((Model)element, writer);
+		}
+
+		// DataTypeFactory
+		else if( element instanceof Enumeration ) {
+			fDataTypeFactory.transformEnumeration((Enumeration)element, writer);
+		}
+
+		else if( element instanceof EnumerationLiteral ) {
+			fDataTypeFactory.transformEnumerationLiteral(
+					(EnumerationLiteral)element, writer);
+		}
+
+		else if( element instanceof DataType ) {
+			fDataTypeFactory.transformDataType((DataType)element, writer);
+		}
+
+		// This Factory
+		else if( element instanceof Package ) {
+			transformPackageDefinition((Package)element, writer);
+		}
+
+		else if( element instanceof Port ) {
+			transformPort((Port)element, writer);
+		}
+		else if( element instanceof Parameter ) {
+			transformParameter((Parameter)element, writer);
+		}
+		else if( element instanceof Property ) {
+			transformProperty((Property)element, writer);
+		}
+
+		else if( element instanceof Operation ) {
+			transformOperation((Operation)element, writer);
+		}
+
+		else if( element instanceof Connector ) {
+			transformConnector((Connector)element, writer);
+		}
+		else if( element instanceof Signal ) {
+			transformSignal((Signal)element, writer);
+		}
+
+		else if( element instanceof NamedElement ) {
+			writer.appendTab("named_element");
+			if( ((NamedElement)element).getName() != null ) {
+				writer.append(' ')
+					.append(((NamedElement)element).getName());
+			}
+			writer.appendEol(" { /* TODO */ }");
+		}
+		else {
+			writer.appendTab("element ")
+				.append(element.toString())
+				.appendEol(" { /* TODO */ }");
+		}
+	}
+
+
+	/**
+	 * performTransform dispatcher for any element to a writer
+	 * @param behavior
+	 * @param writer
+	 */
+	public void performTransformBehavior(Behavior behavior, PrettyPrintWriter writer) {
+		if( behavior != null ) {
+			if( behavior instanceof StateMachine ) {
+				fStatemachineFactory.transformStatemachine(
+						(StateMachine)behavior, writer);
+			}
+			else if( behavior instanceof OpaqueBehavior ) {
+				writer.appendTabEol("/*");
+				transformOpaqueBehavior((OpaqueBehavior)behavior, writer);
+				writer.appendTabEol("*/");
+			}
+			else {
+				writer.appendTab("behavior ")
+					.append( (behavior.getName() != null)?
+							behavior.getName() : "<unamed>" )
+					.appendEol(" {");
+
+				EList<Behavior> behaviors = behavior.getOwnedBehaviors();
+				if( ! behaviors.isEmpty() ) {
+					writer.appendEolTab_Eol("@behavior:");
+					PrettyPrintWriter writer2 = writer.itab2();
+					for( Behavior itBehavior : behaviors ) {
+						performTransformBehavior(itBehavior, writer2);
+					}
+				}
+
+				writer.appendTab2Eol(behavior.toString());
+				writer.appendTabEol("}");
+			}
+		}
+		else {
+			writer.appendTabEol("behavior null { }");
+		}
+	}
+
+	/**
+	 * performTransform an Opaque Behavior element to a writer
+	 * @param behavior
+	 * @param writer
+	 */
+	public void transformBehaviorBody(
+			Behavior behavior, PrettyPrintWriter writer) {
+		if( behavior instanceof OpaqueBehavior ) {
+			transformOpaqueBehaviorBody(
+					(OpaqueBehavior)behavior, writer);
+		}
+		else if( behavior instanceof Activity ) {
+			writer.appendTab2("// exec uml::activity ")
+				.appendEol(behavior.getName());
+		}
+		else if( behavior instanceof Interaction ) {
+			writer.appendTab2("// exec uml::interaction ")
+				.appendEol(behavior.getName());
+		}
+		else if( behavior instanceof StateMachine ) {
+			writer.appendTab2("// exec uml::statemachine ")
+				.appendEol(behavior.getName());
+		}
+		else if( behavior != null ) {
+//			writer.appendTab("// exec uml::behavior ")
+			writer.appendTab2("// exec uml::")
+				.append(behavior.getClass().getSimpleName())
+				.append(" ")
+				.appendEol(behavior.getName());
+		}
+	}
+
+
+	/**
+	 * performTransform an Opaque Behavior element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformOpaqueBehavior(
+			OpaqueBehavior element, PrettyPrintWriter writer) {
+		writer.appendTab("behavior< opaque > ")
+		.append( (element.getName() != null)?
+				element.getName() : "<unamed>" )
+		.appendEol(" {");
+
+		transformOpaqueBehaviorBody(element, writer.itab2());
+
+		writer.appendTabEol("}");
+	}
+
+	/**
+	 * performTransform an Opaque Behavior element to a writer
+	 * @param behavior
+	 * @param writer
+	 */
+	public void transformOpaqueBehaviorBody(
+			OpaqueBehavior behavior, PrettyPrintWriter writer) {
+		for( String body : behavior.getBodies() ) {
+			if( body.startsWith(writer.iTAB) ) {
+				body = body.trim().replaceAll(
+						"\n" /*System.lineSeparator()*/ + writer.iTAB,
+						writer.EOL + writer.TAB1);
+				writer.appendTab2Eol(body);
+			}
+			else {
+				body = body.replaceAll(
+						"\n" /*System.lineSeparator()*/,
+						writer.EOL + writer.TAB1);
+				writer.appendTabEol(body);
+			}
+		}
+	}
+
+
+	////////////////////////////////////////////////////////////////////////////
+	// Tools for Model transformation
+	////////////////////////////////////////////////////////////////////////////
+
+	/**
+	 * performTransform a Package element to a writer
+	 * @param classContainer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformPackageDefinition(
+			Package element, PrettyPrintWriter writer) {
+
+		writer.appendTab("package ")
+			.append(element.getName())
+			.appendEol2(" {");
+
+		for( PackageableElement it : element.getPackagedElements() ) {
+			performTransform( it );
+		}
+
+		writer.appendTab("} // end package ")
+		.appendEol2(element.getName());
+	}
+
+
+	/**
+	 * performTransform a Property element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformProperty(Property element, PrettyPrintWriter writer) {
+		if( element instanceof Port )
+		{
+			transformPort((Port)element, writer);
+		}
+		else if( fClassFactory.isPart(element) ) {
+			if( element.eContainer() instanceof DataType ) {
+				fClassFactory.transformPropertyDefinition(element, writer);
+			}
+			else {
+				writer.appendTabEol( "/* Unexpected property typed by <class> HERE */" );
+
+				fClassFactory.transformPropertyFormalPart(element, writer);
+			}
+		}
+//		else if( StereotypeUtil.getFormalEnvironment(element) != null ) {
+		else if( (element.getType() != null)
+				&& element.getType().getName().equals(STD_ENV_TYPE_NAME) ) {
+			fClassFactory.transformPropertyEnvironment(element, writer);
+		}
+//		else if( StereotypeUtil.getClock(element) != null ) {
+//			transformPropertyDefintion(element, writer, " var clock< ", " > ");
+//
+//			writer.appendEol(";");
+//		}
+		else {
+			transformPropertyDefintion(element, writer,
+					(element.isReadOnly()? " const var " : " var "), " ");
+
+
+			writer.appendEol(";");
+		}
+	}
+
+
+	public void transformPropertyDefintion(
+			Property element, PrettyPrintWriter writer,
+			String beforeTypename, String afterTypename) {
+		writer.appendTab( element.getVisibility().toString() )
+			.append( beforeTypename )
+			.append( fDataTypeFactory.typeName(element) )
+			.append( afterTypename)
+			.append( element.getName() );
+
+		ValueSpecification defaultValue = element.getDefaultValue();
+		if(  defaultValue != null ) {
+			writer.append(" = ");
+			transformValueSpecification(defaultValue, writer);
+		}
+	}
+
+
+
+	/**
+	 * performTransform a Property as Variable element to a writer
+	 * @param element
+	 * @param writer
+	 */
+// TODO MIGRATION
+//	public void transformVariable(Property element, PrettyPrintWriter writer) {
+//		transformPropertyDefintion(element, writer,
+//				(element.isFinal() ? " final " : "") + " var ", " ");
+//
+//		writer.appendEol(";");
+//	}
+
+
+	/**
+	 * performTransform a Operation element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformOperation(Operation element, PrettyPrintWriter writer) {
+		writer.appendTab("macro routine ");
+		if( element.getName() != null ) {
+			writer.append( element.getName() );
+		}
+		else  {
+			writer.append( "null<name>" );
+		}
+
+		transformOperationParameters(element.getOwnedParameters(), writer);
+
+		writer.appendEol(" {");
+
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		for( Behavior method : element.getMethods() ) {
+			if( method instanceof OpaqueBehavior ) {
+				writer.appendTab2("//xlia::behavior ")
+					.appendEol( method.getName() );
+
+				transformOpaqueBehaviorBody((OpaqueBehavior)method, writer2);
+			}
+			else if( method instanceof Activity ) {
+				writer.appendTab2("uml::activity ")
+					.appendEol(method.getName());
+			}
+			else if( method instanceof Interaction ) {
+				writer.appendTab2("uml::interaction ")
+					.appendEol(method.getName());
+			}
+			else if( method instanceof StateMachine ) {
+				writer.appendTab2("uml::statemachine ")
+					.appendEol(method.getName());
+			}
+			else if( method != null ) {
+				writer.appendTab2("uml::")
+					.append(method.getClass().getSimpleName())
+					.append(" ")
+					.appendEol(method.getName());
+			}
+		}
+
+		writer.appendTabEol("}");
+	}
+
+	/**
+	 * performTransform Operation Parameters element to a writer
+	 * @param parameters
+	 * @param writer
+	 */
+	public void transformOperationParameters(
+			EList<Parameter> parameters, PrettyPrintWriter writer) {
+		writer.append("(");
+		boolean firstParam = true;
+		for( Parameter itParameter : parameters ) {
+			if( itParameter.getDirection() != ParameterDirectionKind.RETURN_LITERAL ) {
+				if( firstParam ) {
+					firstParam = false;
+				}
+				else {
+					writer.append(", ");
+				}
+
+				if( itParameter.getDirection() != ParameterDirectionKind.IN_LITERAL ) {
+					writer.append( itParameter.getDirection().toString() )
+						.append(' ');
+				}
+				writer.append( fDataTypeFactory.typeName(itParameter) )
+					.append(' ')
+					.append(itParameter.getName());
+
+				if( itParameter.getDefaultValue() != null ) {
+					writer.append(" = ");
+					transformValueSpecification( itParameter.getDefaultValue(), writer );
+				}
+			}
+		}
+		writer.append(")");
+
+		firstParam = true;
+		for( Parameter itParameter : parameters ) {
+			if( itParameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL ) {
+				if( firstParam ) {
+					writer.append(" --> (");
+					firstParam = false;
+				}
+				else {
+					writer.append(", ");
+				}
+				writer.append( fDataTypeFactory.typeName(itParameter) )
+					.append(' ')
+					.append(itParameter.getName());
+
+				if( itParameter.getDefaultValue() != null ) {
+					writer.append(" = ");
+					transformValueSpecification( itParameter.getDefaultValue(), writer );
+				}
+			}
+		}
+		if( ! firstParam ) {
+			writer.append(")");
+		}
+	}
+
+	/**
+	 * performTransform a Parameter element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformParameter(Parameter element, PrettyPrintWriter writer) {
+		writer.appendTab("parameter");
+		if( element.getName() != null ) {
+			writer.append(' ')
+				.append(element.getName());
+		}
+		writer.appendEol(" { /* TODO */ }");
+	}
+
+
+	/**
+	 * performTransform a Port element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformPort(Port element, PrettyPrintWriter writer) {
+		String direction = portDirection(element);
+
+		// !!!!!!! A revoir : comment modéliser les paramètres des ports !
+		// !!!!!!! Pour le moment on suppose un seul paramètre possible
+		// !!!!!!! et on utilise itProp.getType().getName()
+		// !!!!!!! pour avoir le type du paramètre
+		//
+//		if(  element.getType() instanceof PrimitiveType ) {
+//			writer.appendTab(element.getVisibility().toString())
+//				.append(" port ")
+//				.append( direction )
+//				.append(element.getName())
+//				.append("( ")
+//				.append( fDataTypeFactory.typeName(element) )
+//				.appendEol(" );");
+//			}
+//		else {
+//			writer.appendTab(element.getVisibility().toString())
+//				.append(" port ")
+//				.append( direction )
+//				.append(element.getName())
+//				.append("( ")
+//				.append( fDataTypeFactory.typeName(element) )
+//				.appendEol(" );");
+//		}
+
+		writer.appendTab(element.getVisibility().toString())
+			.append(" port ")
+			.append( direction )
+			.append(element.getName());
+
+		if(element.getType() == null) {
+			writer.appendEol(" ; /* port without a typed argument */");
+		} else {
+			writer.append("( ")
+				.append( fDataTypeFactory.typeName(element) )
+				.appendEol(" );");
+		}
+	}
+
+
+	/**
+	 * @param Port
+	 * @return direction as string
+	 */
+	public String portDirection(Port element) {
+		DirectedPort flowPort = StereotypeUtil.getDirectedPort(element);
+		if( flowPort != null ) {
+			switch( flowPort.getDirection() ) {
+				case IN: {
+					return "input ";
+				}
+				case OUT: {
+					return "output ";
+				}
+				case INOUT:
+				default: {
+					return "inout ";
+				}
+			}
+		}
+
+		return "inout ";
+	}
+
+
+	/**
+	 * performTransform a Signal element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformSignal(Signal element, PrettyPrintWriter writer) {
+		writer.appendTab(element.getVisibility().toString())
+			.append(" signal");
+		if( element.getName() != null ) {
+			writer.append(' ')
+				.append(element.getName());
+		}
+
+		writer.append("(");
+		boolean firstParam = true;
+		for( Property itProp : element.getAllAttributes() ) {
+			if( firstParam ) {
+				firstParam = false;
+			}
+			else {
+				writer.append(", ");
+			}
+
+			writer.append( fDataTypeFactory.typeName(itProp) );
+			}
+		writer.appendEol(");");
+	}
+
+	/**
+	 * performTransform an environmental Connector element to a writer
+	 * @param element
+	 * @param port_connectorEnd i.e. prt of the formalPart that isn't the environment
+	 * @param writer
+	 */
+	private void transformEnvironmentConnector(Connector element, ConnectorEnd port_connectorEnd, PrettyPrintWriter writer) {
+		writer.appendTab("connect< env >");
+		if( element.getName() != null ) {
+			writer.append(" ")
+				.append(element.getName());
+		}
+		writer.appendEol(" {");
+		Property itProperty = port_connectorEnd.getPartWithPort();
+		ConnectableElement itRole = port_connectorEnd.getRole();
+		if( itRole instanceof Port ) {
+			writer.appendTab2Eol(
+					portDirection((Port)itRole) + " " +
+					itProperty.getName() +
+					"->" + itRole.getName() + ";");
+			writer.appendTabEol("}");
+		}
+		else {
+			writer.appendEol(" ERROR : end is not a Port ");
+			return;
+		}
+	}
+
+	/**
+	 * performTransform an environmental Connector element to a writer
+	 * @param element
+	 * @param port_connectorEnd i.e. prt of the formalPart that isn't the environment
+	 * @param writer
+	 */
+	private void transformRelationshipConnector(Connector element, PrettyPrintWriter writer) {
+		Behavior connectorContract = (element.getContracts().isEmpty()
+				? null : element.getContracts().get(0) );
+
+		writer.appendTab("connect");
+
+		if( connectorContract != null ) {
+			writer.append("< ");
+			transformBehaviorBody(connectorContract,
+					new PrettyPrintWriter(writer, "", "", ""));
+			writer.append(" >");
+		}
+
+		if( element.getName() != null ) {
+			writer.append(" ")
+				.append(element.getName());
+		}
+		writer.appendEol(" {");
+
+		Configuration parent_context = StereotypeUtil.getConfiguration(element);
+
+		EList<Property> environmental_properties;
+		if (parent_context != null && parent_context.getEnv() != null) {
+			environmental_properties = parent_context.getEnv();
+		} else {
+			environmental_properties = new BasicEList.UnmodifiableEList<Property>(0, null);
+		}
+
+		for( ConnectorEnd itConnectorEnd : element.getEnds() ) {
+			Property itProperty = itConnectorEnd.getPartWithPort();
+			String comment_on_part = "";
+			if (environmental_properties.contains(itProperty)) {
+				comment_on_part = " /* in formal context 'environment' */";
+			}
+			ConnectableElement itRole = itConnectorEnd.getRole();
+			writer.appendTab2Eol(
+					portDirection((Port)itRole) + " " +
+					itProperty.getName() +
+					"->" + itRole.getName() + ";" + comment_on_part);
+		}
+	}
+
+	/**
+	 * performTransform a Connector element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformConnector(Connector element, PrettyPrintWriter writer) {
+
+		int number_ends = element.getEnds().size();
+
+		if(number_ends > 2) {
+			writer.appendEol(" ERROR : connector has more than 2 ends ");
+			return;
+		}
+
+		if(number_ends <= 1) {
+			writer.appendEol(" ERROR : connector has less than 2 ends ");
+			return;
+		}
+
+		if(number_ends == 2) {
+			ConnectorEnd zero_connectorEnd = element.getEnds().get(0);
+			ConnectorEnd one_connectorEnd = element.getEnds().get(1);
+			ConnectableElement zero_Role = zero_connectorEnd.getRole();
+			ConnectableElement one_Role = one_connectorEnd.getRole();
+
+			if( zero_Role instanceof Port && one_Role instanceof Port) {
+				transformRelationshipConnector(element, writer);
+				return;
+			} else if(zero_Role instanceof Port && !(one_Role instanceof Port)) {
+				transformEnvironmentConnector(element, zero_connectorEnd, writer);
+				return;
+			} else if(one_Role instanceof Port && !(zero_Role instanceof Port)) {
+				transformEnvironmentConnector(element, one_connectorEnd, writer);
+				return;
+			} else {
+				return;
+			}
+		}
+
+	}
+
+
+
+	/**
+	 * performTransform a Value Specification element to a writer
+	 * @param value
+	 * @param writer
+	 */
+	public boolean isExpressionSymbol(ValueSpecification value, String aSymbol) {
+		if( value instanceof Expression ) {
+			return( aSymbol.equals( ((Expression) value).getSymbol() ) );
+		}
+
+		return( false );
+	}
+
+	public boolean isConstraintSymbol(Constraint constraint, String aSymbol) {
+		if( constraint != null ) {
+			return( isExpressionSymbol(constraint.getSpecification(), aSymbol) );
+		}
+
+		return( false );
+	}
+
+	public void transformValueSpecification(
+			ValueSpecification value, PrettyPrintWriter writer) {
+		if( value instanceof LiteralBoolean ) {
+			writer.append(value.booleanValue());
+		}
+		else if( value instanceof LiteralInteger ) {
+			writer.append(value.integerValue());
+		}
+		else if( value instanceof LiteralReal ) {
+			writer.append(value.realValue());
+		}
+		else if( value instanceof LiteralString ) {
+			writer.append(value.stringValue());
+		}
+		else if( value instanceof LiteralUnlimitedNatural ) {
+			writer.append(value.unlimitedValue());
+		}
+		else if( value instanceof Expression ) {
+			writer.append("(");
+
+			Expression expr = (Expression) value;
+
+			writer.append( (expr.getSymbol() != null) ?
+					expr.getSymbol() : "<symbol:null>" );
+
+			for(ValueSpecification vs : expr.getOperands() ) {
+				writer.append(" ");
+				transformValueSpecification(vs, writer);
+			}
+
+			writer.append(")");
+		}
+		else if(  value != null ) {
+			final String name = value.getName();
+			if( name != null ) {
+				writer.append("ValueSpecification< ")
+					.append(name)
+					.append(" > ");
+			}
+			writer.append(value.toString());
+		}
+	}
+
+}
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/StatemachineCodeGenerator.java b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/StatemachineCodeGenerator.java
new file mode 100644
index 0000000..64123f0
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/factory/StatemachineCodeGenerator.java
@@ -0,0 +1,494 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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:
+ *     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.efm.formalml.concretesyntax.m2t.factory;
+
+import org.eclipse.efm.formalml.ReceiveEvent;
+import org.eclipse.efm.formalml.TimedTransition;
+import org.eclipse.efm.formalml.concretesyntax.m2t.util.PrettyPrintWriter;
+import org.eclipse.efm.formalml.util.StereotypeUtil;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Event;
+import org.eclipse.uml2.uml.FinalState;
+import org.eclipse.uml2.uml.OpaqueExpression;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Pseudostate;
+import org.eclipse.uml2.uml.Region;
+import org.eclipse.uml2.uml.SignalEvent;
+import org.eclipse.uml2.uml.State;
+import org.eclipse.uml2.uml.StateMachine;
+import org.eclipse.uml2.uml.Transition;
+import org.eclipse.uml2.uml.Trigger;
+import org.eclipse.uml2.uml.ValueSpecification;
+import org.eclipse.uml2.uml.Vertex;
+
+public class StatemachineCodeGenerator extends AbstractCodeGenerator {
+
+	/**
+	 * Constructor
+	 */
+	public StatemachineCodeGenerator(MainCodeGenerator supervisor) {
+		super(supervisor);
+	}
+
+
+	/**
+	 * performTransform dispatcher for any element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void performTransformImpl(Element element, PrettyPrintWriter writer) {
+		if( element instanceof StateMachine ) {
+			transformStatemachine((StateMachine)element, writer);
+		}
+
+		else if( element instanceof Region ) {
+			transformRegion((Region)element, writer);
+		}
+
+		else if( element instanceof Pseudostate ) {
+			transformPseudostate((Pseudostate)element, writer);
+		}
+		else if( element instanceof FinalState ) {
+			transformFinalState((FinalState)element, writer);
+		}
+		else if( element instanceof State ) {
+			transformState((State)element, writer);
+		}
+		else if( element instanceof Vertex ) {
+			transformVertexContent((Vertex)element, writer);
+		}
+		else if( element instanceof Transition ) {
+			transformTransition((Transition)element, writer);
+		}
+
+		else {
+			performTransformError(this, element);
+		}
+	}
+
+	/**
+	 * performTransform a StateMachine element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformStatemachine(
+			StateMachine element, PrettyPrintWriter writer) {
+		final EList<Region> listOfRegion = element.getRegions();
+
+		writer.appendTab("statemachine< ")
+			.append( (listOfRegion.size() > 1) ? "and" : "or" )
+			.append(" > ")
+			.append(element.getName())
+			.appendEol(" {");
+
+		transformRegion(listOfRegion, writer);
+
+		writer.appendTab("} // end statemachine ")
+			.appendEol2(element.getName());
+	}
+
+
+	/**
+	 * performTransform a Region List element to a writer
+	 * @param listOfRegion
+	 * @param writer
+	 */
+	public void transformRegion(
+			EList<Region> listOfRegion, PrettyPrintWriter writer) {
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		int regionCount = listOfRegion.size();
+		if( regionCount == 1 ) {
+			Region uniqRegion = listOfRegion.get(0);
+
+			writer.appendTab("@region: // name: ")
+				.appendEol(uniqRegion.getName());
+
+			transformRegionBody(uniqRegion, writer2);
+
+			writer.appendTab("// end @region: ")
+				.appendEol(uniqRegion.getName());
+		}
+		else if( regionCount >= 2 ) {
+			writer.appendTabEol("@composite:"/*"@region:"*/);
+
+			// A writer indenting with TAB2 + TAB -> TAB2
+			PrettyPrintWriter writer3 = writer2.itab2();
+
+			for( Region itRegion : listOfRegion ) {
+				writer2.appendTab("state< or > ")
+					.append( itRegion.getName() )
+					.appendEol(" {");
+
+				writer2.appendTabEol("@region:");
+				transformRegionBody(itRegion, writer3);
+
+				writer2.appendTab("} // end region ")
+					.appendEol2(itRegion.getName());
+			}
+		}
+	}
+
+
+	/**
+	 * performTransform a Region element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformRegion(Region element, PrettyPrintWriter writer) {
+		writer.appendTab("region ")
+			.append(element.getName())
+			.appendEol(" {");
+
+		// A writer indenting with TAB + iTAB -> TAB2
+		transformRegionBody(element, writer.itab2());
+
+		writer.appendTab("} // end region ")
+			.appendEol2(element.getName());
+	}
+
+	/**
+	 * performTransform a Region element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformRegionBody(Region element, PrettyPrintWriter writer) {
+		for( Vertex itVertex : element.getSubvertices() ) {
+			if( itVertex instanceof Pseudostate ) {
+				transformPseudostate((Pseudostate)itVertex, writer);
+			}
+			else if( itVertex instanceof FinalState ) {
+				transformFinalState((FinalState)itVertex, writer);
+			}
+			else if( itVertex instanceof State ) {
+				transformState((State)itVertex, writer);
+			}
+			else if( itVertex instanceof Vertex ) {
+				transformVertex(itVertex, writer);
+			}
+		}
+	}
+
+	/**
+	 * performTransform a Pseudostate element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformPseudostate(
+			Pseudostate element, PrettyPrintWriter writer) {
+		writer.appendTab("state< ")
+			.append(element.getKind().toString())
+			.append(" > ")
+			.append(element.getName())
+			.appendEol(" {");
+
+		transformVertexContent(element, writer);
+
+		writer.appendTab("} // end pseudo-state ")
+			.appendEol2(element.getName());
+	}
+
+	/**
+	 * performTransform a FinalState element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformFinalState(
+			FinalState element, PrettyPrintWriter writer) {
+		writer.appendTab("state< final > ")
+			.append(element.getName())
+			.appendEol(" {");
+
+		transformVertexContent(element, writer);
+
+		writer.appendTab("} // end final-state ")
+			.appendEol2(element.getName());
+	}
+
+	/**
+	 * performTransform a State element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformState(State element, PrettyPrintWriter writer) {
+		writer.appendTab("state");
+		if( element.isOrthogonal() ) {
+			writer.append("< and >");
+		}
+		else if( element.isComposite() ) {
+			writer.append("< or >");
+		}
+		writer.append(' ')
+			.append(element.getName())
+			.appendEol(" {");
+
+		transformStateActivity(element, writer);
+
+		transformVertexContent(element, writer);
+
+		transformConnectionPoint(element, writer);
+
+		transformRegion(element.getRegions(), writer);
+
+		writer.appendTab("} // end state ")
+			.appendEol2(element.getName());
+	}
+	
+	
+	public void transformConnectionPoint(State element, PrettyPrintWriter writer) {
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		for( Pseudostate itPoint : element.getConnectionPoints() ) {
+			transformPseudostate(itPoint, writer2);
+		}
+	}
+
+
+	/**
+	 * performTransform a Vertex Content element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformStateActivity(
+			State element, PrettyPrintWriter writer) {
+		
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		transformStateActivityBody("enable", element.getEntry(), writer2);
+
+		transformStateActivityBody("irun", element.getDoActivity(), writer2);
+
+		transformStateActivityBody("disable", element.getExit(), writer2);
+	}
+
+	public void transformStateActivityBody(
+			String name, Behavior activity, PrettyPrintWriter writer) {
+		if( activity != null ) {
+			writer.appendTab("@")
+				.append(name)
+				.appendEol("{");
+	
+			fSupervisor.transformBehaviorBody(activity, writer.itab2());
+
+			writer.appendTab("} // end ")
+				.appendEol(name);
+		}
+	}
+
+	/**
+	 * performTransform a Vertex element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformVertex(Vertex element, PrettyPrintWriter writer) {
+		writer.appendTab("vertex ")
+			.append(element.getName())
+			.appendEol(" {");
+
+		transformVertexContent(element, writer);
+
+		writer.appendTab("} // end vertex ")
+			.appendEol2(element.getName());
+	}
+
+	/**
+	 * performTransform a Vertex Content element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformVertexContent(
+			Vertex element, PrettyPrintWriter writer) {
+		// A writer indenting with TAB + iTAB -> TAB2
+		PrettyPrintWriter writer2 = writer.itab2();
+
+		for( Transition itTransition : element.getOutgoings() ) {
+			transformTransition(itTransition, writer2);
+			// Si ce n'est pas la dernière transition sortante,
+			// Ajout d'un saut de ligne supplémentaire
+			if( element.getOutgoings().indexOf(itTransition) !=
+					(element.getOutgoings().size() - 1) ) {
+				writer.appendEol();
+			}
+		}
+	}
+
+	/**
+	 * performTransform a Transition element to a writer
+	 * @param element
+	 * @param writer
+	 */
+	public void transformTransition(Transition element, PrettyPrintWriter writer) {
+		TimedTransition timedTransition =
+				StereotypeUtil.getTimedTransition(element);
+		
+		boolean isElseGuard =
+				fSupervisor.isConstraintSymbol(element.getGuard(), "else");
+
+		boolean isElseTransition = isElseGuard && (timedTransition == null);
+		
+		writer.appendTab("transition");
+		if( isElseTransition ) {
+			writer.append("< else >");
+		}
+		
+		if( element.getName() != null ) {
+			writer.append(' ')
+				.append(element.getName());
+		}
+		writer.appendEol(" {");
+
+		// Triggers
+		//
+		if( fSupervisor.showTransitionSection ) {
+			writer.appendTabEol("@trigger:");
+		}
+		for( Trigger itTrigger : element.getTriggers() ) {
+			transformTrigger(itTrigger, writer);
+		}
+
+		// Guard
+		//
+		if( ! isElseGuard ) {
+			if( fSupervisor.showTransitionSection ) {
+				writer.appendTabEol("@guard:");
+			}
+			Constraint guard = element.getGuard();
+			if( guard != null ) {
+				ValueSpecification vsGuard = guard.getSpecification();
+				if( vsGuard instanceof OpaqueExpression ) {
+					OpaqueExpression exprGuard = (OpaqueExpression) vsGuard;
+					for( String body : exprGuard.getBodies() ) {
+						if( fSupervisor.showTransitionSection ) {
+							writer.appendTab2Eol( body );
+						}
+						else {
+							writer.appendTab2Eol("guard( " + body + " );");
+						}
+					}
+				}
+				else {
+					writer.appendTab2();
+					fSupervisor.transformValueSpecification(vsGuard, writer);
+					writer.appendEol();
+				}
+			}
+		}
+
+		// Timed Guard
+		//
+		if( fSupervisor.showTransitionSection ) {
+			writer.appendTabEol("@tguard:");
+		}
+		if( timedTransition != null ) {
+			Constraint constraint = timedTransition.getTguard();
+			if( constraint != null ) {
+				ValueSpecification vsTGuard = constraint.getSpecification();
+				if( vsTGuard instanceof OpaqueExpression ) {
+					OpaqueExpression exprTGuard = (OpaqueExpression) vsTGuard;
+					for( String body : exprTGuard.getBodies() ) {
+						if( fSupervisor.showTransitionSection ) {
+							writer.appendTab2Eol( body );
+						}
+						else {
+							writer.appendTab2Eol("tguard( " + body + " );");
+						}
+					}
+				}
+				else {
+					writer.appendTab2();
+					fSupervisor.transformValueSpecification(vsTGuard, writer);
+					writer.appendEol();
+				}
+			}
+		}
+
+		// Behavior
+		//
+		if( fSupervisor.showTransitionSection ) {
+			writer.appendTabEol("@effect:");
+		}
+		
+		fSupervisor.transformBehaviorBody(
+				element.getEffect(), writer.itab2());
+
+		writer.appendTab("} --> ")
+				.append(element.getTarget().getName())
+				.appendEol(";");
+	}
+
+
+	/**
+	 * performTransform a Trigger element to a writer
+	 * @param trigger
+	 * @param writer
+	 */
+	public void transformTrigger(Trigger trigger, PrettyPrintWriter writer) {
+
+		writer.appendTab2("input ");
+
+		int portCount = trigger.getPorts().size();
+
+		if( portCount == 1 ) {
+			writer.append( trigger.getPorts().get(0).getName() );
+		}
+		else if( portCount > 1 ) {
+			writer.append("[");
+			boolean isnotFirst = false;
+			for( Port port : trigger.getPorts() ) {
+				if( isnotFirst ) {
+					writer.append( " , " );
+				}
+				else {
+					isnotFirst = true;
+				}
+				writer.append( port.getName() );
+			}
+			writer.append("]");
+		}
+
+		final Event event = trigger.getEvent();
+		if( event != null ) {
+//			writer.append("/* event: ").append(event.getName()).append(" */");
+			if( event instanceof SignalEvent ) {
+				if( portCount > 0 ) {
+					writer.append(' ');
+				}
+				writer.append(((SignalEvent) event).getSignal().getName());
+			}
+
+			ReceiveEvent inputEvent = StereotypeUtil.getReceiveEvent(event);
+			if( (inputEvent!=null) && (! inputEvent.getParameters().isEmpty()) ) {
+				writer.append('(');
+				boolean isnotFirst = false;
+				for( Property param : inputEvent.getParameters() ) {
+					if( isnotFirst ) {
+						writer.append(", ");
+					}
+					else {
+						isnotFirst = true;
+					}
+					writer.append(param.getName());
+				}
+				writer.append(")");
+			}
+		}
+
+		writer.appendEol(";");
+	}
+
+}
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/util/LogStatus.java b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/util/LogStatus.java
new file mode 100644
index 0000000..8b29cbf
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/util/LogStatus.java
@@ -0,0 +1,24 @@
+/*******************************************************************************

+ * Copyright (c) 2016 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:

+ *     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.efm.formalml.concretesyntax.m2t.util;

+

+import org.eclipse.core.runtime.Status;

+import org.eclipse.efm.formalml.concretesyntax.m2t.Activator;

+

+public class LogStatus extends Status {

+

+	/** Message buffer.

+	 */

+	public LogStatus(int severity, String message) {

+		super(severity, Activator.PLUGIN_ID, message);

+	}

+

+}

diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/util/PrettyPrintWriter.java b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/util/PrettyPrintWriter.java
new file mode 100644
index 0000000..8e581af
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/util/PrettyPrintWriter.java
@@ -0,0 +1,329 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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:
+ *     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.efm.formalml.concretesyntax.m2t.util;
+
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.io.Writer;
+
+public class PrettyPrintWriter extends PrintWriter {
+
+	public static String DEFAULT_TAB  = "";
+	public static String DEFAULT_ITAB = "\t";
+	public static String DEFAULT_EOL  = "\n";
+
+	protected Writer writer;
+
+	public String EOL;
+	public String EOL2;
+
+	public String iTAB;
+
+	public String TAB1;
+	public String TAB2;
+	public String TAB3;
+	public String TAB4;
+	public String TAB5;
+
+
+	////////////////////////////////////////////////////////////////////////////
+	// CONSTRUCTOR
+	////////////////////////////////////////////////////////////////////////////
+
+	public PrettyPrintWriter(Writer writer, String tab, String itab, String eol) {
+		super( writer );
+
+		this.writer = writer;
+
+		this.TAB1 = tab;
+		this.iTAB = itab;
+
+		this.EOL  = eol;
+		this.EOL2 = this.EOL + eol;
+
+		this.TAB2 =  this.TAB1 + this.iTAB;
+		this.TAB3 =  this.TAB2 + this.iTAB;
+		this.TAB4 =  this.TAB3 + this.iTAB;
+		this.TAB5 =  this.TAB4 + this.iTAB;
+	}
+
+	public PrettyPrintWriter(String fileName, String tab, String itab, String eol)
+			throws FileNotFoundException{
+		super( fileName );
+
+		this.TAB1 = tab;
+		this.iTAB = itab;
+
+		this.EOL  = eol;
+		this.EOL2 = this.EOL + eol;
+
+		this.TAB2 =  this.TAB1 + this.iTAB;
+		this.TAB3 =  this.TAB2 + this.iTAB;
+		this.TAB4 =  this.TAB3 + this.iTAB;
+		this.TAB5 =  this.TAB4 + this.iTAB;
+	}
+
+
+	public PrettyPrintWriter(Writer writer, String tab, String itab) {
+		this(writer, tab, itab, DEFAULT_EOL);
+	}
+
+	public PrettyPrintWriter(Writer writer, String tab) {
+		this(writer, tab, DEFAULT_ITAB, DEFAULT_EOL);
+	}
+
+	public PrettyPrintWriter(Writer writer) {
+		this(writer, DEFAULT_TAB, DEFAULT_ITAB, DEFAULT_EOL);
+	}
+
+	public String tab(int count) {
+		String ntab = TAB1;
+		for( ; count > 0 ; --count ) {
+			ntab += iTAB;
+		}
+
+		return( ntab );
+	}
+
+	public void pushTab(int count) {
+		if( count > 0 ) {
+			super.append( TAB1 );
+
+			for( ; count > 0 ; --count ) {
+				super.append( iTAB );
+			}
+		}
+	}
+
+
+	////////////////////////////////////////////////////////////////////////////
+	// INDENTATION
+	////////////////////////////////////////////////////////////////////////////
+
+	public PrettyPrintWriter itab(String tab, String itab, String eol) {
+		return( new PrettyPrintWriter(this, tab, itab, eol) );
+	}
+
+	public PrettyPrintWriter notab() {
+		return( new PrettyPrintWriter(this, "", "", "") );
+	}
+
+	public PrettyPrintWriter itab2() {
+		return( new PrettyPrintWriter(this, TAB2, iTAB, EOL) );
+	}
+
+	public PrettyPrintWriter itab2(String eol) {
+		return( new PrettyPrintWriter(this, TAB2, iTAB, eol) );
+	}
+
+
+	public PrettyPrintWriter itab3() {
+		return( new PrettyPrintWriter(this, TAB3, iTAB, EOL) );
+	}
+
+	public PrettyPrintWriter itab4() {
+		return( new PrettyPrintWriter(this, TAB4, iTAB, EOL) );
+	}
+
+	public PrettyPrintWriter itab5() {
+		return( new PrettyPrintWriter(this, TAB5, iTAB, EOL) );
+	}
+
+	public PrettyPrintWriter itab(int count) {
+		return( new PrettyPrintWriter(this, tab(count), iTAB, EOL) );
+	}
+
+
+	////////////////////////////////////////////////////////////////////////////
+	// append STRING
+	////////////////////////////////////////////////////////////////////////////
+
+	public PrettyPrintWriter append(char c) {
+		super.append( c );
+
+		return this;
+	}
+
+	public PrettyPrintWriter append(String str) {
+		super.append( str );
+
+		return this;
+	}
+
+	public PrettyPrintWriter append(boolean value) {
+		super.print(value);
+
+		return this;
+	}
+
+	public PrettyPrintWriter append(int value) {
+		super.print(value);
+
+		return this;
+	}
+
+	public PrettyPrintWriter append(float value) {
+		super.print(value);
+
+		return this;
+	}
+
+	public PrettyPrintWriter append(double value) {
+		super.print(value);
+
+		return this;
+	}
+
+
+	////////////////////////////////////////////////////////////////////////////
+	// append TAB & STRING
+	////////////////////////////////////////////////////////////////////////////
+
+	public PrettyPrintWriter appendTab() {
+		super.append( TAB1 );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendTab(String str) {
+		super.append( TAB1 ).append( str );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendTabEol(String str) {
+		super.append( TAB1 ).append( str ).append( EOL );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendTabEol2(String str) {
+		super.append( TAB1 ).append( str ).append( EOL2 );
+
+		return this;
+	}
+
+
+	public PrettyPrintWriter appendEol_Eol(String str) {
+		super.append( EOL ).append( str ).append( EOL );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendEolTab(String str) {
+		super.append( EOL ).append( TAB1 ).append( str );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendEolTab2(String str) {
+		super.append( EOL ).append( TAB2 ).append( str );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendEolTab_Eol(String str) {
+		super.append( EOL ).append( TAB1 ).append( str ).append( EOL );
+
+		return this;
+	}
+
+
+
+	////////////////////////////////////////////////////////////////////////////
+	// append TAB2 & STRING
+	////////////////////////////////////////////////////////////////////////////
+
+	public PrettyPrintWriter appendTab2() {
+		super.append( TAB2 );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendTab2(String str) {
+		super.append( TAB2 ).append( str );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendTab2Eol(String str) {
+		super.append( TAB2 ).append( str ).append( EOL );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendTab2Eol2(String str) {
+		super.append( TAB2 ).append( str ).append( EOL2 );
+
+		return this;
+	}
+
+
+	////////////////////////////////////////////////////////////////////////////
+	// append TAB3 & STRING
+	////////////////////////////////////////////////////////////////////////////
+
+	public PrettyPrintWriter appendTab3() {
+		super.append( TAB3 );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendTab3(String str) {
+		super.append( TAB3 ).append( str );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendTab3Eol(String str) {
+		super.append( TAB3 ).append( str ).append( EOL );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendTab3Eol2(String str) {
+		super.append( TAB3 ).append( str ).append( EOL2 );
+
+		return this;
+	}
+
+
+	////////////////////////////////////////////////////////////////////////////
+	// append STRING & EOL
+	////////////////////////////////////////////////////////////////////////////
+
+	public PrettyPrintWriter appendEol() {
+		super.append( EOL );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendEol(String str) {
+		super.append( str ).append( EOL );
+
+		return this;
+	}
+
+
+	public PrettyPrintWriter appendEol2() {
+		super.append( EOL2 );
+
+		return this;
+	}
+
+	public PrettyPrintWriter appendEol2(String str) {
+		super.append( str ).append( EOL2 );
+
+		return this;
+	}
+
+
+}
diff --git a/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/util/SimpleLogger.java b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/util/SimpleLogger.java
new file mode 100644
index 0000000..bb22eb2
--- /dev/null
+++ b/codegen/org.eclipse.efm.formalml.concretesyntax.m2t/src/org/eclipse/efm/formalml/concretesyntax/m2t/util/SimpleLogger.java
@@ -0,0 +1,247 @@
+/*******************************************************************************

+ * Copyright (c) 2016 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:

+ *     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr - initial API and implementation

+ *******************************************************************************/

+package org.eclipse.efm.formalml.concretesyntax.m2t.util;

+

+import java.util.ArrayList;

+

+import org.eclipse.core.runtime.IStatus;

+import org.eclipse.jface.dialogs.MessageDialog;

+

+public class SimpleLogger {

+

+	protected ArrayList<IStatus> fLogs;

+

+//	protected static IStatus fDoneStatus = new LogStatus(IStatus.INFO, "Done.");

+

+	protected int fErrorCount;

+	protected int fWarningCount;

+	protected int fInfoCount;

+	protected int fCancelCount;

+	protected int fOkCount;

+

+

+	public SimpleLogger() {

+		super();

+

+		fLogs = new ArrayList<>();

+	}

+

+

+	public boolean reset() {

+		fLogs.clear();

+

+		return( true );

+	}

+

+	public boolean hasError() {

+		return( fErrorCount > 0 );

+	}

+

+	public boolean hasWrarning() {

+		return( fWarningCount > 0 );

+	}

+

+	public boolean hasInfo() {

+		return( fInfoCount > 0 );

+	}

+

+	public boolean hasCancel() {

+		return( fCancelCount > 0 );

+	}

+

+	public boolean hasOk() {

+		return( fOkCount > 0 );

+	}

+

+	public int getMessageDialogKind() {

+		if( fErrorCount > 0) {

+			return MessageDialog.ERROR;

+		}

+		else if( fWarningCount > 0) {

+			return MessageDialog.WARNING;

+		}

+		else if( fInfoCount > 0) {

+			return MessageDialog.INFORMATION;

+		}

+		else if( fCancelCount > 0) {

+			return MessageDialog.CANCEL;

+		}

+		else if( fOkCount > 0) {

+			return MessageDialog.OK;

+		}

+		else {

+			return MessageDialog.INFORMATION;

+		}

+	}

+

+

+	public boolean equals(IStatus aStatus, IStatus bStatus) {		

+		return( (aStatus.getSeverity() == bStatus.getSeverity())

+				&& (aStatus.getMessage() != null)

+				&& (bStatus.getMessage() != null)

+				&& aStatus.getMessage().equals(bStatus.getMessage()) );

+	}

+

+	public boolean exists(IStatus aStatus) {

+		for (IStatus iStatus : fLogs) {

+			if( equals(aStatus, iStatus) ) {

+				return( true );

+			}

+		}

+		

+		return( false );

+	}

+

+	public void log(IStatus aStatus) {

+		if( exists(aStatus) ) {

+			return;

+		}

+		

+		switch( aStatus.getSeverity() ) {

+			case IStatus.ERROR:

+				fErrorCount += 1;

+				break;

+

+			case IStatus.WARNING:

+				fWarningCount += 1;

+				break;

+

+			case IStatus.INFO:

+				fInfoCount += 1;

+				break;

+

+			case IStatus.CANCEL:

+				fCancelCount += 1;

+				break;

+

+			case IStatus.OK:

+				fOkCount += 1;

+				break;

+

+			default:

+				break;

+		}

+

+		fLogs.add(aStatus);

+	}

+

+

+

+	protected void format(StringBuffer buffer, IStatus aStatus) {

+		buffer.append("[fml2cs] "); //$NON-NLS-1$

+

+		switch( aStatus.getSeverity() ) {

+			case IStatus.ERROR:

+				buffer.append( String.format("%-8s", "ERROR") ); //$NON-NLS-1$

+				break;

+

+			case IStatus.WARNING:

+				buffer.append( String.format("%-8s", "WARNING") ); //$NON-NLS-1$

+				break;

+

+			case IStatus.INFO:

+				buffer.append( String.format("%-8s", "INFO") ); //$NON-NLS-1$

+				break;

+

+			case IStatus.CANCEL:

+				buffer.append( String.format("%-8s", "CANCEL") ); //$NON-NLS-1$

+				break;

+

+			case IStatus.OK:

+				buffer.append( String.format("%-8s", "OK") ); //$NON-NLS-1$

+				break;

+

+			default:

+				buffer.append( String.format("%-8s", "SEVER:") ) //$NON-NLS-1$

+					.append( aStatus.getSeverity() )

+					.append(" ");

+				break;

+		}

+

+		buffer.append("- ")

+			.append(aStatus.getMessage());

+	}

+

+	protected String format(IStatus aStatus) {

+		StringBuffer buffer = new StringBuffer();

+

+		format(buffer, aStatus);

+

+		return buffer.toString();

+	}

+

+

+	public String getReport() {

+		StringBuffer buffer = new StringBuffer();

+

+		buffer.append("[fml2cs] "); //$NON-NLS-1$

+		buffer.append( String.format("%-7s", "REPORT") ); //$NON-NLS-1$

+		buffer.append("- ");

+

+		buffer.append(fErrorCount).append(" error"); //$NON-NLS-1$

+		buffer.append( (fErrorCount > 1) ? "s " : " "); //$NON-NLS-1$

+

+		buffer.append(fWarningCount).append(" warning"); //$NON-NLS-1$

+		buffer.append( (fWarningCount > 1) ? "s " : " "); //$NON-NLS-1$

+

+		if( fInfoCount > 0 ) {

+			buffer.append(fInfoCount).append(" info"); //$NON-NLS-1$

+			buffer.append( (fInfoCount > 1) ? "s " : " "); //$NON-NLS-1$

+		}

+		if( (fCancelCount + fOkCount) > 0 ) {

+			buffer.append(fCancelCount + fOkCount).append(" other"); //$NON-NLS-1$

+			buffer.append( ((fCancelCount + fOkCount) > 1) ? "s " : " "); //$NON-NLS-1$

+		}

+

+		buffer.append('\n');

+

+		if( fLogs.isEmpty() ) {

+//			format(buffer, fDoneStatus);

+			buffer.append("[fml2cs] "); //$NON-NLS-1$

+			buffer.append( String.format("%-9s", "DONE") ); //$NON-NLS-1$

+			buffer.append("- FIN");

+			buffer.append('\n');

+		}

+		else {

+			for (IStatus iStatus : fLogs) {

+				format(buffer, iStatus);

+				buffer.append('\n');

+			}

+		}

+

+		return buffer.toString();

+	}

+

+	public void report() {

+		if( fLogs.isEmpty() ) {

+//			System.out.println( format(fDoneStatus) );

+			System.out.print( "[fml2cs] " );

+			System.out.println( String.format("%-8s", "DONE.") ); //$NON-NLS-1$

+		}

+		else {

+			for (IStatus iStatus : fLogs) {

+				System.out.println( format(iStatus) );

+			}

+		}

+	}

+

+

+	public void error(String message) {

+		LogStatus status = new LogStatus(IStatus.ERROR, message);

+		log( status );

+	}

+

+	public void warning(String message) {

+		LogStatus status = new LogStatus(IStatus.WARNING, message);

+		log( status );

+	}

+

+}

diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/.classpath b/codegen/org.eclipse.efm.papyrus.m2t.ui/.classpath
new file mode 100644
index 0000000..2f5ffb2
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/.classpath
@@ -0,0 +1,8 @@
+<?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-1.8"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="xtend-gen"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/.gitignore b/codegen/org.eclipse.efm.papyrus.m2t.ui/.gitignore
new file mode 100644
index 0000000..bbdfc34
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/.gitignore
@@ -0,0 +1,2 @@
+/bin/
+*.md.html
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/.project b/codegen/org.eclipse.efm.papyrus.m2t.ui/.project
new file mode 100644
index 0000000..6a417d3
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.efm.papyrus.m2t.ui</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<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>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+	</natures>
+</projectDescription>
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/.settings/org.eclipse.core.resources.prefs b/codegen/org.eclipse.efm.papyrus.m2t.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/.settings/org.eclipse.jdt.core.prefs b/codegen/org.eclipse.efm.papyrus.m2t.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/.settings/org.eclipse.m2e.core.prefs b/codegen/org.eclipse.efm.papyrus.m2t.ui/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/META-INF/MANIFEST.MF b/codegen/org.eclipse.efm.papyrus.m2t.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2b0421e
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.efm.papyrus.m2t.ui;singleton:=true
+Bundle-Version: 0.0.1.qualifier
+Bundle-Activator: org.eclipse.efm.papyrus.m2t.ui.Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.uml2.uml,
+ org.eclipse.core.resources,
+ com.google.guava,
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.xtend.lib,
+ org.eclipse.xtend.lib.macro,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.uml.diagram.common,
+ org.eclipse.jface,
+ org.eclipse.efm.formalml.concretesyntax.m2t,
+ org.eclipse.core.expressions,
+ org.eclipse.papyrus.infra.tools,
+ org.eclipse.papyrus.designer.languages.common.base,
+ org.eclipse.papyrus.designer.languages.common.extensionpoints
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/about.html b/codegen/org.eclipse.efm.papyrus.m2t.ui/about.html
new file mode 100644
index 0000000..d35d5ae
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/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/codegen/org.eclipse.efm.papyrus.m2t.ui/build.properties b/codegen/org.eclipse.efm.papyrus.m2t.ui/build.properties
new file mode 100644
index 0000000..00ca8b5
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/build.properties
@@ -0,0 +1,7 @@
+source.. = src/,\
+           xtend-gen/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               icons/
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/icons/alt_diversity.png b/codegen/org.eclipse.efm.papyrus.m2t.ui/icons/alt_diversity.png
new file mode 100644
index 0000000..05d4eaf
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/icons/alt_diversity.png
Binary files differ
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/plugin.xml b/codegen/org.eclipse.efm.papyrus.m2t.ui/plugin.xml
new file mode 100644
index 0000000..284e050
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/plugin.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.core.expressions.definitions">
+      <definition
+            id="org.eclipse.efm.papyrus.m2t.ui.definition.isEnabledDebugCodegen">
+         <or>
+             <with
+                  variable="activeEditorId">
+               <equals
+                     value="org.eclipse.papyrus.infra.core.papyrusEditor">
+               </equals>
+            </with>
+            <with
+                  variable="selection">
+               <count
+                     value="1">
+               </count>
+               <iterate
+                     operator="or">
+                  <adapt
+                        type="org.eclipse.uml2.uml.Class">
+                  </adapt>
+                  <adapt
+                        type="org.eclipse.uml2.uml.Package">
+                  </adapt>
+               </iterate>
+            </with>
+         </or>
+      </definition>
+   </extension>
+   <extension
+         point="org.eclipse.ui.menus">
+      <menuContribution
+            allPopups="false"
+            locationURI="popup:org.eclipse.papyrus.designer.popup?after=codegen">
+         <command
+               commandId="org.eclipse.efm.papyrus.m2t.ui.command"
+               icon="icons/alt_diversity.png"
+               label="Generate FML Concrete Syntax code"
+               style="push">
+            <visibleWhen
+                  checkEnabled="true">
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            allPopups="true"
+            locationURI="popup:org.eclipse.ui.popup.any?after=additions">
+         <command
+               commandId="org.eclipse.efm.papyrus.m2t.ui.command.debug"
+               icon="icons/alt_diversity.png"
+               label="Debug: Generate FML Concrete Syntax code"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="org.eclipse.efm.papyrus.m2t.ui.definition.isEnabledDebugCodegen">
+               </reference>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+   </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+      <command
+            categoryId="org.eclipse.papyrus.editor.category"
+            defaultHandler="org.eclipse.efm.papyrus.m2t.ui.handlers.CodegenHandler"
+            description="Generate FML Concrete Syntax code"
+            id="org.eclipse.efm.papyrus.m2t.ui.command"
+            name="Generate FML Concrete Syntax code">
+      </command>
+      <command
+            categoryId="org.eclipse.papyrus.editor.category"
+            defaultHandler="org.eclipse.efm.papyrus.m2t.ui.handlers.CodegenHandler"
+            description="Debug: Generate FML Concrete Syntax code"
+            id="org.eclipse.efm.papyrus.m2t.ui.command.debug"
+            name="Debug: Generate FML Concrete Syntax code">
+      </command>
+   </extension>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory"
+            class="org.eclipse.efm.papyrus.m2t.ui.preferences.CodegenPreferencePage"
+            id="org.eclipse.efm.papyrus.m2t.ui.CodegenPreferencePage"
+            name="FML Code Generation">
+      </page>
+   </extension>
+   <extension
+         point="org.eclipse.papyrus.designer.languages.common.extensionpoints.languageCodegen">
+      <generator
+            class="org.eclipse.efm.papyrus.m2t.ui.LangCodegen"
+            id="FormalMLCodegen"
+            language="org.eclipse.efm.papyrus.m2t.ui.generatorFML">
+      </generator>
+   </extension>
+
+</plugin>
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/pom.xml b/codegen/org.eclipse.efm.papyrus.m2t.ui/pom.xml
new file mode 100644
index 0000000..cfec3de
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/pom.xml
@@ -0,0 +1,48 @@
+<?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.efm</groupId>
+		<artifactId>org.eclipse.efm.modeling.codegen</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+	</parent>
+	<artifactId>org.eclipse.efm.papyrus.m2t.ui</artifactId>
+	<packaging>eclipse-plugin</packaging>
+	<name>org.eclipse.efm.papyrus.m2t.ui</name>
+	<description>This plug-in contains the XXXXXXXXX.</description>
+	<build>
+		<plugins>
+			<!-- Empty out the xtend-gen folder in the clean phase. -->
+			<plugin>
+				<artifactId>maven-clean-plugin</artifactId>
+				<configuration>
+					<filesets>
+						<fileset>
+							<directory>xtend-gen</directory>
+							<excludes>
+								<exclude>**/.gitignore</exclude>
+							</excludes>
+						</fileset>
+					</filesets>
+				</configuration>
+			</plugin>
+			<!-- Generate Xtend sources in the compilation phase. -->
+			<plugin>
+				<groupId>org.eclipse.xtend</groupId>
+				<artifactId>xtend-maven-plugin</artifactId>
+				<executions>
+					<execution>
+						<goals>
+							<goal>compile</goal>
+							<goal>testCompile</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>xtend-gen</outputDirectory>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/Activator.java b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/Activator.java
new file mode 100644
index 0000000..1a8c7c8
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/Activator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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:
+ *   Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr 
+ *   - Initial API and Implementation
+ *******************************************************************************/
+package org.eclipse.efm.papyrus.m2t.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.eclipse.efm.papyrus.m2t.ui"; //$NON-NLS-1$
+
+	// The shared instance
+	private static Activator plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+}
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/LangCodegen.java b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/LangCodegen.java
new file mode 100644
index 0000000..8a163ce
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/LangCodegen.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *
+ *******************************************************************************/
+package org.eclipse.efm.papyrus.m2t.ui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.papyrus.designer.languages.common.extensionpoints.ILangCodegen2;
+import org.eclipse.papyrus.designer.languages.common.extensionpoints.MethodInfo;
+import org.eclipse.papyrus.designer.languages.common.extensionpoints.SyncInformation;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.PackageableElement;
+
+public class LangCodegen implements ILangCodegen2 {
+
+	public LangCodegen() {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public void generateCode(IProject project, PackageableElement element, IProgressMonitor monitor) {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public IProject getTargetProject(PackageableElement pe, boolean createIfMissing) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getFileName(IProject project, NamedElement element) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void cleanCode(IProject project, PackageableElement element, IProgressMonitor monitor) {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public String getDescription() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public SyncInformation getSyncInformation(String methodName, String body) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean isEligible(Element modelElement) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public String getSuffix(FILE_KIND fileKind) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public MethodInfo getMethodInfo(NamedElement operationOrBehavior) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/codegen/CodegenModelElementsCreator.java b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/codegen/CodegenModelElementsCreator.java
new file mode 100644
index 0000000..70b22c0
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/codegen/CodegenModelElementsCreator.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *
+ *******************************************************************************/
+package org.eclipse.efm.papyrus.m2t.ui.codegen;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.efm.formalml.concretesyntax.m2t.factory.MainCodeGenerator;
+import org.eclipse.efm.formalml.concretesyntax.m2t.util.SimpleLogger;
+import org.eclipse.papyrus.designer.languages.common.base.HierarchyLocationStrategy;
+import org.eclipse.papyrus.designer.languages.common.base.ModelElementsCreator;
+import org.eclipse.papyrus.infra.tools.file.ProjectBasedFileAccess;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.PackageableElement;
+
+public class CodegenModelElementsCreator extends ModelElementsCreator {
+
+	public static final String FML_GEN_FOLDER = "fml-gen"; //$NON-NLS-1$
+
+	public static final String FML_LANGUAGE = "formalML"; //$NON-NLS-1$
+
+	protected MainCodeGenerator fCodeGenerator;
+
+	public CodegenModelElementsCreator(IProject project) {
+		super(new ProjectBasedFileAccess(project),
+				new HierarchyLocationStrategy(), FML_LANGUAGE);
+
+		this.fCodeGenerator = new MainCodeGenerator();
+	}
+
+	/**
+	 * Transformation reporting
+	 */
+	public SimpleLogger getReportLogger() {
+		return this.fCodeGenerator.getReportLogger();
+	}
+
+	@Override
+	protected void createPackageableElementFile(
+			PackageableElement classifier, IProgressMonitor monitor) {
+
+		if( (classifier instanceof org.eclipse.uml2.uml.Class) ||
+			(classifier instanceof org.eclipse.uml2.uml.Model) ) {
+
+			final IPath fileLocation = (new Path(FML_GEN_FOLDER))
+					.append(this.locStrategy.getFileName(classifier))
+					.addFileExtension("fml");
+
+			this.fileSystemAccess.generateFile(fileLocation.toString(),
+					this.fCodeGenerator.performTransform(classifier));
+
+//			PackageableElementCodeGenerator.generateCode(classifier).toString());
+//
+//			if( MainCodeGenerator.performTransform(classifier, fileLocation) ) {
+//
+//			}
+		}
+	}
+
+	@Override
+	protected boolean noCodeGen(Element element) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/codegen/xtend/PackageableElementCodeGenerator.xtend b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/codegen/xtend/PackageableElementCodeGenerator.xtend
new file mode 100644
index 0000000..7171beb
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/codegen/xtend/PackageableElementCodeGenerator.xtend
@@ -0,0 +1,14 @@
+package org.eclipse.efm.papyrus.m2t.ui.codegen.xtend
+
+import org.eclipse.uml2.uml.PackageableElement
+
+class PackageableElementCodeGenerator {
+	static def generateCode(PackageableElement element) '''
+		/************************************************************
+		              Pkg< «element.name» > package header
+		 ************************************************************/
+		 «element.class.simpleName» «element.name» {
+
+		 }
+	'''
+}
\ No newline at end of file
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/handlers/CodegenHandler.java b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/handlers/CodegenHandler.java
new file mode 100644
index 0000000..98ce2ca
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/handlers/CodegenHandler.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *
+ *******************************************************************************/
+package org.eclipse.efm.papyrus.m2t.ui.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.efm.formalml.concretesyntax.m2t.util.SimpleLogger;
+import org.eclipse.efm.papyrus.m2t.ui.codegen.CodegenModelElementsCreator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.PackageableElement;
+
+public class CodegenHandler extends CmdHandler {
+
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		final IProject project = getCurrentproject();
+		if( project != null ) {
+			CodegenModelElementsCreator modelElementsCreator =
+					new CodegenModelElementsCreator(project);
+
+			if( this.selectedEObject instanceof PackageableElement ) {
+				generate(modelElementsCreator,
+						(PackageableElement) (this.selectedEObject));
+			}
+			else if( this.selectedEObject instanceof NamedElement ) {
+				generate(modelElementsCreator,
+						(NamedElement) (this.selectedEObject));
+			}
+
+			IWorkbenchWindow window =
+					HandlerUtil.getActiveWorkbenchWindowChecked(event);
+
+			report(window.getShell(), modelElementsCreator.getReportLogger());
+		}
+		else {
+			System.out.println("xLIA code generation handler done !");
+		}
+		return null;
+	}
+
+
+	public void report(Shell shell, SimpleLogger fml2csLogger) {
+		//opening the dialog
+		MessageDialog.open(fml2csLogger.getMessageDialogKind(),
+				shell, "Formal Modeling Language to Concrete Syntax (xLIA)",
+				fml2csLogger.getReport(), SWT.NONE);
+	}
+
+
+
+	private IProject getCurrentproject() {
+		final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+		final URI uri = this.selectedEObject.eResource().getURI();
+		final IProject project = root.getProject(uri.segment(1));
+
+//		ISelectionService selectionService = PlatformUI.getWorkbench().
+//				getActiveWorkbenchWindow().getSelectionService();
+//
+//		ISelection selection = selectionService.getSelection();
+//
+//		IProject project = null;
+//		if( selection instanceof IStructuredSelection ) {
+//			Object element = ((IStructuredSelection) selection).getFirstElement();
+//
+//			if( element instanceof IResource ) {
+//				project = ((IResource)element ).getProject();
+//			}
+//		}
+
+		return project;
+	}
+
+
+	private void generate(CodegenModelElementsCreator modelElementsCreator,
+			NamedElement namedElement) {
+		System.out.print("xLIA no-code generation for --> ");
+		System.out.print(namedElement.getClass().getName());
+		System.out.print(" : ");
+		System.out.println(namedElement.getQualifiedName());
+	}
+
+	private void generate(CodegenModelElementsCreator modelElementsCreator,
+			PackageableElement packageableElement) {
+		modelElementsCreator.createPackageableElement(packageableElement, null, true);
+	}
+
+
+	@Override
+	public boolean isEnabled() {
+		updateSelectedEObject();
+
+		return( this.selectedEObject instanceof /*Packageable*/NamedElement );
+	}
+
+
+}
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/preferences/CodegenPreferencePage.java b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/preferences/CodegenPreferencePage.java
new file mode 100644
index 0000000..34d076c
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/src/org/eclipse/efm/papyrus/m2t/ui/preferences/CodegenPreferencePage.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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
+ *
+ *******************************************************************************/
+package org.eclipse.efm.papyrus.m2t.ui.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class CodegenPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+	public CodegenPreferencePage() {
+		// TODO Auto-generated constructor stub
+	}
+
+	public CodegenPreferencePage(String title) {
+		super(title);
+		// TODO Auto-generated constructor stub
+	}
+
+	public CodegenPreferencePage(String title, ImageDescriptor image) {
+		super(title, image);
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public void init(IWorkbench workbench) {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	protected Control createContents(Composite parent) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/fml2concretesyntax/xtend/.gitignore b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/fml2concretesyntax/xtend/.gitignore
new file mode 100644
index 0000000..60266a8
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/fml2concretesyntax/xtend/.gitignore
@@ -0,0 +1,3 @@
+/.PackageableElementCodeGenerator.java._trace
+/.PackageableElementCodeGenerator.xtendbin
+/PackageableElementCodeGenerator.java
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/m2t/ui/codegen/xtend/.gitignore b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/m2t/ui/codegen/xtend/.gitignore
new file mode 100644
index 0000000..51a291a
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/m2t/ui/codegen/xtend/.gitignore
@@ -0,0 +1,2 @@
+*._trace
+*.xtendbin
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/m2t/ui/codegen/xtend/PackageableElementCodeGenerator.java b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/m2t/ui/codegen/xtend/PackageableElementCodeGenerator.java
new file mode 100644
index 0000000..2f52766
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/m2t/ui/codegen/xtend/PackageableElementCodeGenerator.java
@@ -0,0 +1,36 @@
+package org.eclipse.efm.papyrus.m2t.ui.codegen.xtend;
+
+import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.xtend2.lib.StringConcatenation;
+
+@SuppressWarnings("all")
+public class PackageableElementCodeGenerator {
+  public static CharSequence generateCode(final PackageableElement element) {
+    StringConcatenation _builder = new StringConcatenation();
+    _builder.append("/************************************************************");
+    _builder.newLine();
+    _builder.append("              ");
+    _builder.append("Pkg< ");
+    String _name = element.getName();
+    _builder.append(_name, "              ");
+    _builder.append(" > package header");
+    _builder.newLineIfNotEmpty();
+    _builder.append(" ");
+    _builder.append("************************************************************/");
+    _builder.newLine();
+    _builder.append(" ");
+    Class<? extends PackageableElement> _class = element.getClass();
+    String _simpleName = _class.getSimpleName();
+    _builder.append(_simpleName, " ");
+    _builder.append(" ");
+    String _name_1 = element.getName();
+    _builder.append(_name_1, " ");
+    _builder.append(" {");
+    _builder.newLineIfNotEmpty();
+    _builder.newLine();
+    _builder.append(" ");
+    _builder.append("}");
+    _builder.newLine();
+    return _builder;
+  }
+}
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/m2t/ui/xtend/.gitignore b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/m2t/ui/xtend/.gitignore
new file mode 100644
index 0000000..fef7b80
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/m2t/ui/xtend/.gitignore
@@ -0,0 +1 @@
+/.PackageableElementCodeGenerator.java._trace
diff --git a/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/ui/fml2concretesyntax/xtend/.gitignore b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/ui/fml2concretesyntax/xtend/.gitignore
new file mode 100644
index 0000000..60266a8
--- /dev/null
+++ b/codegen/org.eclipse.efm.papyrus.m2t.ui/xtend-gen/org/eclipse/efm/papyrus/ui/fml2concretesyntax/xtend/.gitignore
@@ -0,0 +1,3 @@
+/.PackageableElementCodeGenerator.java._trace
+/.PackageableElementCodeGenerator.xtendbin
+/PackageableElementCodeGenerator.java
diff --git a/codegen/pom.xml b/codegen/pom.xml
new file mode 100644
index 0000000..b16ff37
--- /dev/null
+++ b/codegen/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>
+		<groupId>org.eclipse.efm</groupId>
+		<artifactId>org.eclipse.efm.modeling.parent</artifactId>
+		<version>0.0.1-SNAPSHOT</version>
+	</parent>	
+	<artifactId>org.eclipse.efm.modeling.codegen</artifactId>
+	<packaging>pom</packaging>
+	<name>org.eclipse.efm-modeling Code Generator</name>
+	<description>This module contains the different plugins relative to the textual code generation for efm-modeling diagrams</description>
+	
+	<modules>
+		<module>org.eclipse.efm.formalml.concretesyntax.m2t</module>
+		<module>org.eclipse.efm.papyrus.m2t.ui</module>
+	</modules>
+</project>
diff --git a/editor/sew/org.eclipse.efm.sew.xtext.tests/pom.xml b/editor/sew/org.eclipse.efm.sew.xtext.tests/pom.xml
index ac845d6..fe3fa3c 100644
--- a/editor/sew/org.eclipse.efm.sew.xtext.tests/pom.xml
+++ b/editor/sew/org.eclipse.efm.sew.xtext.tests/pom.xml
@@ -1,16 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Copyright (c) 2016 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:
-     Arnault Lapitre (CEA LIST) arnault.lapitre@cea.fr
-      - Initial API and Implementation
- -->
+<!-- Copyright (c) 2016 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: Arnault Lapitre 
+	(CEA LIST) arnault.lapitre@cea.fr - Initial API and Implementation -->
 
 <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">
@@ -25,38 +18,38 @@
 	<name>org.eclipse.efm.sew.xtext.tests</name>
 	<description>This plug-in contains the Symbex Workflow's Xtext based editor core tests.</description>
 
-		<build>
+	<build>
 		<plugins>
 			<!-- Empty out the xtend-gen folder in the clean phase. -->
-		    <plugin>
-		        <artifactId>maven-clean-plugin</artifactId>
-		        <configuration>
-		            <filesets>
-		                <fileset>
-		                    <directory>xtend-gen</directory>
-		                    <excludes>
-		                       <exclude>**/.gitignore</exclude>
-		                    </excludes>
-		                </fileset>
-		            </filesets>
-		        </configuration>
-		    </plugin>
-		    <!-- Generate Xtend sources in the compilation phase. -->
-		    <plugin>
-		        <groupId>org.eclipse.xtend</groupId>
-		        <artifactId>xtend-maven-plugin</artifactId>
-		        <executions>
-		            <execution>
-		                <goals>
-		                    <goal>compile</goal>
-		                    <goal>testCompile</goal>
-		                </goals>
-		                <configuration>
-		                    <outputDirectory>xtend-gen</outputDirectory>
-		                </configuration>
-		            </execution>
-		        </executions>
-		    </plugin>
-		  </plugins>
-	 </build>
+			<plugin>
+				<artifactId>maven-clean-plugin</artifactId>
+				<configuration>
+					<filesets>
+						<fileset>
+							<directory>xtend-gen</directory>
+							<excludes>
+								<exclude>**/.gitignore</exclude>
+							</excludes>
+						</fileset>
+					</filesets>
+				</configuration>
+			</plugin>
+			<!-- Generate Xtend sources in the compilation phase. -->
+			<plugin>
+				<groupId>org.eclipse.xtend</groupId>
+				<artifactId>xtend-maven-plugin</artifactId>
+				<executions>
+					<execution>
+						<goals>
+							<goal>compile</goal>
+							<goal>testCompile</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>xtend-gen</outputDirectory>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
 </project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 7375e72..17f5384 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,6 +73,7 @@
 
 	<modules>
 		<module>core</module>
+		<module>codegen</module>
 		<module>diagram</module>
 		<module>editor</module>
 		<module>gui</module>
diff --git a/targetplatform/org.eclipse.efm.modeling.targetplatform.neon-papyrusnightly/org.eclipse.efm.modeling.targetplatform.neon-papyrusnightly.target b/targetplatform/org.eclipse.efm.modeling.targetplatform.neon-papyrusnightly/org.eclipse.efm.modeling.targetplatform.neon-papyrusnightly.target
index 2c5f48d..3e18595 100644
--- a/targetplatform/org.eclipse.efm.modeling.targetplatform.neon-papyrusnightly/org.eclipse.efm.modeling.targetplatform.neon-papyrusnightly.target
+++ b/targetplatform/org.eclipse.efm.modeling.targetplatform.neon-papyrusnightly/org.eclipse.efm.modeling.targetplatform.neon-papyrusnightly.target
@@ -21,5 +21,12 @@
       <unit id="org.eclipse.papyrus.sdk.feature.feature.group" version="0.0.0"/>
       <repository id="eclipse-papyrus-nighlty-neon" location="http://download.eclipse.org/modeling/mdt/papyrus/updates/nightly/neon/main/"/>
     </location>
+    <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
+      <unit id="org.eclipse.papyrus.designer.languages.common.feature.feature.group" version="0.0.0"/>
+      <!--unit id="org.eclipse.papyrus.designer.languages.cpp.feature.feature.group" version="0.0.0"/>
+      <unit id="org.eclipse.papyrus.designer.languages.main.feature.feature.group" version="0.0.0"/>
+      <unit id="org.eclipse.papyrus.designer.languages.tracing.feature.feature.group" version="0.0.0"/-->
+      <repository id="eclipse-papyrus-designer-nighlty-neon" location="http://download.eclipse.org/modeling/mdt/papyrus/components/designer/"/>
+    </location>
   </locations>
 </target>