Bug 574776 - Remove MARTE dependency from the Designer common feature

- Remove dependency to oepd.deployment.tools
  - Add new class HintUtils in common base
  - move methods "getGeneratorHintFromElement" and "getLanguageFromElement" (from DepUtils) inside

- Remove dependency to oepd.transformation.base in oepd.codegen.ui
  - Change implementation of ChooseGenerator to not use CommandUtils

- Adapt calling code

Change-Id: Iab8058701e5e3d4d6f3cec8a7a51cbf5f120c9cf
Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr>
diff --git a/plugins/deployment/org.eclipse.papyrus.designer.deployment.tools/src/org/eclipse/papyrus/designer/deployment/tools/DepUtils.java b/plugins/deployment/org.eclipse.papyrus.designer.deployment.tools/src/org/eclipse/papyrus/designer/deployment/tools/DepUtils.java
index cd34529..1311c4f 100644
--- a/plugins/deployment/org.eclipse.papyrus.designer.deployment.tools/src/org/eclipse/papyrus/designer/deployment/tools/DepUtils.java
+++ b/plugins/deployment/org.eclipse.papyrus.designer.deployment.tools/src/org/eclipse/papyrus/designer/deployment/tools/DepUtils.java
@@ -16,7 +16,6 @@
 package org.eclipse.papyrus.designer.deployment.tools;
 
 import java.util.Iterator;
-import java.util.List;
 import java.util.Stack;
 
 import org.eclipse.emf.common.util.BasicEList;
@@ -29,9 +28,7 @@
 import org.eclipse.papyrus.designer.deployment.profile.Deployment.ImplementationProperties;
 import org.eclipse.papyrus.designer.deployment.profile.Deployment.Singleton;
 import org.eclipse.papyrus.designer.deployment.profile.Deployment.Target;
-import org.eclipse.papyrus.designer.languages.common.extensionpoints.ILangCodegen;
-import org.eclipse.papyrus.designer.languages.common.extensionpoints.LanguageCodegen;
-import org.eclipse.papyrus.designer.languages.common.profile.Codegen.GeneratorHint;
+import org.eclipse.papyrus.designer.languages.common.base.HintUtils;
 import org.eclipse.papyrus.designer.transformation.base.ElementFilter;
 import org.eclipse.papyrus.designer.transformation.base.preferences.PapyrusDesignerPreferenceConstants;
 import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
@@ -463,50 +460,6 @@
 	}
 
 	/**
-	 * Determine which programming language should be generated for a classifier. The
-	 * stereotype GeneratorHint (which could be on any owning package) is evaluated.
-	 *
-	 * @param element
-	 *            an element (typically a classifier or a package)
-	 * @return the programming language
-	 */
-	public static String getLanguageFromElement(Element element) {
-		GeneratorHint codeGenOpt = getGeneratorHintFromElement(element);
-		if ((codeGenOpt != null) && (codeGenOpt.getLanguage() != null)) {
-			return codeGenOpt.getLanguage().getBase_Class().getName();
-		} else {
-			List<ILangCodegen> eligibleGenerators = LanguageCodegen.getEligibleGeneratorList(LanguageCodegen.MATCH_ALL, element);
-			// get language from first eligible generator
-			if (eligibleGenerators.size() > 0) {
-				return LanguageCodegen.getLanguage(eligibleGenerators.get(0));
-			}
-			else {
-				// Use C++ as default generation language
-				return "C++"; //$NON-NLS-1$
-			}
-		}
-	}
-
-	/**
-	 * Determine whether the stereotype GeneratorHint is applied to the passed element
-	 * or one of its parents
-	 *
-	 * @param element
-	 *            an element (typically a classifier or a package)
-	 * @return the applied stereotype or null
-	 */
-	public static GeneratorHint getGeneratorHintFromElement(Element element) {
-		GeneratorHint codeGenOpt = UMLUtil.getStereotypeApplication(element, GeneratorHint.class);
-		if ((codeGenOpt != null) && (codeGenOpt.getLanguage() != null)) {
-			return codeGenOpt;
-		} else if (element.getOwner() instanceof Package) {
-			return getGeneratorHintFromElement(element.getOwner());
-		} else {
-			return null;
-		}
-	}
-
-	/**
 	 * Return the target language when given the mainInstance
 	 * 
 	 * @param mainInstance
@@ -515,7 +468,7 @@
 	 */
 	public static String getTargetLanguage(InstanceSpecification mainInstance) {
 		Classifier cl = DepUtils.getClassifier(mainInstance);
-		return DepUtils.getLanguageFromElement(cl);
+		return HintUtils.getLanguageFromElement(cl);
 	}
 
 	/**
diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.base/src/org/eclipse/papyrus/designer/languages/common/base/HintUtils.java b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.base/src/org/eclipse/papyrus/designer/languages/common/base/HintUtils.java
new file mode 100644
index 0000000..f2a09c9
--- /dev/null
+++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.base/src/org/eclipse/papyrus/designer/languages/common/base/HintUtils.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2021 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *     CEA LIST - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.papyrus.designer.languages.common.base;
+
+import java.util.List;
+
+import org.eclipse.papyrus.designer.languages.common.extensionpoints.ILangCodegen;
+import org.eclipse.papyrus.designer.languages.common.extensionpoints.LanguageCodegen;
+import org.eclipse.papyrus.designer.languages.common.profile.Codegen.GeneratorHint;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+
+/**
+ * A set of static methods related to generator hints
+ * Moved from DepUtils in the context of 574776 - Remove MARTE dependency from the Designer common feature
+ */
+public class HintUtils {
+
+	/**
+	 * Determine whether the stereotype GeneratorHint is applied to the passed element
+	 * or one of its parents
+	 *
+	 * @param element
+	 *            an element (typically a classifier or a package)
+	 * @return the applied stereotype or null
+	 */
+	public static GeneratorHint getGeneratorHintFromElement(Element element) {
+		GeneratorHint codeGenOpt = UMLUtil.getStereotypeApplication(element, GeneratorHint.class);
+		if ((codeGenOpt != null) && (codeGenOpt.getLanguage() != null)) {
+			return codeGenOpt;
+		} else if (element.getOwner() instanceof Package) {
+			return getGeneratorHintFromElement(element.getOwner());
+		} else {
+			return null;
+		}
+	}
+	
+	/**
+	 * Determine which programming language should be generated for a classifier. The
+	 * stereotype GeneratorHint (which could be on any owning package) is evaluated.
+	 *
+	 * @param element
+	 *            an element (typically a classifier or a package)
+	 * @return the programming language
+	 */
+	public static String getLanguageFromElement(Element element) {
+		GeneratorHint codeGenOpt = HintUtils.getGeneratorHintFromElement(element);
+		if ((codeGenOpt != null) && (codeGenOpt.getLanguage() != null)) {
+			return codeGenOpt.getLanguage().getBase_Class().getName();
+		} else {
+			List<ILangCodegen> eligibleGenerators = LanguageCodegen.getEligibleGeneratorList(LanguageCodegen.MATCH_ALL, element);
+			// get language from first eligible generator
+			if (eligibleGenerators.size() > 0) {
+				return LanguageCodegen.getLanguage(eligibleGenerators.get(0));
+			}
+			else {
+				// Use C++ as default generation language
+				return "C++"; //$NON-NLS-1$
+			}
+		}
+	}
+}
diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/META-INF/MANIFEST.MF b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/META-INF/MANIFEST.MF
index f5bbc89..37f7ea1 100644
--- a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/META-INF/MANIFEST.MF
+++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/META-INF/MANIFEST.MF
@@ -14,8 +14,6 @@
  org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.4.0,5.0.0)",
  org.eclipse.papyrus.designer.ui;bundle-version="[2.0.0,3.0.0)",
  org.eclipse.papyrus.designer.languages.common.extensionpoints;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.designer.deployment.tools;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.designer.transformation.base;bundle-version="[2.0.0,3.0.0)",
  org.eclipse.papyrus.designer.languages.common.profile;bundle-version="[2.0.0,3.0.0)",
  org.eclipse.emf.transaction;bundle-version="1.9.0",
  org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.4.0,5.0.0)"
diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/src/org/eclipse/papyrus/designer/languages/common/codegen/ui/ChooseGenerator.java b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/src/org/eclipse/papyrus/designer/languages/common/codegen/ui/ChooseGenerator.java
index aeb97f9..428d02c 100644
--- a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/src/org/eclipse/papyrus/designer/languages/common/codegen/ui/ChooseGenerator.java
+++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/src/org/eclipse/papyrus/designer/languages/common/codegen/ui/ChooseGenerator.java
@@ -1,8 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 2021 CEA LIST
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License 2.0 which
+ * accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ *   Ansgar Radermacher - Initial API and implementation, bug 574776
+ *   
+ *******************************************************************************/
+
 package org.eclipse.papyrus.designer.languages.common.codegen.ui;
 
 import java.util.List;
 import java.util.regex.Pattern;
 
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
 import org.eclipse.emf.transaction.util.TransactionUtil;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
@@ -14,8 +31,6 @@
 import org.eclipse.papyrus.designer.languages.common.profile.CommonProfileResource;
 import org.eclipse.papyrus.designer.languages.common.profile.Codegen.GeneratorHint;
 import org.eclipse.papyrus.designer.languages.common.profile.Codegen.Language;
-import org.eclipse.papyrus.designer.transformation.base.utils.ApplyProfile;
-import org.eclipse.papyrus.designer.transformation.base.utils.CommandSupport;
 import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
 import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
 import org.eclipse.swt.widgets.Display;
@@ -23,6 +38,7 @@
 import org.eclipse.uml2.uml.NamedElement;
 import org.eclipse.uml2.uml.Package;
 import org.eclipse.uml2.uml.PackageableElement;
+import org.eclipse.uml2.uml.Profile;
 import org.eclipse.uml2.uml.util.UMLUtil;
 
 public class ChooseGenerator {
@@ -90,24 +106,27 @@
 
 	public static void storeGeneratorID(PackageableElement pe, String languageName, final String generatorID) {
 		final Package root = PackageUtil.getRootPackage(pe);
-		CommandSupport.exec(TransactionUtil.getEditingDomain(pe), new ApplyProfile(root, CommonProfileResource.PROFILE_PATH_URI));
+		TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(pe);
 
-		NamedElement languageNE = ElementUtils.getQualifiedElementFromRS(pe, LANGUAGES_PKG + NamedElement.SEPARATOR + languageName);
-		if (languageNE == null) {
-			PackageUtil.loadPackage(CommonProfileResource.LANGUAGES_PATH_URI, pe.eResource().getResourceSet());
-			languageNE = ElementUtils.getQualifiedElementFromRS(pe, LANGUAGES_PKG + NamedElement.SEPARATOR + languageName);
-		}
-		final Language language = (languageNE != null) ? UMLUtil.getStereotypeApplication(languageNE, Language.class) : null;
-		CommandSupport.exec(pe, Messages.ChooseGenerator_CHOOSE_GENERATOR, new Runnable() {
+		domain.getCommandStack().execute(new RecordingCommand(domain, Messages.ChooseGenerator_CHOOSE_GENERATOR) {
 
 			@Override
-			public void run() {
+			public void doExecute() {
+				Package commonProfile =
+						PackageUtil.loadPackage(CommonProfileResource.PROFILE_PATH_URI, pe.eResource().getResourceSet());
+				root.applyProfile((Profile) commonProfile);
+
+				NamedElement languageNE = ElementUtils.getQualifiedElementFromRS(pe, LANGUAGES_PKG + NamedElement.SEPARATOR + languageName);
+				if (languageNE == null) {
+					PackageUtil.loadPackage(CommonProfileResource.LANGUAGES_PATH_URI, pe.eResource().getResourceSet());
+					languageNE = ElementUtils.getQualifiedElementFromRS(pe, LANGUAGES_PKG + NamedElement.SEPARATOR + languageName);
+				}
+				final Language language = (languageNE != null) ? UMLUtil.getStereotypeApplication(languageNE, Language.class) : null;
+
 				GeneratorHint hint = StereotypeUtil.applyApp(root, GeneratorHint.class);
 				hint.setLanguage(language);
 				hint.setGeneratorID(generatorID);
 			}
 		});
 	}
-
-
 }
diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/src/org/eclipse/papyrus/designer/languages/common/codegen/ui/handlers/GenerateCodeHandler.java b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/src/org/eclipse/papyrus/designer/languages/common/codegen/ui/handlers/GenerateCodeHandler.java
index 8509cce..3415881 100644
--- a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/src/org/eclipse/papyrus/designer/languages/common/codegen/ui/handlers/GenerateCodeHandler.java
+++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.codegen.ui/src/org/eclipse/papyrus/designer/languages/common/codegen/ui/handlers/GenerateCodeHandler.java
@@ -24,8 +24,8 @@
 import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.URI;
-import org.eclipse.papyrus.designer.deployment.tools.DepUtils;
 import org.eclipse.papyrus.designer.languages.common.base.ClassUtils;
+import org.eclipse.papyrus.designer.languages.common.base.HintUtils;
 import org.eclipse.papyrus.designer.languages.common.codegen.ui.ChooseGenerator;
 import org.eclipse.papyrus.designer.languages.common.extensionpoints.ILangCodegen;
 import org.eclipse.papyrus.designer.languages.common.extensionpoints.LanguageCodegen;
@@ -131,7 +131,7 @@
 		if (selectedEObject instanceof PackageableElement) {
 			PackageableElement pe = (PackageableElement) selectedEObject;
 
-			GeneratorHint hint = DepUtils.getGeneratorHintFromElement(pe);
+			GeneratorHint hint = HintUtils.getGeneratorHintFromElement(pe);
 			ILangCodegen codeGen = null;
 			if (hint == null) {
 				codeGen = ChooseGenerator.choose(Pattern.compile(".*"), pe); //$NON-NLS-1$
diff --git a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/META-INF/MANIFEST.MF b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/META-INF/MANIFEST.MF
index 78038f9..10b2d25 100644
--- a/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/META-INF/MANIFEST.MF
+++ b/plugins/languages/common/org.eclipse.papyrus.designer.languages.common.validation/META-INF/MANIFEST.MF
@@ -4,8 +4,7 @@
  org.eclipse.emf.validation;bundle-version="1.3.0",
  org.eclipse.ui,
  org.eclipse.papyrus.uml.tools.utils;bundle-version="[3.4.0,5.0.0)",
- org.eclipse.papyrus.designer.deployment.profile;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.designer.deployment.tools;bundle-version="[2.0.0,3.0.0)"
+ org.eclipse.papyrus.designer.deployment.profile;bundle-version="[2.0.0,3.0.0)"
 Bundle-Vendor: %providerName
 Bundle-ActivationPolicy: lazy
 Bundle-Version: 2.0.0.qualifier
diff --git a/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/BootLoaderGen.java b/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/BootLoaderGen.java
index 99bce16..432f2e7 100644
--- a/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/BootLoaderGen.java
+++ b/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/BootLoaderGen.java
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2021 CEA LIST.
  *
  *
  * All rights reserved. This program and the accompanying materials
@@ -16,7 +16,7 @@
 
 package org.eclipse.papyrus.designer.transformation.library.transformations;
 
-import org.eclipse.papyrus.designer.deployment.tools.DepUtils;
+import org.eclipse.papyrus.designer.languages.common.base.HintUtils;
 import org.eclipse.papyrus.designer.transformation.base.utils.TransformationException;
 import org.eclipse.papyrus.designer.transformation.core.m2minterfaces.IM2MTrafoCDP;
 import org.eclipse.papyrus.designer.transformation.extensions.IM2MTrafo;
@@ -34,7 +34,7 @@
 	@Override
 	public void applyTrafo(M2MTrafo trafo, Package deploymentPlan) throws TransformationException {
 		// delegate to language specific variant
-		String language = DepUtils.getLanguageFromElement(deploymentPlan);
+		String language = HintUtils.getLanguageFromElement(deploymentPlan);
 		IM2MTrafo trafo2 = M2MTrafoExt.getM2MTrafo(trafo.getBase_Class().getQualifiedName() + "::" + language); //$NON-NLS-1$
 		if (trafo2 instanceof IM2MTrafoCDP) {
 			((IM2MTrafoCDP) trafo2).applyTrafo(trafo, deploymentPlan);
diff --git a/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/CompleteStatemachine.java b/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/CompleteStatemachine.java
index 15f6a0e..56887d8 100644
--- a/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/CompleteStatemachine.java
+++ b/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/CompleteStatemachine.java
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (c) 2016 CEA LIST.
+ * Copyright (c) 2016, 2021 CEA LIST.
  *
  *
  * All rights reserved. This program and the accompanying materials
@@ -16,7 +16,7 @@
 
 package org.eclipse.papyrus.designer.transformation.library.transformations;
 
-import org.eclipse.papyrus.designer.deployment.tools.DepUtils;
+import org.eclipse.papyrus.designer.languages.common.base.HintUtils;
 import org.eclipse.papyrus.designer.transformation.base.utils.TransformationException;
 import org.eclipse.papyrus.designer.transformation.core.m2minterfaces.IM2MTrafoElem;
 import org.eclipse.papyrus.designer.transformation.extensions.IM2MTrafo;
@@ -38,7 +38,7 @@
 		if (element instanceof Class) {
 			Class clazz = (Class) element;
 			if (clazz.getClassifierBehavior() instanceof StateMachine) {
-				String language = DepUtils.getLanguageFromElement(clazz);
+				String language = HintUtils.getLanguageFromElement(clazz);
 				IM2MTrafo trafoForLang = M2MTrafoExt.getM2MTrafoForLanguage(trafo, language);
 				if (trafoForLang instanceof IM2MTrafoElem) {
 					((IM2MTrafoElem) trafoForLang).transformElement(trafo, element);
diff --git a/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/CreateAndConfigureProject.java b/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/CreateAndConfigureProject.java
index c68a5d1..3334eef 100644
--- a/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/CreateAndConfigureProject.java
+++ b/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/CreateAndConfigureProject.java
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (c) 2016 CEA LIST.
+ * Copyright (c) 2016, 2021 CEA LIST.
  *
  *
  * All rights reserved. This program and the accompanying materials
@@ -29,6 +29,7 @@
 import org.eclipse.papyrus.designer.deployment.profile.Deployment.OperatingSystem;
 import org.eclipse.papyrus.designer.deployment.profile.Deployment.Target;
 import org.eclipse.papyrus.designer.deployment.tools.DepUtils;
+import org.eclipse.papyrus.designer.languages.common.base.HintUtils;
 import org.eclipse.papyrus.designer.languages.common.extensionpoints.AbstractSettings;
 import org.eclipse.papyrus.designer.languages.common.extensionpoints.ILangProjectSupport;
 import org.eclipse.papyrus.designer.languages.common.extensionpoints.LanguageProjectSupport;
@@ -244,7 +245,7 @@
 		// acceptable?)
 		String targetLanguage = topLevelInstances.size() > 0 ?
 				DepUtils.getTargetLanguage(topLevelInstances.iterator().next()) :
-				DepUtils.getLanguageFromElement(deploymentPlan);
+				HintUtils.getLanguageFromElement(deploymentPlan);
 		String projectName = getProjectName(tc.modelRoot, tc.node);
 		projectSupport = LanguageProjectSupport.getProjectSupport(targetLanguage);
 		
diff --git a/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/GenerateCode.java b/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/GenerateCode.java
index f9f42ea..1fbce81 100644
--- a/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/GenerateCode.java
+++ b/plugins/transformation/org.eclipse.papyrus.designer.transformation.library/src/org/eclipse/papyrus/designer/transformation/library/transformations/GenerateCode.java
@@ -1,11 +1,18 @@
-/**
+/*****************************************************************************
+ * Copyright (c) 2016, 2021 CEA LIST.
+ *
+ *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
  * https://www.eclipse.org/legal/epl-2.0/
  *
  * SPDX-License-Identifier: EPL-2.0
- */
+ *
+ * Contributors:
+ *  Ansgar Radermacher  ansgar.radermacher@cea.fr
+ *
+ *****************************************************************************/
 package org.eclipse.papyrus.designer.transformation.library.transformations;
 
 import org.eclipse.core.resources.IProject;
@@ -13,6 +20,7 @@
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.papyrus.designer.deployment.tools.Activator;
 import org.eclipse.papyrus.designer.deployment.tools.DepUtils;
+import org.eclipse.papyrus.designer.languages.common.base.HintUtils;
 import org.eclipse.papyrus.designer.languages.common.extensionpoints.ILangCodegen;
 import org.eclipse.papyrus.designer.languages.common.extensionpoints.LanguageCodegen;
 import org.eclipse.papyrus.designer.transformation.base.UIContext;
@@ -128,7 +136,7 @@
 		String targetLanguage =
 				topLevelInstances.size() > 0 ?
 						DepUtils.getTargetLanguage(topLevelInstances.iterator().next()) :
-						DepUtils.getLanguageFromElement(deploymentPlan);
+						HintUtils.getLanguageFromElement(deploymentPlan);
 		try {
 			generate(null, targetLanguage);
 		}