Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade')
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl130
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl54
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl206
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl902
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl191
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl39
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/AbstractRepresentingClass.mtl69
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/Class.mtl1029
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.java420
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.mtl158
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/LoaderClass.mtl128
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/PackageClass.mtl1289
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/RepresentingElementAdapter.mtl106
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/ResourceClass.mtl536
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/WrapperClass.mtl189
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl127
-rw-r--r--extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl14
17 files changed, 5587 insertions, 0 deletions
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl
new file mode 100644
index 00000000000..1c550f7422d
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eIsSet.mtl
@@ -0,0 +1,130 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module eIsSet('http://www.eclipse.org/emf/2002/GenModel')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnum /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenOperation /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenParameter /]
+
+[template public eIsSet(genClass : GenClass, genModel : GenModel, positiveOffsetCorrection : String, negativeOffsetCorrection : String)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useGenerics()) ]
+ [if (genClass.getEIsSetGenFeatures()->filter(GenFeature)->select(genFeature : GenFeature | genFeature.isListType() and not genFeature.isUnsettable() and not genFeature.isWrappedFeatureMapType() and not genClass.isField(genFeature) and genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()))->notEmpty()]
+ @SuppressWarnings("unchecked")
+ [/if]
+ [/if]
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public boolean eIsSet(int featureID) {
+ switch (featureID[negativeOffsetCorrection/]) {
+[for (genFeature : GenFeature | genClass.getEIsSetGenFeatures())]
+ [let safeNameAccessor : String = if (genFeature.getSafeName() = 'featureID') then 'this.' + genFeature.getSafeName() else genFeature.getSafeName() endif]
+ case [genClass.getQualifiedFeatureID(genFeature)/]:
+ [if (genFeature.hasSettingDelegate()) ]
+ [if (genFeature.isUnsettable()) ]
+ return isSet[genFeature.getAccessorName()/]();
+ [else]
+ return [genFeature.getUpperName()/]__ESETTING_DELEGATE.dynamicIsSet(this, null, 0);
+ [/if]
+ [else][if (genFeature.isListType() and not genFeature.isUnsettable()) ]
+ [if (genFeature.isWrappedFeatureMapType()) ]
+ [if (genFeature.isVolatile()) ]
+ return !(([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal.Wrapper)[genFeature.getGetAccessor()/]()).featureMap().isEmpty();
+ [else]
+ return [genFeature.getGetAccessor()/]() != null && ![genFeature.getGetAccessor()/]().featureMap().isEmpty();
+ [/if]
+ [else]
+ [if (genClass.isField(genFeature)) ]
+ return [genFeature.getGetAccessor()/]() != null && ![genFeature.getGetAccessor()/]().isEmpty();
+ [else]
+ [if (genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
+ [genFeature.getImportedType(genClass)/] [safeNameAccessor/] = ([genFeature.getImportedType(genClass)/])eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ return [safeNameAccessor/] != null && ![safeNameAccessor/].isEmpty();
+ [else]
+ return ![genFeature.getGetAccessor()/]().isEmpty();
+ [/if]
+ [/if]
+ [/if]
+ [else][if (genFeature.isUnsettable()) ]
+ return isSet[genFeature.getAccessorName()/]();
+ [else][if (genFeature.isResolveProxies()) ]
+ [if (genClass.isField(genFeature)) ]
+ return [genFeature.getGetAccessor()/]() != null;
+ [else]
+ [if (genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
+ return eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]) != null;
+ [else]
+ return basicGet[genFeature.getAccessorName()/]() != null;
+ [/if]
+ [/if]
+ [else][if (not genFeature.hasEDefault()) ]
+ [if (genClass.isField(genFeature)) ]
+ return [genFeature.getGetAccessor()/]() != null;
+ [else]
+ [if (genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
+ return eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]) != null;
+ [else]
+ return [genFeature.getGetAccessor()/]() != null;
+ [/if]
+ [/if]
+ [else][if (genFeature.isPrimitiveType() or genFeature.isEnumType()) ]
+ [if (genClass.isField(genFeature)) ]
+ [if (genClass.isFlag(genFeature)) ]
+ [if (genFeature.isBooleanType()) ]
+ return (([genClass.getFlagsField(genFeature)/] & [genFeature.getUpperName()/]_EFLAG) != 0) != [genFeature.getEDefault()/];
+ [else]
+ return ([genClass.getFlagsField(genFeature)/] & [genFeature.getUpperName()/]_EFLAG) != [genFeature.getUpperName()/]_EFLAG_DEFAULT;
+ [/if]
+ [else]
+ return [genFeature.getGetAccessor()/]() != [genFeature.getEDefault()/];
+ [/if]
+ [else]
+ [if (genFeature.isEnumType() and genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
+ return eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], [genFeature.getEDefault()/]) != [genFeature.getEDefault()/];
+ [else]
+ return [genFeature.getGetAccessor()/]() != [genFeature.getEDefault()/];
+ [/if]
+ [/if]
+ [else]
+ [if (genClass.isField(genFeature)) ]
+ return [genFeature.getEDefault()/] == null ? [genFeature.getGetAccessor()/]() != null : ![genFeature.getEDefault()/].equals([genFeature.getGetAccessor()/]());
+ [else]
+ [if (genFeature.isField() and genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
+ [genFeature.getImportedType(genClass)/] [safeNameAccessor/] = ([genFeature.getImportedType(genClass)/])eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], [genFeature.getEDefault()/]);
+ return [genFeature.getEDefault()/] == null ? [safeNameAccessor/] != null : ![genFeature.getEDefault()/].equals([safeNameAccessor/]);
+ [else]
+ return [genFeature.getEDefault()/] == null ? [genFeature.getGetAccessor()/]() != null : ![genFeature.getEDefault()/].equals([genFeature.getGetAccessor()/]());
+ [/if]
+ [/if]
+ [/if][/if][/if][/if][/if][/if]
+ [/let]
+[/for]
+ }
+[if (genModel.minimalReflectiveMethods) ]
+ return super.eIsSet(featureID);
+[else]
+ return eDynamicIsSet(featureID);
+[/if]
+ }
+
+[/template]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl
new file mode 100644
index 00000000000..b6d0ecd3c59
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/eUnset.mtl
@@ -0,0 +1,54 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module eUnset('http://www.eclipse.org/emf/2002/GenModel')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+
+[template public eUnset(genClass : GenClass, genModel : GenModel, negativeOffsetCorrection : String)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public void eUnset(int featureID) {
+ switch (featureID[negativeOffsetCorrection/]) {
+ [for (genFeature : GenFeature | genClass.getEUnsetGenFeatures())]
+ case [genClass.getQualifiedFeatureID(genFeature)/]:
+ [if (genFeature.isListType() and not genFeature.isUnsettable()) ]
+ [if (genFeature.isWrappedFeatureMapType()) ]
+ (([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal.Wrapper)[genFeature.getGetAccessor()/]()).featureMap().clear();
+ [else]
+ [genFeature.getGetAccessor()/]().clear();
+ [/if]
+ [else][if (genFeature.isUnsettable()) ]
+ unset[genFeature.getAccessorName()/]();
+ [else][if (not genFeature.hasEDefault()) ]
+ set[genFeature.getAccessorName()/](([genFeature.getImportedType(genClass)/])null);
+ [else]
+ set[genFeature.getAccessorName()/]([genFeature.getEDefault()/]);
+ [/if][/if][/if]
+ return;
+ [/for]
+ }
+ [if (genModel.minimalReflectiveMethods) ]
+ super.eUnset(featureID);
+ [else]
+ eDynamicUnset(featureID);
+ [/if]
+ }
+
+[/template]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl
new file mode 100644
index 00000000000..39960920800
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genDeclaredFields.mtl
@@ -0,0 +1,206 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module genDeclaredFields('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+
+[template public genDeclaredFields(genFeature : GenFeature, genClass : GenClass, genModel : GenModel, isGWT : Boolean, isJDK50 : Boolean)]
+ [if (genFeature.hasSettingDelegate())]
+ /**
+ * The cached setting delegate for the '{@link #[genFeature.getGetAccessor()/]() <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genFeature.getGetAccessor()/]()
+ * @generated
+ * @ordered
+ */
+ [if (isGWT) ]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected [genModel.getImportedName('org.eclipse.emf.ecore.EStructuralFeature')/].Internal.SettingDelegate [genFeature.getUpperName()/]__ESETTING_DELEGATE = (([genModel.getImportedName('org.eclipse.emf.ecore.EStructuralFeature')/].Internal)[genFeature.getQualifiedFeatureAccessor()/]).getSettingDelegate();
+
+ [else][if (genFeature.isListType() or genFeature.isReferenceType())]
+ [if (genClass.isField(genFeature)) ]
+ /**
+ * The cached value of the '{@link #[genFeature.getGetAccessor()/]() <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genFeature.getGetAccessor()/]()
+ * @generated
+ * @ordered
+ */
+ [if (isGWT) ]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected [genFeature.getImportedInternalType(genClass)/] [genFeature.getSafeName()/];
+
+ [/if]
+ [if (genModel.arrayAccessors and genFeature.isListType() and not genFeature.isFeatureMapType() and not genFeature.isMapType())]
+ [let rawListItemType : String = genFeature.getRawListItemType()]
+ [let index : Integer = rawListItemType.index('[')]
+ [let head : String = if (index <> -1) then rawListItemType.substring(1, index) else rawListItemType endif]
+ [let tail : String = if (index <> -1) then rawListItemType.substring(index + 1) else '' endif]
+ /**
+ * The empty value for the '{@link #[genFeature.getGetArrayAccessor()/]() <em>[genFeature.getFormattedName()/]</em>}' array accessor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genFeature.getGetArrayAccessor()/]()
+ * @generated
+ * @ordered
+ */
+ [if (genFeature.getQualifiedListItemType(genClass).contains('<')) ]
+ @SuppressWarnings("unchecked")
+ [/if]
+ protected static final [rawListItemType/]['[]'/] [genFeature.getUpperName()/]_EEMPTY_ARRAY = new [head/] ['[0]'/][tail/];
+
+ [/let]
+ [/let]
+ [/let]
+ [/let]
+ [/if]
+ [else]
+ [if (genFeature.hasEDefault() and (not genFeature.isVolatile() or not genModel.reflectiveDelegation and (not genFeature.hasDelegateFeature() or not genFeature.isUnsettable())))]
+ [let staticDefaultValue : String = genFeature.getStaticDefaultValue()]
+ /**
+ * The default value of the '{@link #[genFeature.getGetAccessor()/]() <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genFeature.getGetAccessor()/]()
+ * @generated
+ * @ordered
+ */
+ [if (genModel.useGenerics() and genFeature.isListDataType() and genFeature.isSetDefaultValue()) ]
+ @SuppressWarnings("unchecked")
+ [/if]
+ protected static final [genFeature.getImportedType(genClass)/] [genFeature.getEDefault()/][if (staticDefaultValue = '') ]; // TODO The default value literal "[genFeature.ecoreFeature.defaultValueLiteral/]" is not valid.[else] = [staticDefaultValue/];[genModel.getNonNLS(staticDefaultValue)/][/if]
+
+ [/let]
+ [/if]
+ [if (genClass.isField(genFeature)) ]
+ [if (genClass.isFlag(genFeature))]
+ [let flagIndex : Integer = genClass.getFlagIndex(genFeature)]
+ [if (flagIndex > 31 and flagIndex.mod(32) = 0)]
+ /**
+ * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [if (isGWT)]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected int [genClass.getFlagsField(genFeature)/] = 0;
+
+ [/if]
+ [if (genFeature.isEnumType())]
+ /**
+ * The offset of the flags representing the value of the '{@link #[genFeature.getGetAccessor()/]() <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ protected static final int [genFeature.getUpperName()/]_EFLAG_OFFSET = [flagIndex.mod(32)/];
+
+ /**
+ * The flags representing the default value of the '{@link #[genFeature.getGetAccessor()/]() <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ protected static final int [genFeature.getUpperName()/]_EFLAG_DEFAULT = [if (isJDK50) ][genFeature.getEDefault()/].ordinal()[else][genFeature.getImportedType(genClass)/].VALUES.indexOf([genFeature.getEDefault()/])[/if] << [genFeature.getUpperName()/]_EFLAG_OFFSET;
+
+ /**
+ * The array of enumeration values for '{@link [genFeature.getImportedType(genClass)/] [genFeature.getTypeGenClassifier().getFormattedName()/]}'
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ private static final [genFeature.getImportedType(genClass)/]['[]'/] [genFeature.getUpperName()/]_EFLAG_VALUES = [if (isJDK50) ][genFeature.getImportedType(genClass)/].values()[else]([genFeature.getImportedType(genClass)/]['[]'/])[genFeature.getImportedType(genClass)/].VALUES.toArray(new [genFeature.getImportedType(genClass)/]['['/][genFeature.getImportedType(genClass)/].VALUES->size()])[/if];
+
+ [/if]
+ /**
+ * The flag[if genClass.getFlagSize(genFeature) > 1]s[/if] representing the value of the '{@link #[genFeature.getGetAccessor()/]() <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genFeature.getGetAccessor()/]()
+ * @generated
+ * @ordered
+ */
+ protected static final int [genFeature.getUpperName()/]_EFLAG = [genClass.getFlagMask(genFeature)/] << [if (genFeature.isEnumType()) ][genFeature.getUpperName()/]_EFLAG_OFFSET[else][flagIndex.mod(32)/][/if];
+
+ [/let]
+ [else]
+ /**
+ * The cached value of the '{@link #[genFeature.getGetAccessor()/]() <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genFeature.getGetAccessor()/]()
+ * @generated
+ * @ordered
+ */
+ [if (isGWT) ]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected [genFeature.getImportedType(genClass)/] [genFeature.getSafeName()/][if (genFeature.hasEDefault()) ] = [genFeature.getEDefault()/][/if];
+
+ [/if]
+ [/if]
+ [/if][/if]
+ [if (genClass.isESetField(genFeature)) ]
+ [if (genClass.isESetFlag(genFeature))]
+ [let flagIndex : Integer = genClass.getESetFlagIndex(genFeature)]
+ [if (flagIndex > 31 and flagIndex.mod(32) = 0) ]
+ /**
+ * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [if (isGWT) ]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected int [genClass.getESetFlagsField(genFeature)/] = 0;
+
+ [/if]
+ /**
+ * The flag representing whether the [genFeature.getFormattedName()/] [genFeature.getFeatureKind()/] has been set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ protected static final int [genFeature.getUpperName()/]_ESETFLAG = 1 << [flagIndex.mod(32) /];
+ [/let]
+ [else]
+ /**
+ * This is true if the [genFeature.getFormattedName()/] [genFeature.getFeatureKind()/] has been set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [if (isGWT) ]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected boolean [genFeature.getUncapName()/]ESet;
+
+ [/if]
+ [/if]
+[/template]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl
new file mode 100644
index 00000000000..2f3a615e867
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genFeature.mtl
@@ -0,0 +1,902 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module genFeature('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore','http://www.eclipse.org/uml2/4.0.0/UML')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnum /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenOperation /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenParameter /]
+[import org::eclipse::papyrus::facade::codegen::utils::FacadeCodegenUtils /]
+[import org::eclipse::papyrus::facade::codegen::utils::WrappingListUtils /]
+[import org::eclipse::emf::eef::codegen::ecore::model::FactoryClass/]
+
+[template public genFeature(genFeature : GenFeature, genClass : GenClass, genPackage : GenPackage, genModel : GenModel, isJDK50 : Boolean, isInterface : Boolean, isImplementation : Boolean, positiveOffsetCorrection : String, negativeOffsetCorrection : String, singleWildcard : String)]
+[if (genModel.arrayAccessors and genFeature.isListType() and not genFeature.isFeatureMapType() and not genFeature.isMapType()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (not isImplementation) ]
+ [genFeature.getListItemType(genClass)/]['[]'/] [genFeature.getGetArrayAccessor()/]();
+
+ [else]
+ public [genFeature.getListItemType(genClass)/]['[]'/] [genFeature.getGetArrayAccessor()/]() {
+ [if (genFeature.isVolatile()) ]
+ [genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/][genFeature.getListTemplateArguments(genClass)/] list = ([genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/][genFeature.getListTemplateArguments(genClass)/])[genFeature.getGetAccessor()/]();
+ if (list.isEmpty()) return [if (genModel.useGenerics() and not genFeature.getListItemType(genClass).contains('<') and genFeature.getListItemType(null) <> genFeature.getListItemType(genClass)) ]([genFeature.getListItemType(genClass)/]['[]'/])[/if][genFeature.getUpperName()/]_EEMPTY_ARRAY;
+ [else]
+ if ([genFeature.getSafeName()/] == null || [genFeature.getSafeName()/].isEmpty()) return [if (genModel.useGenerics() and not genFeature.getListItemType(genClass).contains('<') and genFeature.getListItemType(null) <> genFeature.getListItemType(genClass)) ]([genFeature.getListItemType(genClass)/]['[]'/])[/if][genFeature.getUpperName()/]_EEMPTY_ARRAY;
+ [genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/][genFeature.getListTemplateArguments(genClass)/] list = ([genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/][genFeature.getListTemplateArguments(genClass)/])[genFeature.getSafeName()/];
+ [/if]
+ list.shrink();
+ return ([genFeature.getListItemType(genClass)/]['[]'/])list.data();
+ }
+
+ [/if]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (not isImplementation) ]
+ [genFeature.getListItemType(genClass)/] get[genFeature.getAccessorName()/](int index);
+
+ [else]
+ public [genFeature.getListItemType(genClass)/] get[genFeature.getAccessorName()/](int index) {
+ return [if (not genModel.useGenerics()) ]([genFeature.getListItemType(genClass)/])[/if][genFeature.getGetAccessor()/]().get(index);
+ }
+
+ [/if]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (not isImplementation) ]
+ int get[genFeature.getAccessorName()/]Length();
+
+ [else]
+ public int get[genFeature.getAccessorName()/]Length() {
+ [if (genFeature.isVolatile()) ]
+ return [genFeature.getGetAccessor()/]().size();
+ [else]
+ return [genFeature.getSafeName()/] == null ? 0 : [genFeature.getSafeName()/].size();
+ [/if]
+ }
+
+ [/if]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (not isImplementation) ]
+ void set[genFeature.getAccessorName()/]([genFeature.getListItemType(genClass)/]['[]'/] new[genFeature.getCapName()/]);
+
+ [else]
+ public void set[genFeature.getAccessorName()/]([genFeature.getListItemType(genClass)/]['[]'/] new[genFeature.getCapName()/]) {
+ (([genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/][genFeature.getListTemplateArguments(genClass)/])[genFeature.getGetAccessor()/]()).setData(new[genFeature.getCapName()/].length, new[genFeature.getCapName()/]);
+ }
+
+ [/if]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (not isImplementation) ]
+ void set[genFeature.getAccessorName()/](int index, [genFeature.getListItemType(genClass)/] element);
+
+ [else]
+ public void set[genFeature.getAccessorName()/](int index, [genFeature.getListItemType(genClass)/] element) {
+ [genFeature.getGetAccessor()/]().set(index, element);
+ }
+
+ [/if]
+[/if]
+[if (genFeature.isGet() and (isImplementation or not genFeature.isSuppressedGetVisibility()))]
+ [if (isInterface)]
+ /**
+ * Returns the value of the '<em><b>[genFeature.getFormattedName()/]</b></em>' [genFeature.getFeatureKind()/].
+ [if (genFeature.isListType())]
+ [if (genFeature.isMapType())]
+ [let keyFeature : GenFeature = genFeature.getMapEntryTypeGenClass().getMapEntryKeyFeature()]
+ [let valueFeature : GenFeature = genFeature.getMapEntryTypeGenClass().getMapEntryValueFeature()]
+ * The key is of type [if (keyFeature.isListType()) ]list of {@link [keyFeature.getQualifiedListItemType(genClass)/]}[else]{@link [keyFeature.getType(genClass)/]}[/if],
+ * and the value is of type [if (valueFeature.isListType()) ]list of {@link [valueFeature.getQualifiedListItemType(genClass)/]}[else]{@link [valueFeature.getType(genClass)/]}[/if],
+ [/let]
+ [/let]
+ [else][if (not genFeature.isWrappedFeatureMapType() and not (genModel.suppressEMFMetaData and 'org.eclipse.emf.ecore.EObject' = genFeature.getQualifiedListItemType(genClass)))]
+ [let typeName : String = genFeature.getQualifiedListItemType(genClass)]
+ [let index : Integer = if typeName.index('<') < 0 then typeName.index('[') else typeName.index('<') endif]
+ [let head : String = if index < 0 then typeName else typeName.substring(1, index - 1) endif]
+ [let tail : String = if index < 0 then '' else typeName.substring(index).replaceAll('<', '&lt;') endif]
+ * The list contents are of type {@link [head/]}[tail/].
+ [/let]
+ [/let]
+ [/let]
+ [/let]
+ [/if][/if]
+ [else][if (genFeature.isSetDefaultValue()) ]
+ * The default value is <code>[genFeature.getDefaultValue()/]</code>.
+ [/if][/if]
+ [if (genFeature.getTypeGenEnum() <> null) ]
+ * The literals are from the enumeration {@link [genFeature.getTypeGenEnum().getQualifiedName()/]}.
+ [/if]
+ [if (genFeature.isBidirectional() and not genFeature.getReverse().genClass.isMapEntry())]
+ [let reverseGenFeature : GenFeature = genFeature.getReverse()]
+ [if (not reverseGenFeature.isSuppressedGetVisibility()) ]
+ * It is bidirectional and its opposite is '{@link [reverseGenFeature.genClass.getQualifiedInterfaceName()/]#[reverseGenFeature.getGetAccessor()/] <em>[reverseGenFeature.getFormattedName()/]</em>}'.
+ [/if]
+ [/let]
+ [/if]
+ * <!-- begin-user-doc -->
+ [if (not genFeature.hasDocumentation()) ]
+ * <p>
+ * If the meaning of the '<em>[genFeature.getFormattedName()/]</em>' [genFeature.getFeatureKind()/] isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ [/if]
+ * <!-- end-user-doc -->
+ [if (genFeature.hasDocumentation()) ]
+ * <!-- begin-model-doc -->
+ * [genFeature.getDocumentation(genModel.getIndentation())/]
+ * <!-- end-model-doc -->
+ [/if]
+ * @return the value of the '<em>[genFeature.getFormattedName()/]</em>' [genFeature.getFeatureKind()/].
+ [if (genFeature.getTypeGenEnum() <> null) ]
+ * @see [genFeature.getTypeGenEnum().getQualifiedName()/]
+ [/if]
+ [if (genFeature.isUnsettable()) ]
+ [if (not genFeature.isSuppressedIsSetVisibility()) ]
+ * @see #isSet[genFeature.getAccessorName()/]()
+ [/if]
+ [if (genFeature.isChangeable() and not genFeature.isSuppressedUnsetVisibility()) ]
+ * @see #unset[genFeature.getAccessorName()/]()
+ [/if]
+ [/if]
+ [if (genFeature.isChangeable() and not genFeature.isListType() and not genFeature.isSuppressedSetVisibility()) ]
+ * @see #set[genFeature.getAccessorName()/]([genFeature.getRawImportedBoundType()/])
+ [/if]
+ [if (not genModel.suppressEMFMetaData) ]
+ * @see [genPackage.getQualifiedPackageInterfaceName()/]#get[genFeature.getFeatureAccessorName()/]()
+ [/if]
+ [if (genFeature.isBidirectional() and not genFeature.getReverse().genClass.isMapEntry())]
+ [let reverseGenFeature : GenFeature = genFeature.getReverse()]
+ [if (not reverseGenFeature.isSuppressedGetVisibility()) ]
+ * @see [reverseGenFeature.genClass.getQualifiedInterfaceName()/]#[reverseGenFeature.getGetAccessor()/]
+ [/if]
+ [/let]
+ [/if]
+ [if (not genModel.suppressEMFModelTags)]
+ [let modelInfoLines : Sequence(String) = genFeature.getModelInfo().tokenize(genModel.getLineDelimiter())]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + '\t * ')/]
+ [/if]
+ [/let]
+ [/if]
+ * @generated
+ */
+ [else][comment isInterface/]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isJDK50)][comment] { //Class/getGenFeature.annotations.insert.javajetinc[/comment]
+ [/if]
+ [/if][comment isInterface/]
+ [if (not isImplementation) ]
+ [genFeature.getImportedType(genClass)/] [genFeature.getGetAccessor()/]();
+
+ [else]
+ [if (genModel.useGenerics() and ((genFeature.isContainer() or genFeature.isResolveProxies()) and not genFeature.isListType() and not (genModel.reflectiveDelegation and genModel.isDynamicDelegation()) and genFeature.isUncheckedCast(genClass) or genFeature.isListType() and not genFeature.isFeatureMapType() and (genModel.reflectiveDelegation or genModel.isVirtualDelegation() or genModel.isDynamicDelegation()) or genFeature.isListDataType() and genFeature.hasDelegateFeature() or genFeature.isListType() and genFeature.hasSettingDelegate())) ]
+ @SuppressWarnings("unchecked")
+ [/if]
+ public [genFeature.getImportedType(genClass)/] [genFeature.getGetAccessor()/][if (genClass.hasCollidingGetAccessorOperation(genFeature)) ]_[/if]() {
+ [genGetContent(genFeature,genModel,genPackage,isImplementation)/]
+
+ }
+
+ [/if]
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation and genFeature.isBasicGet()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isJDK50)][comment] { //Class/basicGetGenFeature.annotations.insert.javajetinc[/comment]
+ [/if]
+ public [genFeature.getImportedType(genClass)/] basicGet[genFeature.getAccessorName()/]() {
+ [genGetContent(genFeature,genModel,genPackage,isImplementation)/]
+ }
+
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation and genFeature.isBasicSet()) ]
+
+ [genBasicSetContent(genFeature, genModel, genPackage, isImplementation, isJDK50, negativeOffsetCorrection, positiveOffsetCorrection)/]
+
+[/if]
+[if (genFeature.isSet() and (isImplementation or not genFeature.isSuppressedSetVisibility())) ]
+ [if (isInterface) ]
+ /**
+ * Sets the value of the '{@link [genClass.getQualifiedInterfaceName()/]#[genFeature.getGetAccessor()/] <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>[genFeature.getFormattedName()/]</em>' [genFeature.getFeatureKind()/].
+ [if (genFeature.isEnumType()) ]
+ * @see [genFeature.getTypeGenEnum().getQualifiedName()/]
+ [/if]
+ [if (genFeature.isUnsettable()) ]
+ [if (not genFeature.isSuppressedIsSetVisibility()) ]
+ * @see #isSet[genFeature.getAccessorName()/]()
+ [/if]
+ [if (not genFeature.isSuppressedUnsetVisibility()) ]
+ * @see #unset[genFeature.getAccessorName()/]()
+ [/if]
+ [/if]
+ * @see #[genFeature.getGetAccessor()/]()
+ * @generated
+ */
+ [else][comment isInterface /]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isJDK50)][comment] { //Class/setGenFeature.annotations.insert.javajetinc[/comment]
+ [/if]
+ [/if][comment isInterface /]
+ [if (not isImplementation)]
+ void set[genFeature.getAccessorName()/]([genFeature.getImportedType(genClass)/] value);
+
+ [else][comment not isImplementation /]
+ [comment Using query instead of variable because let does not support null !!!
+ let setAccessorOperation : GenOperation = genClass.getSetAccessorOperation(genFeature)/]
+
+ [genSetContent(genFeature, genModel, genPackage , isImplementation, isJDK50,negativeOffsetCorrection,positiveOffsetCorrection)/]
+
+ [/if][comment not isImplementation /]
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation and genFeature.isBasicUnset()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isJDK50)][comment] { //Class/basicUnsetGenFeature.annotations.insert.javajetinc[/comment]
+ [/if]
+ public [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] basicUnset[genFeature.getAccessorName()/]([genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] msgs) {
+ [if (genModel.isDynamicDelegation()) ]
+ return eDynamicInverseRemove(([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])[if (genFeature.isResolveProxies()) ]basicGet[genFeature.getAccessorName()/][else][genFeature.getGetAccessor()/][/if](), [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], msgs);
+ [else][if (not genFeature.isVolatile()) ]
+ [if (genModel.isVirtualDelegation()) ]
+ [if (not genModel.suppressNotification) ]Object old[genFeature.getCapName()/] = [/if]eVirtualUnset([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [else]
+ [if (not genModel.suppressNotification) ]
+ [genFeature.getImportedType(genClass)/] old[genFeature.getCapName()/] = [genFeature.getSafeName()/];
+ [/if]
+ [genFeature.getSafeName()/] = null;
+ [/if]
+ [if (genModel.isVirtualDelegation()) ]
+ [if (not genModel.suppressNotification) ]
+ boolean isSetChange = old[genFeature.getCapName()/] != EVIRTUAL_NO_VALUE;
+ [/if]
+ [else][if (genClass.isESetFlag(genFeature)) ]
+ [if (not genModel.suppressNotification) ]
+ boolean old[genFeature.getCapName()/]ESet = ([genClass.getESetFlagsField(genFeature)/] & [genFeature.getUpperName()/]_ESETFLAG) != 0;
+ [/if]
+ [genClass.getESetFlagsField(genFeature)/] &= ~[genFeature.getUpperName()/]_ESETFLAG;
+ [else]
+ [if (not genModel.suppressNotification) ]
+ boolean old[genFeature.getCapName()/]ESet = [genFeature.getUncapName()/]ESet;
+ [/if]
+ [genFeature.getUncapName()/]ESet = false;
+ [/if][/if]
+ [if (not genModel.suppressNotification) ]
+ if (eNotificationRequired()) {
+ [genModel.getImportedName('org.eclipse.emf.ecore.impl.ENotificationImpl')/] notification = new [genModel.getImportedName('org.eclipse.emf.ecore.impl.ENotificationImpl')/](this, [genModel.getImportedName('org.eclipse.emf.common.notify.Notification')/].UNSET, [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], [if (genModel.isVirtualDelegation()) ]isSetChange ? old[genFeature.getCapName()/] : null[else]old[genFeature.getCapName()/][/if], null, [if (genModel.isVirtualDelegation()) ]isSetChange[else]old[genFeature.getCapName()/]ESet[/if]);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ [/if]
+ [else]
+ // TODO: implement this method to unset the contained '[genFeature.getFormattedName()/]' [genFeature.getFeatureKind()/]
+ // -> this method is automatically invoked to keep the containment relationship in synch
+ // -> do not modify other features
+ // -> return msgs, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first)
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException();
+ [/if][/if]
+ }
+
+[/if]
+[if (genFeature.isUnset() and (isImplementation or not genFeature.isSuppressedUnsetVisibility())) ]
+ [if (isInterface) ]
+ /**
+ * Unsets the value of the '{@link [genClass.getQualifiedInterfaceName()/]#[genFeature.getGetAccessor()/] <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ [if (not genFeature.isSuppressedIsSetVisibility()) ]
+ * @see #isSet[genFeature.getAccessorName()/]()
+ [/if]
+ * @see #[genFeature.getGetAccessor()/]()
+ [if (not genFeature.isListType() and not genFeature.isSuppressedSetVisibility()) ]
+ * @see #set[genFeature.getAccessorName()/]([genFeature.getRawImportedBoundType()/])
+ [/if]
+ * @generated
+ */
+ [else][comment isInterface/]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isJDK50)][comment] { //Class/unsetGenFeature.annotations.insert.javajetinc[/comment]
+ [/if]
+ [/if][comment isInterface/]
+ [if (not isImplementation) ]
+ void unset[genFeature.getAccessorName()/]();
+
+ [else][comment not isImplementation/]
+ [genUnsetContent(genFeature,genModel,genPackage,isJDK50,negativeOffsetCorrection,positiveOffsetCorrection, singleWildcard)/]
+ [/if][comment not isImplementation/]
+[/if]
+[if (genFeature.isIsSet() and (isImplementation or not genFeature.isSuppressedIsSetVisibility())) ]
+ [if (isInterface) ]
+ /**
+ * Returns whether the value of the '{@link [genClass.getQualifiedInterfaceName()/]#[genFeature.getGetAccessor()/] <em>[genFeature.getFormattedName()/]</em>}' [genFeature.getFeatureKind()/] is set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return whether the value of the '<em>[genFeature.getFormattedName()/]</em>' [genFeature.getFeatureKind()/] is set.
+ [if (genFeature.isChangeable() and not genFeature.isSuppressedUnsetVisibility()) ]
+ * @see #unset[genFeature.getAccessorName()/]()
+ [/if]
+ * @see #[genFeature.getGetAccessor()/]()
+ [if (not genFeature.isListType() and genFeature.isChangeable() and not genFeature.isSuppressedSetVisibility()) ]
+ * @see #set[genFeature.getAccessorName()/]([genFeature.getRawImportedBoundType()/])
+ [/if]
+ * @generated
+ */
+ [else][comment isInterface/]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [comment][if (isJDK50)][comment] { //Class/isSetGenFeature.annotations.insert.javajetinc[/comment]
+ [/if][/comment]
+ [/if][comment isInterface/]
+ [if (not isImplementation) ]
+ boolean isSet[genFeature.getAccessorName()/]();
+
+ [else][comment not isImplementation/]
+ [genIsSetContent(genFeature , genModel, genPackage ,isJDK50,negativeOffsetCorrection,positiveOffsetCorrection, singleWildcard )/]
+
+ [/if][comment not isImplementation/]
+[/if]
+[/template]
+
+[template public genGetContentPrimitiveType(genFeature : GenFeature, genModel: GenModel, genPackage : GenPackage)]
+ [if (genFeature.isStereotypeProperty())]
+ [genModel.getImportedName('org.eclipse.uml2.uml.Stereotype')/] stereotype = (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getAppliedStereotype("[genFeature.getStereotypeQualifiedName()/]");
+
+ if(stereotype != null) {
+ Object umlElement = (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getValue(stereotype, "[genFeature.getSafeName()/]");
+
+ [if (genFeature.isDerived())]
+ [genFeature.getSafeName()/] = ([genFeature.getImportedType(genClass)/])umlElement;
+ return [genFeature.getSafeName()/];
+ [else]
+ return ([genFeature.getImportedType(genClass)/])umlElement;
+ [/if]
+ }
+
+ throw new UnsupportedOperationException();
+ [else]
+ [if (genFeature.isField())]
+ [genFeature.getSafeName()/] = (([genModel.getImportedName(genFeature.genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genFeature.ecoreFeature.findUMLGetAccessor(genModel)/]();
+ return [genFeature.getSafeName()/];
+ [else]
+ return (([genModel.getImportedName(genFeature.genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genFeature.ecoreFeature.findUMLGetAccessor(genModel)/]();
+ [/if]
+ [/if]
+[/template]
+
+[template public genGetContent(genFeature : GenFeature, genModel: GenModel, genPackage : GenPackage, isImplementation:Boolean)]
+ [if (genFeature.isListType())]
+ [if (genFeature.isPrimtiveList())]
+ [genFeature.genGetContentPrimitiveType(genModel, genPackage)/]
+ [else]
+ [genModel.getImportedName('org.eclipse.emf.common.util.EList')/]<[genModel.getImportedName(genFeature.getTypeGenClass().ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genFeature.getTypeGenClass().ecoreClass.getUMLMetaElement(genModel))/]> umlList = (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genFeature.ecoreFeature.findUMLGetAccessor(genModel)/]();
+ [genFeature.getImportedType(genClass)/] update = new [genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/]<[genFeature.getTypeGenClass().getQualifiedInterfaceName()/]>();
+ [if (genFeature.isField())]
+ if([genFeature.getSafeName()/] == null) {
+ [comment][genFeature.getSafeName()/] = new [genClass.getListConstructor(genFeature)/];[/comment]
+ [genFeature.getSafeName()/] = new [genClass.getWrappingListConstructor(genFeature,genFeature.getTypeGenClass().getQualifiedInterfaceName())/];
+ }
+ [else]
+ [genFeature.getImportedType(genClass)/] [genFeature.getSafeName()/] = new [genClass.getWrappingListConstructor(genFeature,genFeature.getTypeGenClass().getQualifiedInterfaceName())/];[comment]org.eclipse.papyrus.facade.utils.wrappinglist.WrappingBasicEList(umlList);[/comment]
+ [/if]
+
+ for([genModel.getImportedName(genFeature.getTypeGenClass().ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genFeature.getTypeGenClass().ecoreClass.getUMLMetaElement(genModel))/] umlElement : umlList) {
+
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] representingElement = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().findOrCreateSpecific(([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/])umlElement);
+ if(representingElement != null) {
+ if(representingElement instanceof [genFeature.getTypeGenClass().getQualifiedInterfaceName()/]) {
+ update.add(([genFeature.getTypeGenClass().getQualifiedInterfaceName()/])representingElement);
+ }
+ }
+ }
+
+ [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().updateCache(update, [genFeature.getSafeName()/]);
+ return [genFeature.getSafeName()/];
+ [/if]
+
+ [else]
+ [if (genFeature.isPrimitiveType() or genFeature.isStringType())]
+ [genFeature.genGetContentPrimitiveType(genModel, genPackage)/]
+ [else]
+ [if (genFeature.isStereotypeProperty())]
+ [genModel.getImportedName('org.eclipse.uml2.uml.Stereotype')/] stereotype = (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getAppliedStereotype("[genFeature.getStereotypeQualifiedName()/]");
+
+ if(stereotype != null) {
+ Object umlElement = (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getValue(stereotype, "[genFeature.getSafeName()/]");
+ [else]
+ [if (genFeature.isExtentionStereotypeProperty())]
+ [genModel.getImportedName(genFeature.getTypeGenClassifier().getEcoreClassifier().findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genFeature.getTypeGenClassifier().getEcoreClassifier().getUMLMetaElement(genModel))/] umlElement = [genModel.getImportedName('org.eclipse.uml2.uml.util.UMLUtil')/].getStereotypeApplication(([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])get__Represented(), [genModel.getImportedName(genFeature.getTypeGenClassifier().getEcoreClassifier().findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genFeature.getTypeGenClassifier().getEcoreClassifier().getUMLMetaElement(genModel))/].class);
+ [else]
+ [genModel.getImportedName(genFeature.getTypeGenClassifier().getEcoreClassifier().findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genFeature.getTypeGenClassifier().getEcoreClassifier().getUMLMetaElement(genModel))/] umlElement = (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genFeature.ecoreFeature.findUMLGetAccessor(genModel)/]();
+ [/if]
+
+ [/if]
+
+ if(umlElement [if (genFeature.isEnumType())] !=null [else] instanceof [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] [/if]) {
+
+
+ [if (genFeature.isEnumType())]
+ Enum representingElement = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().getEnumMappingFromUML((Enum)umlElement);
+ [else]
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] representingElement = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().findOrCreateSpecific(([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/])umlElement);
+ [/if]
+
+ if(representingElement != null) {
+ if(representingElement instanceof [genFeature.getTypeGenClassifier().getAppropriateQualifiedTypeName()/]) {
+ [if (not genClass.isField(genFeature)) ]
+ return ([genFeature.getTypeGenClassifier().getAppropriateQualifiedTypeName()/])representingElement;
+ [else]
+ [genFeature.getSafeName()/] = ([genFeature.getTypeGenClassifier().getAppropriateQualifiedTypeName()/])representingElement;
+
+ return [genFeature.getSafeName()/];
+ [/if]
+ }
+ }
+ }
+ [if (genFeature.isStereotypeProperty())]
+ }
+ [/if]
+
+ return null;
+ [/if]
+ [/if]
+[/template]
+
+[template public genSetContent(genFeature : GenFeature, genModel: GenModel, genPackage : GenPackage, isImplementation:Boolean, isJDK50:Boolean,negativeOffsetCorrection:String,positiveOffsetCorrection:String)]
+ public void set[genFeature.getAccessorName()/][if (genClass.hasCollidingSetAccessorOperation(genFeature)) ]_[/if]([genFeature.getImportedType(genClass)/] [if (genClass.getSetAccessorOperation(genFeature) = null)]new[genFeature.getCapName()/][else][genClass.getSetAccessorOperation(genFeature).genParameters->at(1).getName()/][/if]) {
+ [if (not genFeature.isVolatile()) ]
+ [if (genFeature.isContainer())]
+ [let reverseFeature : GenFeature = genFeature.getReverse()]
+ [let targetClass : GenClass = reverseFeature.genClass]
+ [let reverseOffsetCorrection : String = if (targetClass.hasOffsetCorrection()) then ' + ' + genClass.getOffsetCorrectionField(genFeature) else '' endif]
+ if (new[genFeature.getCapName()/] != eInternalContainer() || (eContainerFeatureID() != [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/] && new[genFeature.getCapName()/] != null)) {
+ if ([genModel.getImportedName('org.eclipse.emf.ecore.util.EcoreUtil')/].isAncestor(this, [genFeature.getEObjectCast()/]new[genFeature.getCapName()/]))
+ throw new [genModel.getImportedName('java.lang.IllegalArgumentException')/]("Recursive containment not allowed for " + toString());[genModel.getNonNLS()/]
+ if (eInternalContainer() != null)
+ eBasicRemoveFromContainer(null);
+ if (new[genFeature.getCapName()/] != null)
+ (([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])new[genFeature.getCapName()/]).eInverseAdd(this, [targetClass.getQualifiedFeatureID(reverseFeature)/][reverseOffsetCorrection/], [targetClass.getRawImportedInterfaceName()/].class, null);
+ basicSet[genFeature.getAccessorName()/]([genFeature.getInternalTypeCast()/]new[genFeature.getCapName()/], null);
+
+ }
+ [/let]
+ [/let]
+ [/let]
+ [else][if (genFeature.isBidirectional() or genFeature.isEffectiveContains()) ]
+ [if (genModel.isVirtualDelegation()) ]
+ [genFeature.getImportedType(genClass)/] [genFeature.getSafeName()/] = ([genFeature.getImportedType(genClass)/])eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [/if]
+ if (new[genFeature.getCapName()/] != [genFeature.getSafeName()/]) {
+ if ([genFeature.getSafeName()/] != null)
+ [if (not genFeature.isBidirectional()) ]
+ (([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])[genFeature.getSafeName()/]).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - [genClass.getQualifiedFeatureID(genFeature)/][negativeOffsetCorrection/], null, null);
+ if (new[genFeature.getCapName()/] != null)
+ (([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])new[genFeature.getCapName()/]).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - [genClass.getQualifiedFeatureID(genFeature)/][negativeOffsetCorrection/], null, null);
+ [else]
+ [let reverseFeature : GenFeature = genFeature.getReverse()]
+ [let targetClass : GenClass = reverseFeature.genClass]
+ [let reverseOffsetCorrection : String = if (targetClass.hasOffsetCorrection()) then ' + ' + genClass.getOffsetCorrectionField(genFeature) else '' endif]
+ (([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])[genFeature.getSafeName()/]).eInverseRemove(this, [targetClass.getQualifiedFeatureID(reverseFeature)/][reverseOffsetCorrection/], [targetClass.getRawImportedInterfaceName()/].class, null);
+ if (new[genFeature.getCapName()/] != null)
+ (([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])new[genFeature.getCapName()/]).eInverseAdd(this, [targetClass.getQualifiedFeatureID(reverseFeature)/][reverseOffsetCorrection/], [targetClass.getRawImportedInterfaceName()/].class, null);
+ [/let]
+ [/let]
+ [/let]
+ [/if]
+ basicSet[genFeature.getAccessorName()/]([genFeature.getInternalTypeCast()/]new[genFeature.getCapName()/], null);
+ }[if (genFeature.isUnsettable())] else {
+ [if (genModel.isVirtualDelegation()) ]
+ boolean old[genFeature.getCapName()/]ESet = eVirtualIsSet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [else][if (genClass.isESetFlag(genFeature)) ]
+ [if (not genModel.suppressNotification) ]
+ boolean old[genFeature.getCapName()/]ESet = ([genClass.getESetFlagsField(genFeature)/] & [genFeature.getUpperName()/]_ESETFLAG) != 0;
+ [/if]
+ [genClass.getESetFlagsField(genFeature)/] |= [genFeature.getUpperName()/]_ESETFLAG;
+ [else]
+ [if (not genModel.suppressNotification) ]
+ boolean old[genFeature.getCapName()/]ESet = [genFeature.getUncapName()/]ESet;
+ [/if]
+ [genFeature.getUncapName()/]ESet = true;
+ [/if][/if]
+ [if (not genModel.suppressNotification) ]
+ if (eNotificationRequired())
+ eNotify(new [genModel.getImportedName('org.eclipse.emf.ecore.impl.ENotificationImpl')/](this, [genModel.getImportedName('org.eclipse.emf.common.notify.Notification')/].SET, [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], new[genFeature.getCapName()/], new[genFeature.getCapName()/], not old[genFeature.getCapName()/]ESet));
+ [/if]
+ }
+
+ [/if]
+ [else]
+
+
+
+ [if (genFeature.isAPrimitiveType() or genFeature.isStringType() ) ]
+ [if (genFeature.isStereotypeProperty())]
+ [stereotypeSetContent(genModel,genFeature)/]
+ [else]
+ (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).set[genFeature.ecoreFeature.findUMLAccessorName(genModel)/](new[genFeature.getCapName()/]);
+ [/if]
+ [else]
+ [if (genFeature.isEnumType())]
+ [if (genFeature.isStereotypeProperty())]
+ [stereotypeSetContent(genModel,genFeature)/]
+ [else]
+ (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).set[genFeature.ecoreFeature.findUMLAccessorName(genModel)/](([genModel.getImportedName(genFeature.getTypeGenClassifier().getEcoreClassifier().findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genFeature.getTypeGenClassifier().getEcoreClassifier().getUMLMetaElement(genModel))/])[genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().getEnumMappingFromSpecific(new[genFeature.getCapName()/]));
+ [/if]
+ [else]
+ [if (genFeature.isStereotypeProperty())]
+ [stereotypeSetContent(genModel,genFeature)/]
+ [else]
+ (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).set[genFeature.ecoreFeature.findUMLAccessorName(genModel)/](([genModel.getImportedName(genFeature.getTypeGenClassifier().getEcoreClassifier().findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genFeature.getTypeGenClassifier().getEcoreClassifier().getUMLMetaElement(genModel))/])new[genFeature.getCapName()/].get__Represented());
+ [/if]
+ [/if]
+ [/if]
+ [/if][/if]
+ [else]
+ throw new UnsupportedOperationException();
+ [/if]
+ }
+[/template]
+
+[template public stereotypeSetContent(genModel:GenModel,genFeature:GenFeature)]
+ [genModel.getImportedName('org.eclipse.uml2.uml.Stereotype')/] stereotype = (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])get__Represented()).getAppliedStereotype("[genFeature.getStereotypeQualifiedName()/]");
+
+ if(stereotype != null) {
+ (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])get__Represented()).setValue(stereotype, "[genFeature.ecoreFeature.name/]", new[genFeature.getCapName()/]);
+ }
+[/template]
+
+[template public genBasicSetContent(genFeature : GenFeature, genModel: GenModel, genPackage : GenPackage, isImplementation:Boolean, isJDK50:Boolean,negativeOffsetCorrection:String,positiveOffsetCorrection:String)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isJDK50)][comment] { //Class/basicSetGenFeature.annotations.insert.javajetinc[/comment]
+ [/if]
+ public [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] basicSet[genFeature.getAccessorName()/]([genFeature.getImportedInternalType(genClass)/] new[genFeature.getCapName()/], [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] msgs) {
+ [if (genFeature.isContainer()) ]
+ msgs = eBasicSetContainer(([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])new[genFeature.getCapName()/], [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], msgs);
+ return msgs;
+ [else][if (genModel.isDynamicDelegation()) ]
+ msgs = eDynamicInverseAdd(([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])new[genFeature.getCapName()/], [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], msgs);
+ return msgs;
+ [else][if (not genFeature.isVolatile()) ]
+ [if (genModel.isVirtualDelegation()) ]
+ Object old[genFeature.getCapName()/] = eVirtualSet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], new[genFeature.getCapName()/]);
+ [else]
+ [genFeature.getImportedType(genClass)/] old[genFeature.getCapName()/] = [genFeature.getSafeName()/];
+ [genFeature.getSafeName()/] = new[genFeature.getCapName()/];
+ [/if]
+ [if (genFeature.isUnsettable()) ]
+ [if (genModel.isVirtualDelegation()) ]
+ [if (not genModel.suppressNotification) ]
+ boolean isSetChange = old[genFeature.getCapName()/] == EVIRTUAL_NO_VALUE;
+ [/if]
+ [else][if (genClass.isESetFlag(genFeature)) ]
+ boolean old[genFeature.getCapName()/]ESet = ([genClass.getESetFlagsField(genFeature)/] & [genFeature.getUpperName()/]_ESETFLAG) != 0;
+ [if (not genModel.suppressNotification) ]
+ [genClass.getESetFlagsField(genFeature)/] |= [genFeature.getUpperName()/]_ESETFLAG;
+ [/if]
+ [else]
+ [if (not genModel.suppressNotification) ]
+ boolean old[genFeature.getCapName()/]ESet = [genFeature.getUncapName()/]ESet;
+ [/if]
+ [genFeature.getUncapName()/]ESet = true;
+ [/if][/if]
+ [/if]
+
+ [if (genFeature.isStereotypeProperty())]
+ [genModel.getImportedName('org.eclipse.uml2.uml.Stereotype')/] stereotype = (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])get__Represented()).getAppliedStereotype("[genFeature.getStereotypeQualifiedName()/]");
+
+ if(stereotype != null) {
+ if(new[genFeature.getCapName()/] == null) {
+ (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])get__Represented()).setValue(stereotype, "[genFeature.ecoreFeature.name/]", null);
+ } else {
+ (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])get__Represented()).setValue(stereotype, "[genFeature.ecoreFeature.name/]", new[genFeature.getCapName()/].get__Represented());
+ }
+ }
+ [else]
+ [if (genFeature.isExtentionStereotypeProperty())]
+ if(new[genFeature.getCapName()/] == null) {
+ String['[]'/] stereotypesQualifiedNames = { [genFeature.getTypeGenClassifier().getEcoreClassifier().getAllStereotypeQualifiedNames(genModel)/] };
+
+ for([genModel.getImportedName('java.lang.String')/] stereoQualifiedName : stereotypesQualifiedNames) {
+ if((([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getAppliedStereotype(stereoQualifiedName) != null) {
+ [genModel.getImportedName('org.eclipse.uml2.uml.Stereotype')/] stereotype = (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getApplicableStereotype(stereoQualifiedName);
+ if(stereotype != null) {
+ (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).unapplyStereotype(stereotype);
+ } else {
+ System.err.println("Problem: cannot unapply stereotype " + stereoQualifiedName);
+ }
+ }
+ }
+ [genModel.getImportedName('org.eclipse.emf.common.notify.Notification')/] notification = new [genModel.getImportedName('org.eclipse.emf.ecore.impl.ENotificationImpl')/](this, [genModel.getImportedName('org.eclipse.emf.common.notify.Notification')/].REMOVE, [genModel.getImportedName(genPackage.getImportedPackageInterfaceName())/].eINSTANCE.get[genFeature.getFeatureAccessorName()/](), old[genFeature.getCapName()/], new[genFeature.getCapName()/], -1, old[genFeature.getCapName()/] != null);
+ this.eNotify(notification);
+ } else {
+ String['[]'/] stereotypesQualifiedNames = { [genFeature.getTypeGenClassifier().getEcoreClassifier().getAllStereotypeQualifiedNames(genModel)/] };
+
+ for([genModel.getImportedName('java.lang.String')/] stereoQualifiedName : stereotypesQualifiedNames) {
+ if((([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getAppliedStereotype(stereoQualifiedName) == null) {
+ [genModel.getImportedName('org.eclipse.uml2.uml.Stereotype')/] stereotype = (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getApplicableStereotype(stereoQualifiedName);
+ if(stereotype != null) {
+ (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).applyStereotype(stereotype);
+ } else {
+ System.err.println("Problem: cannot apply stereotype " + stereoQualifiedName);
+ }
+ }
+ }
+ [genModel.getImportedName('org.eclipse.emf.common.notify.Notification')/] notification = new [genModel.getImportedName('org.eclipse.emf.ecore.impl.ENotificationImpl')/](this, [genModel.getImportedName('org.eclipse.emf.common.notify.Notification')/].ADD, [genModel.getImportedName(genPackage.getImportedPackageInterfaceName())/].eINSTANCE.get[genFeature.getFeatureAccessorName()/](), old[genFeature.getCapName()/], new[genFeature.getCapName()/], -1, old[genFeature.getCapName()/] != null);
+ this.eNotify(notification);
+ }
+ [else]
+ if(new[genFeature.getCapName()/] == null) {
+ (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).set[genFeature.ecoreFeature.findUMLAccessorName(genModel)/](null);
+ } else {
+ (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).set[genFeature.ecoreFeature.findUMLAccessorName(genModel)/](([genModel.getImportedName(genFeature.getTypeGenClass().ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genFeature.getTypeGenClass().ecoreClass.getUMLMetaElement(genModel))/])new[genFeature.getCapName()/].get__Represented());
+ }
+ [/if]
+ [/if]
+
+
+
+ return null;
+ [else][if (genFeature.hasDelegateFeature())]
+ [let delegateFeature : GenFeature = genFeature.getDelegateFeature()]
+ [if (delegateFeature.isWrappedFeatureMapType()) ]
+ return (([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal)(([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal.Wrapper)get[delegateFeature.getAccessorName()/]()).featureMap()).basicAdd([genFeature.getQualifiedFeatureAccessor()/], new[genFeature.getCapName()/], msgs);
+ [else]
+ return (([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal)get[delegateFeature.getAccessorName()/]()).basicAdd([genFeature.getQualifiedFeatureAccessor()/], new[genFeature.getCapName()/], msgs);
+ [/if]
+ [/let]
+ [else]
+ // TODO: implement this method to set the contained '[genFeature.getFormattedName()/]' [genFeature.getFeatureKind()/]
+ // -> this method is automatically invoked to keep the containment relationship in synch
+ // -> do not modify other features
+ // -> return msgs, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first)
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException();
+ [/if][/if][/if][/if]
+ }
+[/template]
+
+[template public genUnsetContent(genFeature : GenFeature, genModel: GenModel, genPackage : GenPackage,isJDK50:Boolean,negativeOffsetCorrection:String,positiveOffsetCorrection:String, singleWildcard : String)]
+ public void unset[genFeature.getAccessorName()/][if (genClass.hasCollidingUnsetAccessorOperation(genFeature)) ]_[/if]() {
+
+ (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).unset[genFeature.ecoreFeature.findUMLAccessorName(genModel)/]();
+
+ [comment][if (genModel.isDynamicDelegation()) ]
+ eDynamicUnset([genClass.getQualifiedFeatureID(genFeature)/], [genFeature.getQualifiedFeatureAccessor()/]);
+ [else][if (genModel.reflectiveDelegation) ]
+ eUnset([genFeature.getQualifiedFeatureAccessor()/]);
+ [else][if (genFeature.hasSettingDelegate()) ]
+ [genFeature.getUpperName()/]__ESETTING_DELEGATE.dynamicUnset(this, null, 0);
+ [else][if (not genFeature.isVolatile()) ]
+ [if (genFeature.isListType()) ]
+ [if (genModel.isVirtualDelegation()) ]
+ [genFeature.getImportedType(genClass)/] [genFeature.getSafeName()/] = ([genFeature.getImportedType(genClass)/])eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [/if]
+ if ([genFeature.getSafeName()/] != null) (([genModel.getImportedName('org.eclipse.emf.ecore.util.InternalEList')/].Unsettable[singleWildcard/])[genFeature.getSafeName()/]).unset();
+ [else][if (genFeature.isBidirectional() or genFeature.isEffectiveContains()) ]
+ [if (genModel.isVirtualDelegation()) ]
+ [genFeature.getImportedType(genClass)/] [genFeature.getSafeName()/] = ([genFeature.getImportedType(genClass)/])eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [/if]
+ if ([genFeature.getSafeName()/] != null) {
+ [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] msgs = null;
+ [if (not genFeature.isBidirectional()) ]
+ msgs = (([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])[genFeature.getSafeName()/]).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - [genClass.getQualifiedFeatureID(genFeature)/][negativeOffsetCorrection/], null, msgs);
+ [else]
+ [let reverseFeature : GenFeature = genFeature.getReverse()]
+ [let targetClass : GenClass = reverseFeature.genClass]
+ [let reverseOffsetCorrection : String = if (targetClass.hasOffsetCorrection()) then ' + ' + genClass.getOffsetCorrectionField(genFeature) else '' endif]
+ msgs = (([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])[genFeature.getSafeName()/]).eInverseRemove(this, [targetClass.getQualifiedFeatureID(reverseFeature)/][reverseOffsetCorrection/], [targetClass.getRawImportedInterfaceName()/].class, msgs);
+ [/let]
+ [/let]
+ [/let]
+ [/if]
+ msgs = basicUnset[genFeature.getAccessorName()/](msgs);
+ if (msgs != null) msgs.dispatch();
+ } else {
+ [if (genModel.isVirtualDelegation()) ]
+ boolean old[genFeature.getCapName()/]ESet = eVirtualIsSet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [else][if (genClass.isESetFlag(genFeature)) ]
+ [if (not genModel.suppressNotification) ]
+ boolean old[genFeature.getCapName()/]ESet = ([genClass.getESetFlagsField(genFeature)/] & [genFeature.getUpperName()/]_ESETFLAG) != 0;
+ [/if]
+ [genClass.getESetFlagsField(genFeature)/] &= ~[genFeature.getUpperName()/]_ESETFLAG;
+ [else]
+ [if (not genModel.suppressNotification) ]
+ boolean old[genFeature.getCapName()/]ESet = [genFeature.getUncapName()/]ESet;
+ [/if]
+ [genFeature.getUncapName()/]ESet = false;
+ [/if][/if]
+ [if (not genModel.suppressNotification) ]
+ if (eNotificationRequired())
+ eNotify(new [genModel.getImportedName('org.eclipse.emf.ecore.impl.ENotificationImpl')/](this, [genModel.getImportedName('org.eclipse.emf.common.notify.Notification')/].UNSET, [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], null, null, old[genFeature.getCapName()/]ESet));
+ [/if]
+ }
+ [else]
+ [if (genClass.isFlag(genFeature)) ]
+ [if (not genModel.suppressNotification) ]
+ [if (genFeature.isBooleanType()) ]
+ [genFeature.getImportedType(genClass)/] old[genFeature.getCapName()/] = ([genClass.getFlagsField(genFeature)/] & [genFeature.getUpperName()/]_EFLAG) != 0;
+ [else]
+ [genFeature.getImportedType(genClass)/] old[genFeature.getCapName()/] = [genFeature.getUpperName()/]_EFLAG_VALUES['['/]([genClass.getFlagsField(genFeature)/] & [genFeature.getUpperName()/]_EFLAG) >>> [genFeature.getUpperName()/]_EFLAG_OFFSET];
+ [/if]
+ [/if]
+ [else][if (genModel.isVirtualDelegation() and not genFeature.isPrimitiveType()) ]
+ Object old[genFeature.getCapName()/] = eVirtualUnset([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [else]
+ [if (not genModel.suppressNotification) ]
+ [genFeature.getImportedType(genClass)/] old[genFeature.getCapName()/] = [genFeature.getSafeName()/];
+ [/if]
+ [/if][/if]
+ [if (not genModel.suppressNotification) ]
+ [if (genModel.isVirtualDelegation() and not genFeature.isPrimitiveType()) ]
+ boolean isSetChange = old[genFeature.getCapName()/] != EVIRTUAL_NO_VALUE;
+ [else][if (genClass.isESetFlag(genFeature)) ]
+ boolean old[genFeature.getCapName()/]ESet = ([genClass.getESetFlagsField(genFeature)/] & [genFeature.getUpperName()/]_ESETFLAG) != 0;
+ [else]
+ boolean old[genFeature.getCapName()/]ESet = [genFeature.getUncapName()/]ESet;
+ [/if][/if]
+ [/if]
+ [if (genFeature.isReferenceType()) ]
+ [genFeature.getSafeName()/] = null;
+ [if (not genModel.isVirtualDelegation()) ]
+ [if (genClass.isESetFlag(genFeature)) ]
+ [genClass.getESetFlagsField(genFeature)/] &= ~[genFeature.getUpperName()/]_ESETFLAG;
+ [else]
+ [genFeature.getUncapName()/]ESet = false;
+ [/if]
+ [/if]
+ [if (not genModel.suppressNotification) ]
+ if (eNotificationRequired())
+ eNotify(new [genModel.getImportedName('org.eclipse.emf.ecore.impl.ENotificationImpl')/](this, [genModel.getImportedName('org.eclipse.emf.common.notify.Notification')/].UNSET, [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], [if (genModel.isVirtualDelegation()) ]isSetChange ? old[genFeature.getCapName()/] : null[else]old[genFeature.getCapName()/][/if], null, [if (genModel.isVirtualDelegation()) ]isSetChange[else]old[genFeature.getCapName()/]ESet[/if]));
+ [/if]
+ [else]
+ [if (genClass.isFlag(genFeature)) ]
+ [if (genFeature.isBooleanType()) ]
+ if ([genFeature.getEDefault()/]) [genClass.getFlagsField(genFeature)/] |= [genFeature.getUpperName()/]_EFLAG; else [genClass.getFlagsField(genFeature)/] &= ~[genFeature.getUpperName()/]_EFLAG;
+ [else]
+ [genClass.getFlagsField(genFeature)/] = [genClass.getFlagsField(genFeature)/] & ~[genFeature.getUpperName()/]_EFLAG | [genFeature.getUpperName()/]_EFLAG_DEFAULT;
+ [/if]
+ [else][if (not genModel.isVirtualDelegation() or genFeature.isPrimitiveType()) ]
+ [genFeature.getSafeName()/] = [genFeature.getEDefault()/];
+ [/if][/if]
+ [if (not genModel.isVirtualDelegation() or genFeature.isPrimitiveType()) ]
+ [if (genClass.isESetFlag(genFeature)) ]
+ [genClass.getESetFlagsField(genFeature)/] &= ~[genFeature.getUpperName()/]_ESETFLAG;
+ [else]
+ [genFeature.getUncapName()/]ESet = false;
+ [/if]
+ [/if]
+ [if (not genModel.suppressNotification) ]
+ if (eNotificationRequired())
+ eNotify(new [genModel.getImportedName('org.eclipse.emf.ecore.impl.ENotificationImpl')/](this, [genModel.getImportedName('org.eclipse.emf.common.notify.Notification')/].UNSET, [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], [if (genModel.isVirtualDelegation() and not genFeature.isPrimitiveType()) ]isSetChange ? old[genFeature.getCapName()/] : [genFeature.getEDefault()/][else]old[genFeature.getCapName()/][/if], [genFeature.getEDefault()/], [if (genModel.isVirtualDelegation() and not genFeature.isPrimitiveType()) ]isSetChange[else]old[genFeature.getCapName()/]ESet[/if]));
+ [/if]
+ [/if]
+ [/if][/if]
+ [else]][if (genFeature.hasDelegateFeature())]
+ [let delegateFeature : GenFeature = genFeature.getDelegateFeature()]
+ [if (delegateFeature.isWrappedFeatureMapType()) ]
+ (([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal)(([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal.Wrapper)get[delegateFeature.getAccessorName()/]()).featureMap()).clear([genFeature.getQualifiedFeatureAccessor()/]);
+ [else]
+ (([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal)get[delegateFeature.getAccessorName()/]()).clear([genFeature.getQualifiedFeatureAccessor()/]);
+ [/if]
+ [/let]
+ [else][if (genClass.getUnsetAccessorOperation(genFeature) <> null) ]
+ [genClass.getUnsetAccessorOperation(genFeature).getBody(genModel.getIndentation())/]
+ [else]
+ // TODO: implement this method to unset the '[genFeature.getFormattedName()/]' [genFeature.getFeatureKind()/]
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException();
+ [/if][/if][/if][/if][/if][/if][/comment]
+ }
+
+[/template]
+
+[template public genIsSetContent(genFeature : GenFeature, genModel: GenModel, genPackage : GenPackage,isJDK50:Boolean,negativeOffsetCorrection:String,positiveOffsetCorrection:String, singleWildcard : String)]
+ public boolean isSet[genFeature.getAccessorName()/][if (genClass.hasCollidingIsSetAccessorOperation(genFeature)) ]_[/if]() {
+
+ return (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).isSet[genFeature.ecoreFeature.findUMLAccessorName(genModel)/]();
+
+ [comment][if (genModel.isDynamicDelegation()) ]
+ return eDynamicIsSet([genClass.getQualifiedFeatureID(genFeature)/], [genFeature.getQualifiedFeatureAccessor()/]);
+ [else][if (genModel.reflectiveDelegation) ]
+ return eIsSet([genFeature.getQualifiedFeatureAccessor()/]);
+ [else][if (genFeature.hasSettingDelegate()) ]
+ return [genFeature.getUpperName()/]__ESETTING_DELEGATE.dynamicIsSet(this, null, 0);
+ [else][if (not genFeature.isVolatile()) ]
+ [if (genFeature.isListType()) ]
+ [if (genModel.isVirtualDelegation()) ]
+ [genFeature.getImportedType(genClass)/] [genFeature.getSafeName()/] = ([genFeature.getImportedType(genClass)/])eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [/if]
+ return [genFeature.getSafeName()/] != null && (([genModel.getImportedName('org.eclipse.emf.ecore.util.InternalEList')/].Unsettable[singleWildcard/])[genFeature.getSafeName()/]).isSet();
+ [else]
+ [if (genModel.isVirtualDelegation() and not genFeature.isPrimitiveType()) ]
+ return eVirtualIsSet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [else][if (genClass.isESetFlag(genFeature)) ]
+ return ([genClass.getESetFlagsField(genFeature)/] & [genFeature.getUpperName()/]_ESETFLAG) != 0;
+ [else]
+ return [genFeature.getUncapName()/]ESet;
+ [/if][/if]
+ [/if]
+ [else][if (genFeature.hasDelegateFeature())]
+ [let delegateFeature : GenFeature = genFeature.getDelegateFeature()]
+ [if (delegateFeature.isWrappedFeatureMapType()) ]
+ return !(([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal)(([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal.Wrapper)get[delegateFeature.getAccessorName()/]()).featureMap()).isEmpty([genFeature.getQualifiedFeatureAccessor()/]);
+ [else]
+ return !(([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal)get[delegateFeature.getAccessorName()/]()).isEmpty([genFeature.getQualifiedFeatureAccessor()/]);
+ [/if]
+ [/let]
+ [else][if (genClass.getIsSetAccessorOperation(genFeature) <> null) ]
+ [genClass.getIsSetAccessorOperation(genFeature).getBody(genModel.getIndentation())/]
+ [else]
+ // TODO: implement this method to return whether the '[genFeature.getFormattedName()/]' [genFeature.getFeatureKind()/] is set
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new UnsupportedOperationException();
+ [/if][/if][/if][/if][/if][/if][/comment]
+ }
+[/template]
+
+[query public isAPrimitiveType(genFeature : GenFeature) : Boolean=
+ if(genFeature.ecoreFeature.eType.instanceTypeName='java.lang.String' or genFeature.ecoreFeature.eType.instanceTypeName='int' or genFeature.ecoreFeature.eType.instanceTypeName='boolean' or genFeature.ecoreFeature.eType.instanceTypeName='double') then true else false endif/]
+
+[query public toUpperCase( string : String) : String
+ = invoke('java.lang.String', 'toUpperCase()', Sequence{string}) /]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl
new file mode 100644
index 00000000000..54e85fb0106
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/genOperation.mtl
@@ -0,0 +1,191 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module genOperation('http://www.eclipse.org/emf/2002/GenModel')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnum /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenOperation /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenParameter /]
+[import org::eclipse::papyrus::facade::codegen::utils::FacadeCodegenUtils /]
+[import org::eclipse::papyrus::facade::codegen::utils::WrappingListUtils /]
+
+[template public genOperation(genOperation : GenOperation, genClass : GenClass, genPackage : GenPackage, genModel : GenModel, isJDK50 : Boolean, isInterface : Boolean, isImplementation : Boolean, isGWT : Boolean)]
+[if (isImplementation) ]
+ [if (genOperation.isInvariant() and genOperation.hasInvariantExpression()) ]
+ /**
+ * The cached validation expression for the '{@link #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/]) <em>[genOperation.getFormattedName()/]</em>}' invariant operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/])
+ * @generated
+ * @ordered
+ */
+ protected static final [genModel.getImportedName('java.lang.String')/] [genClass.getUniqueNameUpperCase(genOperation)/]__EEXPRESSION = "[genOperation.getInvariantExpression('\t\t')/]";[genModel.getNonNLS()/]
+
+ [else][if (genOperation.hasInvocationDelegate()) ]
+ /**
+ * The cached invocation delegate for the '{@link #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/]) <em>[genOperation.getFormattedName()/]</em>}' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #[genOperation.getName()/]([genOperation.getParameterTypes(', ')/])
+ * @generated
+ * @ordered
+ */
+ protected static final [genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/].Internal.InvocationDelegate [genClass.getUniqueNameUpperCase(genOperation)/]__EINVOCATION_DELEGATE = (([genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/].Internal)[genOperation.getQualifiedOperationAccessor()/]).getInvocationDelegate();
+
+ [/if][/if]
+[/if]
+[if (isInterface) ]
+[comment]<%@ include file="Class/genOperation.javadoc.override.javajetinc" fail="alternative" %>[/comment]
+[comment]<%@ start %>[/comment]
+ /**
+[comment]<%@ include file="Class/genOperation.javadoc.insert.javajetinc" fail="silent" %>[/comment]
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ [if (genOperation.hasDocumentation() or genOperation.hasParameterDocumentation()) ]
+ * <!-- begin-model-doc -->
+ [if (genOperation.hasDocumentation()) ]
+ * [genOperation.getDocumentation(genModel.getIndentation())/]
+ [/if]
+ [for (genParameter : GenParameter | genOperation.genParameters)]
+ [if (genParameter.hasDocumentation())]
+ [let documentation : String = genParameter.getDocumentation('')]
+ [if (documentation.contains('\n') or documentation.contains('\r')) ]
+ * @param [genParameter.getName()/]
+ * [genParameter.getDocumentation(genModel.getIndentation())/]
+ [else]
+ * @param [genParameter.getName()/] [genParameter.getDocumentation(genModel.getIndentation())/]
+ [/if]
+ [/let]
+ [/if]
+ [/for]
+ * <!-- end-model-doc -->
+ [/if]
+ [if (not genModel.suppressEMFModelTags)]
+ [let modelInfoLines : Sequence(String) = genOperation.getModelInfo().tokenize(genModel.getLineDelimiter())]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + '\t * ')/]
+ [/if]
+ [/let]
+ [/if]
+ * @generated
+ */
+[comment]<%@ end %><%//Class/genOperation.javadoc.override.javajetinc%>[/comment]
+[else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isJDK50)][comment]//Class/genOperation.annotations.insert.javajetinc[/comment]
+[comment]<%@ include file="Class/genOperation.annotations.insert.javajetinc" fail="silent" %>[/comment]
+ [/if]
+[/if]
+[if (not isImplementation) ]
+ [genOperation.getTypeParameters(genClass)/][genOperation.getImportedType(genClass)/] [genOperation.getName()/]([genOperation.getParameters(genClass)/])[genOperation.getThrows(genClass)/];
+
+[else]
+ public [genOperation.getTypeParameters(genClass)/][genOperation.getImportedType(genClass)/] [genOperation.getName()/]([genOperation.getParameters(genClass)/])[genOperation.getThrows(genClass)/] {
+ [if (genOperation.hasBody()) ]
+ [genOperation.getBody(genModel.getIndentation())/]
+ [else]
+ [if (genOperation.isListType())]
+ [if (genOperation.isPrimtiveList())]
+ [genOperation.genGetContentPrimitiveType(genModel, genPackage)/]
+ [else]
+ [genModel.getImportedName('org.eclipse.emf.common.util.EList')/]<? extends [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/]> umlList = (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genOperation.ecoreOperation.findUMLGetAccessor(genModel)/]([genParameters(genOperation)/]);
+ [genOperation.getImportedType(genClass)/] update = new [genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/]<[genOperation.getTypeGenClass().getQualifiedInterfaceName()/]>();
+
+ for([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] umlElement : umlList) {
+
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] representingElement = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().findOrCreateSpecific(([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/])umlElement);
+ if(representingElement != null) {
+ if(representingElement instanceof [genOperation.getTypeGenClass().getQualifiedInterfaceName()/]) {
+ update.add(([genOperation.getTypeGenClass().getQualifiedInterfaceName()/])representingElement);
+ }
+ }
+ }
+
+ return update;
+ [/if]
+
+ [else]
+ [if (genOperation.isPrimitive())]
+ [genOperation.genGetContentPrimitiveType(genModel, genPackage)/]
+ [else]
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] umlElement = (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genOperation.ecoreOperation.findUMLGetAccessor(genModel)/]([genParameters(genOperation)/]);
+
+ if(umlElement [if (genOperation.isEnumType())] !=null [else] instanceof [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] [/if]) {
+
+
+ [if (genOperation.isEnumType())]
+ Enum representingElement = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().getEnumMappingFromUML((Enum)umlElement);
+ [else]
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] representingElement = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Wrapper')/].getInstance().findOrCreateSpecific(([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/])umlElement);
+ [/if]
+
+ if(representingElement != null) {
+ if(representingElement instanceof [genOperation.getTypeGenClassifier().getAppropriateQualifiedTypeName()/]) {
+
+ return ([genOperation.getTypeGenClassifier().getAppropriateQualifiedTypeName()/])representingElement;
+
+ }
+ }
+ }
+
+ return null;
+ [/if]
+ [/if]
+
+ [/if]
+ }
+
+[/if]
+[comment]<%@ include file="Class/genOperation.insert.javajetinc" fail="silent" %>[/comment]
+[comment]<%@ end %><%//Class/implementedGenOperation.override.javajetinc%>[/comment]
+[/template]
+
+[template public genParameters(genOperation : GenOperation)]
+ [for (param : GenParameter | genOperation.genParameters) separator (',')]
+ [if (param.isPrimitive() or genOperation.isInvariant() or param.isPrimtiveList())]
+ [param.getName()/]
+ [else]
+ [if (param.isListType())]
+ [param.getGenModel().getImportedName(param.getGenPackage().getUtilitiesPackageName()+'.Wrapper')/].getInstance().toRepresentedList([param.getName()/])
+ [else]
+ [if (param.isEnumType())]
+ (([param.getGenModel().getImportedName(param.getTypeGenClassifier().getEcoreClassifier().findUMLMetaElement(param.getGenModel()).getPackagePathFromUML()+'.'+param.getTypeGenClassifier().getEcoreClassifier().getUMLMetaElement(param.getGenModel()))/])[param.getGenModel().getImportedName(param.getGenPackage().getUtilitiesPackageName()+'.Wrapper')/].getInstance().getEnumMappingFromSpecific([param.getName()/]))
+ [else]
+ ([param.getGenModel().getImportedName(param.getTypeGenClass().ecoreClass.findUMLMetaElement(param.getGenModel()).getPackagePathFromUML()+'.'+param.getTypeGenClass().ecoreClass.getUMLMetaElement(param.getGenModel()))/])[param.getName()/].get__Represented()
+ [/if]
+ [/if]
+ [/if]
+
+ [/for]
+[/template]
+
+[template public genGetContentPrimitiveType(genOperation : GenOperation, genModel: GenModel, genPackage : GenPackage)]
+
+ [if (genOperation.isVoid())]
+ (([genModel.getImportedName(genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genOperation.ecoreOperation.findUMLGetAccessor(genModel)/]([genParameters(genOperation)/]);
+ [else]
+ return (([genModel.getImportedName(genOperation.genClass.ecoreClass.findUMLMetaElement(genModel).getPackagePathFromUML()+'.'+genClass.ecoreClass.getUMLMetaElement(genModel))/])get__Represented()).[genOperation.ecoreOperation.findUMLGetAccessor(genModel)/]([genParameters(genOperation)/]);
+ [/if]
+
+[/template]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl
new file mode 100644
index 00000000000..27bebd978a0
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genclass/reflectiveDelegationAlternative.mtl
@@ -0,0 +1,39 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module reflectiveDelegationAlternative('http://www.eclipse.org/emf/2002/GenModel')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+
+
+[template public reflectiveDelegationAlternative(genClass : GenClass, isImplementation : Boolean, genModel : GenModel)]
+[if (isImplementation
+ and (genModel.featureDelegation = GenDelegationKind::Reflective
+ or genModel.isDynamicDelegation())
+ and (genClass.getClassExtendsGenClass() = null
+ or (genClass.getClassExtendsGenClass().getGenModel().featureDelegation <> GenDelegationKind::Reflective
+ and not genClass.getClassExtendsGenClass().getGenModel().isDynamicDelegation()))) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ protected int eStaticFeatureCount()
+ {
+ return [if genClass.getClassExtendsGenClass() = null]0[else][genClass.getClassExtendsGenClass().getAllGenFeatures()->size()/][/if];
+ }
+
+[/if]
+[/template]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/AbstractRepresentingClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/AbstractRepresentingClass.mtl
new file mode 100644
index 00000000000..ea9464612df
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/AbstractRepresentingClass.mtl
@@ -0,0 +1,69 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module AbstractRepresentingClass('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::common /]
+[import org::eclipse::emf::eef::codegen::ecore::services::header /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::StringUtil /]
+
+
+[template public abstractRepresentingClass(genPackage : GenPackage) { genModel : GenModel = genPackage.genModel; packageName : String = genPackage.getUtilitiesPackageName(); className : String = 'AbstractRepresentingElement'} ]
+[genModel.initializeImportManager(packageName, className)/]
+
+[genModel.getImportedName('org.eclipse.emf.common.util.URI')/]
+
+[file (genPackage.abstractRepresentingClassPath(className), false, 'UTF-8')]
+[genModel.includeHeader()/]
+package [packageName/];
+[let content : String = genPackage. abstractRepresentingFileContent(genModel, className)]
+[genModel.genSortedImports()/]
+[content/]
+[/let]
+[/file]
+[/template]
+
+[template protected abstractRepresentingFileContent(genPackage : GenPackage, genModel : GenModel, className : String)]
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
+import org.eclipse.papyrus.facade.utils.RepresentingElement;
+
+
+public abstract class AbstractRepresentingElement extends MinimalEObjectImpl.Container implements RepresentingElement {
+
+
+ protected EObject __representedElement;
+
+ @Override
+ public EObject get__Represented() {
+ return __representedElement;
+ }
+
+ @Override
+ public void set__Represented(EObject represented) {
+ this.__representedElement = represented;
+ }
+
+
+}
+
+[/template]
+
+[query public abstractRepresentingClassPath(genPackage : GenPackage, className : String) : String
+ = genPackage.genModel.extractSourceDirectory(genPackage.genModel.modelDirectory) + '/'+ genPackage.getUtilitiesPackageName().toPath() + '/' +
+ className+ '.java'/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/Class.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/Class.mtl
new file mode 100644
index 00000000000..4e80f3a0cf3
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/Class.mtl
@@ -0,0 +1,1029 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module Class('http://www.eclipse.org/emf/2002/GenModel')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::common /]
+[import org::eclipse::emf::eef::codegen::ecore::services::header /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenOperation /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenParameter /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::papyrus::facade::codegen::genclass::genDeclaredFields /]
+[import org::eclipse::papyrus::facade::codegen::genclass::genFeature /]
+[import org::eclipse::papyrus::facade::codegen::genclass::genOperation /]
+[import org::eclipse::papyrus::facade::codegen::genclass::eUnset /]
+[import org::eclipse::papyrus::facade::codegen::genclass::eIsSet /]
+[import org::eclipse::emf::eef::codegen::ecore::services::StringUtil /]
+[import org::eclipse::papyrus::facade::codegen::utils::FacadeCodegenUtils /]
+
+[template public genGenClass(genClass : GenClass, isInterface : Boolean, isImplementation : Boolean)]
+[let genPackage : GenPackage = genClass.genPackage]
+[let genModel : GenModel = genPackage.genModel]
+[let isJDK50 : Boolean = genModel.isJDK50()]
+[comment the two following booleans are passed as arguments to this template/]
+[comment] final boolean isInterface = Boolean.TRUE.equals(((Object['[]'/])argument)[1]); final boolean isImplementation = Boolean.TRUE.equals(((Object['[]'/])argument)[2]);[/comment]
+[let isGWT : Boolean = genModel.runtimePlatform = GenRuntimePlatform::GWT]
+[let publicStaticFinalFlag : String = if isImplementation then 'public static final ' else '' endif]
+[let singleWildcard : String = if isJDK50 then '<?>' else '' endif]
+[let negativeOffsetCorrection : String = if genClass.hasOffsetCorrection() then ' - ' + genClass.getDefaultOffsetCorrectionField(genClass) else '' endif]
+[let positiveOffsetCorrection : String = if genClass.hasOffsetCorrection() then ' + ' + genClass.getDefaultOffsetCorrectionField(genClass) else '' endif]
+[let negativeOperationOffsetCorrection : String = if genClass.hasOffsetCorrection() then ' - EOPERATION_OFFSET_CORRECTION' + genClass.getDefaultOffsetCorrectionField(genClass) else '' endif]
+[let positiveOperationOffsetCorrection : String = if genClass.hasOffsetCorrection() then ' + EOPERATION_OFFSET_CORRECTION' + genClass.getDefaultOffsetCorrectionField(genClass) else '' endif]
+
+[let packageName : String = if (isInterface) then
+ genPackage.getInterfacePackageName()
+ else
+ genPackage.getClassPackageName()
+ endif]
+[let className : String = if (isImplementation) then
+ genClass.getClassName()
+ else
+ genClass.getInterfaceName()
+ endif]
+
+[genModel.initializeImportManager(genPackage, packageName, className)/]
+[if (isImplementation)]
+ [genClass.addClassPseudoImports()/]
+[/if]
+
+
+
+[file (genClass.classFilePath(isInterface, isImplementation), false, 'UTF-8')]
+[genClass.includeHeader()/]
+[if (isInterface) ]
+package [genPackage.getInterfacePackageName()/];
+[else]
+package [genPackage.getClassPackageName()/];
+[/if]
+[let content : String = genClass.classFileContent(isInterface, isImplementation, genPackage, genModel, isJDK50, isGWT, publicStaticFinalFlag, singleWildcard, negativeOffsetCorrection, positiveOffsetCorrection, negativeOperationOffsetCorrection, positiveOperationOffsetCorrection)]
+
+[genClass.genSortedImports(isInterface, isImplementation).trim()/]
+
+[content/]
+[/let]
+[/file]
+
+
+
+[/let]
+[/let]
+
+[/let]
+[/let]
+[/let]
+[/let]
+[/let]
+[/let]
+[/let]
+[/let]
+[/let]
+[/let]
+[/template]
+
+[template protected classFileContent(genClass : GenClass, isInterface : Boolean, isImplementation : Boolean, genPackage : GenPackage, genModel : GenModel, isJDK50 : Boolean, isGWT : Boolean, publicStaticFinalFlag : String, singleWildcard : String, negativeOffsetCorrection : String, positiveOffsetCorrection : String, negativeOperationOffsetCorrection : String, positiveOperationOffsetCorrection : String) post(trim())]
+[if (isInterface)]
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>[genClass.getFormattedName()/]</b></em>'.
+ * <!-- end-user-doc -->
+ [if (genClass.hasDocumentation())]
+ *
+ * <!-- begin-model-doc -->
+ * [genClass.getDocumentation(genModel.getIndentation())/]
+ * <!-- end-model-doc -->
+ [/if]
+ *
+ [if (not genClass.genFeatures->isEmpty())]
+ * <p>
+ * The following features are supported:
+ * <ul>
+ [for (genFeature : GenFeature | genClass.genFeatures)]
+ [if (not genFeature.isSuppressedGetVisibility())]
+ * <li>{@link [genClass.getQualifiedInterfaceName()/]#[genFeature.getGetAccessor()/] <em>[genFeature.getFormattedName()/]</em>}</li>
+ [/if]
+ [/for]
+ * </ul>
+ * </p>
+ [/if]
+ *
+ [if (not genModel.suppressEMFMetaData)]
+ * @see [genPackage.getQualifiedPackageInterfaceName()/]#get[genClass.getClassifierAccessorName()/]()
+ [/if]
+ [if (not genModel.suppressEMFModelTags)]
+ [let modelInfoLines : Sequence(String) = genClass.getModelInfo().tokenize(genModel.getLineDelimiter() + '\r')]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + ' * ')/]
+ [/if]
+ [/let]
+ [/if]
+ [if (genClass.needsRootExtendsInterfaceExtendsTag())]
+ * @extends [genModel.getImportedName(genModel.rootExtendsInterface)/]
+ [/if]
+ * @generated
+ */
+[else]
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>[genClass.getFormattedName()/]</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ [if (not genClass.getImplementedGenFeatures()->isEmpty())]
+ * The following features are implemented:
+ * <ul>
+ [for (genFeature : GenFeature | genClass.getImplementedGenFeatures())]
+ * <li>{@link [genClass.getQualifiedClassName()/]#[genFeature.getGetAccessor()/] <em>[genFeature.getFormattedName()/]</em>}</li>
+ [/for]
+ * </ul>
+ [/if]
+ * </p>
+ *
+ * @generated
+ */
+[/if]
+[if (isImplementation) ]
+public[if (genClass.isAbstract()) ] abstract[/if] class [genClass.getClassName()/][genClass.getTypeParameters().trim()/][if (genClass.ecoreClass.eSuperTypes->isEmpty()) ] extends [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.AbstractRepresentingElement')/] [else] [genClass.getClassExtends()/] [/if][genClass.getClassImplements()/] {
+
+
+[else]
+public interface [genClass.getInterfaceName()/][genClass.getTypeParameters().trim()/][genClass.getInterfaceExtends()/], [genModel.getImportedName('org.eclipse.papyrus.facade.utils.RepresentingElement')/] {
+
+ [comment]public [genModel.getImportedName('org.eclipse.uml2.uml.Element')/] get__Represented();
+
+ public void set__Represented([genModel.getImportedName('org.eclipse.uml2.uml.Element')/] represented);[/comment]
+
+[/if]
+[if (genModel.hasCopyrightField()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] copyright = [genModel.getCopyrightFieldLiteral()/];[genModel.getNonNLS()/]
+
+[/if]
+[if (isImplementation and genModel.getDriverNumber() <> null) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final [genModel.getImportedName('java.lang.String')/] mofDriverNumber = "[genModel.getDriverNumber()/]";[genModel.getNonNLS()/]
+
+[/if]
+[if (isImplementation and genClass.isJavaIOSerializable()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final long serialVersionUID = 1L;
+
+[/if]
+[if (isImplementation and genModel.isVirtualDelegation())]
+ [let eVirtualValuesField : String = genClass.getEVirtualValuesField()]
+ [if (genClass.getEVirtualValuesField() <> null) ]
+ /**
+ * An array of objects representing the values of non-primitive features.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isGWT) ]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected Object['[]'/] [genClass.getEVirtualValuesField()/];
+
+ [/if]
+ [let eVirtualIndexBitFields : Sequence(String) = genClass.getEVirtualIndexBitFields()]
+ [if (not eVirtualIndexBitFields->isEmpty()) ]
+ [for (eVirtualIndexBitField : String | eVirtualIndexBitFields)]
+ /**
+ * A bit field representing the indices of non-primitive feature values.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isGWT) ]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected int [eVirtualIndexBitField/];
+
+ [/for]
+ [/if]
+ [/let]
+ [/let]
+[/if]
+[if (isImplementation and genClass.isModelRoot() and genModel.isBooleanFlagsEnabled() and genModel.booleanFlagsReservedBits = -1) ]
+ /**
+ * A set of bit flags representing the values of boolean attributes and whether unsettable features have been set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [if (isGWT) ]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected int [genModel.booleanFlagsField/] = 0;
+
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation) ]
+ [for (genFeature : GenFeature | genClass.getDeclaredFieldGenFeatures())]
+[genFeature.genDeclaredFields(genClass, genModel, isGWT, isJDK50)/][/for]
+[/if]
+[if (isImplementation and genClass.hasOffsetCorrection() and not genClass.getImplementedGenFeatures()->isEmpty()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final int [genClass.getDefaultOffsetCorrectionField()/] = [genClass.getQualifiedClassifierAccessor()/].getFeatureID([genClass.getImplementedGenFeatures()->at(1).oclAsType(GenFeature).getQualifiedFeatureAccessor()/]) - [genClass.getQualifiedFeatureID(genClass.getImplementedGenFeatures()->at(1).oclAsType(GenFeature))/];
+
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation) ]
+ [for (genFeature : GenFeature | genClass.getImplementedGenFeatures())]
+ [let reverseFeature : GenFeature = genFeature.getReverse()]
+ [if (reverseFeature <> null and reverseFeature.genClass.hasOffsetCorrection()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final int [genClass.getOffsetCorrectionField(genFeature)/] = [reverseFeature.genClass.getQualifiedClassifierAccessor()/].getFeatureID([reverseFeature.getQualifiedFeatureAccessor()/]) - [reverseFeature.genClass.getQualifiedFeatureID(reverseFeature)/];
+
+ [/if]
+ [/let]
+ [/for]
+[/if]
+[if (genModel.operationReflection and isImplementation and genClass.hasOffsetCorrection() and not genClass.getImplementedGenOperations()->isEmpty()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final int "EOPERATION_OFFSET_CORRECTION" = [genClass.getQualifiedClassifierAccessor()/].getOperationID([genClass.getImplementedGenOperations()->at(1).oclAsType(GenOperation).getQualifiedOperationAccessor()/]) - [genClass.getQualifiedOperationID(genClass.getImplementedGenOperations()->at(1).oclAsType(GenOperation))/];
+
+[/if]
+[if (isImplementation) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.publicConstructors) ]public[else]protected[/if] [genClass.getClassName()/]() {
+ super();
+ [if (not genClass.isAbstract()) ]
+ __representedElement = [genClass.ecoreClass.getUMLFactory(genModel)/].eINSTANCE.create[genClass.ecoreClass.getUMLMetaElement(genModel)/]();
+
+ boolean adapterExists = false;
+ for([genModel.getImportedName('org.eclipse.emf.common.notify.Adapter')/] adapter : __representedElement.eAdapters()) {
+ if(adapter instanceof [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.RepresentingElementAdapter')/]) {
+ (([genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.RepresentingElementAdapter')/])adapter).set__Representing(this);
+ adapterExists = true;
+ }
+ }
+
+ if(!adapterExists) {
+ [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.RepresentingElementAdapter')/] adapter = new [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.RepresentingElementAdapter')/]();
+ adapter.set__Representing(this);
+ __representedElement.eAdapters().add(adapter);
+ }
+ [/if]
+
+
+
+ [for (genFeature : GenFeature | genClass.getFlagGenFeaturesWithDefault()) ]
+ [genClass.getFlagsField(genFeature)/] |= [genFeature.getUpperName()/]_EFLAG[if (not genFeature.isBooleanType()) ]_DEFAULT[/if];
+ [/for]
+ }
+
+
+ [if ( genClass.ecoreClass.getNonAssociationStereotypeQualifiedNames(genModel) <> '' )]
+
+ @Override
+ public [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] eBasicSetContainer([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/] newContainer, int newContainerFeatureID, [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] msgs) {
+ [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] chain = super.eBasicSetContainer(newContainer, newContainerFeatureID, msgs);
+ if(newContainer != null) {
+ String['[]'/] stereotypesQualifiedNames = { [genClass.ecoreClass.getNonAssociationStereotypeQualifiedNames(genModel)/] };
+
+ for([genModel.getImportedName('java.lang.String')/] stereoQualifiedName : stereotypesQualifiedNames) {
+ if((([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getAppliedStereotype(stereoQualifiedName) == null) {
+ [genModel.getImportedName('org.eclipse.uml2.uml.Stereotype')/] stereotype = (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).getApplicableStereotype(stereoQualifiedName);
+ if(stereotype != null) {
+ (([genModel.getImportedName('org.eclipse.uml2.uml.Element')/])__representedElement).applyStereotype(stereotype);
+ } else {
+ System.err.println("Problem: cannot apply stereotype " + stereoQualifiedName);
+ }
+ }
+ }
+ }
+
+ return chain;
+ }
+
+ [/if]
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ protected [genModel.getImportedName('org.eclipse.emf.ecore.EClass')/] eStaticClass() {
+ return [genClass.getQualifiedClassifierAccessor()/];
+ }
+
+[/if]
+
+[for (genFeature : GenFeature | if isImplementation then genClass.getImplementedGenFeatures() else genClass.getDeclaredGenFeatures() endif)]
+[genFeature.genFeature(genClass, genPackage, genModel, isJDK50, isInterface, isImplementation, positiveOffsetCorrection, negativeOffsetCorrection, singleWildcard)/][/for]
+
+[for (genOperation : GenOperation | if isImplementation then genClass.getImplementedGenOperations() else genClass.getDeclaredGenOperations() endif)]
+[genOperation.genOperation(genClass, genPackage, genModel, isJDK50, isInterface, isImplementation, isGWT)/][/for]
+[if (isImplementation and not genModel.reflectiveDelegation and genClass.implementsAnyEInverseAddGenFeatures()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useGenerics())]
+ [if (genClass.getEInverseAddGenFeatures()->filter(GenFeature)->select(f : GenFeature | f.isUncheckedCast(genClass))->size() > 0)]
+ @SuppressWarnings("unchecked")
+ [/if]
+ [/if]
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] eInverseAdd([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/] otherEnd, int featureID, [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] msgs) {
+ switch (featureID[negativeOffsetCorrection/]) {
+[for (genFeature : GenFeature | genClass.getEInverseAddGenFeatures())]
+ case [genClass.getQualifiedFeatureID(genFeature)/]:
+ [if (genFeature.isListType())]
+ [let cast : String = '('
+ + genModel.getImportedName('org.eclipse.emf.ecore.util.InternalEList')
+ + if (not genModel.useGenerics()) then
+ ')'
+ else
+ '<'
+ + genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')
+ + '>)('
+ + genModel.getImportedName('org.eclipse.emf.ecore.util.InternalEList')
+ + '<?>)'
+ endif]
+ [if (genFeature.isMapType() and genFeature.isEffectiveSuppressEMFTypes()) ]
+ return (([cast/]([genModel.getImportedName('org.eclipse.emf.common.util.EMap')/].InternalMapView[genFeature.getImportedMapTemplateArguments(genClass)/])[genFeature.getGetAccessor()/]()).eMap()).basicAdd(otherEnd, msgs);
+ [else]
+ return ([cast/][genFeature.getGetAccessor()/]()).basicAdd(otherEnd, msgs);
+ [/if]
+ [/let]
+ [else][if (genFeature.isContainer()) ]
+ if (eInternalContainer() != null)
+ msgs = eBasicRemoveFromContainer(msgs);
+ [if (genFeature.isBasicSet()) ]
+ return basicSet[genFeature.getAccessorName()/](([genFeature.getImportedType(genClass)/])otherEnd, msgs);
+ [else]
+ return eBasicSetContainer(otherEnd, [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], msgs);
+ [/if]
+ [else]
+ [if (genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) ]
+ [genFeature.getImportedType(genClass)/] [genFeature.getSafeName()/] = ([genFeature.getImportedType(genClass)/])eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/]);
+ [else][if (genFeature.isVolatile() or genClass.getImplementingGenModel(genFeature).isDynamicDelegation()) ]
+ [genFeature.getImportedType(genClass)/] [genFeature.getSafeName()/] = [if (genFeature.isResolveProxies()) ]basicGet[genFeature.getAccessorName()/][else][genFeature.getGetAccessor()/][/if]();
+ [/if][/if]
+ if ([genFeature.getSafeName()/] != null)
+ [if (genFeature.isEffectiveContains()) ]
+ msgs = (([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])[genFeature.getSafeName()/]).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - [genClass.getQualifiedFeatureID(genFeature)/][negativeOffsetCorrection/], null, msgs);
+ [else]
+ [let reverseFeature : GenFeature = genFeature.getReverse()]
+ [let targetClass : GenClass = reverseFeature.genClass]
+ [let reverseOffsetCorrection : String = if (targetClass.hasOffsetCorrection()) then ' + ' + genClass.getOffsetCorrectionField(genFeature) else '' endif]
+ msgs = (([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/])[genFeature.getSafeName()/]).eInverseRemove(this, [targetClass.getQualifiedFeatureID(reverseFeature)/][reverseOffsetCorrection/], [targetClass.getRawImportedInterfaceName()/].class, msgs);
+ [/let]
+ [/let]
+ [/let]
+ [/if]
+ return basicSet[genFeature.getAccessorName()/](([genFeature.getImportedType(genClass)/])otherEnd, msgs);
+ [/if][/if]
+[/for]
+ }
+[if (genModel.minimalReflectiveMethods) ]
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+[else]
+ return eDynamicInverseAdd(otherEnd, featureID, msgs);
+[/if]
+ }
+
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation and genClass.implementsAnyEInverseRemoveGenFeatures()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] eInverseRemove([genModel.getImportedName('org.eclipse.emf.ecore.InternalEObject')/] otherEnd, int featureID, [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] msgs) {
+ switch (featureID[negativeOffsetCorrection/]) {
+[for (genFeature : GenFeature | genClass.getEInverseRemoveGenFeatures())]
+ case [genClass.getQualifiedFeatureID(genFeature)/]:
+ [if (genFeature.isListType()) ]
+ [if (genFeature.isMapType() and genFeature.isEffectiveSuppressEMFTypes()) ]
+ return (([genModel.getImportedName('org.eclipse.emf.ecore.util.InternalEList')/][singleWildcard/])(([genModel.getImportedName('org.eclipse.emf.common.util.EMap')/].InternalMapView[genFeature.getImportedMapTemplateArguments(genClass)/])[genFeature.getGetAccessor()/]()).eMap()).basicRemove(otherEnd, msgs);
+ [else][if (genFeature.isWrappedFeatureMapType()) ]
+ return (([genModel.getImportedName('org.eclipse.emf.ecore.util.InternalEList')/][singleWildcard/])(([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal.Wrapper)[genFeature.getGetAccessor()/]()).featureMap()).basicRemove(otherEnd, msgs);
+ [else]
+ return (([genModel.getImportedName('org.eclipse.emf.ecore.util.InternalEList')/][singleWildcard/])[genFeature.getGetAccessor()/]()).basicRemove(otherEnd, msgs);
+ [/if][/if]
+ [else ][if (genFeature.isContainer() and not genFeature.isBasicSet()) ]
+ return eBasicSetContainer(null, [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/], msgs);
+ [else][if (genFeature.isUnsettable()) ]
+ return basicUnset[genFeature.getAccessorName()/](msgs);
+ [else]
+ return basicSet[genFeature.getAccessorName()/](null, msgs);
+ [/if][/if][/if]
+[/for]
+ }
+[if (genModel.minimalReflectiveMethods) ]
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+[else]
+ return eDynamicInverseRemove(otherEnd, featureID, msgs);
+[/if]
+ }
+
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation and genClass.implementsAnyEBasicRemoveFromContainerGenFeatures()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public [genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] eBasicRemoveFromContainerFeature([genModel.getImportedName('org.eclipse.emf.common.notify.NotificationChain')/] msgs) {
+ switch (eContainerFeatureID()[negativeOffsetCorrection/]) {
+[for (genFeature : GenFeature | genClass.getEBasicRemoveFromContainerGenFeatures())]
+ [let reverseFeature : GenFeature = genFeature.getReverse()]
+ [let targetClass : GenClass = reverseFeature.genClass]
+ [let reverseOffsetCorrection : String = if (targetClass.hasOffsetCorrection()) then ' + ' + genClass.getOffsetCorrectionField(genFeature) else '' endif]
+ case [genClass.getQualifiedFeatureID(genFeature)/]:
+ return eInternalContainer().eInverseRemove(this, [targetClass.getQualifiedFeatureID(reverseFeature)/][reverseOffsetCorrection/], [targetClass.getRawImportedInterfaceName()/].class, msgs);
+ [/let]
+ [/let]
+ [/let]
+[/for]
+ }
+[if (genModel.minimalReflectiveMethods) ]
+ return super.eBasicRemoveFromContainerFeature(msgs);
+[else]
+ return eDynamicBasicRemoveFromContainer(msgs);
+[/if]
+ }
+
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation and genClass.implementsAnyEGetGenFeatures()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID[negativeOffsetCorrection/]) {
+[for (genFeature : GenFeature | genClass.getEGetGenFeatures())]
+ case [genClass.getQualifiedFeatureID(genFeature)/]:
+ [if (genFeature.isPrimitiveType()) ]
+ [if (isJDK50) ]
+ return [genFeature.getGetAccessor()/]();
+ [else][if (genFeature.isBooleanType()) ]
+ return [genFeature.getGetAccessor()/]() ? Boolean.TRUE : Boolean.FALSE;
+ [else]
+ return new [genFeature.getObjectType(genClass)/]([genFeature.getGetAccessor()/]());
+ [/if][/if]
+ [else][if (genFeature.isResolveProxies() and not genFeature.isListType()) ]
+ if (resolve) return [genFeature.getGetAccessor()/]();
+ return basicGet[genFeature.getAccessorName()/]();
+ [else][if (genFeature.isMapType()) ]
+ [if (genFeature.isEffectiveSuppressEMFTypes()) ]
+ if (coreType) return (([genModel.getImportedName('org.eclipse.emf.common.util.EMap')/].InternalMapView[genFeature.getImportedMapTemplateArguments(genClass)/])[genFeature.getGetAccessor()/]()).eMap();
+ else return [genFeature.getGetAccessor()/]();
+ [else]
+ if (coreType) return [genFeature.getGetAccessor()/]();
+ else return [genFeature.getGetAccessor()/]().map();
+ [/if]
+ [else][if (genFeature.isWrappedFeatureMapType()) ]
+ if (coreType) return (([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal.Wrapper)[genFeature.getGetAccessor()/]()).featureMap();
+ return [genFeature.getGetAccessor()/]();
+ [else][if (genFeature.isFeatureMapType()) ]
+ if (coreType) return [genFeature.getGetAccessor()/]();
+ return (([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal)[genFeature.getGetAccessor()/]()).getWrapper();
+ [else]
+ return [genFeature.getGetAccessor()/]();
+ [/if][/if][/if][/if][/if]
+[/for]
+ }
+[if (genModel.minimalReflectiveMethods) ]
+ return super.eGet(featureID, resolve, coreType);
+[else]
+ return eDynamicGet(featureID, resolve, coreType);
+[/if]
+ }
+
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation and genClass.implementsAnyESetGenFeatures()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useGenerics()) ]
+ [if (genClass.getESetGenFeatures()->filter(GenFeature)->select(f : GenFeature| f.isUncheckedCast(genClass) and not f.isFeatureMapType() and not f.isMapType())->notEmpty()) ]
+ @SuppressWarnings("unchecked")
+ [/if]
+ [/if]
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID[negativeOffsetCorrection/]) {
+ [for (genFeature : GenFeature | genClass.getESetGenFeatures())]
+ case [genClass.getQualifiedFeatureID(genFeature)/]:
+ [if (genFeature.isListType()) ]
+ [if (genFeature.isWrappedFeatureMapType()) ]
+ (([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal)(([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal.Wrapper)[genFeature.getGetAccessor()/]()).featureMap()).set(newValue);
+ [else][if (genFeature.isFeatureMapType()) ]
+ (([genModel.getImportedName('org.eclipse.emf.ecore.util.FeatureMap')/].Internal)[genFeature.getGetAccessor()/]()).set(newValue);
+ [else][if (genFeature.isMapType()) ]
+ [if (genFeature.isEffectiveSuppressEMFTypes()) ]
+ (([genModel.getImportedName('org.eclipse.emf.ecore.EStructuralFeature')/].Setting)(([genModel.getImportedName('org.eclipse.emf.common.util.EMap')/].InternalMapView[genFeature.getImportedMapTemplateArguments(genClass)/])[genFeature.getGetAccessor()/]()).eMap()).set(newValue);
+ [else]
+ (([genModel.getImportedName('org.eclipse.emf.ecore.EStructuralFeature')/].Setting)[genFeature.getGetAccessor()/]()).set(newValue);
+ [/if]
+ [else]
+ [genFeature.getGetAccessor()/]().clear();
+ [genFeature.getGetAccessor()/]().addAll(([genModel.getImportedName('java.util.Collection')/][if (isJDK50) ]<? extends [genFeature.getListItemType(genClass)/]>[/if])newValue);
+ [/if][/if][/if]
+ [else][if (not isJDK50 and genFeature.isPrimitiveType()) ]
+ set[genFeature.getAccessorName()/]((([genFeature.getObjectType(genClass)/])newValue).[genFeature.getPrimitiveValueFunction()/]());
+ [else]
+ set[genFeature.getAccessorName()/]([if (genFeature.getTypeGenDataType() = null or not genFeature.getTypeGenDataType().isObjectType() or genFeature.getRawType() <> genFeature.getType(genClass)) ]([genFeature.getObjectType(genClass)/])[/if]newValue);
+ [/if][/if]
+ return;
+ [/for]
+ }
+ [if (genModel.minimalReflectiveMethods) ]
+ super.eSet(featureID, newValue);
+ [else]
+ eDynamicSet(featureID, newValue);
+ [/if]
+ }
+
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation and genClass.implementsAnyEUnsetGenFeatures()) ]
+[genClass.eUnset(genModel, negativeOffsetCorrection)/]
+[/if]
+[if (isImplementation and not genModel.reflectiveDelegation and genClass.implementsAnyEIsSetGenFeatures()) ]
+[genClass.eIsSet(genModel, positiveOffsetCorrection, negativeOffsetCorrection)/]
+[/if]
+[if (isImplementation and (not genClass.getMixinGenFeatures()->isEmpty() or genClass.hasOffsetCorrection() and not genClass.genFeatures->isEmpty())) ]
+ [if (not genClass.getMixinGenFeatures()->isEmpty()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class[singleWildcard/] baseClass) {
+ [for (mixinGenClass : GenClass | genClass.getMixinGenClasses())]
+ if (baseClass == [mixinGenClass.getRawImportedInterfaceName()/].class) {
+ switch (derivedFeatureID[negativeOffsetCorrection/]) {
+ [for (genFeature : GenFeature | mixinGenClass.genFeatures)]
+ case [genClass.getQualifiedFeatureID(genFeature)/]: return [mixinGenClass.getQualifiedFeatureID(genFeature)/];
+ [/for]
+ default: return -1;
+ }
+ }
+ [/for]
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+ [/if]
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class[singleWildcard/] baseClass) {
+ [for (mixinGenClass : GenClass | genClass.getMixinGenClasses())]
+ if (baseClass == [mixinGenClass.getRawImportedInterfaceName()/].class) {
+ switch (baseFeatureID) {
+ [for (genFeature : GenFeature | mixinGenClass.genFeatures)]
+ case [mixinGenClass.getQualifiedFeatureID(genFeature)/]: return [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/];
+ [/for]
+ default: return -1;
+ }
+ }
+ [/for]
+ [if (genClass.hasOffsetCorrection() and not genClass.genFeatures->isEmpty()) ]
+ if (baseClass == [genClass.getRawImportedInterfaceName()/].class) {
+ switch (baseFeatureID[negativeOffsetCorrection/]) {
+ [for (genFeature : GenFeature | genClass.genFeatures)]
+ case [genClass.getQualifiedFeatureID(genFeature)/]: return [genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/];
+ [/for]
+ default: return -1;
+ }
+ }
+ [/if]
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+[/if]
+[if (genModel.operationReflection
+ and isImplementation
+ and (not genClass.getMixinGenOperations()->isEmpty()
+ or not genClass.overridesGenOperations()
+ or genClass.hasOffsetCorrection() and not genClass.genOperations->isEmpty()))]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public int eDerivedOperationID(int baseOperationID, Class[singleWildcard/] baseClass) {
+ [for (extendedGenClass : GenClass | genClass.getExtendedGenClasses())]
+ [let extendedImplementedGenOperations : Sequence(GenOperation) = extendedGenClass.getImplementedGenOperations()]
+ [let implementedGenOperations : Sequence(GenOperation) = genClass.getImplementedGenOperations()]
+ [if (not genClass.overridesExtendedGenOperations(extendedGenClass)) ]
+ if (baseClass == [extendedGenClass.getRawImportedInterfaceName()/].class) {
+ switch (baseOperationID) {
+ [for (genOperation : GenOperation | extendedImplementedGenOperations)]
+ [let overrideGenOperation : GenOperation = genClass.getOverrideGenOperation(genOperation)]
+ [if (implementedGenOperations->includes(overrideGenOperation)) ]
+ case [extendedGenClass.getQualifiedOperationID(genOperation)/]: return [genClass.getQualifiedOperationID(overrideGenOperation)/][positiveOperationOffsetCorrection/];
+ [/if]
+ [/let]
+ [/for]
+ default: return super.eDerivedOperationID(baseOperationID, baseClass);
+ }
+ }
+ [/if]
+ [/let]
+ [/let]
+ [/for]
+ [for (mixinGenClass : GenClass | genClass.getMixinGenClasses())]
+ if (baseClass == [mixinGenClass.getRawImportedInterfaceName()/].class) {
+ switch (baseOperationID) {
+ [for (genOperation : GenOperation | mixinGenClass.genOperations)]
+ [let overrideGenOperation : GenOperation = genClass.getOverrideGenOperation(genOperation)]
+ case [mixinGenClass.getQualifiedOperationID(genOperation)/]: return [genClass.getQualifiedOperationID(if (overrideGenOperation <> null) then overrideGenOperation else genOperation endif)/][positiveOperationOffsetCorrection/];
+ [/let]
+ [/for]
+ default: return -1;
+ }
+ }
+ [/for]
+ [if (genClass.hasOffsetCorrection() and not genClass.genOperations->isEmpty()) ]
+ if (baseClass == [genClass.getRawImportedInterfaceName()/].class) {
+ switch (baseOperationID[negativeOperationOffsetCorrection/]) {
+ [for (genOperation : GenOperation | genClass.genOperations)]
+ case [genClass.getQualifiedOperationID(genOperation)/]: return [genClass.getQualifiedOperationID(genOperation)/][positiveOperationOffsetCorrection/];
+ [/for]
+ default: return -1;
+ }
+ }
+ [/if]
+ return super.eDerivedOperationID(baseOperationID, baseClass);
+ }
+
+[/if]
+[if (isImplementation and genModel.isVirtualDelegation())]
+ [comment][let eVirtualValuesField : String = genClass.getEVirtualValuesField()][/comment]
+ [if (genClass.getEVirtualValuesField() <> null) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ protected Object['[]'/] eVirtualValues() {
+ return [genClass.getEVirtualValuesField()/];
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ protected void eSetVirtualValues(Object['[]'/] newValues) {
+ [genClass.getEVirtualValuesField()/] = newValues;
+ }
+
+ [/if]
+ [let eVirtualIndexBitFields : Sequence(String) = genClass.getEVirtualIndexBitFields()]
+ [if (not eVirtualIndexBitFields->isEmpty())]
+ [let allEVirtualIndexBitFields : Sequence(String) = genClass.getAllEVirtualIndexBitFields()]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ protected int eVirtualIndexBits(int offset) {
+ switch (offset) {
+ [for (field : String | allEVirtualIndexBitFields)]
+ case [i - 1/] :
+ return [field/];
+ [/for]
+ default :
+ throw new IndexOutOfBoundsException();
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ protected void eSetVirtualIndexBits(int offset, int newIndexBits) {
+ switch (offset) {
+ [for (field : String | allEVirtualIndexBitFields)]
+ case [i - 1/] :
+ [field/] = newIndexBits;
+ break;
+ [/for]
+ default :
+ throw new IndexOutOfBoundsException();
+ }
+ }
+
+ [/let]
+ [/if]
+ [/let]
+ [comment][/let][/comment]
+[/if]
+[if (genModel.operationReflection and isImplementation and not genClass.getImplementedGenOperations()->isEmpty()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ [let genOpList : Sequence(GenOperation) = if (genModel.minimalReflectiveMethods) then genClass.getImplementedGenOperations() else genClass.getAllGenOperations() endif]
+ [if (genOpList.genParameters
+ ->flatten()
+ ->filter(GenParameter)
+ ->select(genParameter : GenParameter | genParameter.isUncheckedCast())
+ ->notEmpty())]
+ @SuppressWarnings("unchecked")
+ [/if]
+ public Object eInvoke(int operationID, [genModel.getImportedName('org.eclipse.emf.common.util.EList')/][singleWildcard/] arguments) throws [genModel.getImportedName(if (isGWT) then 'org.eclipse.emf.common.util.InvocationTargetException' else 'java.lang.reflect.InvocationTargetException' endif)/] {
+ switch (operationID[negativeOperationOffsetCorrection/]) {
+[for (genOperation : GenOperation | genOpList)]
+ [let genParameters : OrderedSet(GenParameter) = genOperation.genParameters]
+ [let size : Integer = genParameters->size()]
+ case [genClass.getQualifiedOperationID(genOperation)/]:
+ [if (genOperation.isVoid()) ]
+ [genOperation.getName()/]([for (genParameter : GenParameter | genParameters)][if (not isJDK50 and genParameter.isPrimitiveType()) ]([/if][if (genParameter.getTypeGenDataType() = null or not genParameter.getTypeGenDataType().isObjectType() or genParameter.getRawType() <> genParameter.getType(genClass)) ]([genParameter.getObjectType(genClass)/])[/if]arguments.get([i/])[if (not isJDK50 and genParameter.isPrimitiveType()) ]).[genParameter.getPrimitiveValueFunction()/]()[/if][if (size > 1 and i < size) ], [/if][/for]);
+ return null;
+ [else]
+ return [if (not isJDK50 and genOperation.isPrimitiveType())]new [genOperation.getObjectType(genClass)/]([/if][genOperation.getName()/]([for (genParameter : GenParameter | genParameters)][if (not isJDK50 and genParameter.isPrimitiveType())]([/if][if (genParameter.getTypeGenDataType() = null or not genParameter.getTypeGenDataType().isObjectType() or genParameter.getRawType() <> genParameter.getType(genClass)) ]([genParameter.getObjectType(genClass)/])[/if]arguments.get([i - 1/])[if (not isJDK50 and genParameter.isPrimitiveType()) ]).[genParameter.getPrimitiveValueFunction()/]()[/if][if (i < size) ], [/if][/for])[if (not isJDK50 and genOperation.isPrimitiveType()) ])[/if];
+ [/if]
+ [/let]
+ [/let]
+[/for]
+ [/let]
+ }
+[if (genModel.minimalReflectiveMethods) ]
+ return super.eInvoke(operationID, arguments);
+[else]
+ return eDynamicInvoke(operationID, arguments);
+[/if]
+ }
+
+[/if]
+[if (not genClass.hasImplementedToStringGenOperation() and isImplementation and not genModel.reflectiveDelegation and not genModel.isDynamicDelegation() and not genClass.getToStringGenFeatures()->isEmpty()) ]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation()) ]
+ @Override
+ [/if]
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ [for (genFeature : GenFeature | genClass.getToStringGenFeatures())]
+ [if (i = 1)]
+ result.append(" ([genFeature.getName()/]: ");[genModel.getNonNLS()/]
+ [else]
+ result.append(", [genFeature.getName()/]: ");[genModel.getNonNLS()/]
+ [/if]
+ [if (genFeature.isUnsettable() and not genFeature.isListType()) ]
+ [if (genModel.isVirtualDelegation() and not genFeature.isPrimitiveType()) ]
+ if (eVirtualIsSet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/])) result.append(eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/])); else result.append("<unset>");[genModel.getNonNLS()/]
+ [else]
+ [if (genClass.isFlag(genFeature)) ]
+ [if (genFeature.isBooleanType()) ]
+ if ([if (genClass.isESetFlag(genFeature)) ]([genClass.getESetFlagsField(genFeature)/] & [genFeature.getUpperName()/]_ESETFLAG) != 0[else][genFeature.getUncapName()/]ESet[/if]) result.append(([genClass.getFlagsField(genFeature)/] & [genFeature.getUpperName()/]_EFLAG) != 0); else result.append("<unset>");[genModel.getNonNLS()/]
+ [else]
+ if ([if (genClass.isESetFlag(genFeature)) ]([genClass.getESetFlagsField(genFeature)/] & [genFeature.getUpperName()/]_ESETFLAG) != 0[else][genFeature.getUncapName()/]ESet[/if]) result.append([genFeature.getUpperName()/]_EFLAG_VALUES['['/]([genClass.getFlagsField(genFeature)/] & [genFeature.getUpperName()/]_EFLAG) >>> [genFeature.getUpperName()/]_EFLAG_OFFSET]); else result.append("<unset>");[genModel.getNonNLS()/]
+ [/if]
+ [else]
+ if ([if (genClass.isESetFlag(genFeature)) ]([genClass.getESetFlagsField(genFeature)/] & [genFeature.getUpperName()/]_ESETFLAG) != 0[else][genFeature.getUncapName()/]ESet[/if]) result.append([genFeature.getSafeName()/]); else result.append("<unset>");[genModel.getNonNLS()/]
+ [/if]
+ [/if]
+ [else]
+ [if (genModel.isVirtualDelegation() and not genFeature.isPrimitiveType()) ]
+ result.append(eVirtualGet([genClass.getQualifiedFeatureID(genFeature)/][positiveOffsetCorrection/][if (not genFeature.isListType() and not genFeature.isReferenceType())], [genFeature.getEDefault()/][/if]));
+ [else]
+ [if (genClass.isFlag(genFeature)) ]
+ [if (genFeature.isBooleanType()) ]
+ result.append(([genClass.getFlagsField(genFeature)/] & [genFeature.getUpperName()/]_EFLAG) != 0);
+ [else]
+ result.append([genFeature.getUpperName()/]_EFLAG_VALUES['['/]([genClass.getFlagsField(genFeature)/] & [genFeature.getUpperName()/]_EFLAG) >>> [genFeature.getUpperName()/]_EFLAG_OFFSET]);
+ [/if]
+ [else]
+ result.append([genFeature.getSafeName()/]);
+ [/if]
+ [/if]
+ [/if]
+ [/for]
+ result.append(')');
+ return result.toString();
+ }
+
+[/if]
+[if (isImplementation and genClass.isMapEntry())]
+[let keyFeature : GenFeature = genClass.getMapEntryKeyFeature()]
+[let valueFeature : GenFeature = genClass.getMapEntryValueFeature()]
+[let objectType : String = genModel.getImportedName('java.lang.Object')]
+[let keyType : String = if isJDK50 then keyFeature.getObjectType(genClass) else objectType endif]
+[let valueType : String = if isJDK50 then valueFeature.getObjectType(genClass) else objectType endif]
+[let eMapType : String = genModel.getImportedName('org.eclipse.emf.common.util.EMap') + (if isJDK50 then '<' + keyType + ', ' + valueType + '>' else '' endif)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isGWT) ]
+ @[genModel.getImportedName('com.google.gwt.user.client.rpc.GwtTransient')/]
+ [/if]
+ protected int hash = -1;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getHash() {
+ if (hash == -1) {
+ [objectType/] theKey = getKey();
+ hash = (theKey == null ? 0 : theKey.hashCode());
+ }
+ return hash;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setHash(int hash) {
+ this.hash = hash;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public [keyType/] getKey() {
+ [if (not isJDK50 and keyFeature.isPrimitiveType()) ]
+ return new [keyFeature.getObjectType(genClass)/](getTypedKey());
+ [else]
+ return getTypedKey();
+ [/if]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setKey([keyType/] key) {
+ [if (keyFeature.isListType()) ]
+ getTypedKey().addAll([if (not genModel.useGenerics()) ]([genModel.getImportedName('java.util.Collection')/])[/if]key);
+ [else][if (isJDK50)]
+ setTypedKey(key);
+ [else][if (keyFeature.isPrimitiveType())]
+ setTypedKey((([keyFeature.getObjectType(genClass)/])key).[keyFeature.getPrimitiveValueFunction()/]());
+ [else]
+ setTypedKey(([keyFeature.getImportedType(genClass)/])key);
+ [/if][/if][/if]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public [valueType/] getValue() {
+ [if (not isJDK50 and valueFeature.isPrimitiveType()) ]
+ return new [valueFeature.getObjectType(genClass)/](getTypedValue());
+ [else]
+ return getTypedValue();
+ [/if]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public [valueType/] setValue([valueType/] value) {
+ [valueType/] oldValue = getValue();
+ [if (valueFeature.isListType()) ]
+ getTypedValue().clear();
+ getTypedValue().addAll([if (not genModel.useGenerics()) ]([genModel.getImportedName('java.util.Collection')/])[/if]value);
+ [else][if (isJDK50)]
+ setTypedValue(value);
+ [else][if (valueFeature.isPrimitiveType()) ]
+ setTypedValue((([valueFeature.getObjectType(genClass)/])value).[valueFeature.getPrimitiveValueFunction()/]());
+ [else]
+ setTypedValue(([valueFeature.getImportedType(genClass)/])value);
+ [/if][/if][/if]
+ return oldValue;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useGenerics()) ]
+ @SuppressWarnings("unchecked")
+ [/if]
+ public [eMapType/] getEMap() {
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] container = eContainer();
+ return container == null ? null : ([eMapType/])container.eGet(eContainmentFeature());
+ }
+
+[/let]
+[/let]
+[/let]
+[/let]
+[/let]
+[/let]
+[/if]
+} //[if (isInterface)] [genClass.getInterfaceName()/][else][genClass.getClassName()/][/if]
+[/template]
+
+[query public classFilePath(genClass : GenClass, isInterface : Boolean, isImplementation : Boolean) : String
+ = genClass.getGenModel().extractSourceDirectory(genClass.getGenModel().modelDirectory) + '/' +
+ if isInterface then
+ genClass.getQualifiedInterfaceName().toPath()
+ else
+ genClass.getQualifiedClassName().toPath()
+ endif +
+ '.java' /]
+
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.java b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.java
new file mode 100644
index 00000000000..31b9c62b4d2
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.java
@@ -0,0 +1,420 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ * CEA LIST - Modification to support Facade code generation
+ *******************************************************************************/
+package org.eclipse.papyrus.facade.codegen.genfacade;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.common.preference.AcceleoPreferences;
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'GenFacade' generation module.
+ *
+ * @generated
+ */
+public class GenFacade extends AbstractAcceleoGenerator {
+
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade"; //$NON-NLS-1$
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "GenAllGenClass" }; //$NON-NLS-1$
+
+ /**
+ * The list of properties files from the launch parameters (Launch configuration).
+ *
+ * @generated
+ */
+ private List<String> propertiesFiles = new ArrayList<String>();
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of {@link #initialize(EObject, File, List)} or {@link #initialize(URI, File, List)} is
+ * called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this generation to call it from another Java file, as it allows for the retrieval
+ * of {@link #getProperties()} and {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public GenFacade() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public GenFacade(URI modelURI, File targetFolder, List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public GenFacade(EObject model, File targetFolder, List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+
+ List<String> arguments = new ArrayList<String>();
+
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * Add in this list all the arguments used by the starting point of the generation
+ * If your main template is called on an element of your model and a String, you can
+ * add in "arguments" this "String" attribute.
+ */
+
+ GenFacade generator = new GenFacade(modelURI, folder, arguments);
+
+ /*
+ * Add the properties from the launch arguments.
+ * If you want to programmatically add new properties, add them in "propertiesFiles"
+ * You can add the absolute path of a properties files, or even a project relative path.
+ * If you want to add another "protocol" for your properties files, please override
+ * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
+ * The behavior of the properties loader service is explained in the Acceleo documentation
+ * (Help -> Help Contents).
+ */
+
+ for (int i = 2; i < args.length; i++) {
+ generator.addPropertiesFile(args[i]);
+ }
+
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated NOT
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this. The default behavior should
+ * be sufficient in most cases. If you want to change the content of this method, do NOT forget to
+ * change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
+ * any compilation of the Acceleo module with the main template that has caused the creation of this
+ * class will revert your modifications. If you encounter a problem with an unresolved proxy during the
+ * generation, you can remove the comments in the following instructions to check for problems. Please
+ * note that those instructions may have a significant impact on the performances.
+ */
+
+ //org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
+
+ /*
+ * If you want to check for potential errors in your models before the launch of the generation, you
+ * use the code below.
+ */
+
+ //if (model != null && model.eResource() != null) {
+ // List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
+ // for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
+ // System.err.println(diagnostic.toString());
+ // }
+ //}
+
+ // super.doGenerate(monitor);
+ EObject model = getModel();
+ if(model instanceof org.eclipse.emf.codegen.ecore.genmodel.GenModel) {
+ ((org.eclipse.emf.codegen.ecore.genmodel.GenModel)model).getStaticGenPackages();
+ }
+ boolean formerCacheFlag = AcceleoPreferences.isQueryCacheEnabled();
+ try {
+ AcceleoPreferences.switchQueryCache(false);
+ super.doGenerate(monitor);
+ } finally {
+ AcceleoPreferences.switchQueryCache(formerCacheFlag);
+ }
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ /*
+ * TODO if you need to listen to generation event, add listeners to the list here. If you want to change
+ * the content of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method
+ * to "@generated NOT". Without this new tag, any compilation of the Acceleo module with the main template
+ * that has caused the creation of this class will revert your modifications.
+ */
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates files on the fly. If you only need to
+ * preview the results, return a new {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of the
+ * running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna override files that are under clear case or
+ * any other VCS that could forbid the overriding), then return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}. <b>Note</b>, however, that this <b>cannot</b> be used
+ * standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ @Override
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * TODO if your generation module requires access to properties files, add their qualified path to the list here.
+ *
+ * Properties files can be located in an Eclipse plug-in or in the file system (all Acceleo projects are Eclipse
+ * plug-in). In order to use properties files located in an Eclipse plugin, you need to add the path of the properties
+ * files to the "propertiesFiles" list:
+ *
+ * final String prefix = "platform:/plugin/";
+ * final String pluginName = "org.eclipse.acceleo.module.sample";
+ * final String packagePath = "/org/eclipse/acceleo/module/sample/properties/";
+ * final String fileName = "default.properties";
+ * propertiesFiles.add(prefix + pluginName + packagePath + fileName);
+ *
+ * With this mechanism, you can load properties files from your plugin or from another plugin.
+ *
+ * You may want to load properties files from the file system, for that you need to add the absolute path of the file:
+ *
+ * propertiesFiles.add("C:\Users\MyName\MyFile.properties");
+ *
+ * If you want to let your users add properties files located in the same folder as the model:
+ *
+ * if (EMFPlugin.IS_ECLIPSE_RUNNING && model != null && model.eResource() != null) {
+ * propertiesFiles.addAll(AcceleoEngineUtils.getPropertiesFilesNearModel(model.eResource()));
+ * }
+ *
+ * To learn more about Properties Files, have a look at the Acceleo documentation (Help -> Help Contents).
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * Adds a properties file in the list of properties files.
+ *
+ * @param propertiesFile
+ * The properties file to add.
+ * @generated
+ * @since 3.1
+ */
+ @Override
+ public void addPropertiesFile(String propertiesFile) {
+ this.propertiesFiles.add(propertiesFile);
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ if (!isInWorkspace(org.eclipse.emf.ecore.EcorePackage.class)) {
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ }
+ if (!isInWorkspace(org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage.class)) {
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage.eINSTANCE.getNsURI(), org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage.eINSTANCE);
+ }
+
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * If you need additional package registrations, you can register them here. The following line
+ * (in comment) is an example of the package registration for UML.
+ *
+ * You can use the method "isInWorkspace(Class c)" to check if the package that you are about to
+ * register is in the workspace.
+ *
+ * To register a package properly, please follow the following conventions:
+ *
+ * If the package is located in another plug-in, already installed in Eclipse. The following content should
+ * have been generated at the beginning of this method. Do not register the package using this mechanism if
+ * the metamodel is located in the workspace.
+ *
+ * if (!isInWorkspace(UMLPackage.class)) {
+ * // The normal package registration if your metamodel is in a plugin.
+ * resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ * }
+ *
+ * If the package is located in another project in your workspace, the plugin containing the package has not
+ * been register by EMF and Acceleo should register it automatically. If you want to use the generator in
+ * stand alone, the regular registration (seen a couple lines before) is needed.
+ *
+ * To learn more about Package Registration, have a look at the Acceleo documentation (Help -> Help Contents).
+ */
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * TODO If you need additional resource factories registrations, you can register them here. the following line
+ * (in comment) is an example of the resource factory registration for UML.
+ *
+ * If you want to use the generator in stand alone, the resource factory registration will be required.
+ *
+ * To learn more about the registration of Resource Factories, have a look at the Acceleo documentation (Help -> Help Contents).
+ */
+
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.mtl
new file mode 100644
index 00000000000..3f688fde6df
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/GenFacade.mtl
@@ -0,0 +1,158 @@
+[comment]Copyright (c) 2008, 2012 Obeo.
+
+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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8/]
+[module GenFacade('http://www.eclipse.org/emf/2002/Ecore', 'http://www.eclipse.org/emf/2002/GenModel')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::model::buildproperties /]
+[import org::eclipse::emf::eef::codegen::ecore::model::AdapterFactoryClass /]
+[import org::eclipse::emf::eef::codegen::ecore::model::FactoryClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::PackageClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::Class /]
+[import org::eclipse::emf::eef::codegen::ecore::model::EnumClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnum /]
+[import org::eclipse::emf::eef::codegen::ecore::model::manifest /]
+[import org::eclipse::emf::eef::codegen::ecore::model::module_gwt_xml /]
+[import org::eclipse::emf::eef::codegen::ecore::model::Plugin /]
+[import org::eclipse::emf::eef::codegen::ecore::model::plugin_properties /]
+[import org::eclipse::emf::eef::codegen::ecore::model::plugin_xml /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::ResourceClass /]
+[import org::eclipse::emf::eef::codegen::ecore::model::ResourceFactoryClass /]
+[import org::eclipse::emf::eef::codegen::ecore::model::SwitchClass /]
+[import org::eclipse::emf::eef::codegen::ecore::model::ValidatorClass /]
+[import org::eclipse::emf::eef::codegen::ecore::model::XmlProcessorClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::fileUtil /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::WrapperClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::LoaderClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::AbstractRepresentingClass /]
+[import org::eclipse::papyrus::facade::codegen::genfacade::RepresentingElementAdapter /]
+[import org::eclipse::papyrus::facade::codegen::utils::FacadeCodegenUtils /]
+
+
+[**
+ * Generates all the classes of the Model plug-in from a genModel.
+ *
+ * WARNING: The genModel passed to this template MUST be loaded and reconciled as in
+ * org.eclipse.emf.codegen.ecore.genmodel.presentation.GeneratorUIUtil.loadGenModels()
+ * Otherwise canGenerate() will always return false, and invalid reference in the GenModel will cause problems.
+ * In order to prevent a reference to an Ecore UI plug-in, this is done in the eef ui plug-in.
+ *
+*/]
+[template public GenAllGenClass(genModel : GenModel) ? (genModel.canGenerate())]
+ [comment @main /]
+ [if (not genModel.fileExistsModel(genModel.buildPropertiesFilePath()))]
+ [genModel.buildProperties()/]
+ [/if]
+
+ [comment from EMF codegen : Do allow an existing MANIFEST.MF to be overwritten, since it may have been created as part of an empty EMF project.
+ Use the existence of a plugin.xml as a guard against overwriting in a project that has already been generated. /]
+ [if (not genModel.fileExistsModel(genModel.pluginXmlFilePath()))]
+ [genModel.manifest()/]
+ [/if]
+
+ [comment @TODO See when and where GWT files are generated/]
+ [comment][genModel.moduleGwt()/][/comment]
+
+ [if (genModel.hasModelPluginClass())]
+ [genModel.plugin()/]
+ [/if]
+
+ [if (genModel.hasPluginSupport())]
+ [if (not genModel.sameModelEditProject() and not genModel.sameModelEditorProject())]
+ [if (genModel.bundleManifest and not genModel.fileExistsModel(genModel.manifestFilePath()))]
+ [genModel.manifest()/]
+ [/if]
+
+ [if (not genModel.fileExistsModel(genModel.pluginXmlFilePath()))]
+ [genModel.pluginXml()/]
+ [/if]
+ [/if]
+
+ [if (not genModel.fileExistsModel(genModel.pluginPropertiesFilePath()))]
+ [genModel.pluginProperties()/]
+ [/if]
+
+ [if (not genModel.fileExistsModel(genModel.buildPropertiesFilePath()))]
+ [genModel.buildProperties()/]
+ [/if]
+ [/if]
+
+ [for (p : GenPackage | genModel.eAllContents(GenPackage))]
+ [if (p.canGenerate())]
+ [p.prepareCache()/][comment Create helpers to cache and supply information for unique naming./]
+
+ [copyEcore(p)/]
+
+ [initUtilsCaches()/]
+
+ [for (genClass : GenClass | p.genClasses)]
+ [if (genClass.canGenerate())]
+ [if (not genClass.isExternalInterface() and (not genModel.suppressInterfaces or genClass.isInterface()))]
+ [genClass.genGenClass(true, false)/]
+ [/if]
+ [if (not genClass.isInterface())]
+ [genClass.genGenClass(if genModel.suppressInterfaces then true else false endif, true)/]
+ [/if]
+ [/if]
+ [/for]
+ [for (genEnum : GenEnum | p.genEnums)]
+ [if (genEnum.canGenerate())]
+ [genEnum.enumClass()/]
+ [/if]
+ [/for]
+
+ [if (p.hasClassifiers())]
+
+
+
+ [if (not genModel.suppressEMFMetaData and not genModel.suppressInterfaces)]
+ [p.packageClass(true, false)/]
+ [/if]
+
+ [p.packageClass(if genModel.suppressEMFMetaData or genModel.suppressInterfaces then true else false endif, true)/]
+
+ [if (not genModel.suppressInterfaces)]
+ [p.factoryClass(true, false)/]
+ [/if]
+
+ [p.factoryClass(if genModel.suppressInterfaces then true else false endif, true)/]
+
+ [if (p.resource = GenResourceKind::XML)]
+ [p.xmlProcessorClass()/]
+ [/if]
+
+ [comment][if (p.hasConstraints())]
+ [p.validatorClass()/]
+ [/if][/comment]
+
+ [if (p.adapterFactory and p.genClasses->notEmpty())]
+ [p.switchClass()/]
+ [p.adapterFactoryClass()/]
+ [/if]
+ [/if]
+
+ [p.wrapperClass()/]
+ [p.loaderClass()/]
+ [p.abstractRepresentingClass()/]
+ [p.representingElementAdapterClass()/]
+
+
+ [if (p.resource <> GenResourceKind::None)]
+ [p.resourceFactoryClass()/]
+ [p.resourceClass()/]
+ [/if]
+
+ [p.clearCache()/]
+ [/if]
+ [/for]
+[/template]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/LoaderClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/LoaderClass.mtl
new file mode 100644
index 00000000000..0be27c265bd
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/LoaderClass.mtl
@@ -0,0 +1,128 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module LoaderClass('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::common /]
+[import org::eclipse::emf::eef::codegen::ecore::services::header /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::StringUtil /]
+
+
+[template public loaderClass(genPackage : GenPackage) { genModel : GenModel = genPackage.genModel; packageName : String = genPackage.getUtilitiesPackageName(); className : String = 'Loader'} ]
+[genModel.initializeImportManager(packageName, className)/]
+
+[genModel.getImportedName('org.eclipse.emf.common.util.URI')/]
+
+[file (genPackage.loaderPath(className), false, 'UTF-8')]
+[genModel.includeHeader()/]
+package [packageName/];
+[let content : String = genPackage.loaderFileContent(genModel, className)]
+[genModel.genSortedImports()/]
+[content/]
+[/let]
+[/file]
+[/template]
+
+[template protected loaderFileContent(genPackage : GenPackage, genModel : GenModel, className : String)]
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+
+public class Loader {
+
+ public static Resource doLoad(InputStream inputStream, Map<?, ?> options, EFactory inputFactory, Resource res) throws IOException {
+ //System.err.println("Load : " + res);
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db;
+
+ // Open XML
+ try {
+ db = dbf.newDocumentBuilder();
+ Document document = db.parse(inputStream);
+ Element root = document.getDocumentElement();
+
+ if(root.getNodeName().equals("source")) {
+ String umlFileURIAtt = root.getAttribute("uri");
+ URI umlFileURI = URI.createURI(umlFileURIAtt);
+
+ ResourceSet resSetUML = new ResourceSetImpl();
+ Resource resUML = resSetUML.getResource(umlFileURI, true);
+ if(resUML != null) {
+
+ Iterator<EObject> content = resUML.getContents().iterator();
+ ArrayList internalEObjectList = new ArrayList<>();
+
+ while(content.hasNext()) {
+ EObject umlModelElement = (EObject)content.next();
+ if(umlModelElement instanceof org.eclipse.uml2.uml.Element) {
+ EObject representing = Wrapper.getInstance().findOrCreateSpecific((org.eclipse.uml2.uml.Element)umlModelElement);
+
+ if(representing != null) {
+ internalEObjectList.add(representing);
+ }
+ }
+ }
+
+ InternalEList<InternalEObject> internalEObjects = (InternalEList<InternalEObject>)(InternalEList<?>)res.getContents();
+ internalEObjects.addAllUnique(internalEObjectList);
+
+ return resUML;
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+ } catch (ParserConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (SAXException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
+
+ }
+}
+
+
+[/template]
+
+[query public loaderPath(genPackage : GenPackage, className : String) : String
+ = genPackage.genModel.extractSourceDirectory(genPackage.genModel.modelDirectory) + '/'+ genPackage.getUtilitiesPackageName().toPath() + '/' +
+ className+ '.java'/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/PackageClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/PackageClass.mtl
new file mode 100644
index 00000000000..0ccb37a9895
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/PackageClass.mtl
@@ -0,0 +1,1289 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module PackageClass('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::common /]
+[import org::eclipse::emf::eef::codegen::ecore::services::header /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnum /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenEnumLiteral /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenOperation /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenParameter /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenTypeParameter /]
+[import org::eclipse::emf::eef::codegen::ecore::model::genpackage::EGenericType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::EAnnotation /]
+[import org::eclipse::emf::eef::codegen::ecore::services::StringUtil /]
+
+[template public packageClass(genPackage : GenPackage, isInterface : Boolean, isImplementation : Boolean)]
+[comment]
+ /**
+ * <copyright>
+ *
+ * Copyright (c) 2002-2010 IBM Corporation and others.
+ * 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:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ */
+[/comment]
+[let genModel : GenModel = genPackage.genModel]
+[let packageName : String = genPackage.packageClassPackageName(isInterface)]
+[let className : String = genPackage.packageClassName(isImplementation)]
+
+[genModel.initializeImportManager(genPackage, packageName, className)/]
+
+[if (isImplementation)]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.EPackage.Registry')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.EPackage.Descriptor')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.EPackageImpl.EBasicWhiteList')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.EPackageImpl.EBasicWhiteList')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container.Dynamic')/]
+[if (genPackage.isLiteralsInterface())]
+ [genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + '.Literals')/]
+[/if]
+[for (genClassifier : GenClassifier | genPackage.getOrderedGenClassifiers())]
+ [genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + '.' + genPackage.getClassifierID(genClassifier))/]
+[/for]
+[/if]
+
+
+
+[file (packageClassPath(genPackage, isInterface, isImplementation), false, 'UTF-8')]
+[genModel.includeHeader()/]
+package [packageName/];
+[let content : String = genPackage.packageClassFileContent(isInterface, isImplementation, genModel, className)]
+[genModel.genSortedImports()/]
+
+[content.trim()/]
+[/let]
+[/file]
+
+
+
+[/let][comment className /]
+[/let][comment packageName /]
+[/let][comment genModel /]
+[/template]
+
+[template protected packageClassFileContent(genPackage : GenPackage, isInterface : Boolean, isImplementation : Boolean, genModel : GenModel, className : String)]
+[let publicStaticFinalFlag : String = if (isImplementation) then 'public static final ' else '' endif]
+[if (isImplementation)]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.EPackage.Registry')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.EPackage.Descriptor')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.EPackageImpl.EBasicWhiteList')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container')/]
+[genModel.addPseudoImport('org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container.Dynamic')/]
+ [if (genPackage.isLiteralsInterface())]
+[genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + '.Literals')/]
+ [/if]
+ [for (genClassifier : GenClassifier | genPackage.getOrderedGenClassifiers())]
+ [genModel.addPseudoImport(genPackage.getQualifiedPackageInterfaceName() + '.' + genPackage.getClassifierID(genClassifier))/]
+ [/for]
+[/if]
+[if (isInterface)]
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ [if (genModel.operationReflection)]
+ * <li>each operation of each class,</li>
+ [/if]
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ [if (genPackage.hasDocumentation())]
+ * <!-- begin-model-doc -->
+ * [genPackage.getDocumentation(genModel.getIndentation())/]
+ * <!-- end-model-doc -->
+ [/if]
+ * @see [genPackage.getQualifiedFactoryInterfaceName()/]
+ [if (not genModel.suppressEMFModelTags)]
+ [let modelInfoLines : Sequence(String) = genPackage.getModelInfo().tokenize(genModel.getLineDelimiter() + '\r')]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + ' * ')/]
+ [/if]
+ [/let]
+ [/if]
+ * @generated
+ */
+[else][comment isInterface /]
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+[/if][comment isInterface /]
+[if (isImplementation)]
+public class [className/] extends [genModel.getImportedName('org.eclipse.emf.ecore.impl.EPackageImpl')/][if (not isInterface)] implements [genPackage.getImportedPackageInterfaceName()/][/if] {
+[else]
+public interface [className/] extends [genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/] {
+[/if]
+[if (genModel.hasCopyrightField())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] copyright = [genModel.getCopyrightFieldLiteral()/];[genModel.getNonNLS()/]
+
+[/if]
+[if (isInterface)]
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] eNAME = "[genPackage.getPackageName()/]";[genModel.getNonNLS()/]
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] eNS_URI = "[genPackage.getNSURI()/]";[genModel.getNonNLS()/]
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] eNS_PREFIX = "[genPackage.getNSName()/]";[genModel.getNonNLS()/]
+ [if (genPackage.isContentType())]
+
+ /**
+ * The package content type ID.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genModel.getImportedName('java.lang.String')/] eCONTENT_TYPE = "[genPackage.contentTypeIdentifier/]";[genModel.getNonNLS()/]
+ [/if]
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genPackage.getPackageInterfaceName()/] eINSTANCE = [genPackage.getQualifiedPackageClassName()/].init();
+
+ [for (genClassifier : GenClassifier | genPackage.getOrderedGenClassifiers())]
+ /**
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [if (not genClass.isInterface())]
+ * The meta object id for the '{@link [genClass.getQualifiedClassName()/] <em>[genClass.getFormattedName()/]</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genClass.getQualifiedClassName()/]
+ [else]
+ * The meta object id for the '{@link [genClass.getQualifiedInterfaceName()/] <em>[genClass.getFormattedName()/]</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genClass.getQualifiedInterfaceName()/]
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenEnum))]
+ [let genEnum : GenEnum = genClassifier.oclAsType(GenEnum)]
+ * The meta object id for the '{@link [genEnum.getQualifiedName()/] <em>[genEnum.getFormattedName()/]</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genEnum.getQualifiedName()/]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ * The meta object id for the '<em>[genDataType.getFormattedName()/]</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ [if (not genDataType.isPrimitiveType() and not genDataType.isArrayType())]
+ * @see [genDataType.getRawInstanceClassName()/]
+ [/if]
+ [/let]
+ [/if][/if][/if]
+ * @see [genPackage.getQualifiedPackageClassName()/]#get[genClassifier.getClassifierAccessorName()/]()
+ * @generated
+ */
+ [publicStaticFinalFlag/]int [genPackage.getClassifierID(genClassifier)/] = [genPackage.getClassifierValue(genClassifier)/];
+
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [for (genFeature : GenFeature | genClass.getAllGenFeatures())]
+ /**
+ * The feature id for the '<em><b>[genFeature.getFormattedName()/]</b></em>' [genFeature.getFeatureKind()/].
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [publicStaticFinalFlag/]int [genClass.getFeatureID(genFeature)/] = [genClass.getFeatureValue(genFeature)/];
+
+ [/for]
+ /**
+ * The number of structural features of the '<em>[genClass.getFormattedName()/]</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [publicStaticFinalFlag/]int [genClass.getFeatureCountID()/] = [genClass.getFeatureCountValue()/];
+
+ [if (genModel.operationReflection)]
+ [for (genOperation : GenOperation | genClass.getAllGenOperations(false))]
+ [if (genClass.getOverrideGenOperation(genOperation) = null)]
+ /**
+ * The operation id for the '<em>[genOperation.getFormattedName()/]</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [publicStaticFinalFlag/]int [genClass.getOperationID(genOperation, false)/] = [genClass.getOperationValue(genOperation)/];
+
+ [/if]
+ [/for]
+ /**
+ * The number of operations of the '<em>[genClass.getFormattedName()/]</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ [publicStaticFinalFlag/]int [genClass.getOperationCountID()/] = [genClass.getOperationCountValue()/];
+
+ [/if]
+ [/let]
+ [/if]
+ [/for]
+[/if]
+[if (isImplementation)]
+ [if (genPackage.isLoadingInitialization())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected String packageFilename = "[genPackage.getSerializedPackageFilename()/]";[genModel.getNonNLS()/]
+
+ [/if]
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private [genClassifier.getImportedMetaType()/] [genClassifier.getClassifierInstanceName()/] = null;
+
+ [/for]
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see [genPackage.getQualifiedPackageInterfaceName()/]#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private [genPackage.getPackageClassName()/]() {
+ super(eNS_URI, [genPackage.getQualifiedEFactoryInstanceAccessor()/]);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link [genPackage.getImportedPackageInterfaceName()/]#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ [if (not genPackage.isLoadedInitialization())]
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ [/if]
+ * @generated
+ */
+ public static [genPackage.getImportedPackageInterfaceName()/] init() {
+ if (isInited) return ([genPackage.getImportedPackageInterfaceName()/])[genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([genPackage.getImportedPackageInterfaceName()/].eNS_URI);
+
+ [if (genModel.runtimePlatform = GenRuntimePlatform::GWT)]
+ initializeRegistryHelpers();
+
+ [/if]
+ // Obtain or create and register package
+ [genPackage.getPackageClassName()/] the[genPackage.getBasicPackageName()/] = ([genPackage.getPackageClassName()/])([genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.get(eNS_URI) instanceof [genPackage.getPackageClassName()/] ? [genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.get(eNS_URI) : new [genPackage.getPackageClassName()/]());
+
+ isInited = true;
+
+ [if (genPackage.getPackageSimpleDependencies()->notEmpty())]
+ // Initialize simple dependencies
+ [for (dep : GenPackage | genPackage.getPackageSimpleDependencies())]
+ [dep.getImportedPackageInterfaceName()/].eINSTANCE.eClass();
+ [/for]
+
+ [/if]
+ [if (genPackage.getPackageInterDependencies()->notEmpty())]
+ // Obtain or create and register interdependencies
+ [for (interdep : GenPackage | genPackage.getPackageInterDependencies())]
+ [interdep.getImportedPackageClassName()/] [genPackage.getPackageInstanceVariable(interdep)/] = ([interdep.getImportedPackageClassName()/])([genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([interdep.getImportedPackageInterfaceName()/].eNS_URI) instanceof [interdep.getImportedPackageClassName()/] ? [genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([interdep.getImportedPackageInterfaceName()/].eNS_URI) : [interdep.getImportedPackageInterfaceName()/].eINSTANCE);
+ [/for]
+
+ [/if]
+ [if (genPackage.isLoadedInitialization() or genPackage.getPackageLoadInterDependencies()->notEmpty())]
+ // Load packages
+ [if (genPackage.isLoadingInitialization())]
+ the[genPackage.getBasicPackageName()/].loadPackage();
+ [/if]
+ [for (interdep : GenPackage | genPackage.getPackageLoadInterDependencies())]
+ [if (interdep.isLoadingInitialization())]
+ [genPackage.getPackageInstanceVariable(interdep)/].loadPackage();
+ [/if]
+ [/for]
+
+ [/if]
+ [if (not genPackage.isLoadedInitialization() or genPackage.getPackageBuildInterDependencies()->notEmpty())]
+ // Create package meta-data objects
+ [if (not genPackage.isLoadedInitialization())]
+ the[genPackage.getBasicPackageName()/].createPackageContents();
+ [/if]
+ [for (interdep : GenPackage | genPackage.getPackageBuildInterDependencies())]
+ [genPackage.getPackageInstanceVariable(interdep)/].createPackageContents();
+ [/for]
+
+ // Initialize created meta-data
+ [if (not genPackage.isLoadedInitialization())]
+ the[genPackage.getBasicPackageName()/].initializePackageContents();
+ [/if]
+ [for (interdep : GenPackage | genPackage.getPackageBuildInterDependencies())]
+ [genPackage.getPackageInstanceVariable(interdep)/].initializePackageContents();
+ [/for]
+
+ [/if]
+ [if (genPackage.isLoadedInitialization() or genPackage.getPackageLoadInterDependencies()->notEmpty())]
+ // Fix loaded packages
+ [if (genPackage.isLoadedInitialization())]
+ the[genPackage.getBasicPackageName()/].fixPackageContents();
+ [/if]
+ [for (interdep : GenPackage | genPackage.getPackageLoadInterDependencies())]
+ [genPackage.getPackageInstanceVariable(interdep)/].fixPackageContents();
+ [/for]
+
+ [/if]
+ [comment][if (genPackage.hasConstraints())]
+ // Register package validator
+ [genModel.getImportedName('org.eclipse.emf.ecore.EValidator')/].Registry.INSTANCE.put
+ (the[genPackage.getBasicPackageName()/],
+ new [genModel.getImportedName('org.eclipse.emf.ecore.EValidator')/].Descriptor()
+ {
+ public [genModel.getImportedName('org.eclipse.emf.ecore.EValidator')/] getEValidator()
+ {
+ return [genPackage.getImportedValidatorClassName()/].INSTANCE;
+ }
+ });
+
+ [/if][/comment]
+ [if (not genPackage.isEcorePackage())]
+ // Mark meta-data to indicate it can't be changed
+ the[genPackage.getBasicPackageName()/].freeze();
+
+ [/if]
+
+ // Update the registry and return the package
+ [genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.put([genPackage.getImportedPackageInterfaceName()/].eNS_URI, the[genPackage.getBasicPackageName()/]);
+ return the[genPackage.getBasicPackageName()/];
+ }
+ [if (genModel.runtimePlatform = GenRuntimePlatform::GWT)]
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static void initializeRegistryHelpers() {
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [if (not genClass.dynamic)]
+ [genModel.getImportedName('org.eclipse.emf.common.util.Reflect')/].register
+ ([if (genClass.isMapEntry())][genClass.getImportedClassName()/][else][genClass.getRawImportedInterfaceName()/][/if].class,
+ new [genModel.getImportedName('org.eclipse.emf.common.util.Reflect')/].Helper()
+ {
+ public boolean isInstance(Object instance)
+ {
+ return instance instanceof [if (genClass.isMapEntry())][genClass.getImportedClassName()/][else][genClass.getRawImportedInterfaceName()/][genClass.getInterfaceWildTypeArguments()/][/if];
+ }
+
+ public Object newArrayInstance(int size)
+ {
+ return new [if (genClass.isMapEntry())][genClass.getImportedClassName()/][else][genClass.getRawImportedInterfaceName()/][/if]['[size]'/];
+ }
+ });
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ [if (not genDataType.isPrimitiveType() and not genDataType.isObjectType())]
+ [genModel.getImportedName('org.eclipse.emf.common.util.Reflect')/].register
+ ([genDataType.getRawImportedInstanceClassName()/].class,
+ new [genModel.getImportedName('org.eclipse.emf.common.util.Reflect')/].Helper() {
+ public boolean isInstance(Object instance) {
+ return instance instanceof [genDataType.getImportedWildcardInstanceClassName()/];
+ }
+
+ public Object newArrayInstance(int size) {
+ [if (genDataType.isArrayType())]
+ [let componentType :String = genDataType.getRawImportedInstanceClassName().replaceAll('(?:\\[\\])+$', '')]
+ [let indices : String = genDataType.getRawImportedInstanceClassName().replaceAll('.*(?:\\[\\])+$', '$1')]
+ return new [componentType/]['[size]'/][indices/];
+ [/let]
+ [/let]
+ [else]
+ return new [genDataType.getRawImportedInstanceClassName()/]['[size]'/];
+ [/if]
+ }
+ });
+ [/if]
+ [/let]
+ [/if][/if]
+ [/for]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class WhiteList implements [genModel.getImportedName('com.google.gwt.user.client.rpc.IsSerializable')/], EBasicWhiteList {
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [if (not genClass.dynamic)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [if (genClass.isMapEntry())][genClass.getImportedClassName()/][else][genClass.getImportedWildcardInstanceClassName()/][/if] [genClass.getSafeUncapName()/];
+
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ [if (not genDataType.isObjectType() and genDataType.isSerializable())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genDataType.getImportedWildcardInstanceClassName()/] [genDataType.getSafeUncapName()/];
+
+ [/if]
+ [/let]
+ [/if][/if]
+ [/for]
+ }
+ [/if]
+
+[/if]
+[if (isInterface)][comment TODO REMOVE THIS BOGUS EMPTY LINE /]
+
+[/if]
+[for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ [if (isInterface)]
+ /**
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ * Returns the meta object for class '{@link [genClass.getQualifiedInterfaceName()/] <em>[genClass.getFormattedName()/]</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>[genClass.getFormattedName()/]</em>'.
+ * @see [genClass.getQualifiedInterfaceName()/]
+ [if (not genModel.suppressEMFModelTags and (genClass.isExternalInterface() or genClass.dynamic))]
+ [let modelInfoLines : Sequence(String) = genClass.getModelInfo().tokenize(genModel.getLineDelimiter() + '\r')]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + '\t * ')/]
+ [/if]
+ [/let]
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenEnum))]
+ [let genEnum : GenEnum = genClassifier.oclAsType(GenEnum)]
+ * Returns the meta object for enum '{@link [genEnum.getQualifiedName()/] <em>[genEnum.getFormattedName()/]</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>[genEnum.getFormattedName()/]</em>'.
+ * @see [genEnum.getQualifiedName()/]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ [if (genDataType.isPrimitiveType() or genDataType.isArrayType())]
+ * Returns the meta object for data type '<em>[genDataType.getFormattedName()/]</em>'.
+ [else]
+ * Returns the meta object for data type '{@link [genDataType.getRawInstanceClassName()/] <em>[genDataType.getFormattedName()/]</em>}'.
+ [/if]
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>[genDataType.getFormattedName()/]</em>'.
+ [if (not genDataType.isPrimitiveType() and not genDataType.isArrayType())]
+ * @see [genDataType.getRawInstanceClassName()/]
+ [/if]
+ [if (not genModel.suppressEMFModelTags)]
+ [let modelInfoLines : Sequence(String) = genDataType.getModelInfo().tokenize(genModel.getLineDelimiter() + '\r')]
+ [if (modelInfoLines->isEmpty())]
+ * @model
+ [else]
+ * @model [modelInfoLines->sep(genModel.getLineDelimiter() + '\t * ')/]
+ [/if]
+ [/let]
+ [/if]
+ [/let]
+ [/if][/if][/if]
+ * @generated
+ */
+ [else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [/if]
+ [if (isImplementation)]
+ public [genClassifier.getImportedMetaType()/] get[genClassifier.getClassifierAccessorName()/]() {
+ [if (genPackage.isLoadedInitialization())]
+ if ([genClassifier.getClassifierInstanceName()/] == null) {
+ [genClassifier.getClassifierInstanceName()/] = ([genClassifier.getImportedMetaType()/])[genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([genPackage.getImportedPackageInterfaceName()/].eNS_URI).getEClassifiers().get([genPackage.getLocalClassifierIndex(genClassifier)/]);
+ }
+ [/if]
+ return [genClassifier.getClassifierInstanceName()/];
+ }
+
+ [else]
+ [genClassifier.getImportedMetaType()/] get[genClassifier.getClassifierAccessorName()/]();
+
+ [/if]
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [for (genFeature : GenFeature | genClass.genFeatures)]
+ [if (isInterface)]
+ /**
+ * Returns the meta object for the [genFeature.getFeatureKind()/] '{@link [genClass.getQualifiedInterfaceName()/][if (not genClass.isMapEntry() and not genFeature.isSuppressedGetVisibility())]#[genFeature.getGetAccessor()/][/if] <em>[genFeature.getFormattedName()/]</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the [genFeature.getFeatureKind()/] '<em>[genFeature.getFormattedName()/]</em>'.
+ * @see [genClass.getQualifiedInterfaceName()/][if (not genClass.isMapEntry() and not genFeature.isSuppressedGetVisibility())]#[genFeature.getGetAccessor()/]()[/if]
+ * @see #get[genClass.getClassifierAccessorName()/]()
+ * @generated
+ */
+ [else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [/if]
+ [if (isImplementation)]
+ public [genFeature.getImportedMetaType()/] get[genFeature.getFeatureAccessorName()/]() {
+ [if (not genPackage.isLoadedInitialization())]
+ return ([genFeature.getImportedMetaType()/])[genClass.getClassifierInstanceName()/].getEStructuralFeatures().get([genClass.getLocalFeatureIndex(genFeature)/]);
+ [else]
+ return ([genFeature.getImportedMetaType()/])get[genClassifier.getClassifierAccessorName()/]().getEStructuralFeatures().get([genClass.getLocalFeatureIndex(genFeature)/]);
+ [/if]
+ }
+ [else]
+ [genFeature.getImportedMetaType()/] get[genFeature.getFeatureAccessorName()/]();
+ [/if]
+
+ [/for]
+ [if (genModel.operationReflection)]
+ [for (genOperation : GenOperation | genClass.genOperations)]
+ [if (isInterface)]
+ /**
+ * Returns the meta object for the '{@link [genClass.getQualifiedInterfaceName()/]#[genOperation.getName()/]([genOperation.getParameterTypes(', ')/]) <em>[genOperation.getFormattedName()/]</em>}' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the '<em>[genOperation.getFormattedName()/]</em>' operation.
+ * @see [genClass.getQualifiedInterfaceName()/]#[genOperation.getName()/]([genOperation.getParameterTypes(', ')/])
+ * @generated
+ */
+ [else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [/if]
+ [if (isImplementation)]
+ public [genOperation.getImportedMetaType()/] get[genOperation.getOperationAccessorName()/]() {
+ [if (not genPackage.isLoadedInitialization())]
+ return [genClass.getClassifierInstanceName()/].getEOperations().get([genClass.getLocalOperationIndex(genOperation)/]);
+ [else]
+ return get[genClassifier.getClassifierAccessorName()/]().getEOperations().get([genClass.getLocalOperationIndex(genOperation)/]);
+ [/if]
+ }
+ [else]
+ [genOperation.getImportedMetaType()/] get[genOperation.getOperationAccessorName()/]();
+ [/if]
+
+ [/for]
+ [/if]
+ [/let]
+ [/if]
+[/for]
+[if (isInterface)]
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+[else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+[/if]
+[if (isImplementation)]
+ public [genPackage.getImportedFactoryInterfaceName()/] get[genPackage.getFactoryName()/]() {
+ return ([genPackage.getImportedFactoryInterfaceName()/])getEFactoryInstance();
+ }
+[else]
+ [genPackage.getFactoryInterfaceName()/] get[genPackage.getFactoryName()/]();
+[/if]
+
+[if (isImplementation)]
+ [if (not genPackage.isLoadedInitialization())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ [if (genPackage.genClasses->notEmpty())]
+ // Create classes and their features
+ [for (genClass : GenClass | genPackage.genClasses) separator (genModel.getLineDelimiter())]
+ [genClass.getClassifierInstanceName()/] = create[genClass.getMetaType()/]([genClass.getClassifierID()/]);
+ [for (genFeature : GenFeature | genClass.genFeatures)]
+ create[genFeature.getMetaType()/]([genClass.getClassifierInstanceName()/], [genClass.getFeatureID(genFeature)/]);
+ [/for]
+ [if (genModel.operationReflection)]
+ [for (genOperation : GenOperation | genClass.genOperations)]
+ createEOperation([genClass.getClassifierInstanceName()/], [genClass.getOperationID(genOperation, false)/]);
+ [/for]
+ [/if]
+ [/for]
+ [/if]
+ [if (genPackage.genEnums->notEmpty())]
+
+ // Create enums
+ [for (genEnum : GenEnum | genPackage.genEnums)]
+ [genEnum.getClassifierInstanceName()/] = createEEnum([genEnum.getClassifierID()/]);
+ [/for]
+ [/if]
+ [if (genPackage.genDataTypes->notEmpty())]
+
+ // Create data types
+ [for (genDataType : GenDataType | genPackage.genDataTypes)]
+ [genDataType.getClassifierInstanceName()/] = createEDataType([genDataType.getClassifierID()/]);
+ [/for]
+ [/if]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+ [if (genPackage.getPackageInitializationDependencies()->notEmpty())]
+
+ // Obtain other dependent packages
+ [for (dep : GenPackage | genPackage.getPackageInitializationDependencies())]
+ [dep.getImportedPackageInterfaceName()/] [genPackage.getPackageInstanceVariable(dep)/] = ([dep.getImportedPackageInterfaceName()/])[genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/].Registry.INSTANCE.getEPackage([dep.getImportedPackageInterfaceName()/].eNS_URI);
+ [/for]
+ [/if]
+ [if (genPackage.getSubGenPackages()->notEmpty())]
+
+ // Add subpackages
+ [for (sub : GenPackage | genPackage.getSubGenPackages())]
+ getESubpackages().add([genPackage.getPackageInstanceVariable(sub)/]);
+ [/for]
+ [/if]
+ [if (genPackage.genClasses->notEmpty())]
+ [comment { boolean firstOperationAssignment = true; int maxTypeParameterAssignment = 0;/]
+ [if (genModel.useGenerics())]
+
+ // Create type parameters
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ [for (genTypeParameter : GenTypeParameter | genClassifier.genTypeParameters)]
+ [if (genTypeParameter.ecoreTypeParameter.eBounds->notEmpty() or genTypeParameter.isUsed())]
+ [genModel.getImportedName('org.eclipse.emf.ecore.ETypeParameter')/] [genClassifier.getClassifierInstanceName()/]_[genTypeParameter.getName()/] = addETypeParameter([genClassifier.getClassifierInstanceName()/], "[genTypeParameter.getName()/]");[genModel.getNonNLS()/]
+ [else]
+ addETypeParameter([genClassifier.getClassifierInstanceName()/], "[genTypeParameter.getName()/]");[genModel.getNonNLS()/]
+ [/if]
+ [/for]
+ [/for]
+ [/if]
+
+ [if (genModel.useGenerics())]
+
+ // Set bounds for type parameters[genPackage.resetMaxGenericTypeAssignment()/][genPackage.resetGenOperationPrefix()/]
+ [for (genClassifier : GenClassifier |genPackage.genClassifiers)]
+ [for (genTypeParameter : GenTypeParameter | genClassifier.genTypeParameters)]
+ [for (bound : EGenericType | genTypeParameter.ecoreTypeParameter.eBounds)]
+ [genPackage.prefix(0)/]g1 = createEGenericType([bound.type(genModel, genPackage)/]);
+ [for (eGenericType : EGenericType | bound.eAllContents(EGenericType))]
+ [comment]<%for (InformationIterator i=new InformationIterator(bound); i.hasNext(); ) { Information info = i.next(); String prefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>[/comment]
+ [genPackage.prefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/for]
+ [genClassifier.getClassifierInstanceName()/]_[genTypeParameter.getName()/].getEBounds().add(g1);
+ [/for]
+ [/for]
+ [/for]
+ [/if]
+
+ // Add supertypes to classes
+ [for (genClass : GenClass | genPackage.genClasses)]
+ [if (not genClass.hasGenericSuperTypes())]
+ [for (baseGenClass : GenClass | genClass.getBaseGenClasses())]
+ [genClass.getClassifierInstanceName()/].getESuperTypes().add([genPackage.getPackageInstanceVariable(baseGenClass.genPackage)/].get[baseGenClass.getClassifierAccessorName()/]());
+ [/for]
+ [else]
+ [for (superType : EGenericType | genClass.ecoreClass.eGenericSuperTypes)]
+ [genPackage.prefix(0)/]g1 = createEGenericType([superType.type(genModel, genPackage)/]);
+ [for (eGenericType : EGenericType | superType.eAllContents(EGenericType))]
+ [comment]<%for (InformationIterator i=new InformationIterator(superType); i.hasNext(); ) { Information info = i.next(); String prefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>[/comment]
+ [genPackage.prefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/for]
+ [genClass.getClassifierInstanceName()/].getEGenericSuperTypes().add(g1);
+ [/for]
+ [/if]
+ [/for]
+
+ // Initialize classes[if (genModel.operationReflection)], features, and operations; add parameters[else] and features; add operations and parameters[/if]
+ [for (genClass : GenClass | genPackage.genClasses) separator(genModel.getLineDelimiter())]
+ [let hasInstanceTypeName : Boolean = genModel.useGenerics() and genClass.ecoreClass.instanceTypeName <> null and genClass.ecoreClass.instanceTypeName.contains('<')]
+ initEClass([genClass.getClassifierInstanceName()/], [if (genClass.dynamic)]null[else][genClass.getRawImportedInterfaceName()/].class[/if], "[genClass.getName()/]", [genClass.getAbstractFlag()/], [genClass.getInterfaceFlag()/], [genClass.getGeneratedInstanceClassFlag()/][if (hasInstanceTypeName)], "[genClass.ecoreClass.instanceTypeName/]"[/if]);[genModel.getNonNLS()/][if (hasInstanceTypeName)][genModel.getNonNLS(2)/][/if]
+ [for (genFeature : GenFeature |genClass.genFeatures)]
+ [if (genFeature.hasGenericType())]
+ [let genericType : EGenericType = genFeature.ecoreFeature.eGenericType]
+ [genPackage.prefix(0)/]g1 = createEGenericType([genericType.type(genModel, genPackage)/]);
+ [for (eGenericType : EGenericType | genericType.eAllContents(EGenericType))]
+ [comment]<%for (InformationIterator i=new InformationIterator(genFeature.getEcoreFeature().getEGenericType()); i.hasNext(); ) { Information info = i.next(); String prefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; prefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>[/comment]
+ [genPackage.prefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/for]
+ [/let]
+ [/if]
+ [if (genFeature.isReferenceType())]
+ [let reverse : String = if (genFeature.getReverse() = null) then 'null' else genPackage.getPackageInstanceVariable(genFeature.getReverse().getGenPackage()) + '.get' + genFeature.getReverse().getFeatureAccessorName() + '()' endif]
+ initEReference(get[genFeature.getFeatureAccessorName()/](), [if (genFeature.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())/].get[genFeature.getTypeClassifierAccessorName()/]()[/if], [reverse/], "[genFeature.getName()/]", [genFeature.getDefaultValue()/], [genFeature.getLowerBound()/], [genFeature.getUpperBound()/], [genFeature.getContainerClass()/], [genFeature.getTransientFlag()/], [genFeature.getVolatileFlag()/], [genFeature.getChangeableFlag()/], [genFeature.getContainmentFlag()/], [genFeature.getResolveProxiesFlag()/], [genFeature.getUnsettableFlag()/], [genFeature.getUniqueFlag()/], [genFeature.getDerivedFlag()/], [genFeature.getOrderedFlag()/]);[genModel.getNonNLS()/][genModel.getNonNLS(genFeature.getDefaultValue(), 2)/]
+ [for (keyFeature : GenFeature |genFeature.getKeys())]
+ get[genFeature.getFeatureAccessorName()/]().getEKeys().add([genPackage.getPackageInstanceVariable(keyFeature.getGenPackage())/].get[keyFeature.getFeatureAccessorName()/]());
+ [/for]
+ [/let]
+ [else]
+ initEAttribute(get[genFeature.getFeatureAccessorName()/](), [if (genFeature.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())/].get[genFeature.getTypeClassifierAccessorName()/]()[/if], "[genFeature.getName()/]", [genFeature.getDefaultValue()/], [genFeature.getLowerBound()/], [genFeature.getUpperBound()/], [genFeature.getContainerClass()/], [genFeature.getTransientFlag()/], [genFeature.getVolatileFlag()/], [genFeature.getChangeableFlag()/], [genFeature.getUnsettableFlag()/], [genFeature.getIDFlag()/], [genFeature.getUniqueFlag()/], [genFeature.getDerivedFlag()/], [genFeature.getOrderedFlag()/]);[genModel.getNonNLS()/][genModel.getNonNLS(genFeature.getDefaultValue(), 2)/]
+ [/if]
+ [/for]
+ [for (genOperation : GenOperation | genClass.genOperations)]
+
+ [if (genModel.useGenerics())]
+ [genOperation.prefix()/][if (genModel.operationReflection)]initEOperation(get[genOperation.getOperationAccessorName()/]()[else]addEOperation([genClass.getClassifierInstanceName()/][/if], [if (genOperation.isVoid() or genOperation.hasGenericType())]null[else][genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage())/].get[genOperation.getTypeClassifierAccessorName()/]()[/if], "[genOperation.getName()/]", [genOperation.getLowerBound()/], [genOperation.getUpperBound()/], [genOperation.getUniqueFlag()/], [genOperation.getOrderedFlag()/]);[genModel.getNonNLS()/]
+ [else][if (not genOperation.isVoid())]
+ [if (not genOperation.ecoreOperation.ordered or not genOperation.ecoreOperation.unique)]
+ [genPackage.requireAddEOperation()/][genOperation.prefix()/][if (genModel.operationReflection)]initEOperation(get[genOperation.getOperationAccessorName()/]()[else]addEOperation([genClass.getClassifierInstanceName()/][/if], [genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage())/].get[genOperation.getTypeClassifierAccessorName()/](), "[genOperation.getName()/]", [genOperation.getLowerBound()/], [genOperation.getUpperBound()/], [genOperation.getUniqueFlag()/], [genOperation.getOrderedFlag()/]);[genModel.getNonNLS()/]
+ [else]
+ [genOperation.prefix()/][if (genModel.operationReflection)]initEOperation(get[genOperation.getOperationAccessorName()/]()[else]addEOperation([genClass.getClassifierInstanceName()/][/if], [genPackage.getPackageInstanceVariable(genOperation.getTypeGenPackage())/].get[genOperation.getTypeClassifierAccessorName()/](), "[genOperation.getName()/]", [genOperation.getLowerBound()/], [genOperation.getUpperBound()/]);[genModel.getNonNLS()/]
+ [/if]
+ [else]
+ [genOperation.prefix()/][if (genModel.operationReflection)]initEOperation(get[genOperation.getOperationAccessorName()/]()[else]addEOperation([genClass.getClassifierInstanceName()/][/if], null, "[genOperation.getName()/]");[genModel.getNonNLS()/]
+ [/if][/if]
+ [if (genModel.useGenerics())]
+ [for (genTypeParameter : GenTypeParameter | genOperation.genTypeParameters)][comment @TODO remove let typeParameterVariable /]
+ [let typeParameterVariable : String =
+ if (genTypeParameter.ecoreTypeParameter.eBounds->notEmpty() or genTypeParameter.isUsed()) then
+ if (i = 1) then
+ genModel.getImportedName('org.eclipse.emf.ecore.ETypeParameter') + ' t' + i + ' = '
+ else
+ 't' + i + ' = '
+ endif
+ else
+ ''
+ endif
+ ]
+ [comment for (ListIterator<GenTypeParameter> t=genOperation.getGenTypeParameters().listIterator(); t.hasNext(); ) {
+ GenTypeParameter genTypeParameter = t.next();
+ String typeParameterVariable = "";
+ if (genTypeParameter.getEcoreTypeParameter().getEBounds()->notEmpty() || genTypeParameter.isUsed()) {
+ if (maxTypeParameterAssignment <= t.previousIndex()) {
+ ++maxTypeParameterAssignment;
+ typeParameterVariable = genModel.getImportedName("org.eclipse.emf.ecore.ETypeParameter") + " t" + t.nextIndex() + " = ";
+ } else {
+ typeParameterVariable = "t" + t.nextIndex() + " = ";
+ }
+ } /]
+ [typeParameterVariable/]addETypeParameter(op, "[genTypeParameter.getName()/]");[genModel.getNonNLS()/]
+ [for (typeParameter : EGenericType | genTypeParameter.ecoreTypeParameter.eBounds)]
+[comment <%for (InformationIterator i=new InformationIterator(typeParameter); i.hasNext(); ) {
+ Information info = i.next(); String typePrefix = "";
+ if (maxGenericTypeAssignment <= eGenericType.depth()) {
+ ++maxGenericTypeAssignment;
+ typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " ";
+ }%>/]
+ [for (eGenericType : EGenericType | Sequence{typeParameter}->union(typeParameter.eAllContents(EGenericType)))]
+ [genPackage.typePrefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ [if (eGenericType.depth() > 0)]
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/if]
+ [/for]
+ t[i + 1/].getEBounds().add(g1);
+ [/for]
+ [/let]
+ [/for]
+ [/if]
+ [for (genParameter : GenParameter | genOperation.genParameters)]
+ [if (genParameter.hasGenericType())]
+ [for (eGenericType : EGenericType | genParameter.ecoreParameter.eAllContents(EGenericType))]
+ [comment <%for (InformationIterator i=new InformationIterator(genParameter.getEcoreParameter().getEGenericType()); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>/]
+ [genPackage.typePrefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ [if (eGenericType.depth() > 0)]
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/if]
+ [/for]
+ [/if]
+ [if (genModel.useGenerics())]
+ addEParameter(op, [if (genParameter.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage())/].get[genParameter.getTypeClassifierAccessorName()/]()[/if], "[genParameter.getName()/]", [genParameter.getLowerBound()/], [genParameter.getUpperBound()/], [genParameter.getUniqueFlag()/], [genParameter.getOrderedFlag()/]);[genModel.getNonNLS()/]
+ [else][if (not genParameter.ecoreParameter.ordered or not genParameter.ecoreParameter.unique)]
+ [genPackage.requireAddEParameter()/]addEParameter(op, [if (genParameter.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage())/].get[genParameter.getTypeClassifierAccessorName()/]()[/if], "[genParameter.getName()/]", [genParameter.getLowerBound()/], [genParameter.getUpperBound()/], [genParameter.getUniqueFlag()/], [genParameter.getOrderedFlag()/]);[genModel.getNonNLS()/]
+ [else]
+ addEParameter(op, [if (genParameter.hasGenericType())]g1[else][genPackage.getPackageInstanceVariable(genParameter.getTypeGenPackage())/].get[genParameter.getTypeClassifierAccessorName()/]()[/if], "[genParameter.getName()/]", [genParameter.getLowerBound()/], [genParameter.getUpperBound()/]);[genModel.getNonNLS()/]
+ [/if][/if]
+ [/for]
+ [if (genOperation.hasGenericExceptions())]
+ [for (genericExceptions : EGenericType | genOperation.ecoreOperation.eGenericExceptions)]
+ [for (eGenericType : EGenericType | genericExceptions.eAllContents(EGenericType)->flatten())]
+ [comment <%for (InformationIterator i=new InformationIterator(genericExceptions); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>/]
+ [genPackage.typePrefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ [if (eGenericType.depth() > 0)]
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/if]
+ addEException(op, g[eGenericType.depth() + 1/]);
+ [/for]
+ [/for]
+ [else]
+ [for (genException : GenClassifier | genOperation.getGenExceptions())]
+ addEException(op, [genPackage.getPackageInstanceVariable(genException.genPackage)/].get[genException.getClassifierAccessorName()/]());
+ [/for]
+ [/if]
+ [if (not genOperation.isVoid() and genOperation.hasGenericType())]
+ [for (eGenericType : EGenericType | Sequence{genOperation.ecoreOperation.eGenericType}->union(genOperation.ecoreOperation.eGenericType.eAllContents(EGenericType)))]
+ [comment]<%for (InformationIterator i=new InformationIterator(genOperation.getEcoreOperation().getEGenericType()); i.hasNext(); ) { Information info = i.next(); String typePrefix = ""; if (maxGenericTypeAssignment <= eGenericType.depth()) { ++maxGenericTypeAssignment; typePrefix = genModel.getImportedName("org.eclipse.emf.ecore.EGenericType") + " "; }%>[/comment]
+ [genPackage.typePrefix(eGenericType.depth())/]g[eGenericType.depth() + 1/] = createEGenericType([eGenericType.type(genModel, genPackage)/]);
+ [if (eGenericType.depth() > 0)]
+ g[eGenericType.depth()/].[eGenericType.accessor()/](g[eGenericType.depth() + 1/]);
+ [/if]
+ [/for]
+ initEOperation(op, g1);
+ [/if]
+ [/for][comment genOperation/]
+ [/let]
+ [/for]
+ [/if]
+ [if (genPackage.genEnums->notEmpty())]
+
+ // Initialize enums and add enum literals
+ [for (genEnum : GenEnum | genPackage.genEnums) separator(genModel.getLineDelimiter())]
+ initEEnum([genEnum.getClassifierInstanceName()/], [genModel.getImportedName(genEnum.getQualifiedName())/].class, "[genEnum.getName()/]");[genModel.getNonNLS()/]
+ [for (genEnumLiteral : GenEnumLiteral |genEnum.genEnumLiterals)]
+ addEEnumLiteral([genEnum.getClassifierInstanceName()/], [if (genModel.getImportedName(genEnum.getQualifiedName()) = genEnum.getClassifierID())][genEnum.getQualifiedName()/][else][genModel.getImportedName(genEnum.getQualifiedName())/][/if].[genEnumLiteral.getEnumLiteralInstanceConstantName()/]);
+ [/for]
+ [/for]
+ [/if]
+ [if (genPackage.genDataTypes->notEmpty())]
+
+ // Initialize data types
+ [for (genDataType : GenDataType | genPackage.genDataTypes)]
+ [let hasInstanceTypeName : Boolean = genModel.useGenerics() and genDataType.ecoreDataType.instanceTypeName <> null and genDataType.ecoreDataType.instanceTypeName.contains('<')]
+ initEDataType([genDataType.getClassifierInstanceName()/], [genDataType.getRawImportedInstanceClassName()/].class, "[genDataType.getName()/]", [genDataType.getSerializableFlag()/], [genDataType.getGeneratedInstanceClassFlag()/][if (hasInstanceTypeName)], "[genDataType.ecoreDataType.instanceTypeName/]"[/if]);[genModel.getNonNLS()/][if (hasInstanceTypeName)][genModel.getNonNLS(2)/][/if]
+ [/let]
+ [/for]
+ [/if]
+ [if (genPackage.getSuperGenPackage() = null)]
+
+ // Create resource
+ createResource(eNS_URI);
+ [/if]
+ [if (not genPackage.isEcorePackage() and genPackage.getAnnotationSources()->notEmpty())]
+
+ // Create annotations
+ [for (annotationSource : String |genPackage.getAnnotationSources())]
+ // [annotationSource/]
+ create[genPackage.getAnnotationSourceIdentifier(annotationSource)/]Annotations();
+ [/for]
+ [/if]
+ }
+
+ [for (annotationSource : String | genPackage.getAnnotationSources())]
+ /**
+ * Initializes the annotations for <b>[annotationSource/]</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void create[genPackage.getAnnotationSourceIdentifier(annotationSource)/]Annotations() {
+ String source = [if (annotationSource = null)]null;[else]"[annotationSource/]";[genModel.getNonNLS()/][/if]
+ [for (eAnnotation : EAnnotation | genPackage.getAllAnnotations())]
+ [let annotationReferenceDataList : Sequence(Sequence(OclAny)) = eAnnotation.getReferenceData(genPackage)]
+ [comment] @TODO How? use collect(some transformation) on annotationSource creation
+[if (annotationSource = null)][eAnnotation.source = null/][else][annotationSource = eAnnotation.source/][/if][/comment]
+ addAnnotation
+ ([genPackage.getAnnotatedModelElementAccessor(eAnnotation)/],
+ source,
+ new String['[]'/]
+ {
+ [eAnnotation.writeKeyValuePairs(genModel)/]
+ }[if (eAnnotation.hasReferenceData(genPackage))]);[else],[/if]
+ [if (not eAnnotation.hasReferenceData(genPackage))]
+ new [genModel.getImportedName('org.eclipse.emf.common.util.URI')/]['[]'/]
+ {
+ [for (annotationReferenceData : Sequence(OclAny) | annotationReferenceDataList) separator (',' + genModel.getNonNLS())]
+ [genModel.getImportedName('org.eclipse.emf.common.util.URI')/].createURI([if (annotationReferenceData->at(1) <> genPackage)][annotationReferenceData->at(1).oclAsType(GenPackage).getImportedPackageInterfaceName()/].[/if]eNS_URI).appendFragment("[annotationReferenceData->at(2)/]")[/for][genModel.getNonNLS()/]
+ });
+ [/if]
+ [for (nestedEAnnotation : EAnnotation | genPackage.getAllNestedAnnotations(eAnnotation))]
+ [let nestedAnnotationSource : String = nestedEAnnotation.source]
+ [let depth : Integer = nestedEAnnotation.depth()]
+ [let nestedAnnotationReferenceDataList : Sequence(Sequence(OclAny)) = nestedEAnnotation.getReferenceData(genPackage)]
+ addAnnotation
+ ([genPackage.getAnnotatedModelElementAccessor(eAnnotation)/],
+ [depth/],
+ [if (nestedAnnotationSource = null)]null,[else]"[nestedAnnotationSource/]",[genModel.getNonNLS()/][/if]
+ new String['[]'/]
+ {
+ [nestedEAnnotation.writeKeyValuePairs(genModel)/]
+ }[if (nestedEAnnotation.hasReferenceData(genPackage))]);[else],[/if]
+ [if (not nestedEAnnotation.hasReferenceData(genPackage))]
+ new [genModel.getImportedName('org.eclipse.emf.common.util.URI')/]['[]'/]
+ {
+ [for (annotationReferenceData : Sequence(OclAny) | nestedAnnotationReferenceDataList) separator (',' + genModel.getNonNLS())]
+ [genModel.getImportedName('org.eclipse.emf.common.util.URI')/].createURI([if (annotationReferenceData->at(1) <> genPackage)][annotationReferenceData->at(1).oclAsType(GenPackage).getImportedPackageInterfaceName()/].[/if]eNS_URI).appendFragment("[annotationReferenceData->at(2)/]")[/for][genModel.getNonNLS()/]
+ });
+ [/if]
+ [/let]
+ [/let]
+ [/let]
+ [/for]
+ [/let]
+ [/for]
+ }
+
+ [/for]
+ [else]
+ [if (genPackage.isLoadingInitialization())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isLoaded = false;
+
+ /**
+ * Laods the package and any sub-packages from their serialized form.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void loadPackage() {
+ if (isLoaded) return;
+ isLoaded = true;
+
+ [genModel.getImportedName('java.net.URL')/] url = getClass().getResource(packageFilename);
+ if (url == null) {
+ throw new RuntimeException("Missing serialized package: " + packageFilename);[genModel.getNonNLS()/]
+ }
+ [genModel.getImportedName('org.eclipse.emf.common.util.URI')/] uri = [genModel.getImportedName('org.eclipse.emf.common.util.URI')/].createURI(url.toString());
+ [genModel.getImportedName('org.eclipse.emf.ecore.resource.Resource')/] resource = new [genModel.getImportedName('org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl')/]().createResource(uri);
+ try {
+ resource.load(null);
+ }
+ catch ([genModel.getImportedName('java.io.IOException')/] exception) {
+ throw new [genModel.getImportedName('org.eclipse.emf.common.util.WrappedException')/](exception);
+ }
+ initializeFromLoadedEPackage(this, ([genModel.getImportedName('org.eclipse.emf.ecore.EPackage')/])resource.getContents().get(0));
+ createResource(eNS_URI);
+ }
+
+ [/if]
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isFixed = false;
+
+ /**
+ * Fixes up the loaded package, to make it appear as if it had been programmatically built.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fixPackageContents() {
+ if (isFixed) return;
+ isFixed = true;
+ fixEClassifiers();
+ }
+
+ /**
+ * Sets the instance class on the given classifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation())]
+ @Override
+ [/if]
+ protected void fixInstanceClass([genModel.getImportedName('org.eclipse.emf.ecore.EClassifier')/] eClassifier) {
+ if (eClassifier.getInstanceClassName() == null) {
+ [let dynamicGenClasses : OrderedSet(GenClass) = genPackage.genClasses->select(c : GenClass | c.dynamic)]
+ [if (dynamicGenClasses->isEmpty())]
+ eClassifier.setInstanceClassName("[genPackage.getInterfacePackageName()/]." + eClassifier.getName());[genModel.getNonNLS()/]
+ setGeneratedClassName(eClassifier);
+ [else]
+ switch (eClassifier.getClassifierID()) {
+ [for (genClass : GenClass | dynamicGenClasses)]
+ [if (genClass.dynamic)]
+ case [genPackage.getClassifierID(genClass)/]:
+ [/if]
+ [/for]
+ {
+ break;
+ }
+ default:
+ {
+ eClassifier.setInstanceClassName("[genPackage.getInterfacePackageName()/]." + eClassifier.getName());[genModel.getNonNLS()/]
+ setGeneratedClassName(eClassifier);
+ break;
+ }
+ }
+ [/if]
+ [/let]
+ }
+ }
+
+ [/if]
+ [if (needsAddEOperation())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/] addEOperation([genModel.getImportedName('org.eclipse.emf.ecore.EClass')/] owner, [genModel.getImportedName('org.eclipse.emf.ecore.EClassifier')/] type, String name, int lowerBound, int upperBound, boolean isUnique, boolean isOrdered) {
+ [genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/] o = addEOperation(owner, type, name, lowerBound, upperBound);
+ o.setUnique(isUnique);
+ o.setOrdered(isOrdered);
+ return o;
+ }
+
+ [/if][comment needsAddEOperation /]
+ [if (needsAddEParameter())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genModel.getImportedName('org.eclipse.emf.ecore.EParameter')/] addEParameter([genModel.getImportedName('org.eclipse.emf.ecore.EOperation')/] owner, [genModel.getImportedName('org.eclipse.emf.ecore.EClassifier')/] type, String name, int lowerBound, int upperBound, boolean isUnique, boolean isOrdered) {
+ [genModel.getImportedName('org.eclipse.emf.ecore.EParameter')/] p = ecoreFactory.createEParameter();
+ p.setEType(type);
+ p.setName(name);
+ p.setLowerBound(lowerBound);
+ p.setUpperBound(upperBound);
+ p.setUnique(isUnique);
+ p.setOrdered(isOrdered);
+ owner.getEParameters().add(p);
+ return p;
+ }
+
+ [/if][comment needsAddEParameter /]
+[/if][comment isImplementation) /]
+[if (isInterface and genPackage.isLiteralsInterface())]
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ [if (genModel.operationReflection)]
+ * <li>each operation of each class,</li>
+ [/if]
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (isImplementation)]public [/if]interface Literals {
+ [for (genClassifier : GenClassifier | genPackage.genClassifiers)]
+ /**
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [if (not genClass.isInterface())]
+ * The meta object literal for the '{@link [genClass.getQualifiedClassName()/] <em>[genClass.getFormattedName()/]</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genClass.getQualifiedClassName()/]
+ [else]
+ * The meta object literal for the '{@link [genClass.getQualifiedInterfaceName()/] <em>[genClass.getFormattedName()/]</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genClass.getQualifiedInterfaceName()/]
+ [/if]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenEnum))]
+ [let genEnum : GenEnum = genClassifier.oclAsType(GenEnum)]
+ * The meta object literal for the '{@link [genEnum.getQualifiedName()/] <em>[genEnum.getFormattedName()/]</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see [genEnum.getQualifiedName()/]
+ [/let]
+ [else][if (genClassifier.oclIsKindOf(GenDataType))]
+ [let genDataType : GenDataType = genClassifier.oclAsType(GenDataType)]
+ * The meta object literal for the '<em>[genDataType.getFormattedName()/]</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ [if (not genDataType.isPrimitiveType() and not genDataType.isArrayType())]
+ * @see [genDataType.getRawInstanceClassName()/]
+ [/if]
+ [/let]
+ [/if][/if][/if]
+ * @see [genPackage.getQualifiedPackageClassName()/]#get[genClassifier.getClassifierAccessorName()/]()
+ * @generated
+ */
+ [publicStaticFinalFlag/][genClassifier.getImportedMetaType()/] [genPackage.getClassifierID(genClassifier)/] = eINSTANCE.get[genClassifier.getClassifierAccessorName()/]();
+
+ [if (genClassifier.oclIsKindOf(GenClass))]
+ [let genClass : GenClass = genClassifier.oclAsType(GenClass)]
+ [for (genFeature : GenFeature |genClass.genFeatures)]
+ /**
+ * The meta object literal for the '<em><b>[genFeature.getFormattedName()/]</b></em>' [genFeature.getFeatureKind()/] feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genFeature.getImportedMetaType()/] [genClass.getFeatureID(genFeature)/] = eINSTANCE.get[genFeature.getFeatureAccessorName()/]();
+
+ [/for]
+ [if (genModel.operationReflection)]
+ [for (genOperation : GenOperation | genClass.genOperations)]
+ /**
+ * The meta object literal for the '<em><b>[genOperation.getFormattedName()/]</b></em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [publicStaticFinalFlag/][genOperation.getImportedMetaType()/] [genClass.getOperationID(genOperation, false)/] = eINSTANCE.get[genOperation.getOperationAccessorName()/]();
+
+ [/for]
+ [/if]
+ [/let]
+ [/if]
+ [/for]
+ }
+
+[/if]
+} //[className/]
+[/let][comment publicStaticFinalFlag /]
+[/template]
+
+[query public packageClassPackageName(genPackage : GenPackage, isInterface : Boolean) : String =
+ if (isInterface and not genPackage.genModel.suppressInterfaces) then
+ genPackage.getReflectionPackageName()
+ else
+ genPackage.getClassPackageName()
+ endif
+/]
+
+[query public packageClassName(genPackage : GenPackage, isImplementation : Boolean) : String =
+ if (isImplementation) then
+ genPackage.getPackageClassName()
+ else
+ genPackage.getPackageInterfaceName()
+ endif
+/]
+
+[query public packageClassPath(genPackage : GenPackage, isInterface : Boolean, isImplementation : Boolean) : String
+ = genPackage.genModel.modelPath(genPackage.packageClassPackageName(isInterface), genPackage.packageClassName(isImplementation)) /]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/RepresentingElementAdapter.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/RepresentingElementAdapter.mtl
new file mode 100644
index 00000000000..f5be6ff5a8e
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/RepresentingElementAdapter.mtl
@@ -0,0 +1,106 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module RepresentingElementAdapter('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::common /]
+[import org::eclipse::emf::eef::codegen::ecore::services::header /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::StringUtil /]
+
+
+[template public representingElementAdapterClass(genPackage : GenPackage) { genModel : GenModel = genPackage.genModel; packageName : String = genPackage.getUtilitiesPackageName(); className : String = 'RepresentingElementAdapter'} ]
+[genModel.initializeImportManager(packageName, className)/]
+
+[genModel.getImportedName('org.eclipse.emf.common.util.URI')/]
+
+[file (genPackage.representingElementAdapterClassPath(className), false, 'UTF-8')]
+[genModel.includeHeader()/]
+package [packageName/];
+[let content : String = genPackage. representingElementAdapterFileContent(genModel, className)]
+[genModel.genSortedImports()/]
+[content/]
+[/let]
+[/file]
+[/template]
+
+[template protected representingElementAdapterFileContent(genPackage : GenPackage, genModel : GenModel, className : String)]
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.uml2.uml.Element;
+
+public class RepresentingElementAdapter extends AdapterImpl {
+
+ private EObject representingElement;
+
+ /**
+ * Does nothing; clients may override so that it does something.
+ */
+ public void notifyChanged(Notification msg) {
+
+ //Wrap notif
+ Object umlNotifier = msg.getNotifier();
+ EObject specificNotifier = Wrapper.getInstance().findOrCreateSpecific((EObject)umlNotifier);
+
+ Object umlFeature = msg.getFeature();
+ EStructuralFeature specificFeature = Wrapper.getInstance().getFeatureMappingFromUML((EStructuralFeature)umlFeature);
+
+ if(msg.getFeature() instanceof EReference) {
+ Object umlOld = msg.getOldValue();
+ EObject specificOld = null;
+ if(umlOld != null) {
+ specificOld = Wrapper.getInstance().findOrCreateSpecific((Element)umlOld);
+ }
+
+ Object umlNew = msg.getNewValue();
+ EObject specificNew = null;
+ if(umlNew != null) {
+ specificNew = Wrapper.getInstance().findOrCreateSpecific((Element)umlNew);
+ }
+
+ Notification notification = new ENotificationImpl((InternalEObject)specificNotifier, msg.getEventType(), specificFeature, specificOld, specificNew, msg.getPosition(), msg.wasSet());
+
+ specificNotifier.eNotify(notification);
+
+ } else {
+ Notification notification = new ENotificationImpl((InternalEObject)specificNotifier, msg.getEventType(), specificFeature, msg.getOldValue(), msg.getNewValue(), msg.getPosition(), msg.wasSet());
+
+ specificNotifier.eNotify(notification);
+ }
+ //System.err.println("UML Notif -> " + msg);
+ }
+
+
+ public EObject get__Representing() {
+ return representingElement;
+ }
+
+ public void set__Representing(EObject representing) {
+ representingElement = representing;
+ }
+}
+
+
+[/template]
+
+[query public representingElementAdapterClassPath(genPackage : GenPackage, className : String) : String
+ = genPackage.genModel.extractSourceDirectory(genPackage.genModel.modelDirectory) + '/'+ genPackage.getUtilitiesPackageName().toPath() + '/' +
+ className+ '.java'/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/ResourceClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/ResourceClass.mtl
new file mode 100644
index 00000000000..5db46f61e88
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/ResourceClass.mtl
@@ -0,0 +1,536 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module ResourceClass('http://www.eclipse.org/emf/2002/GenModel', 'http://www.eclipse.org/emf/2002/Ecore')/]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::common /]
+[import org::eclipse::emf::eef::codegen::ecore::services::header /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::StringUtil /]
+
+[comment]
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2002-2006 IBM Corporation and others.
+ * 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:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ */
+[/comment]
+
+[template public resourceClass(genPackage : GenPackage) { genModel : GenModel = genPackage.genModel; packageName : String = genPackage.getUtilitiesPackageName(); className : String = genPackage.getResourceClassName();} ]
+[genModel.initializeImportManager(packageName, className)/]
+
+[genModel.getImportedName('org.eclipse.emf.common.util.URI')/]
+
+[file (genPackage.resourceClassPath(), false, 'UTF-8')]
+[genModel.includeHeader()/]
+package [packageName/];
+[let content : String = genPackage.resourceFileContent(genModel, className)]
+[genModel.genSortedImports()/]
+[content/]
+[/let]
+[/file]
+[/template]
+
+[template protected resourceFileContent(genPackage : GenPackage, genModel : GenModel, className : String)]
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Resource </b> associated with the package.
+ * <!-- end-user-doc -->
+ * @see [genPackage.getQualifiedResourceFactoryClassName()/]
+ * @generated
+ */
+public class [className/] extends [genPackage.getImportedResourceBaseClassName()/]
+{
+ private [genModel.getImportedName('org.eclipse.emf.ecore.resource.Resource')/] resUML;
+
+ @Override
+ public void doLoad([genModel.getImportedName('java.io.InputStream')/] inputStream, [genModel.getImportedName('java.util.Map')/]<?, ?> options) throws [genModel.getImportedName('java.io.IOException')/] {
+ resUML = [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.Loader')/].doLoad(inputStream, options, [genModel.getImportedName(genPackage.getImportedFactoryInterfaceName())/].eINSTANCE, this);
+ }
+
+ @Override
+ public void doSave([genModel.getImportedName('java.io.OutputStream')/] outputStream, [genModel.getImportedName('java.util.Map')/]<?, ?> options) throws [genModel.getImportedName('java.io.IOException')/] {
+ if(resUML != null) {
+ resUML.save(options);
+ }
+ [genModel.getImportedName('java.io.PrintStream')/] stream = new [genModel.getImportedName('java.io.PrintStream')/](outputStream);
+ stream.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ String uri = resUML.getURI().toString();
+ stream.println("<source uri=\"" + uri + "\"/>");
+ }
+
+[if (genModel.hasCopyrightField())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final [genModel.getImportedName('java.lang.String')/] copyright = [genModel.getCopyrightFieldLiteral()/];[genModel.getNonNLS()/]
+
+[/if]
+ /**
+ * Creates an instance of the resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param uri the URI of the new resource.
+ * @generated
+ */
+ public [className/](URI uri)
+ {
+ super(uri);
+[if (genPackage.getResource() = GenResourceKind::XML)][comment Do nothing/]
+[/if]
+ }
+
+[if (genPackage.dataTypeConverters and (genPackage.hasDocumentRoot() or genPackage.isXMLTypePackage()))]
+[let _Map : String = if (genModel.useGenerics()) then 'Map<?, ?>' else 'Map' endif]
+[let _MapStringBoolean : String = if (genModel.useGenerics()) then 'Map<String, Boolean>' else 'Map' endif]
+[let _MapStringWildcard : String = if (genModel.useGenerics()) then 'Map<String, ?>' else 'Map' endif]
+[comment || org.eclipse.emf.ecore.xml.type.XMLTypePackage.eNS_URI.equals(genPackage.getNSURI()))) { boolean isXMLTypePackage = org.eclipse.emf.ecore.xml.type.XMLTypePackage.eNS_URI.equals(genPackage.getNSURI());%>/]
+ [if (not genPackage.isXMLTypePackage())]
+[genModel.getImportedName('org.eclipse.emf.ecore.xmi.XMLResource')/]
+[genModel.getImportedName('org.eclipse.emf.ecore.xmi.XMLParserPool')/]
+[genModel.getImportedName('org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl')/]
+[genModel.getImportedName('java.io.InputStream')/]
+[genModel.getImportedName('java.io.IOException')/]
+[genModel.getImportedName('org.eclipse.emf.ecore.EObject')/]
+[genModel.getImportedName('java.util.Collections')/]
+[genModel.getImportedName('java.util.HashMap')/]
+[genModel.getImportedName('java.util.Map')/]
+[genModel.getImportedName('org.xml.sax.InputSource')/]
+[genModel.getImportedName('javax.xml.parsers.SAXParser')/]
+ [/if]
+[genModel.getImportedName('org.xml.sax.Attributes')/]
+[genModel.getImportedName('org.xml.sax.SAXException')/]
+[let _StackFrame : String = genModel.getImportedName('org.eclipse.emf.ecore.xml.type.util.XMLTypeResourceImpl') + '.StackFrame']
+[let _DataFrame : String = genModel.getImportedName('org.eclipse.emf.ecore.xml.type.util.XMLTypeResourceImpl') + '.DataFrame']
+ [if (not genPackage.isXMLTypePackage())]
+ /**
+ * A load option that turns of the use of the generate data converters.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String OPTION_USE_DATA_CONVERTER = "USE_DATA_CONVERTER";
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation())]
+ @Override
+ [/if]
+ public void doLoad(InputStream inputStream, [_Map/] options) throws IOException
+ {
+ if (options != null && Boolean.TRUE.equals(options.get(OPTION_USE_DATA_CONVERTER)))
+ {
+ getContents().add
+ (load
+ (new InputSource(inputStream),
+ ([_MapStringBoolean/])options.get(XMLResource.OPTION_PARSER_FEATURES),
+ ([_MapStringWildcard/])options.get(XMLResource.OPTION_PARSER_PROPERTIES),
+ Boolean.TRUE.equals(options.get(XMLResource.OPTION_USE_LEXICAL_HANDLER))).eContainer());
+ }
+ else
+ {
+ super.doLoad(inputStream, options);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation())]
+ @Override
+ [/if]
+ public void doLoad(InputSource inputSource, [_Map/] options) throws IOException
+ {
+ if (options != null && Boolean.TRUE.equals(options.get(OPTION_USE_DATA_CONVERTER)))
+ {
+ getContents().add
+ (load
+ (inputSource,
+ ([_MapStringBoolean/])options.get(XMLResource.OPTION_PARSER_FEATURES),
+ ([_MapStringWildcard/])options.get(XMLResource.OPTION_PARSER_PROPERTIES),
+ Boolean.TRUE.equals(options.get(XMLResource.OPTION_USE_LEXICAL_HANDLER))).eContainer());
+ }
+ else
+ {
+ super.doLoad(inputSource, options);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static final XMLParserPool parserPool = new XMLParserPoolImpl();
+
+ /**
+ * Loads an instance from the input.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param inputSource the input from which to load.
+ * @param features a map of the parser features and their values.
+ * @param properties a map of a parser properties and their values.
+ * @param useLexicalHandler whether a lexical handler should be used during loading.
+ * @return the root object; for the case of a document root, the child of that document root is return.
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @generated
+ */
+ public static EObject load(InputSource inputSource, [_MapStringBoolean/] features, [_MapStringWildcard/] properties, boolean useLexicalHandler) throws IOException
+ {
+ [_MapStringBoolean/] requiredFeatures = new [_MapStringBoolean.replaceAll('Map','HashMap')/]();
+ requiredFeatures.put("http://xml.org/sax/features/namespaces", Boolean.TRUE);
+ if (features != null)
+ {
+ requiredFeatures.putAll(features);
+ }
+
+ if (properties == null)
+ {
+ properties = Collections.[if (genModel.useGenerics())]emptyMap()[else]EMPTY_MAP[/if];
+ }
+
+ SAXParser saxParser = null;
+ try
+ {
+ saxParser = parserPool.get(requiredFeatures, properties, useLexicalHandler);
+ final FrameFactory.DocumentRootStackFrame documentRoot = FrameFactory.INSTANCE.pushDocumentRoot(null, null);
+ XMLTypeResourceImpl.Handler handler = new XMLTypeResourceImpl.Handler(documentRoot);
+ saxParser.parse(inputSource, handler);
+ [if (genModel.suppressEMFTypes)]
+ return (EObject)((EObject)FrameFactory.INSTANCE.popDocumentRoot(documentRoot)).eContents().get(0);
+ [else]
+ return FrameFactory.INSTANCE.popDocumentRoot(documentRoot).eContents().get(0);
+ [/if]
+ }
+ catch (Exception exception)
+ {
+ throw new IOWrappedException(exception);
+ }
+ finally
+ {
+ parserPool.release(saxParser, requiredFeatures, properties, useLexicalHandler);
+ }
+ }
+
+ [/if]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public final static class FrameFactory
+ {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final FrameFactory INSTANCE = new FrameFactory();
+
+ [for (genClass : GenClass | genPackage.genClasses)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genClass.getName()/]StackFrame [genClass.getSafeUncapName()/];
+
+ [/for]
+ [for (genDataType : GenDataType | genPackage.getAllGenDataTypes())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [_DataFrame/] [genDataType.getSafeUncapName()/];
+
+ [/for]
+ [for (genClass : GenClass | genPackage.genClasses)]
+ [let attributes : Sequence(EStructuralFeature) = genModel.getAllExtendedMetaDataAttributes(genClass.ecoreClass)]
+ [let elements : Sequence(EStructuralFeature) = genModel.getAllExtendedMetaDataElements(genClass.ecoreClass)]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public [genClass.getName()/]StackFrame push[genClass.getName()/]([_StackFrame/] previous, Attributes attributes)
+ {
+ [genClass.getName()/]StackFrame result[genClass.getName()/] = [genClass.getSafeUncapName()/] == null ? new [genClass.getName()/]StackFrame() : [genClass.getSafeUncapName()/];
+ [genClass.getSafeUncapName()/] = null;
+ result[genClass.getName()/].pushOnto(previous);
+ result[genClass.getName()/].handleAttributes(attributes);
+ return result[genClass.getName()/];
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public [genClass.getImportedInterfaceName()/] pop[genClass.getName()/]([genClass.getName()/]StackFrame [genClass.getSafeUncapName()/])
+ {
+ [genClass.getImportedInterfaceName()/] result[genClass.getName()/]Value = [genClass.getSafeUncapName()/].pop[genClass.getName()/]();
+ this.[genClass.getSafeUncapName()/] = [genClass.getSafeUncapName()/];
+ return result[genClass.getName()/]Value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class [genClass.getName()/]StackFrame extends [_StackFrame/]
+ {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genClass.getImportedInterfaceName()/] the[genClass.getName()/];
+
+ [for (genFeature : GenFeature | genClass.getAllGenFeatures())]
+ [let name : String = genModel.getExtendedMetaDataName(genFeature.ecoreFeature)]
+ [if ((elements->includes(genFeature.ecoreFeature) or attributes->includes(genFeature.ecoreFeature)) and name.index(':') < 0)]
+ [if (genFeature.isReferenceType())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genFeature.getTypeGenClass().genPackage.getImportedResourceClassName()/].FrameFactory.[genFeature.getTypeGenClass().getName()/]StackFrame [genFeature.getSafeName()/];
+
+ [else]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [_DataFrame/] [genFeature.getSafeName()/];
+
+ [/if]
+ [/if]
+ [/let]
+ [/for]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation())]
+ @Override
+ [/if]
+ public void handleAttributes(Attributes attributes)
+ {
+ [comment int count = 0; for (GenFeature genFeature : genClass.getAllGenFeatures()) /]
+ [let featuresToHandle : Sequence(GenFeature) = genClass.getAllGenFeatures()->filter(GenFeature)
+ ->select(f : GenFeature| attributes->includes(f.ecoreFeature)
+ and not f.isDerived()
+ and genModel.getExtendedMetaDataName(f.ecoreFeature).index(':') < 0
+ and not f.isReferenceType())]
+ [for (genFeature : GenFeature | featuresToHandle)]
+ [let name : String = genModel.getExtendedMetaDataName(genFeature.ecoreFeature)]
+ [let namespace : String = genModel.getExtendedMetaDataNamespaceAsLiteral(genFeature.ecoreFeature)]
+ [let genClassifier : GenClassifier = genFeature.getTypeGenClassifier()]
+ [if (i = 0)]
+ String theValue = attributes.getValue([namespace/], "[name/]");
+ [else]
+ theValue = attributes.getValue([namespace/], "[name/]");
+ [/if]
+ if (theValue != null)
+ {
+ [if (genClassifier.genPackage.dataTypeConverters)]
+ the[genClass.getName()/].set[genFeature.getAccessorName()/]([genClassifier.genPackage.getQualifiedFactoryInstanceAccessor()/].create[genClassifier.getName()/](theValue));
+ [else]
+ the[genClass.getName()/].set[genFeature.getAccessorName()/](([genFeature.getImportedType(null)/])[genClassifier.genPackage.getQualifiedEFactoryInstanceAccessor()/].createFromString([genClassifier.getQualifiedClassifierAccessor()/], theValue));
+ [/if]
+ }
+ [/let]
+ [/let]
+ [/let]
+ [/for]
+ [if (featuresToHandle->isEmpty())]
+ // There are attributes to handle.
+ [/if]
+ [/let]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation())]
+ @Override
+ [/if]
+ public [_StackFrame/] startElement(String namespace, String localName, String qName, Attributes attributes) throws SAXException
+ {
+ [let featuresToHandle : Sequence(GenFeature) = genClass.getAllGenFeatures()->filter(GenFeature)
+ ->select(f : GenFeature | elements->includes(f.ecoreFeature)
+ and genModel.getExtendedMetaDataName(f.ecoreFeature).index(':') < 0)]
+ [for (genFeature : GenFeature | featuresToHandle)]
+ [let name : String = genModel.getExtendedMetaDataName(genFeature.ecoreFeature)]
+ [let namespace : String = genModel.getExtendedMetaDataNamespaceAsLiteral(genFeature.ecoreFeature)]
+ [if (i > 0)]else [/if]if ("[name/]".equals(localName) && [namespace/].equals(namespace))
+ {
+ return [genFeature.getSafeName()/] = [genFeature.getTypeGenClassifier().genPackage.getImportedResourceClassName()/].FrameFactory.INSTANCE.push[genFeature.getTypeGenClassifier().getName()/](this, attributes);
+ }
+ [/let]
+ [/let]
+ [/for]
+ [if (featuresToHandle->isEmpty())]
+ return super.startElement(namespace, localName, qName, attributes);
+ [else]
+ else
+ {
+ return super.startElement(namespace, localName, qName, attributes);
+ }
+ [/if]
+ [/let]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation())]
+ @Override
+ [/if]
+ public void endElement([_StackFrame/] child) throws SAXException
+ {
+ [let featuresToHandle : Sequence(GenFeature) = genClass.getAllGenFeatures()->filter(GenFeature)
+ ->select(f : GenFeature | elements->includes(f.ecoreFeature)
+ and genModel.getExtendedMetaDataName(f.ecoreFeature).index(':') < 0)]
+ [for (genFeature : GenFeature | featuresToHandle)]
+ [let name : String = genModel.getExtendedMetaDataName(genFeature.ecoreFeature)]
+ [if (i > 0)]else [/if]if (child == [genFeature.getSafeName()/])
+ {
+ [if (genFeature.isListType())]
+ the[genClass.getName()/].[genFeature.getGetAccessor()/]().add([genFeature.getTypeGenClassifier().genPackage.getImportedResourceClassName()/].FrameFactory.INSTANCE.pop[genFeature.getTypeGenClassifier().getName()/]([genFeature.getSafeName()/]));
+ [else]
+ the[genClass.getName()/].set[genFeature.getAccessorName()/]([genFeature.getTypeGenClassifier().genPackage.getImportedResourceClassName()/].FrameFactory.INSTANCE.pop[genFeature.getTypeGenClassifier().getName()/]([genFeature.getSafeName()/]));
+ [/if]
+ [genFeature.getSafeName()/] = null;
+ }
+ [/let]
+ [/for]
+ [if (featuresToHandle->isEmpty())]
+ super.endElement(child);
+ [else]
+ else
+ {
+ super.endElement(child);
+ }
+ [/if]
+ [/let]
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ [if (genModel.useClassOverrideAnnotation())]
+ @Override
+ [/if]
+ public void create()
+ {
+ the[genClass.getName()/] = [genPackage.getQualifiedFactoryInstanceAccessor()/].create[genClass.getName()/]();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected [genClass.getImportedInterfaceName()/] pop[genClass.getName()/]()
+ {
+ pop();
+ [genClass.getImportedInterfaceName()/] result[genClass.getName()/]Value = the[genClass.getName()/];
+ the[genClass.getName()/] = null;
+ return result[genClass.getName()/]Value;
+ }
+
+ }
+
+ [/let]
+ [/let]
+ [/for]
+ [for (genDataType : GenDataType | genPackage.getAllGenDataTypes())]
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public [_DataFrame/] push[genDataType.getName()/]([_StackFrame/] previous, Attributes attributes)
+ {
+ [_DataFrame/] result[genDataType.getName()/] = [genDataType.getSafeUncapName()/] == null ? new [_DataFrame/]() : [genDataType.getSafeUncapName()/];
+ [genDataType.getSafeUncapName()/] = null;
+ result[genDataType.getName()/].pushOnto(previous);
+ result[genDataType.getName()/].handleAttributes(attributes);
+ return result[genDataType.getName()/];
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public [genDataType.getImportedParameterizedInstanceClassName()/] pop[genDataType.getName()/]([_DataFrame/] [genDataType.getSafeUncapName()/])
+ {
+ [if (genDataType.genPackage.dataTypeConverters)]
+ [genDataType.getImportedParameterizedInstanceClassName()/] result[genDataType.getName()/]Value = [genDataType.genPackage.getQualifiedFactoryInstanceAccessor()/].create[genDataType.getName()/]([genDataType.getSafeUncapName()/].popValue());
+ [else][if (genDataType.isPrimitiveType() and not genModel.isJDK50())]
+ [genDataType.getImportedInstanceClassName()/] result[genDataType.getName()/]Value = (([genDataType.getObjectInstanceClassName()/])[genDataType.genPackage.getQualifiedEFactoryInstanceAccessor()/].createFromString([genDataType.getQualifiedClassifierAccessor()/], [genDataType.getSafeUncapName()/].popValue())).[genDataType.getPrimitiveValueFunction()/]();
+ [else]
+ [genDataType.getImportedInstanceClassName()/] result[genDataType.getName()/]Value = ([genDataType.getObjectInstanceClassName()/])[genDataType.genPackage.getQualifiedEFactoryInstanceAccessor()/].createFromString([genDataType.getQualifiedClassifierAccessor()/], [genDataType.getSafeUncapName()/].popValue());
+ [/if][/if]
+ this.[genDataType.getSafeUncapName()/] = [genDataType.getSafeUncapName()/];
+ return result[genDataType.getName()/]Value;
+ }
+
+ [/for]
+ }
+
+[/let]
+[/let]
+[/let]
+[/let]
+[/let]
+[/if]
+} //[className/]
+[/template]
+
+[query public resourceClassPath(genPackage : GenPackage) : String
+ = genPackage.genModel.extractSourceDirectory(genPackage.genModel.modelDirectory) + '/'
+ + genPackage.getQualifiedResourceClassName().toPath() + '.java'/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/WrapperClass.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/WrapperClass.mtl
new file mode 100644
index 00000000000..aac751d53f3
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/genfacade/WrapperClass.mtl
@@ -0,0 +1,189 @@
+[comment]Copyright (c) 2013 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:
+ Obeo - Initial API and implementation
+ CEA LIST - Modification to support Facade code generation[/comment]
+[comment encoding = UTF-8 /]
+[module WrapperClass('http://www.eclipse.org/emf/2002/GenModel','http://www.eclipse.org/papyrus/facademapping','http://www.eclipse.org/emf/2002/Ecore')]
+
+[import org::eclipse::emf::eef::codegen::ecore::services::common /]
+[import org::eclipse::emf::eef::codegen::ecore::services::header /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenModel /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenPackage /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClass /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenClassifier /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenFeature /]
+[import org::eclipse::emf::eef::codegen::ecore::services::wrappers::GenDataType /]
+[import org::eclipse::emf::eef::codegen::ecore::services::StringUtil /]
+[import org::eclipse::papyrus::facade::codegen::utils::FacadeCodegenUtils /]
+
+
+[template public wrapperClass(genPackage : GenPackage) { genModel : GenModel = genPackage.genModel; packageName : String = genPackage.getUtilitiesPackageName(); className : String = 'Wrapper'}]
+
+[genModel.initializeImportManager(packageName, className)/]
+
+[genModel.getImportedName('org.eclipse.emf.common.util.URI')/]
+
+
+[file (genPackage.wrapperClassPath(className), false, 'UTF-8')]
+[genModel.includeHeader()/]
+package [packageName/];
+[let content : String = genPackage.wrapperFileContent(genModel, className)]
+[genModel.genSortedImports()/]
+[content/]
+[/let]
+[/file]
+
+[/template]
+
+[template protected wrapperFileContent(genPackage : GenPackage, genModel : GenModel, className : String)]
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Wrapper</b> associated with the package.
+ * <!-- end-user-doc -->
+ * @see [genPackage.getQualifiedResourceFactoryClassName()/]
+ * @generated
+ */
+public class [className/]
+{
+private static volatile Wrapper instance = null;
+
+ private Wrapper() {
+ super();
+ }
+
+ public final static Wrapper getInstance() {
+ if(instance == null) {
+ synchronized(Wrapper.class) {
+ if(instance == null) {
+ instance = new Wrapper();
+ }
+ }
+ }
+ return instance;
+ }
+
+ public [genModel.getImportedName('org.eclipse.emf.ecore.EClassifier')/] getMappingFromUML([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] umlElement) {
+
+ [genModel.getAllMetaclassMappings().genMappingfromUML(genModel, genPackage)/]
+
+ return null;
+ }
+
+ public <E extends [genModel.getImportedName('org.eclipse.papyrus.facade.utils.RepresentingElement')/]> void updateCache([genModel.getImportedName('org.eclipse.emf.common.util.EList')/]<E> update, [genModel.getImportedName('org.eclipse.emf.common.util.EList')/]<E> cache) {
+ //Empty the cache
+ while(!cache.isEmpty()) {
+ ((org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList<E>)cache).silentRemove(0);
+ }
+
+
+ for(int i = 0; i < update.size(); i++) {
+ E elementInUpdate = update.get(i);
+ ((org.eclipse.papyrus.facade.utils.wrappinglist.WrappingList<E>)cache).silentAdd(i, elementInUpdate);
+ }
+ }
+
+ public <E extends [genModel.getImportedName('org.eclipse.papyrus.facade.utils.RepresentingElement')/]> [genModel.getImportedName('org.eclipse.emf.common.util.EList')/] toRepresentedList([genModel.getImportedName('java.util.List')/]<E> list) {
+ [genModel.getImportedName('org.eclipse.emf.common.util.EList')/]<[genModel.getImportedName('org.eclipse.emf.ecore.EObject')/]> result = new [genModel.getImportedName('org.eclipse.emf.common.util.BasicEList')/]<[genModel.getImportedName('org.eclipse.emf.ecore.EObject')/]>();
+
+ for(E representingElement : list) {
+ result.add(representingElement.get__Represented());
+ }
+
+ return result;
+ }
+
+ public [genModel.getImportedName('org.eclipse.emf.ecore.EStructuralFeature')/] getFeatureMappingFromUML([genModel.getImportedName('org.eclipse.emf.ecore.EStructuralFeature')/] feature) {
+
+ [genModel.getAllFeatureMappings().getFeatureMappingFromUML(genModel, genPackage)/]
+
+
+ return null;
+ }
+
+ public Enum getEnumMappingFromUML(Enum value) {
+
+ [genModel.getAllEnumLiteralMappings().genEnumMappingfromUML(genModel, genPackage)/]
+
+ return null;
+ }
+
+ public Enum getEnumMappingFromSpecific(Enum value) {
+
+ [genModel.getAllEnumLiteralMappings().genEnumMappingfromSpecific(genModel, genPackage)/]
+
+ return null;
+ }
+
+ public [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] findOrCreateSpecific([genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] umlElement) {
+ [genModel.getImportedName('org.eclipse.emf.common.util.EList')/]<[genModel.getImportedName('org.eclipse.emf.common.notify.Adapter')/]> adapters = umlElement.eAdapters();
+ for([genModel.getImportedName('org.eclipse.emf.common.notify.Adapter')/] adapter : adapters) {
+ if(adapter instanceof [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.RepresentingElementAdapter')/]) {
+ return (([genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.RepresentingElementAdapter')/])adapter).get__Representing();
+ }
+ }
+
+ [genModel.getImportedName('org.eclipse.emf.ecore.EClassifier')/] eClassifier = getMappingFromUML(umlElement);
+ if(eClassifier != null) {
+ if(eClassifier instanceof [genModel.getImportedName('org.eclipse.emf.ecore.EClass')/]) {
+ [genModel.getImportedName('org.eclipse.emf.ecore.EObject')/] representingElement = [genPackage.getImportedFactoryInterfaceName()/].eINSTANCE.create(([genModel.getImportedName('org.eclipse.emf.ecore.EClass')/])eClassifier);
+ if(representingElement instanceof [genModel.getImportedName('org.eclipse.papyrus.facade.utils.RepresentingElement')/]) {
+ //Override represented
+
+ (([genModel.getImportedName('org.eclipse.papyrus.facade.utils.RepresentingElement')/])representingElement).set__Represented(umlElement);
+ [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.RepresentingElementAdapter')/] adapter = new [genModel.getImportedName(genPackage.getUtilitiesPackageName()+'.RepresentingElementAdapter')/]();
+ adapter.set__Representing(representingElement);
+ umlElement.eAdapters().add(adapter);
+ return representingElement;
+ }
+ }
+ }
+
+
+ return null;
+ }
+}
+
+[/template]
+
+[template public genEnumMappingfromUML(mapping : Mapping , genModel:GenModel, genPackage: GenPackage)]
+
+ if(value == [getPackagePathFromMapping(mapping)/].[getUMLEnumElementFromMapping(mapping)/]) {
+ return [genModel.getImportedName(genPackage.getInterfacePackageName())/].[getFacadeEnumElementFromMapping(mapping)/];
+ }
+
+[/template]
+
+[template public genEnumMappingfromSpecific(mapping : Mapping , genModel:GenModel, genPackage: GenPackage)]
+
+ if(value == [genModel.getImportedName(genPackage.getInterfacePackageName())/].[getFacadeEnumElementFromMapping(mapping)/]) {
+ return [getPackagePathFromMapping(mapping)/].[getUMLEnumElementFromMapping(mapping)/];
+ }
+
+[/template]
+
+[template public genMappingfromUML(mapping : Mapping , genModel:GenModel, genPackage: GenPackage)]
+
+ if(umlElement.eClass() == [genModel.getImportedName(getUMLPackageName(mapping))/].eINSTANCE.get[getUMLAccessorName(mapping,genModel)/]()) {
+ [mapping.getCorrespondingStereotypeMapping(genModel,genPackage)/]
+
+ return [genModel.getImportedName(genPackage.getImportedPackageInterfaceName())/].eINSTANCE.get[getClassifierAccessorName(genModel,mapping)/]();
+ }
+
+[/template]
+
+[template public getFeatureMappingFromUML(mapping : Mapping , genModel:GenModel, genPackage: GenPackage)]
+ if(feature == [genModel.getImportedName(getUMLPackageName(mapping))/].eINSTANCE.get[getUMLFeatureFromMapping(mapping,genModel)/]()) {
+ return [genModel.getImportedName(genPackage.getImportedPackageInterfaceName())/].eINSTANCE.get[getFeatureAccessorName(genModel,mapping)/]();
+
+ }
+[/template]
+
+[query public wrapperClassPath(genPackage : GenPackage, className : String) : String
+ = genPackage.genModel.extractSourceDirectory(genPackage.genModel.modelDirectory) + '/'+ genPackage.getUtilitiesPackageName().toPath() + '/' +
+ className+ '.java'/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl
new file mode 100644
index 00000000000..9712b218a46
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/FacadeCodegenUtils.mtl
@@ -0,0 +1,127 @@
+[comment]Copyright (c) 2013 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:
+ CEA LIST - Initial API and implementation[/comment]
+[comment encoding = UTF-8 /]
+[module FacadeCodegenUtils('http://www.eclipse.org/emf/2002/Ecore','http://www.eclipse.org/papyrus/facademapping', 'http://www.eclipse.org/emf/2002/GenModel','http://www.eclipse.org/uml2/4.0.0/UML')/]
+
+[query public getUMLMetaElement( facadeMetaElement : EObject, genModel :GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLMetaElement( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,genModel})
+/]
+
+[query public findUMLMetaElement( facadeMetaElement : EObject, genModel :GenModel) : EObject
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'findUMLMetaElement( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,genModel})
+/]
+
+[query public findUMLGetAccessor( facadeMetaFeature : EObject, facadeGenModel :GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'findUMLGetAccessor( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaFeature,facadeGenModel})
+/]
+
+[query public findUMLAccessorName( facadeMetaFeature : EObject, facadeGenModel :GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'findUMLAccessorName( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaFeature,facadeGenModel})
+/]
+
+[query public getClassifierAccessorName( genModel:GenModel, mapping:Mapping) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getClassifierAccessorName( org.eclipse.emf.codegen.ecore.genmodel.GenModel,org.eclipse.papyrus.facademapping.Mapping)', Sequence{genModel,mapping})
+/]
+
+[query public getFeatureAccessorName( genModel:GenModel, mapping:Mapping) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getFeatureAccessorName( org.eclipse.emf.codegen.ecore.genmodel.GenModel,org.eclipse.papyrus.facademapping.Mapping)', Sequence{genModel,mapping})
+/]
+
+[query public getUMLPackageName( mapping : Mapping) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLPackageName( org.eclipse.papyrus.facademapping.Mapping)', Sequence{mapping})
+/]
+
+[query public getPackagePathFromUML( facadeMetaElement:EObject) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getPackagePathFromUML(org.eclipse.emf.ecore.EObject)', Sequence{facadeMetaElement})
+/]
+
+[query public getPackagePathFromMapping( mapping : Mapping) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getPackagePathFromMapping(org.eclipse.papyrus.facademapping.Mapping)', Sequence{mapping})
+/]
+
+[query public getUMLFactory( facadeMetaElement:EObject, genModel:GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLFactory( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,genModel})
+/]
+
+[query public getUMLAccessorName( mapping : Mapping, genModel :GenModel) : EObject
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLAccessorName( org.eclipse.papyrus.facademapping.Mapping ,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{mapping,genModel})
+/]
+
+[query public getAllMetaclassMappings( facadeGenModel :GenModel) : Sequence(Mapping)
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllMetaclassMappings(org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeGenModel})
+/]
+
+[query public getUMLFeatureFromMapping( mapping : Mapping, genModel :GenModel) : EObject
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLFeatureFromMapping( org.eclipse.papyrus.facademapping.Mapping ,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{mapping,genModel})
+/]
+
+[query public getAllFeatureMappings( facadeGenModel :GenModel) : Sequence(Mapping)
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllFeatureMappings(org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeGenModel})
+/]
+
+[query public getAppropriateQualifiedTypeName( genClassifier :GenClassifier) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAppropriateQualifiedTypeName(org.eclipse.emf.codegen.ecore.genmodel.GenClassifier)', Sequence{genClassifier})
+/]
+
+[query public getAllStereotypeQualifiedNames( facadeMetaElement:EObject, facadeGenModel:GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllStereotypeQualifiedNames( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,facadeGenModel})
+/]
+
+[query public getNonAssociationStereotypeQualifiedNames( facadeMetaElement:EObject, facadeGenModel:GenModel) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getNonAssociationStereotypeQualifiedNames( org.eclipse.emf.ecore.EObject,org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeMetaElement,facadeGenModel})
+/]
+
+[query public getUMLEnumElementFromMapping( mapping : Mapping) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getUMLEnumElementFromMapping( org.eclipse.papyrus.facademapping.Mapping )', Sequence{mapping})
+/]
+
+[query public getFacadeEnumElementFromMapping( mapping : Mapping) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getFacadeEnumElementFromMapping( org.eclipse.papyrus.facademapping.Mapping )', Sequence{mapping})
+/]
+
+[query public getAllEnumLiteralMappings( facadeGenModel :GenModel) : Sequence(Mapping)
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getAllEnumLiteralMappings(org.eclipse.emf.codegen.ecore.genmodel.GenModel)', Sequence{facadeGenModel})
+/]
+
+[query public isStereotypeProperty(genFeature:GenFeature) : Boolean
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'isStereotypeProperty(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)', Sequence{genFeature})
+/]
+
+[query public isExtensionProperty(genFeature:GenFeature) : Boolean
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'isExtensionProperty(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)', Sequence{genFeature})
+/]
+
+[query public isExtentionStereotypeProperty(genFeature:GenFeature) : Boolean
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'isExtentionStereotypeProperty(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)', Sequence{genFeature})
+/]
+
+[query public isPrimtiveList(genTypedElement:GenTypedElement) : Boolean
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'isPrimtiveList(org.eclipse.emf.codegen.ecore.genmodel.GenTypedElement)', Sequence{genTypedElement})
+/]
+
+[query public isPrimitive(genTypedElement:GenTypedElement) : Boolean
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'isPrimitive(org.eclipse.emf.codegen.ecore.genmodel.GenTypedElement)', Sequence{genTypedElement})
+/]
+
+[query public getCorrespondingStereotypeMapping(mapping : Mapping, genModel:GenModel,genPackage:GenPackage) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getCorrespondingStereotypeMapping(org.eclipse.papyrus.facademapping.Mapping,org.eclipse.emf.codegen.ecore.genmodel.GenModel,org.eclipse.emf.codegen.ecore.genmodel.GenPackage)', Sequence{mapping,genModel,genPackage})
+/]
+
+[query public getStereotypeQualifiedName(genFeature:GenFeature) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'getStereotypeQualifiedName(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)', Sequence{genFeature})
+/]
+
+[query public copyEcore(genPackage:GenPackage) : OclVoid
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'copyEcore(org.eclipse.emf.codegen.ecore.genmodel.GenPackage)', Sequence{genPackage})
+/]
+
+[query public initUtilsCaches(traceabilityContext : OclAny) : OclVoid
+= invoke('org.eclipse.papyrus.facade.codegen.utils.FacadeCodegenUtils', 'initUtilsCaches()', Sequence{})
+/]
diff --git a/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl
new file mode 100644
index 00000000000..f825f95aa75
--- /dev/null
+++ b/extraplugins/facade/org.eclipse.papyrus.facade.codegen/src-templates/org/eclipse/papyrus/facade/codegen/utils/WrappingListUtils.mtl
@@ -0,0 +1,14 @@
+[comment]Copyright (c) 2013 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:
+ CEA LIST - Initial API and implementation[/comment]
+[comment encoding = UTF-8 /]
+[module WrappingListUtils('http://www.eclipse.org/emf/2002/Ecore','http://www.eclipse.org/papyrus/facademapping', 'http://www.eclipse.org/emf/2002/GenModel','http://www.eclipse.org/uml2/2.2.0/GenModel')/]
+
+[query public getWrappingListConstructor(genClass:GenClass, genFeature:GenFeature, typeArgument:String) : String
+= invoke('org.eclipse.papyrus.facade.codegen.utils.WrappingListUtils', 'getWrappingListConstructor(org.eclipse.emf.codegen.ecore.genmodel.GenClass, org.eclipse.emf.codegen.ecore.genmodel.GenFeature, java.lang.String)', Sequence{ genClass, genFeature, typeArgument})/]

Back to the top