Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2007-04-18 15:20:52 -0400
committerashatalin2007-04-18 15:20:52 -0400
commita5511c739ab4c3a86792d39032f8c7e5cc79fba8 (patch)
tree4fd206da329ff570605a837c04860c39f001ee0e
parent1819e149cb5d3201937ff29eb37db9f382ff42e8 (diff)
downloadorg.eclipse.gmf-tooling-a5511c739ab4c3a86792d39032f8c7e5cc79fba8.tar.gz
org.eclipse.gmf-tooling-a5511c739ab4c3a86792d39032f8c7e5cc79fba8.tar.xz
org.eclipse.gmf-tooling-a5511c739ab4c3a86792d39032f8c7e5cc79fba8.zip
Removing unnecessary parameters + more correct external interface check added.
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt18
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateRefLinkCommand.xpt4
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientUtils.xpt22
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt4
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt4
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/commonBaseCanonicalMethods.xpt4
6 files changed, 26 insertions, 30 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt
index 5788db7cb..ce49ae1c0 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt
@@ -64,23 +64,19 @@
«getDiagramEditorUtilQualifiedClassName()».setCharset(«varName»);
«ENDDEFINE»
-«REM»
- containerClass parameter was added because GenFeature.genClass could be a super-class of containerClass.
-«ENDREM»
-«DEFINE getFeatureValue(String containerVar, genmodel::GenClass containerClass, boolean typedContainer) FOR genmodel::GenFeature-»
+«DEFINE getFeatureValue(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
«IF isExternalInterface(containerClass)-»
-((«getFeatureTargetType()») «IF typedContainer»((org.eclipse.emf.ecore.EObject) «ENDIF»«containerVar»«IF typedContainer»)«ENDIF».eGet(«EXPAND metaFeatureAccessor»))«-»
+((«getFeatureTargetType()») ((org.eclipse.emf.ecore.EObject) «containerVar»).eGet(«EXPAND metaFeatureAccessor»))«-»
«ELSE-»
-«IF !typedContainer»((«getQualifiedInterfaceName(genClass)»)«ENDIF»«containerVar»«IF !typedContainer»)«ENDIF».«getGetAccessor()»()«-»
+«containerVar».«getGetAccessor()»()«-»
«ENDIF-»
«ENDDEFINE»
-«DEFINE setFeatureValue(String containerVar, boolean typedContainer, String valueVar, boolean typedValue) FOR genmodel::GenFeature-»
- «IF isExternalInterface(genClass)-»
-«IF typedContainer»((org.eclipse.emf.ecore.EObject) «ENDIF»«containerVar»«IF typedContainer»)«ENDIF».eSet(«EXPAND metaFeatureAccessor», «valueVar»)«-»
+«DEFINE setFeatureValue(String containerVar, genmodel::GenClass containerGenClass, String valueVar) FOR genmodel::GenFeature-»
+ «IF isExternalInterface(containerGenClass)-»
+((org.eclipse.emf.ecore.EObject) «containerVar»).eSet(«EXPAND metaFeatureAccessor», «valueVar»)«-»
«ELSE-»
-«IF !typedContainer»((«getQualifiedInterfaceName(genClass)»)«ENDIF»«containerVar»«IF !typedContainer»)«ENDIF».set«getAccessorName(this)»(
- «IF !typedValue»(«getQualifiedInterfaceName(getTypeGenClassX(this))»)«ENDIF»«valueVar»«IF !typedValue»«ENDIF»)«-»
+«containerVar».set«getAccessorName(this)»(«valueVar»)«-»
«ENDIF-»
«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateRefLinkCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateRefLinkCommand.xpt
index 36271683f..050e9b13d 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateRefLinkCommand.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateRefLinkCommand.xpt
@@ -79,8 +79,8 @@ public class «createCommandClassName» extends org.eclipse.gmf.runtime.emf.type.c
«ENDREM»
«DEFINE setValue FOR gmfgen::FeatureLinkModelFacet-»
«IF metaFeature.ecoreFeature.many-»
- «EXPAND xpt::Common::getFeatureValue("getSource()", getSourceType(), true) FOR metaFeature».add(getTarget());
+ «EXPAND xpt::Common::getFeatureValue("getSource()", getSourceType()) FOR metaFeature».add(getTarget());
«ELSE-»
- «EXPAND xpt::Common::setFeatureValue("getSource()", true, "getTarget()", true) FOR metaFeature»;
+ «EXPAND xpt::Common::setFeatureValue("getSource()", getSourceType(), "getTarget()") FOR metaFeature»;
«ENDIF-»
«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientUtils.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientUtils.xpt
index 1a9201eaa..cc4853f25 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientUtils.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientUtils.xpt
@@ -175,12 +175,12 @@
«DEFINE extractFeatureWithCheck(String containerVar, genmodel::GenClass containerGenClass, String featureVar, String featureTypeFQN) FOR genmodel::GenFeature-»
«IF ecoreFeature.many-»
- if («EXPAND xpt::Common::getFeatureValue(containerVar, containerGenClass, true)».size() != 1) {
+ if («EXPAND xpt::Common::getFeatureValue(containerVar, containerGenClass)».size() != 1) {
return false;
}
- «featureTypeFQN» «featureVar» = («featureTypeFQN») «EXPAND xpt::Common::getFeatureValue(containerVar, containerGenClass, true)».get(0);
+ «featureTypeFQN» «featureVar» = («featureTypeFQN») «EXPAND xpt::Common::getFeatureValue(containerVar, containerGenClass)».get(0);
«ELSE-»
- «featureTypeFQN» «featureVar» = «EXPAND xpt::Common::getFeatureValue(containerVar, containerGenClass, true)»;
+ «featureTypeFQN» «featureVar» = «EXPAND xpt::Common::getFeatureValue(containerVar, containerGenClass)»;
«ENDIF-»
«ENDDEFINE»
@@ -277,12 +277,12 @@
«REM»
Replace old target with the new one in the source.
«ENDREM»
-«DEFINE changeTarget(String sourceVar, genmodel::GenClass sourceGenClass, String oldTargetVar, String newTargetVar) FOR genmodel::GenFeature-»
+«DEFINE changeTarget(String sourceVar, genmodel::GenClass sourceVarGenClass, String oldTargetVar, String newTargetVar) FOR genmodel::GenFeature-»
«IF ecoreFeature.many-»
- «EXPAND xpt::Common::getFeatureValue(sourceVar, sourceGenClass, true)».remove(«oldTargetVar»);
- «EXPAND xpt::Common::getFeatureValue(sourceVar, sourceGenClass, true)».add(«newTargetVar»);
+ «EXPAND xpt::Common::getFeatureValue(sourceVar, sourceVarGenClass)».remove(«oldTargetVar»);
+ «EXPAND xpt::Common::getFeatureValue(sourceVar, sourceVarGenClass)».add(«newTargetVar»);
«ELSE-»
- «EXPAND xpt::Common::setFeatureValue(sourceVar, true, newTargetVar, true)»;
+ «EXPAND xpt::Common::setFeatureValue(sourceVar, sourceVarGenClass, newTargetVar)»;
«ENDIF-»
«ENDDEFINE»
@@ -291,10 +291,10 @@
«ENDREM»
«DEFINE changeSource(String targetVar, String oldSourceVar, String newSourceVar, genmodel::GenClass sourceVarGenClass) FOR genmodel::GenFeature-»
«IF ecoreFeature.many-»
- «EXPAND xpt::Common::getFeatureValue(oldSourceVar, sourceVarGenClass, true)».remove(«targetVar»);
- «EXPAND xpt::Common::getFeatureValue(newSourceVar, sourceVarGenClass, true)».add(«targetVar»);
+ «EXPAND xpt::Common::getFeatureValue(oldSourceVar, sourceVarGenClass)».remove(«targetVar»);
+ «EXPAND xpt::Common::getFeatureValue(newSourceVar, sourceVarGenClass)».add(«targetVar»);
«ELSE-»
- «EXPAND xpt::Common::setFeatureValue(oldSourceVar, true, "null", true)»;
- «EXPAND xpt::Common::setFeatureValue(newSourceVar, true, targetVar, true)»;
+ «EXPAND xpt::Common::setFeatureValue(oldSourceVar, sourceVarGenClass, "null")»;
+ «EXPAND xpt::Common::setFeatureValue(newSourceVar, sourceVarGenClass, targetVar)»;
«ENDIF-»
«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
index de1b8fd38..dbd1181e7 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
@@ -436,7 +436,7 @@ if («EXPAND featureBoundComparator(getContainerVariable(modelFacet), modelFacet.
«ENDIF-»
«ENDDEFINE»
-«DEFINE featureBoundComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND xpt::Common::getFeatureValue(featureVar, featureVarGenClass, true)»«IF ecoreFeature.upperBound == 1» != null«ELSE».size() >= «ecoreFeature.upperBound»«ENDIF»«ENDDEFINE»
+«DEFINE featureBoundComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND xpt::Common::getFeatureValue(featureVar, featureVarGenClass)»«IF ecoreFeature.upperBound == 1» != null«ELSE».size() >= «ecoreFeature.upperBound»«ENDIF»«ENDDEFINE»
«DEFINE checkEMFConstraints FOR gmfgen::FeatureLinkModelFacet-»
«LET "source" AS sourceVar-»
@@ -454,7 +454,7 @@ if («sourceVar» != null) {
«ENDLET-»
«ENDDEFINE»
-«DEFINE featureUniquenessComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND xpt::Common::getFeatureValue(featureVar, featureVarGenClass, true) FOR this».contains(target)«ENDDEFINE»
+«DEFINE featureUniquenessComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND xpt::Common::getFeatureValue(featureVar, featureVarGenClass) FOR this».contains(target)«ENDDEFINE»
«DEFINE checkEMFConstraints FOR gmfgen::LinkModelFacet-»
«EXPAND incorrectLinkModelFacet-»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt
index 298486d1d..1656a0c17 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt
@@ -78,9 +78,9 @@ private java.util.Collection refreshPhantoms() {
«DEFINE collectPotentialPhantoms(genmodel::GenClass containerGenClass) FOR gmfgen::GenLink-»
«LET ((gmfgen::FeatureLinkModelFacet) modelFacet).metaFeature AS genFeature-»
«IF isListType(genFeature)-»
-phantomNodes.addAll(«EXPAND xpt::Common::getFeatureValue("container", containerGenClass, true) FOR genFeature»);
+phantomNodes.addAll(«EXPAND xpt::Common::getFeatureValue("container", containerGenClass) FOR genFeature»);
«ELSE-»
-phantomNodes.add(«EXPAND xpt::Common::getFeatureValue("container", containerGenClass, true) FOR genFeature»);
+phantomNodes.add(«EXPAND xpt::Common::getFeatureValue("container", containerGenClass) FOR genFeature»);
«ENDIF-»
«ENDLET-»
«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/commonBaseCanonicalMethods.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/commonBaseCanonicalMethods.xpt
index 20b8d33a9..b472ebf93 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/commonBaseCanonicalMethods.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/commonBaseCanonicalMethods.xpt
@@ -63,9 +63,9 @@ java.util.List allValues = new java.util.LinkedList();
«IF null == childFeature-»
allValues.add(/*FIXME no containment/child feature found in the genmodel, toolsmith need to specify correct one here manually*/);
«ELSEIF isListType(childFeature)-»
-allValues.addAll(«EXPAND xpt::Common::getFeatureValue("modelObject", containerGenClass, true) FOR childFeature»);
+allValues.addAll(«EXPAND xpt::Common::getFeatureValue("modelObject", containerGenClass) FOR childFeature»);
«ELSE-»
-allValues.add(«EXPAND xpt::Common::getFeatureValue("modelObject", containerGenClass, true) FOR childFeature»);
+allValues.add(«EXPAND xpt::Common::getFeatureValue("modelObject", containerGenClass) FOR childFeature»);
«ENDIF-»
«ENDFOREACH-»
«ENDDEFINE»

Back to the top