diff options
author | ptessier | 2011-09-21 09:12:50 +0000 |
---|---|---|
committer | ptessier | 2011-09-21 09:12:50 +0000 |
commit | 3cd31179790e1e5f77d1455d85b61fd92a77f54b (patch) | |
tree | 10c7a27770e1845c6dd6077bc1412ac78342e673 /plugins/developer | |
parent | 626f1162e5471e5c3c43c7b3b14c746d01543956 (diff) | |
download | org.eclipse.papyrus-3cd31179790e1e5f77d1455d85b61fd92a77f54b.tar.gz org.eclipse.papyrus-3cd31179790e1e5f77d1455d85b61fd92a77f54b.tar.xz org.eclipse.papyrus-3cd31179790e1e5f77d1455d85b61fd92a77f54b.zip |
358375: [Generative tool] template xpand need to be updated
https://bugs.eclipse.org/bugs/show_bug.cgi?id=358375
Diffstat (limited to 'plugins/developer')
2 files changed, 41 insertions, 27 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/diagram/commands/CreateNodeCommand.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/diagram/commands/CreateNodeCommand.xpt index 9792da2be81..8182b8c5b9c 100644 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/diagram/commands/CreateNodeCommand.xpt +++ b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/diagram/commands/CreateNodeCommand.xpt @@ -18,6 +18,8 @@ «EXTENSION xpt::diagram::Utils»
«EXTENSION xpt::diagram::commands::file»
«EXTENSION xpt::diagram::commands::NodeConstraintUtils»
+«EXTENSION xpt::OclMigrationProblems»
+
«DEFINE CreateNodeCommand FOR gmfgen::GenNode-»
«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
package «getDiagram().editCommandsPackageName»;
@@ -129,25 +131,29 @@ protected org.eclipse.emf.ecore.EObject getElementToEdit() { }
«ENDDEFINE»
«DEFINE canExecute_Normal FOR gmfgen::TypeModelFacet-»
-«IF containmentMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0 or (childMetaFeature <> containmentMetaFeature and childMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0)-»
- «EXPAND MetaModel::DeclareAndAssign('container', 'getElementToEdit()') FOR containmentMetaFeature.genClass-»
- «IF containmentMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0-»
- «IF containmentMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) = 1»
- if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR containmentMetaFeature» != null) {
- «ELSE-»
- if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR containmentMetaFeature».size() >= «containmentMetaFeature.ecoreFeature.upperBound.oclAsType(Integer)») {
+«IF not containmentMetaFeature.oclIsUndefined()-»
+ «IF not containmentMetaFeature.ecoreFeature.oclIsUndefined()-»
+ «IF not isUnbounded(containmentMetaFeature.ecoreFeature) or (childMetaFeature <> containmentMetaFeature and not isUnbounded(childMetaFeature.ecoreFeature))-»
+ «EXPAND MetaModel::DeclareAndAssign('container', 'getElementToEdit()') FOR containmentMetaFeature.genClass-»
+ «IF not isUnbounded(containmentMetaFeature.ecoreFeature)-»
+ «IF isSingleValued(containmentMetaFeature.ecoreFeature)»
+ if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR containmentMetaFeature» != null) {
+ «ELSE-»
+ if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR containmentMetaFeature».size() >= «containmentMetaFeature.ecoreFeature.upperBound») {
+ «ENDIF-»
+ return false;
+ }
+ «ENDIF-»
+ «IF childMetaFeature <> containmentMetaFeature and not isUnbounded(childMetaFeature.ecoreFeature)-»
+ «IF isSingleValued(childMetaFeature.ecoreFeature)-»
+ if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR childMetaFeature» != null) {
+ «ELSE-»
+ if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR childMetaFeature».size() >= «childMetaFeature.ecoreFeature.upperBound») {
+ «ENDIF-»
+ return false;
+ }
«ENDIF-»
- return false;
- }
«ENDIF-»
- «IF childMetaFeature <> containmentMetaFeature and childMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0-»
- «IF childMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) = 1-»
- if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR childMetaFeature» != null) {
- «ELSE-»
- if («EXPAND MetaModel::getFeatureValue('container', containmentMetaFeature.genClass) FOR childMetaFeature».size() >= «childMetaFeature.ecoreFeature.upperBound.oclAsType(Integer)») {
- «ENDIF-»
- return false;
- }
«ENDIF-»
«ENDIF-»
«REM» [NodeCreationConstraint] START «ENDREM»
@@ -173,7 +179,7 @@ return true; «ENDDEFINE»
«DEFINE normalElementCreation(node : gmfgen::GenNode, varName : String) FOR gmfgen::TypeModelFacet-»
«EXPAND MetaModel::NewInstance(varName) FOR metaClass»
-«IF containmentMetaFeature <> null-»
+«IF not containmentMetaFeature.oclIsUndefined()-»
«EXPAND MetaModel::DeclareAndAssign('owner', 'getElementToEdit()') FOR containmentMetaFeature.genClass»
«EXPAND MetaModel::modifyFeature('owner', containmentMetaFeature.genClass, varName) FOR containmentMetaFeature-»
«ELSE-»
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt index f9380220426..2245af7e972 100644 --- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt +++ b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt @@ -18,6 +18,7 @@ «EXTENSION xpt::GenModelUtils» «EXTENSION xpt::expressions::ValueExpression» «EXTENSION xpt::StringOperations» +«EXTENSION xpt::OclMigrationProblems» «REM»Documentation: PapyrusGenCode«ENDREM» «REM»This tamplate has been modified in order to allow the moving command«ENDREM» @@ -400,25 +401,30 @@ public boolean canCreate«getUniqueIdentifier()»(«EXPAND canCreateParameters F «DEFINE checkEMFConstraints FOR gmfgen::LinkModelFacet»«ERROR 'Unrecognized link model facet in checkEMFConstraints: ' + self.repr()»«ENDDEFINE» + «DEFINE checkEMFConstraints FOR gmfgen::TypeLinkModelFacet-» - «LET childMetaFeature <> containmentMetaFeature and childMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0 AS checkChildFeatureUpperBound-» - «IF containmentMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0 or checkChildFeatureUpperBound-» +«IF not containmentMetaFeature.ecoreFeature.oclIsUndefined()-» + «LET childMetaFeature <> containmentMetaFeature and not isUnbounded(childMetaFeature.ecoreFeature) AS checkChildFeatureBounds-» + «IF not isUnbounded(containmentMetaFeature.ecoreFeature) or checkChildFeatureBounds-» if («getContainerVariable(self)» != null) { «EXPAND checkEMFConstraints(self) FOR containmentMetaFeature-» - «IF checkChildFeatureUpperBound-» + «IF checkChildFeatureBounds-» «EXPAND checkEMFConstraints(self) FOR childMetaFeature-» «ENDIF-» } «ENDIF-» «ENDLET-» +«ENDIF-» «ENDDEFINE» «DEFINE checkEMFConstraints(modelFacet : gmfgen::TypeLinkModelFacet) FOR genmodel::GenFeature-» -«IF ecoreFeature.upperBound.oclAsType(Integer) > 0-» +«IF not containmentMetaFeature.ecoreFeature.oclIsUndefined()-» +«IF not isUnbounded(ecoreFeature)-» if («EXPAND featureBoundComparator(getContainerVariable(modelFacet), modelFacet.getSourceType())») { return false; } «ENDIF-» +«ENDIF-» «ENDDEFINE» «DEFINE checkEMFConstraints FOR gmfgen::FeatureLinkModelFacet-» @@ -441,11 +447,13 @@ if (target != null && («EXPAND featureBoundsConditionClause('target', getTarget «DEFINE featureBoundsConditionClause(targetVar : String, targetType : genmodel::GenClass) FOR genmodel::GenFeature-» «REM»Checking upper bounds if was specified in MM«ENDREM»«-» -«IF ecoreFeature.upperBound.oclAsType(Integer) > 0»«EXPAND featureBoundComparator(targetVar, targetType)»«ENDIF-» -«REM»Checking uniqueness in addition if upper bounds > 1«ENDREM»«-» -«IF ecoreFeature.upperBound.oclAsType(Integer) > 1» || «ENDIF-» -«REM»Checking uniqueness in if upper bounds > 1 or < 0«ENDREM»«-» -«IF ecoreFeature.upperBound.oclAsType(Integer) <> 1»«EXPAND featureUniquenessComparator(targetVar, targetType)»«ENDIF» +«IF not ecoreFeature.oclIsUndefined()» + «IF not isUnbounded(ecoreFeature)»«EXPAND featureBoundComparator(targetVar, targetType)»«ENDIF-» + «REM»Checking uniqueness in addition if upper bounds != 1«ENDREM»«-» + «IF not isSingleValued(ecoreFeature) and not isUnbounded(ecoreFeature)» || «ENDIF-» + «REM»Checking uniqueness in if upper bounds !- 1«ENDREM»«-» + «IF not isSingleValued(ecoreFeature)»«EXPAND featureUniquenessComparator(targetVar, targetType)»«ENDIF» +«ENDIF» «ENDDEFINE» «DEFINE featureBoundComparator(featureVar : String, featureVarGenClass : genmodel::GenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass)»«IF ecoreFeature.upperBound.oclAsType(Integer) = 1» != null«ELSE».size() >= «ecoreFeature.upperBound.oclAsType(Integer)»«ENDIF»«ENDDEFINE» |