Enable SUML to provide its own task execution factory

Change-Id: Ie4a163363165b50473751911f00822dc30ad7700
Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.classpath b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.classpath
index eca7bdb..43b9862 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.classpath
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.classpath
@@ -3,5 +3,5 @@
 	<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="bin"/>
+	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.project b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.project
new file mode 100644
index 0000000..24150a9
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.papyrus.moka.engine.suml.ease</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.jdt.core.javanature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/META-INF/MANIFEST.MF b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/META-INF/MANIFEST.MF
index 6d24f41..8281260 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/META-INF/MANIFEST.MF
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@
 Bundle-Version: 0.1.0.qualifier
 Automatic-Module-Name: org.eclipse.papyrus.moka.engine.suml.ease
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.papyrus.moka.engine.suml;visibility:=reexport,
- org.eclipse.emf.common;bundle-version="2.16.0",
- org.eclipse.ease;bundle-version="0.7.0";visibility:=reexport
+Require-Bundle: org.eclipse.papyrus.moka.engine.suml;bundle-version="[0.1.0,1.0.0)",
+ org.eclipse.emf.common;bundle-version="[2.16.0,3.0.0)",
+ org.eclipse.ease;bundle-version="[0.7.0,1.0.0)"
 Export-Package: org.eclipse.papyrus.moka.engine.suml.ease
+Bundle-Vendor: CEA LIST
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/build.properties b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/build.properties
index 34d2e4d..b107977 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/build.properties
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/build.properties
@@ -1,4 +1,3 @@
 source.. = src/
-output.. = bin/
 bin.includes = META-INF/,\
                .
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/.project b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/.project
new file mode 100644
index 0000000..9d1f195
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.papyrus.moka.engine.suml.python</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.jdt.core.javanature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/META-INF/MANIFEST.MF b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/META-INF/MANIFEST.MF
index b33872d..a8a3db5 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/META-INF/MANIFEST.MF
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/META-INF/MANIFEST.MF
@@ -5,7 +5,10 @@
 Bundle-Version: 0.1.0.qualifier
 Automatic-Module-Name: org.eclipse.papyrus.moka.engine.suml.python
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.debug.core,
- org.eclipse.papyrus.moka.engine.suml.ease,
- org.jython;bundle-version="2.7.0"
+Require-Bundle: org.eclipse.debug.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.moka.engine.suml.ease;bundle-version="[0.1.0,1.0.0)",
+ org.jython;bundle-version="[2.7.0,3.0.0)",
+ org.eclipse.ease;bundle-version="[0.7.0,1.0.0)",
+ org.eclipse.papyrus.moka.engine.suml;bundle-version="[0.1.0,1.0.0)"
 Bundle-ClassPath: .
+Bundle-Vendor: CEA LIST
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/build.properties b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/build.properties
index 7cebe16..6d21007 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/build.properties
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/build.properties
@@ -1,5 +1,4 @@
 source.. = src/
-output.. = bin/
 bin.includes = META-INF/,\
                .,\
                plugin.xml,\
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.classpath b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.classpath
index eca7bdb..53404e4 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.classpath
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.classpath
@@ -1,7 +1,9 @@
 <?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="bin"/>
+	<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/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.project b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.project
new file mode 100644
index 0000000..4e222d6
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.papyrus.moka.engine.suml</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.jdt.core.javanature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/META-INF/MANIFEST.MF b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/META-INF/MANIFEST.MF
index 66c1d15..cb1347d 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/META-INF/MANIFEST.MF
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/META-INF/MANIFEST.MF
@@ -5,23 +5,23 @@
 Bundle-Version: 0.1.0.qualifier
 Automatic-Module-Name: org.eclipse.papyrus.moka.engine.suml
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.papyrus.moka.kernel,
+Require-Bundle: org.eclipse.papyrus.moka.kernel;bundle-version="[4.0.0,5.0.0)",
  org.eclipse.debug.core;bundle-version="[3.13.0,4.0.0)",
  org.eclipse.equinox.registry;bundle-version="[3.8.100,4.0.0)",
- org.eclipse.papyrus.moka.fuml.interfaces,
- org.eclipse.papyrus.moka.fuml,
- org.eclipse.papyrus.moka.pscs,
- org.eclipse.papyrus.moka.pssm,
+ org.eclipse.papyrus.moka.fuml.interfaces;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.fuml;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.pscs;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.pssm;bundle-version="[4.0.0,5.0.0)",
  org.eclipse.emf.ecore;bundle-version="[2.15.0,3.0.0)",
  org.eclipse.uml2.uml;bundle-version="[5.4.0,6.0.0)",
- org.eclipse.papyrus.moka.utils,
- org.eclipse.papyrus.moka.engine.uml.scheduling,
- org.eclipse.papyrus.moka.kernel.debug,
- org.eclipse.papyrus.moka.engine.uml.debug,
- org.eclipse.papyrus.moka.kernel.scheduling,
- org.eclipse.papyrus.moka.engine.uml;bundle-version="4.0.0",
- org.eclipse.papyrus.moka.engine.uml.animation,
- org.eclipse.papyrus.moka.kernel.animation;bundle-version="4.0.0",
+ org.eclipse.papyrus.moka.utils;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.engine.uml.scheduling;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.kernel.debug;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.engine.uml.debug;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.kernel.scheduling;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.engine.uml;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.engine.uml.animation;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.kernel.animation;bundle-version="[4.0.0,5.0.0)",
  org.eclipse.papyrus.moka.engine.uml.time;bundle-version="[4.0.0,5.0.0)",
  org.eclipse.papyrus.moka.engine.uml.time.scheduling;bundle-version="[4.0.0,5.0.0)"
 Export-Package: org.eclipse.papyrus.moka.engine.suml,
@@ -33,4 +33,5 @@
  org.eclipse.papyrus.moka.engine.suml.loci,
  org.eclipse.papyrus.moka.engine.suml.opaquebehaviors,
  org.eclipse.papyrus.moka.engine.suml.script,
- org.eclipse.papyrus.moka.engine.suml.script.gen
+ org.eclipse.papyrus.moka.engine.suml.script.gen,
+ org.eclipse.papyrus.moka.engine.suml.tasks
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/build.properties b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/build.properties
index e9863e2..cc91072 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/build.properties
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/build.properties
@@ -1,5 +1,4 @@
 source.. = src/
-output.. = bin/
 bin.includes = META-INF/,\
                .,\
                plugin.xml
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/pom.xml b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/pom.xml
index c195296..377bc31 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/pom.xml
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/pom.xml
@@ -1,15 +1,16 @@
 <?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">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 	<parent>
 		<groupId>org.eclipse.papyrus.moka.incubation</groupId>
 		<artifactId>org.eclipse.papyrus.moka.engine.suml.root</artifactId>
 		<version>0.1.0-SNAPSHOT</version>
 	</parent>
-	
+
 	<artifactId>org.eclipse.papyrus.moka.engine.suml</artifactId>
 	<packaging>eclipse-plugin</packaging>
 	<name>org.eclipse.papyrus.moka.engine.suml</name>
-	
+
 </project>
\ No newline at end of file
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLExecutionEngine.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLExecutionEngine.java
index 628f22f..4d962d0 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLExecutionEngine.java
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLExecutionEngine.java
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (c) 2019 CEA LIST
+ * Copyright (c) 2019, 2020 CEA LIST
  * 
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -7,7 +7,8 @@
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *   David Lopez david.lopez@cea.fr(CEA LIST)
+ *   David Lopez david.lopez@cea.fr (CEA LIST)
+ *   jeremie.tatibouet@cea.fr (CEA LIST)
  *   
  *****************************************************************************/
 package org.eclipse.papyrus.moka.engine.suml;
@@ -22,7 +23,9 @@
 import org.eclipse.papyrus.moka.engine.suml.accessor.locus.ParameterValueAdapter;
 import org.eclipse.papyrus.moka.engine.suml.loci.SUML_ExecutionFactory;
 import org.eclipse.papyrus.moka.engine.suml.opaquebehaviors.SUMLScriptExecutionFactory;
+import org.eclipse.papyrus.moka.engine.suml.tasks.SUMLTaskExecutionFactory;
 import org.eclipse.papyrus.moka.engine.uml.UMLExecutionEngine;
+import org.eclipse.papyrus.moka.engine.uml.scheduling.IUMLTaskExecutionFactory;
 import org.eclipse.papyrus.moka.fuml.loci.ILocus;
 import org.eclipse.papyrus.moka.kernel.engine.EngineConfiguration;
 import org.eclipse.papyrus.moka.pscs.loci.CS_Executor;
@@ -39,7 +42,7 @@
 	}
 
 	@Override
-	public void init(EngineConfiguration configuration, SubMonitor monitor) {
+	public void init(EngineConfiguration<?> configuration, SubMonitor monitor) {
 		super.init(configuration, monitor);
 		
 		//Register the used component/value type
@@ -64,16 +67,11 @@
 		
 	}
 	
-	
-	
-	 @Override
-	public void run(EngineConfiguration configuration, SubMonitor monitor) {
-		 try {
-			 super.run(configuration, monitor);
-		 }catch( Exception e) {
-			 this.dispose(monitor);
-			 throw e;
-		 }
+	@Override
+	protected IUMLTaskExecutionFactory createUMLTaskFactory() {
+		SUMLTaskExecutionFactory factory = SUMLTaskExecutionFactory.getInstance();
+		factory.setExecutionLoop(controller.getExecutionLoop());
+		return factory;
 	}
 
 	@Override
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueBehaviorExecution.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueBehaviorExecution.java
index 9fe0f57..a116970 100644
--- a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueBehaviorExecution.java
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueBehaviorExecution.java
@@ -15,8 +15,6 @@
 import java.util.List;
 
 import org.eclipse.papyrus.moka.engine.suml.ScriptExecutionFactoryRegistry;
-import org.eclipse.papyrus.moka.engine.suml.accessor.AccessAdapterRegistry;
-import org.eclipse.papyrus.moka.engine.suml.accessor.locus.IValueConverter;
 import org.eclipse.papyrus.moka.engine.suml.opaquebehaviors.ScriptExecution;
 import org.eclipse.papyrus.moka.fuml.commonbehavior.IParameterValue;
 import org.eclipse.papyrus.moka.fuml.commonbehavior.OpaqueBehaviorExecution;
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/tasks/RootOpaqueBehaviorTaskExecution.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/tasks/RootOpaqueBehaviorTaskExecution.java
new file mode 100644
index 0000000..8c5c9de
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/tasks/RootOpaqueBehaviorTaskExecution.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *   CEA LIST - Initial API and implementation
+ *   
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.tasks;
+
+import org.eclipse.papyrus.moka.engine.uml.scheduling.RootBehaviorTaskExecution;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.papyrus.moka.kernel.scheduling.control.IExecutionLoop;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.OpaqueBehavior;
+
+public class RootOpaqueBehaviorTaskExecution extends RootBehaviorTaskExecution {
+
+	public RootOpaqueBehaviorTaskExecution(IExecutionLoop loop, Behavior executionRoot) {
+		super(loop, executionRoot);
+	}
+
+	@Override
+	public boolean canExecute() {
+		return super.canExecute() || root instanceof OpaqueBehavior;
+	}
+
+	@Override
+	public IValue new_() {
+		return new RootOpaqueBehaviorTaskExecution(executionLoop, root);
+	}
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/tasks/SUMLTaskExecutionFactory.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/tasks/SUMLTaskExecutionFactory.java
new file mode 100644
index 0000000..4cb92dd
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/tasks/SUMLTaskExecutionFactory.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ * 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *   CEA LIST - Initial API and implementation
+ *   
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.tasks;
+
+import org.eclipse.papyrus.moka.engine.uml.scheduling.UMLRootExecution;
+import org.eclipse.papyrus.moka.engine.uml.scheduling.UMLTaskExecutionFactory;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.OpaqueBehavior;
+
+public class SUMLTaskExecutionFactory extends UMLTaskExecutionFactory {
+
+	/**
+	 * Factory instance
+	 */
+	private static SUMLTaskExecutionFactory FACTORY;
+
+	/**
+	 * Create (if required) and return the factory instance
+	 * 
+	 * @return the task factory
+	 */
+	public static SUMLTaskExecutionFactory getInstance() {
+		if (FACTORY == null) {
+			FACTORY = new SUMLTaskExecutionFactory();
+		}
+		return FACTORY;
+	}
+
+	@Override
+	public UMLRootExecution<?> createRootExecution(Element executionRoot) {
+		UMLRootExecution<?> rootExecution = null;
+		if (executionRoot instanceof OpaqueBehavior) {
+			rootExecution = new RootOpaqueBehaviorTaskExecution(executionLoop, (OpaqueBehavior) executionRoot);
+		} else {
+			rootExecution = super.createRootExecution(executionRoot);
+		}
+		return rootExecution;
+	}
+
+}