Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2005-11-16 10:45:26 -0500
committerashatalin2005-11-16 10:45:26 -0500
commit0878129ed17f9e34b99292bb00f2963927b60941 (patch)
tree7a6e07cc0caa20a30086a57ebd28ea814e55e1fc
parent9aad9cef66b1922ddce254558197eed7b957f227 (diff)
downloadorg.eclipse.gmf-tooling-0878129ed17f9e34b99292bb00f2963927b60941.tar.gz
org.eclipse.gmf-tooling-0878129ed17f9e34b99292bb00f2963927b60941.tar.xz
org.eclipse.gmf-tooling-0878129ed17f9e34b99292bb00f2963927b60941.zip
#116448
Correcting CanonicalEditPolicy + SemanticEditPolicy to support references with multiplicities "1","n".
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/CompartmentEditPartGenerator.java106
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java106
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java145
-rw-r--r--plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java757
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/parts/childContainerCanonicalEditPolicy.jetinc41
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/policies/childContainerCreateCommand.jetinc23
6 files changed, 670 insertions, 508 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/CompartmentEditPartGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/CompartmentEditPartGenerator.java
index d9340e976..8a7649084 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/CompartmentEditPartGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/CompartmentEditPartGenerator.java
@@ -34,31 +34,30 @@ public class CompartmentEditPartGenerator
protected final String TEXT_15 = " modelElement = (";
protected final String TEXT_16 = ") ((View) getHost().getModel()).getElement();" + NL + "\t\t\tList result = new ";
protected final String TEXT_17 = "();" + NL;
- protected final String TEXT_18 = NL + "\t\t\tresult.";
- protected final String TEXT_19 = "(((";
- protected final String TEXT_20 = ") modelElement).";
- protected final String TEXT_21 = "());";
+ protected final String TEXT_18 = NL + "\t\t\tresult.addAll(modelElement.";
+ protected final String TEXT_19 = "());";
+ protected final String TEXT_20 = NL + "\t\t\tObject featureValue = modelElement.";
+ protected final String TEXT_21 = "();" + NL + "\t\t\tif (featureValue != null) {" + NL + "\t\t\t\tresult.add(featureValue);" + NL + "\t\t\t}";
protected final String TEXT_22 = NL + "\t\t\t";
- protected final String TEXT_23 = " featureValues = ((";
- protected final String TEXT_24 = ") modelElement).";
- protected final String TEXT_25 = "();" + NL + "\t\t\tfor (";
- protected final String TEXT_26 = " it = featureValues.iterator(); it.hasNext();) {" + NL + "\t\t\t\t";
- protected final String TEXT_27 = " nextValue = (";
- protected final String TEXT_28 = ") it.next();";
- protected final String TEXT_29 = NL + "\t\t\t";
- protected final String TEXT_30 = " nextValue = (";
- protected final String TEXT_31 = ") ((";
- protected final String TEXT_32 = ") modelElement).";
- protected final String TEXT_33 = "();";
- protected final String TEXT_34 = NL + "\t\t\t";
- protected final String TEXT_35 = " nextEClass = nextValue.eClass();";
- protected final String TEXT_36 = NL + "\t\t\tif (";
- protected final String TEXT_37 = ".eINSTANCE.get";
- protected final String TEXT_38 = "().equals(nextEClass)) {" + NL + "\t\t\t\tresult.add(nextValue);" + NL + "\t\t\t} ";
- protected final String TEXT_39 = NL + "\t\t\t}";
- protected final String TEXT_40 = NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_41 = NL + "}";
- protected final String TEXT_42 = NL;
+ protected final String TEXT_23 = " featureValues = modelElement.";
+ protected final String TEXT_24 = "();" + NL + "\t\t\tfor (";
+ protected final String TEXT_25 = " it = featureValues.iterator(); it.hasNext();) {" + NL + "\t\t\t\t";
+ protected final String TEXT_26 = " nextValue = (";
+ protected final String TEXT_27 = ") it.next();";
+ protected final String TEXT_28 = NL + "\t\t\t";
+ protected final String TEXT_29 = " nextValue = (";
+ protected final String TEXT_30 = ") modelElement.";
+ protected final String TEXT_31 = "();";
+ protected final String TEXT_32 = NL + "\t\t\tif (nextValue != null) {" + NL + "\t\t\t\t";
+ protected final String TEXT_33 = " nextEClass = nextValue.eClass();";
+ protected final String TEXT_34 = NL + "\t\t\t\tif (";
+ protected final String TEXT_35 = ".eINSTANCE.get";
+ protected final String TEXT_36 = "().equals(nextEClass)) {" + NL + "\t\t\t\t\tresult.add(nextValue);" + NL + "\t\t\t\t} ";
+ protected final String TEXT_37 = NL + "\t\t\t}";
+ protected final String TEXT_38 = NL + "\t\t\t}";
+ protected final String TEXT_39 = NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_40 = NL + "}";
+ protected final String TEXT_41 = NL;
public String generate(Object argument)
{
@@ -115,6 +114,14 @@ String modelElementInterfaceName = importManager.getImportedName(containerNode.g
stringBuffer.append(importManager.getImportedName("java.util.LinkedList"));
stringBuffer.append(TEXT_17);
+/*
+ Since there could e several child nodes with the same childMetaFeatures, but different domainMetaClasses
+specified, we are creating a Map{GenFeature -> Collection{GenChildNodes}}. If GenChildNode without specified
+domainMetaClass found, all the rest of GenChildNodes with the same childMetaFeature will be ignored because
+all the elements from this childMetaFeature will be treated as "this" type of GenChildNodes (without specified
+domainMetaClass).
+*/
+
Map childFeature2NodesMap = new HashMap();
for (Iterator it = childContainer.getChildNodes().iterator(); it.hasNext();) {
GenChildNode nextChildNode = (GenChildNode) it.next();
@@ -138,83 +145,90 @@ for (Iterator it = childContainer.getChildNodes().iterator(); it.hasNext();) {
genChildNodes.add(nextChildNode);
}
+// For each childMetaFeature:
for (Iterator it = childFeature2NodesMap.entrySet().iterator(); it.hasNext();) {
Map.Entry nextEntry = (Map.Entry) it.next();
GenFeature nextFeature = (GenFeature) nextEntry.getKey();
List childNodes = (List) nextEntry.getValue();
if (childNodes.size() == 1 && ((GenChildNode) childNodes.get(0)).getDomainMetaClass() == null) {
+// GenChildNode without specified domainMetaClass found:
+ if (nextFeature.isListType()) {
stringBuffer.append(TEXT_18);
- stringBuffer.append(nextFeature.isListType() ? "addAll" : "add");
+ stringBuffer.append(nextFeature.getGetAccessor());
stringBuffer.append(TEXT_19);
- stringBuffer.append(modelElementInterfaceName);
+
+ } else {
+
stringBuffer.append(TEXT_20);
stringBuffer.append(nextFeature.getGetAccessor());
stringBuffer.append(TEXT_21);
+ }
+// Continue with the next entry in the Map
continue;
}
-
+
+// GenChildNodes with specified domainMetaClass found:
if (nextFeature.isListType()) {
stringBuffer.append(TEXT_22);
stringBuffer.append(importManager.getImportedName("java.util.Collection"));
stringBuffer.append(TEXT_23);
- stringBuffer.append(modelElementInterfaceName);
- stringBuffer.append(TEXT_24);
stringBuffer.append(nextFeature.getGetAccessor());
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_24);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_25);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_26);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_27);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_28);
} else {
+ stringBuffer.append(TEXT_28);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_29);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_30);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_31);
- stringBuffer.append(modelElementInterfaceName);
- stringBuffer.append(TEXT_32);
stringBuffer.append(nextFeature.getGetAccessor());
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_31);
}
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_32);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_33);
for (Iterator childNodesIterator = childNodes.iterator(); childNodesIterator.hasNext();) {
GenChildNode nextChildNode = (GenChildNode) childNodesIterator.next();
GenClass domainMetaclass = nextChildNode.getDomainMetaClass();
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(importManager.getImportedName(domainMetaclass.getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(domainMetaclass.getClassifierAccessorName());
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_36);
stringBuffer.append(childNodesIterator.hasNext() ? "else" : "");
}
if (nextFeature.isListType()) {
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_37);
}
+
+ stringBuffer.append(TEXT_38);
+
}
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_39);
}
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_40);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_41);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java
index 7e3202047..45db51a00 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java
@@ -55,31 +55,30 @@ public class NodeEditPartGenerator
protected final String TEXT_36 = " modelElement = (";
protected final String TEXT_37 = ") ((View) getHost().getModel()).getElement();" + NL + "\t\t\tList result = new ";
protected final String TEXT_38 = "();" + NL;
- protected final String TEXT_39 = NL + "\t\t\tresult.";
- protected final String TEXT_40 = "(((";
- protected final String TEXT_41 = ") modelElement).";
- protected final String TEXT_42 = "());";
+ protected final String TEXT_39 = NL + "\t\t\tresult.addAll(modelElement.";
+ protected final String TEXT_40 = "());";
+ protected final String TEXT_41 = NL + "\t\t\tObject featureValue = modelElement.";
+ protected final String TEXT_42 = "();" + NL + "\t\t\tif (featureValue != null) {" + NL + "\t\t\t\tresult.add(featureValue);" + NL + "\t\t\t}";
protected final String TEXT_43 = NL + "\t\t\t";
- protected final String TEXT_44 = " featureValues = ((";
- protected final String TEXT_45 = ") modelElement).";
- protected final String TEXT_46 = "();" + NL + "\t\t\tfor (";
- protected final String TEXT_47 = " it = featureValues.iterator(); it.hasNext();) {" + NL + "\t\t\t\t";
- protected final String TEXT_48 = " nextValue = (";
- protected final String TEXT_49 = ") it.next();";
- protected final String TEXT_50 = NL + "\t\t\t";
- protected final String TEXT_51 = " nextValue = (";
- protected final String TEXT_52 = ") ((";
- protected final String TEXT_53 = ") modelElement).";
- protected final String TEXT_54 = "();";
- protected final String TEXT_55 = NL + "\t\t\t";
- protected final String TEXT_56 = " nextEClass = nextValue.eClass();";
- protected final String TEXT_57 = NL + "\t\t\tif (";
- protected final String TEXT_58 = ".eINSTANCE.get";
- protected final String TEXT_59 = "().equals(nextEClass)) {" + NL + "\t\t\t\tresult.add(nextValue);" + NL + "\t\t\t} ";
- protected final String TEXT_60 = NL + "\t\t\t}";
- protected final String TEXT_61 = NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}\t";
- protected final String TEXT_62 = NL + "}";
- protected final String TEXT_63 = NL;
+ protected final String TEXT_44 = " featureValues = modelElement.";
+ protected final String TEXT_45 = "();" + NL + "\t\t\tfor (";
+ protected final String TEXT_46 = " it = featureValues.iterator(); it.hasNext();) {" + NL + "\t\t\t\t";
+ protected final String TEXT_47 = " nextValue = (";
+ protected final String TEXT_48 = ") it.next();";
+ protected final String TEXT_49 = NL + "\t\t\t";
+ protected final String TEXT_50 = " nextValue = (";
+ protected final String TEXT_51 = ") modelElement.";
+ protected final String TEXT_52 = "();";
+ protected final String TEXT_53 = NL + "\t\t\tif (nextValue != null) {" + NL + "\t\t\t\t";
+ protected final String TEXT_54 = " nextEClass = nextValue.eClass();";
+ protected final String TEXT_55 = NL + "\t\t\t\tif (";
+ protected final String TEXT_56 = ".eINSTANCE.get";
+ protected final String TEXT_57 = "().equals(nextEClass)) {" + NL + "\t\t\t\t\tresult.add(nextValue);" + NL + "\t\t\t\t} ";
+ protected final String TEXT_58 = NL + "\t\t\t}";
+ protected final String TEXT_59 = NL + "\t\t\t}";
+ protected final String TEXT_60 = NL + "\t\t\treturn result;" + NL + "\t\t}" + NL + "\t}\t";
+ protected final String TEXT_61 = NL + "}";
+ protected final String TEXT_62 = NL;
public String generate(Object argument)
{
@@ -205,6 +204,14 @@ String modelElementInterfaceName = importManager.getImportedName(containerNode.g
stringBuffer.append(importManager.getImportedName("java.util.LinkedList"));
stringBuffer.append(TEXT_38);
+/*
+ Since there could e several child nodes with the same childMetaFeatures, but different domainMetaClasses
+specified, we are creating a Map{GenFeature -> Collection{GenChildNodes}}. If GenChildNode without specified
+domainMetaClass found, all the rest of GenChildNodes with the same childMetaFeature will be ignored because
+all the elements from this childMetaFeature will be treated as "this" type of GenChildNodes (without specified
+domainMetaClass).
+*/
+
Map childFeature2NodesMap = new HashMap();
for (Iterator it = childContainer.getChildNodes().iterator(); it.hasNext();) {
GenChildNode nextChildNode = (GenChildNode) it.next();
@@ -228,83 +235,90 @@ for (Iterator it = childContainer.getChildNodes().iterator(); it.hasNext();) {
genChildNodes.add(nextChildNode);
}
+// For each childMetaFeature:
for (Iterator it = childFeature2NodesMap.entrySet().iterator(); it.hasNext();) {
Map.Entry nextEntry = (Map.Entry) it.next();
GenFeature nextFeature = (GenFeature) nextEntry.getKey();
List childNodes = (List) nextEntry.getValue();
if (childNodes.size() == 1 && ((GenChildNode) childNodes.get(0)).getDomainMetaClass() == null) {
+// GenChildNode without specified domainMetaClass found:
+ if (nextFeature.isListType()) {
stringBuffer.append(TEXT_39);
- stringBuffer.append(nextFeature.isListType() ? "addAll" : "add");
+ stringBuffer.append(nextFeature.getGetAccessor());
stringBuffer.append(TEXT_40);
- stringBuffer.append(modelElementInterfaceName);
+
+ } else {
+
stringBuffer.append(TEXT_41);
stringBuffer.append(nextFeature.getGetAccessor());
stringBuffer.append(TEXT_42);
+ }
+// Continue with the next entry in the Map
continue;
}
-
+
+// GenChildNodes with specified domainMetaClass found:
if (nextFeature.isListType()) {
stringBuffer.append(TEXT_43);
stringBuffer.append(importManager.getImportedName("java.util.Collection"));
stringBuffer.append(TEXT_44);
- stringBuffer.append(modelElementInterfaceName);
- stringBuffer.append(TEXT_45);
stringBuffer.append(nextFeature.getGetAccessor());
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_45);
stringBuffer.append(importManager.getImportedName("java.util.Iterator"));
+ stringBuffer.append(TEXT_46);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_47);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_48);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_49);
} else {
+ stringBuffer.append(TEXT_49);
+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_50);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
stringBuffer.append(TEXT_51);
- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_52);
- stringBuffer.append(modelElementInterfaceName);
- stringBuffer.append(TEXT_53);
stringBuffer.append(nextFeature.getGetAccessor());
- stringBuffer.append(TEXT_54);
+ stringBuffer.append(TEXT_52);
}
- stringBuffer.append(TEXT_55);
+ stringBuffer.append(TEXT_53);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_56);
+ stringBuffer.append(TEXT_54);
for (Iterator childNodesIterator = childNodes.iterator(); childNodesIterator.hasNext();) {
GenChildNode nextChildNode = (GenChildNode) childNodesIterator.next();
GenClass domainMetaclass = nextChildNode.getDomainMetaClass();
- stringBuffer.append(TEXT_57);
+ stringBuffer.append(TEXT_55);
stringBuffer.append(importManager.getImportedName(domainMetaclass.getGenPackage().getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_58);
+ stringBuffer.append(TEXT_56);
stringBuffer.append(domainMetaclass.getClassifierAccessorName());
- stringBuffer.append(TEXT_59);
+ stringBuffer.append(TEXT_57);
stringBuffer.append(childNodesIterator.hasNext() ? "else" : "");
}
if (nextFeature.isListType()) {
- stringBuffer.append(TEXT_60);
+ stringBuffer.append(TEXT_58);
}
+
+ stringBuffer.append(TEXT_59);
+
}
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_60);
}
- stringBuffer.append(TEXT_62);
+ stringBuffer.append(TEXT_61);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_62);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java
index 144dadfca..6e8b58dcb 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/CompartmentItemSemanticEditPolicyGenerator.java
@@ -29,32 +29,42 @@ public class CompartmentItemSemanticEditPolicyGenerator
protected final String TEXT_10 = " req) {";
protected final String TEXT_11 = NL + "\t\tif (";
protected final String TEXT_12 = ".";
- protected final String TEXT_13 = " == req.getElementType()) {" + NL + "\t\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\t\treq.setContainmentFeature(";
- protected final String TEXT_14 = ".eINSTANCE.get";
- protected final String TEXT_15 = "());" + NL + "\t\t\t}" + NL + "\t\t\treturn getMSLWrapper(new Create";
- protected final String TEXT_16 = "Command(req));" + NL + "\t\t}";
- protected final String TEXT_17 = NL + "\t\treturn super.getCreateCommand(req);" + NL + "\t}";
- protected final String TEXT_18 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
- protected final String TEXT_19 = "Command extends ";
- protected final String TEXT_20 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
- protected final String TEXT_21 = "Command(CreateElementRequest req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_22 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
- protected final String TEXT_23 = ".eINSTANCE.get";
- protected final String TEXT_24 = "();" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_25 = " getElementToEdit() {" + NL + "\t\t\t";
- protected final String TEXT_26 = " container = ((CreateElementRequest) getRequest()).getContainer();" + NL + "\t\t\tif (container instanceof ";
- protected final String TEXT_27 = ") {" + NL + "\t\t\t\tcontainer = ((";
- protected final String TEXT_28 = ") container).getElement();" + NL + "\t\t\t}" + NL + "\t\t\treturn container;" + NL + "\t\t}";
- protected final String TEXT_29 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_30 = " doDefaultElementCreation() {";
- protected final String TEXT_31 = NL + "\t\t\t";
- protected final String TEXT_32 = " newElement = (";
- protected final String TEXT_33 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {" + NL + "\t\t\t\t";
- protected final String TEXT_34 = ".Initializers.";
- protected final String TEXT_35 = ".init(newElement);" + NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}";
- protected final String TEXT_36 = NL + "\t}";
- protected final String TEXT_37 = NL + NL + "}";
- protected final String TEXT_38 = NL;
+ protected final String TEXT_13 = " == req.getElementType()) {";
+ protected final String TEXT_14 = "\t\t" + NL + "\t\t\t";
+ protected final String TEXT_15 = " container = (";
+ protected final String TEXT_16 = ") req.getContainer();";
+ protected final String TEXT_17 = NL + "\t\t\tif (container.";
+ protected final String TEXT_18 = "() != null) {";
+ protected final String TEXT_19 = NL + "\t\t\tif (container.";
+ protected final String TEXT_20 = "().size() >= ";
+ protected final String TEXT_21 = ") {";
+ protected final String TEXT_22 = NL + "\t\t\t\treturn super.getCreateCommand(req);" + NL + "\t\t\t}";
+ protected final String TEXT_23 = NL + "\t\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\t\treq.setContainmentFeature(";
+ protected final String TEXT_24 = ".eINSTANCE.get";
+ protected final String TEXT_25 = "());" + NL + "\t\t\t}" + NL + "\t\t\treturn getMSLWrapper(new Create";
+ protected final String TEXT_26 = "Command(req));" + NL + "\t\t}";
+ protected final String TEXT_27 = NL + "\t\treturn super.getCreateCommand(req);" + NL + "\t}";
+ protected final String TEXT_28 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
+ protected final String TEXT_29 = "Command extends ";
+ protected final String TEXT_30 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
+ protected final String TEXT_31 = "Command(CreateElementRequest req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_32 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
+ protected final String TEXT_33 = ".eINSTANCE.get";
+ protected final String TEXT_34 = "();" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_35 = " getElementToEdit() {" + NL + "\t\t\t";
+ protected final String TEXT_36 = " container = ((CreateElementRequest) getRequest()).getContainer();" + NL + "\t\t\tif (container instanceof ";
+ protected final String TEXT_37 = ") {" + NL + "\t\t\t\tcontainer = ((";
+ protected final String TEXT_38 = ") container).getElement();" + NL + "\t\t\t}" + NL + "\t\t\treturn container;" + NL + "\t\t}";
+ protected final String TEXT_39 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_40 = " doDefaultElementCreation() {";
+ protected final String TEXT_41 = NL + "\t\t\t";
+ protected final String TEXT_42 = " newElement = (";
+ protected final String TEXT_43 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {" + NL + "\t\t\t\t";
+ protected final String TEXT_44 = ".Initializers.";
+ protected final String TEXT_45 = ".init(newElement);" + NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}";
+ protected final String TEXT_46 = NL + "\t}";
+ protected final String TEXT_47 = NL + NL + "}";
+ protected final String TEXT_48 = NL;
public String generate(Object argument)
{
@@ -91,68 +101,101 @@ GenPackage genPackage = genDiagram.getDomainMetaModel();
for (Iterator nodes = childContainer.getChildNodes().iterator(); nodes.hasNext(); ) {
GenNode genChildNode = (GenNode) nodes.next();
TypeModelFacet modelFacet = genChildNode.getModelFacet();
+ GenFeature containmentMetaFeature = modelFacet.getContainmentMetaFeature();
+ int upperBound = containmentMetaFeature.getEcoreFeature().getUpperBound();
stringBuffer.append(TEXT_11);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
stringBuffer.append(TEXT_12);
stringBuffer.append(genChildNode.getUniqueIdentifier());
stringBuffer.append(TEXT_13);
- stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
+
+ if (upperBound > 0) {
+ String containerInterfaceName = importManager.getImportedName(containerNode.getModelFacet().getMetaClass().getQualifiedInterfaceName());
+
stringBuffer.append(TEXT_14);
- stringBuffer.append(modelFacet.getContainmentMetaFeature().getFeatureAccessorName());
+ stringBuffer.append(containerInterfaceName);
stringBuffer.append(TEXT_15);
- stringBuffer.append(modelFacet.getMetaClass().getName());
+ stringBuffer.append(containerInterfaceName);
stringBuffer.append(TEXT_16);
-}
+ if (upperBound == 1) {
stringBuffer.append(TEXT_17);
+ stringBuffer.append(containmentMetaFeature.getGetAccessor());
+ stringBuffer.append(TEXT_18);
+
+ } else {
+
+ stringBuffer.append(TEXT_19);
+ stringBuffer.append(containmentMetaFeature.getGetAccessor());
+ stringBuffer.append(TEXT_20);
+ stringBuffer.append(upperBound);
+ stringBuffer.append(TEXT_21);
+
+ }
+
+ stringBuffer.append(TEXT_22);
+
+ }
+
+ stringBuffer.append(TEXT_23);
+ stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
+ stringBuffer.append(TEXT_24);
+ stringBuffer.append(modelFacet.getContainmentMetaFeature().getFeatureAccessorName());
+ stringBuffer.append(TEXT_25);
+ stringBuffer.append(modelFacet.getMetaClass().getName());
+ stringBuffer.append(TEXT_26);
+
+}
+
+ stringBuffer.append(TEXT_27);
for (Iterator nodes = childContainer.getChildNodes().iterator(); nodes.hasNext(); ) {
GenNode genChildNode = (GenNode) nodes.next();
TypeModelFacet modelFacet = genChildNode.getModelFacet();
- stringBuffer.append(TEXT_18);
+ stringBuffer.append(TEXT_28);
stringBuffer.append(modelFacet.getMetaClass().getName());
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_29);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.commands.core.commands.MSLCreateElementCommand"));
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_30);
stringBuffer.append(modelFacet.getMetaClass().getName());
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_31);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_32);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(containerNode.getModelFacet().getMetaClass().getClassifierAccessorName());
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_36);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_37);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_38);
if (modelFacet.getModelElementInitializer() != null) {
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_39);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_40);
String metaClassName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName());
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_41);
stringBuffer.append(metaClassName);
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_42);
stringBuffer.append(metaClassName);
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_44);
stringBuffer.append(genChildNode.getUniqueIdentifier());
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_45);
}
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_46);
}
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_47);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_48);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java
index fd0911a34..0d0f254ba 100644
--- a/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java
+++ b/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/policies/NodeItemSemanticEditPolicyGenerator.java
@@ -30,186 +30,196 @@ public class NodeItemSemanticEditPolicyGenerator
protected final String TEXT_11 = " req) {";
protected final String TEXT_12 = NL + "\t\tif (";
protected final String TEXT_13 = ".";
- protected final String TEXT_14 = " == req.getElementType()) {" + NL + "\t\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\t\treq.setContainmentFeature(";
- protected final String TEXT_15 = ".eINSTANCE.get";
- protected final String TEXT_16 = "());" + NL + "\t\t\t}" + NL + "\t\t\treturn getMSLWrapper(new Create";
- protected final String TEXT_17 = "Command(req));" + NL + "\t\t}";
- protected final String TEXT_18 = NL + "\t\treturn super.getCreateCommand(req);" + NL + "\t}";
- protected final String TEXT_19 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
- protected final String TEXT_20 = "Command extends ";
- protected final String TEXT_21 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
- protected final String TEXT_22 = "Command(CreateElementRequest req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_23 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
- protected final String TEXT_24 = ".eINSTANCE.get";
- protected final String TEXT_25 = "();" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_26 = " getElementToEdit() {" + NL + "\t\t\t";
- protected final String TEXT_27 = " container = ((CreateElementRequest) getRequest()).getContainer();" + NL + "\t\t\tif (container instanceof ";
- protected final String TEXT_28 = ") {" + NL + "\t\t\t\tcontainer = ((";
- protected final String TEXT_29 = ") container).getElement();" + NL + "\t\t\t}" + NL + "\t\t\treturn container;" + NL + "\t\t}";
- protected final String TEXT_30 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_31 = " doDefaultElementCreation() {";
- protected final String TEXT_32 = NL + "\t\t\t";
- protected final String TEXT_33 = " newElement = (";
- protected final String TEXT_34 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {" + NL + "\t\t\t\t";
- protected final String TEXT_35 = ".Initializers.";
- protected final String TEXT_36 = ".init(newElement);" + NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}";
- protected final String TEXT_37 = NL + "\t}";
- protected final String TEXT_38 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getDestroyElementCommand(DestroyElementRequest req) {" + NL + "\t\treturn getMSLWrapper(new MSLDestroyElementCommand(req));" + NL + "\t}";
- protected final String TEXT_39 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {";
- protected final String TEXT_40 = NL + "\t\tif (";
- protected final String TEXT_41 = ".";
- protected final String TEXT_42 = " == req.getElementType()) {" + NL + "\t\t\treturn req.getTarget() == null ? getCreateStart";
- protected final String TEXT_43 = "Command(req) : getCreateComplete";
- protected final String TEXT_44 = "Command(req);" + NL + "\t\t}";
- protected final String TEXT_45 = NL + "\t\treturn super.getCreateRelationshipCommand(req);" + NL + "\t}";
- protected final String TEXT_46 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateStart";
- protected final String TEXT_47 = "Command(CreateRelationshipRequest req) {";
- protected final String TEXT_48 = NL + "\t\t";
- protected final String TEXT_49 = " element = (";
- protected final String TEXT_50 = ") getSemanticElement();";
- protected final String TEXT_51 = NL + "\t\tif (element.get";
- protected final String TEXT_52 = "() != null) {";
- protected final String TEXT_53 = NL + "\t\tif (element.get";
- protected final String TEXT_54 = "().size() >= ";
- protected final String TEXT_55 = ") {";
- protected final String TEXT_56 = NL + "\t\t\treturn ";
- protected final String TEXT_57 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_58 = NL + "\t\treturn new Command() {" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateComplete";
- protected final String TEXT_59 = "Command(CreateRelationshipRequest req) {";
- protected final String TEXT_60 = NL + "\t\tif (!(req.getSource() instanceof ";
- protected final String TEXT_61 = ")) {" + NL + "\t\t\treturn ";
- protected final String TEXT_62 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_63 = NL + "\t\t";
- protected final String TEXT_64 = " element = (";
- protected final String TEXT_65 = ") getSemanticElement();";
- protected final String TEXT_66 = NL + "\t\tif (element.get";
- protected final String TEXT_67 = "() != null) {";
- protected final String TEXT_68 = NL + "\t\tif (element.get";
- protected final String TEXT_69 = "().size() >= ";
- protected final String TEXT_70 = ") {";
- protected final String TEXT_71 = NL + "\t\t\treturn ";
+ protected final String TEXT_14 = " == req.getElementType()) {";
+ protected final String TEXT_15 = "\t\t" + NL + "\t\t\t";
+ protected final String TEXT_16 = " container = (";
+ protected final String TEXT_17 = ") req.getContainer();";
+ protected final String TEXT_18 = NL + "\t\t\tif (container.";
+ protected final String TEXT_19 = "() != null) {";
+ protected final String TEXT_20 = NL + "\t\t\tif (container.";
+ protected final String TEXT_21 = "().size() >= ";
+ protected final String TEXT_22 = ") {";
+ protected final String TEXT_23 = NL + "\t\t\t\treturn super.getCreateCommand(req);" + NL + "\t\t\t}";
+ protected final String TEXT_24 = NL + "\t\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\t\treq.setContainmentFeature(";
+ protected final String TEXT_25 = ".eINSTANCE.get";
+ protected final String TEXT_26 = "());" + NL + "\t\t\t}" + NL + "\t\t\treturn getMSLWrapper(new Create";
+ protected final String TEXT_27 = "Command(req));" + NL + "\t\t}";
+ protected final String TEXT_28 = NL + "\t\treturn super.getCreateCommand(req);" + NL + "\t}";
+ protected final String TEXT_29 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
+ protected final String TEXT_30 = "Command extends ";
+ protected final String TEXT_31 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
+ protected final String TEXT_32 = "Command(CreateElementRequest req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_33 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
+ protected final String TEXT_34 = ".eINSTANCE.get";
+ protected final String TEXT_35 = "();" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_36 = " getElementToEdit() {" + NL + "\t\t\t";
+ protected final String TEXT_37 = " container = ((CreateElementRequest) getRequest()).getContainer();" + NL + "\t\t\tif (container instanceof ";
+ protected final String TEXT_38 = ") {" + NL + "\t\t\t\tcontainer = ((";
+ protected final String TEXT_39 = ") container).getElement();" + NL + "\t\t\t}" + NL + "\t\t\treturn container;" + NL + "\t\t}";
+ protected final String TEXT_40 = NL + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_41 = " doDefaultElementCreation() {";
+ protected final String TEXT_42 = NL + "\t\t\t";
+ protected final String TEXT_43 = " newElement = (";
+ protected final String TEXT_44 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {" + NL + "\t\t\t\t";
+ protected final String TEXT_45 = ".Initializers.";
+ protected final String TEXT_46 = ".init(newElement);" + NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}";
+ protected final String TEXT_47 = NL + "\t}";
+ protected final String TEXT_48 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getDestroyElementCommand(DestroyElementRequest req) {" + NL + "\t\treturn getMSLWrapper(new MSLDestroyElementCommand(req));" + NL + "\t}";
+ protected final String TEXT_49 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {";
+ protected final String TEXT_50 = NL + "\t\tif (";
+ protected final String TEXT_51 = ".";
+ protected final String TEXT_52 = " == req.getElementType()) {" + NL + "\t\t\treturn req.getTarget() == null ? getCreateStart";
+ protected final String TEXT_53 = "Command(req) : getCreateComplete";
+ protected final String TEXT_54 = "Command(req);" + NL + "\t\t}";
+ protected final String TEXT_55 = NL + "\t\treturn super.getCreateRelationshipCommand(req);" + NL + "\t}";
+ protected final String TEXT_56 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateStart";
+ protected final String TEXT_57 = "Command(CreateRelationshipRequest req) {";
+ protected final String TEXT_58 = NL + "\t\t";
+ protected final String TEXT_59 = " element = (";
+ protected final String TEXT_60 = ") getSemanticElement();";
+ protected final String TEXT_61 = NL + "\t\tif (element.get";
+ protected final String TEXT_62 = "() != null) {";
+ protected final String TEXT_63 = NL + "\t\tif (element.get";
+ protected final String TEXT_64 = "().size() >= ";
+ protected final String TEXT_65 = ") {";
+ protected final String TEXT_66 = NL + "\t\t\treturn ";
+ protected final String TEXT_67 = ".INSTANCE;" + NL + "\t\t}";
+ protected final String TEXT_68 = NL + "\t\treturn new Command() {" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateComplete";
+ protected final String TEXT_69 = "Command(CreateRelationshipRequest req) {";
+ protected final String TEXT_70 = NL + "\t\tif (!(req.getSource() instanceof ";
+ protected final String TEXT_71 = ")) {" + NL + "\t\t\treturn ";
protected final String TEXT_72 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_73 = NL + "\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\treq.setContainmentFeature(";
- protected final String TEXT_74 = ".eINSTANCE.get";
- protected final String TEXT_75 = "());" + NL + "\t\t}" + NL + "\t\treturn getMSLWrapper(new Create";
- protected final String TEXT_76 = "Command(req));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
- protected final String TEXT_77 = "Command extends ";
- protected final String TEXT_78 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
- protected final String TEXT_79 = "Command(CreateRelationshipRequest req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_80 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
- protected final String TEXT_81 = ".eINSTANCE.get";
- protected final String TEXT_82 = "();" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_83 = " getElementToEdit() {" + NL + "\t\t\treturn getTarget();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_84 = " doDefaultElementCreation() {";
- protected final String TEXT_85 = NL + "\t\t\t";
- protected final String TEXT_86 = " newElement = (";
- protected final String TEXT_87 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {" + NL + "\t\t\t\tnewElement.set";
- protected final String TEXT_88 = "((";
- protected final String TEXT_89 = ") getSource());";
- protected final String TEXT_90 = NL + "\t\t\t\t";
- protected final String TEXT_91 = ".Initializers.";
- protected final String TEXT_92 = ".init(newElement);";
- protected final String TEXT_93 = NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_94 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateStart";
- protected final String TEXT_95 = "Command(CreateRelationshipRequest req) {";
- protected final String TEXT_96 = NL + "\t\treturn new Command() {" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateComplete";
- protected final String TEXT_97 = "Command(CreateRelationshipRequest req) {";
- protected final String TEXT_98 = NL + "\t\tif (!(req.getSource() instanceof ";
- protected final String TEXT_99 = ")) {" + NL + "\t\t\treturn ";
- protected final String TEXT_100 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_101 = NL + "\t\t";
- protected final String TEXT_102 = " element = (";
- protected final String TEXT_103 = ") req.getSource();";
- protected final String TEXT_104 = NL + "\t\tif (element.get";
- protected final String TEXT_105 = "() != null) {";
- protected final String TEXT_106 = NL + "\t\tif (element.get";
- protected final String TEXT_107 = "().size() >= ";
- protected final String TEXT_108 = ") {";
- protected final String TEXT_109 = NL + "\t\t\treturn ";
+ protected final String TEXT_73 = NL + "\t\t";
+ protected final String TEXT_74 = " element = (";
+ protected final String TEXT_75 = ") getSemanticElement();";
+ protected final String TEXT_76 = NL + "\t\tif (element.get";
+ protected final String TEXT_77 = "() != null) {";
+ protected final String TEXT_78 = NL + "\t\tif (element.get";
+ protected final String TEXT_79 = "().size() >= ";
+ protected final String TEXT_80 = ") {";
+ protected final String TEXT_81 = NL + "\t\t\treturn ";
+ protected final String TEXT_82 = ".INSTANCE;" + NL + "\t\t}";
+ protected final String TEXT_83 = NL + "\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\treq.setContainmentFeature(";
+ protected final String TEXT_84 = ".eINSTANCE.get";
+ protected final String TEXT_85 = "());" + NL + "\t\t}" + NL + "\t\treturn getMSLWrapper(new Create";
+ protected final String TEXT_86 = "Command(req));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
+ protected final String TEXT_87 = "Command extends ";
+ protected final String TEXT_88 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
+ protected final String TEXT_89 = "Command(CreateRelationshipRequest req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_90 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
+ protected final String TEXT_91 = ".eINSTANCE.get";
+ protected final String TEXT_92 = "();" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_93 = " getElementToEdit() {" + NL + "\t\t\treturn getTarget();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_94 = " doDefaultElementCreation() {";
+ protected final String TEXT_95 = NL + "\t\t\t";
+ protected final String TEXT_96 = " newElement = (";
+ protected final String TEXT_97 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {" + NL + "\t\t\t\tnewElement.set";
+ protected final String TEXT_98 = "((";
+ protected final String TEXT_99 = ") getSource());";
+ protected final String TEXT_100 = NL + "\t\t\t\t";
+ protected final String TEXT_101 = ".Initializers.";
+ protected final String TEXT_102 = ".init(newElement);";
+ protected final String TEXT_103 = NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_104 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateStart";
+ protected final String TEXT_105 = "Command(CreateRelationshipRequest req) {";
+ protected final String TEXT_106 = NL + "\t\treturn new Command() {" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateComplete";
+ protected final String TEXT_107 = "Command(CreateRelationshipRequest req) {";
+ protected final String TEXT_108 = NL + "\t\tif (!(req.getSource() instanceof ";
+ protected final String TEXT_109 = ")) {" + NL + "\t\t\treturn ";
protected final String TEXT_110 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_111 = NL + "\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\treq.setContainmentFeature(";
- protected final String TEXT_112 = ".eINSTANCE.get";
- protected final String TEXT_113 = "());" + NL + "\t\t}" + NL + "\t\treturn getMSLWrapper(new Create";
- protected final String TEXT_114 = "Command(req));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
- protected final String TEXT_115 = "Command extends ";
- protected final String TEXT_116 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
- protected final String TEXT_117 = "Command(CreateRelationshipRequest req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_118 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
- protected final String TEXT_119 = ".eINSTANCE.get";
- protected final String TEXT_120 = "();" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_121 = " getElementToEdit() {" + NL + "\t\t\treturn getSource();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
- protected final String TEXT_122 = " doDefaultElementCreation() {";
- protected final String TEXT_123 = NL + "\t\t\t";
- protected final String TEXT_124 = " newElement = (";
- protected final String TEXT_125 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {" + NL + "\t\t\t\tnewElement.set";
- protected final String TEXT_126 = "((";
- protected final String TEXT_127 = ") getTarget());";
- protected final String TEXT_128 = NL + "\t\t\t\t";
- protected final String TEXT_129 = ".Initializers.";
- protected final String TEXT_130 = ".init(newElement);";
- protected final String TEXT_131 = NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_132 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateStart";
- protected final String TEXT_133 = "Command(CreateRelationshipRequest req) {";
- protected final String TEXT_134 = NL + "\t\t";
- protected final String TEXT_135 = " element = (";
- protected final String TEXT_136 = ") getSemanticElement();";
- protected final String TEXT_137 = NL + "\t\tif (element.get";
- protected final String TEXT_138 = "() != null) {";
- protected final String TEXT_139 = NL + "\t\tif (element.get";
- protected final String TEXT_140 = "().size() >= ";
- protected final String TEXT_141 = ") {";
- protected final String TEXT_142 = NL + "\t\t\treturn ";
- protected final String TEXT_143 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_144 = NL + "\t\treturn new Command() {" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateComplete";
- protected final String TEXT_145 = "Command(CreateRelationshipRequest req) {";
- protected final String TEXT_146 = NL + "\t\tif (!(req.getSource() instanceof ";
- protected final String TEXT_147 = ")) {" + NL + "\t\t\treturn ";
- protected final String TEXT_148 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_149 = NL + "\t\t";
- protected final String TEXT_150 = " element = (";
- protected final String TEXT_151 = ") getSemanticElement();";
- protected final String TEXT_152 = NL + "\t\tif (element.get";
- protected final String TEXT_153 = "() != null) {";
- protected final String TEXT_154 = NL + "\t\tif (element.get";
- protected final String TEXT_155 = "().size() >= ";
- protected final String TEXT_156 = NL + "\t\t\t|| element.get";
- protected final String TEXT_157 = "().contains(req.getSource())";
- protected final String TEXT_158 = NL + "\t\t\t\t) {";
- protected final String TEXT_159 = NL + "\t\t\treturn ";
- protected final String TEXT_160 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_161 = NL + "\t\t";
- protected final String TEXT_162 = " setReq = new ";
- protected final String TEXT_163 = "(req.getTarget()," + NL + "\t\t\t";
- protected final String TEXT_164 = ".eINSTANCE.get";
- protected final String TEXT_165 = "(), req.getSource());" + NL + "\t\treturn getMSLWrapper(new ";
- protected final String TEXT_166 = "(setReq));" + NL + "\t}";
- protected final String TEXT_167 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateStart";
- protected final String TEXT_168 = "Command(CreateRelationshipRequest req) {";
- protected final String TEXT_169 = NL + "\t\treturn new Command() {" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateComplete";
- protected final String TEXT_170 = "Command(CreateRelationshipRequest req) {";
- protected final String TEXT_171 = NL + "\t\tif (!(req.getSource() instanceof ";
- protected final String TEXT_172 = ")) {" + NL + "\t\t\treturn ";
- protected final String TEXT_173 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_174 = NL + "\t\t";
- protected final String TEXT_175 = " element = (";
- protected final String TEXT_176 = ") req.getSource();";
- protected final String TEXT_177 = NL + "\t\tif (element.get";
- protected final String TEXT_178 = "() != null) {";
- protected final String TEXT_179 = NL + "\t\tif (element.get";
- protected final String TEXT_180 = "().size() >= ";
- protected final String TEXT_181 = NL + "\t\t\t|| element.get";
- protected final String TEXT_182 = "().contains(req.getTarget())";
- protected final String TEXT_183 = NL + "\t\t\t\t) {";
- protected final String TEXT_184 = NL + "\t\t\treturn ";
- protected final String TEXT_185 = ".INSTANCE;" + NL + "\t\t}";
- protected final String TEXT_186 = NL + "\t\t";
- protected final String TEXT_187 = " setReq = new ";
- protected final String TEXT_188 = "(req.getSource()," + NL + "\t\t\t";
- protected final String TEXT_189 = ".eINSTANCE.get";
- protected final String TEXT_190 = "(), req.getTarget());" + NL + "\t\treturn getMSLWrapper(new ";
- protected final String TEXT_191 = "(setReq));" + NL + "\t}";
- protected final String TEXT_192 = NL + "}";
- protected final String TEXT_193 = NL;
+ protected final String TEXT_111 = NL + "\t\t";
+ protected final String TEXT_112 = " element = (";
+ protected final String TEXT_113 = ") req.getSource();";
+ protected final String TEXT_114 = NL + "\t\tif (element.get";
+ protected final String TEXT_115 = "() != null) {";
+ protected final String TEXT_116 = NL + "\t\tif (element.get";
+ protected final String TEXT_117 = "().size() >= ";
+ protected final String TEXT_118 = ") {";
+ protected final String TEXT_119 = NL + "\t\t\treturn ";
+ protected final String TEXT_120 = ".INSTANCE;" + NL + "\t\t}";
+ protected final String TEXT_121 = NL + "\t\tif (req.getContainmentFeature() == null) {" + NL + "\t\t\treq.setContainmentFeature(";
+ protected final String TEXT_122 = ".eINSTANCE.get";
+ protected final String TEXT_123 = "());" + NL + "\t\t}" + NL + "\t\treturn getMSLWrapper(new Create";
+ protected final String TEXT_124 = "Command(req));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class Create";
+ protected final String TEXT_125 = "Command extends ";
+ protected final String TEXT_126 = " {" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Create";
+ protected final String TEXT_127 = "Command(CreateRelationshipRequest req) {" + NL + "\t\t\tsuper(req);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_128 = " getEClassToEdit() {" + NL + "\t\t\treturn ";
+ protected final String TEXT_129 = ".eINSTANCE.get";
+ protected final String TEXT_130 = "();" + NL + "\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_131 = " getElementToEdit() {" + NL + "\t\t\treturn getSource();" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
+ protected final String TEXT_132 = " doDefaultElementCreation() {";
+ protected final String TEXT_133 = NL + "\t\t\t";
+ protected final String TEXT_134 = " newElement = (";
+ protected final String TEXT_135 = ") super.doDefaultElementCreation();" + NL + "\t\t\tif (newElement != null) {" + NL + "\t\t\t\tnewElement.set";
+ protected final String TEXT_136 = "((";
+ protected final String TEXT_137 = ") getTarget());";
+ protected final String TEXT_138 = NL + "\t\t\t\t";
+ protected final String TEXT_139 = ".Initializers.";
+ protected final String TEXT_140 = ".init(newElement);";
+ protected final String TEXT_141 = NL + "\t\t\t}" + NL + "\t\t\treturn newElement;" + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_142 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateStart";
+ protected final String TEXT_143 = "Command(CreateRelationshipRequest req) {";
+ protected final String TEXT_144 = NL + "\t\t";
+ protected final String TEXT_145 = " element = (";
+ protected final String TEXT_146 = ") getSemanticElement();";
+ protected final String TEXT_147 = NL + "\t\tif (element.get";
+ protected final String TEXT_148 = "() != null) {";
+ protected final String TEXT_149 = NL + "\t\tif (element.get";
+ protected final String TEXT_150 = "().size() >= ";
+ protected final String TEXT_151 = ") {";
+ protected final String TEXT_152 = NL + "\t\t\treturn ";
+ protected final String TEXT_153 = ".INSTANCE;" + NL + "\t\t}";
+ protected final String TEXT_154 = NL + "\t\treturn new Command() {" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateComplete";
+ protected final String TEXT_155 = "Command(CreateRelationshipRequest req) {";
+ protected final String TEXT_156 = NL + "\t\tif (!(req.getSource() instanceof ";
+ protected final String TEXT_157 = ")) {" + NL + "\t\t\treturn ";
+ protected final String TEXT_158 = ".INSTANCE;" + NL + "\t\t}";
+ protected final String TEXT_159 = NL + "\t\t";
+ protected final String TEXT_160 = " element = (";
+ protected final String TEXT_161 = ") getSemanticElement();";
+ protected final String TEXT_162 = NL + "\t\tif (element.get";
+ protected final String TEXT_163 = "() != null) {";
+ protected final String TEXT_164 = NL + "\t\tif (element.get";
+ protected final String TEXT_165 = "().size() >= ";
+ protected final String TEXT_166 = NL + "\t\t\t|| element.get";
+ protected final String TEXT_167 = "().contains(req.getSource())";
+ protected final String TEXT_168 = NL + "\t\t\t\t) {";
+ protected final String TEXT_169 = NL + "\t\t\treturn ";
+ protected final String TEXT_170 = ".INSTANCE;" + NL + "\t\t}";
+ protected final String TEXT_171 = NL + "\t\t";
+ protected final String TEXT_172 = " setReq = new ";
+ protected final String TEXT_173 = "(req.getTarget()," + NL + "\t\t\t";
+ protected final String TEXT_174 = ".eINSTANCE.get";
+ protected final String TEXT_175 = "(), req.getSource());" + NL + "\t\treturn getMSLWrapper(new ";
+ protected final String TEXT_176 = "(setReq));" + NL + "\t}";
+ protected final String TEXT_177 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateStart";
+ protected final String TEXT_178 = "Command(CreateRelationshipRequest req) {";
+ protected final String TEXT_179 = NL + "\t\treturn new Command() {" + NL + "\t\t};" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Command getCreateComplete";
+ protected final String TEXT_180 = "Command(CreateRelationshipRequest req) {";
+ protected final String TEXT_181 = NL + "\t\tif (!(req.getSource() instanceof ";
+ protected final String TEXT_182 = ")) {" + NL + "\t\t\treturn ";
+ protected final String TEXT_183 = ".INSTANCE;" + NL + "\t\t}";
+ protected final String TEXT_184 = NL + "\t\t";
+ protected final String TEXT_185 = " element = (";
+ protected final String TEXT_186 = ") req.getSource();";
+ protected final String TEXT_187 = NL + "\t\tif (element.get";
+ protected final String TEXT_188 = "() != null) {";
+ protected final String TEXT_189 = NL + "\t\tif (element.get";
+ protected final String TEXT_190 = "().size() >= ";
+ protected final String TEXT_191 = NL + "\t\t\t|| element.get";
+ protected final String TEXT_192 = "().contains(req.getTarget())";
+ protected final String TEXT_193 = NL + "\t\t\t\t) {";
+ protected final String TEXT_194 = NL + "\t\t\treturn ";
+ protected final String TEXT_195 = ".INSTANCE;" + NL + "\t\t}";
+ protected final String TEXT_196 = NL + "\t\t";
+ protected final String TEXT_197 = " setReq = new ";
+ protected final String TEXT_198 = "(req.getSource()," + NL + "\t\t\t";
+ protected final String TEXT_199 = ".eINSTANCE.get";
+ protected final String TEXT_200 = "(), req.getTarget());" + NL + "\t\treturn getMSLWrapper(new ";
+ protected final String TEXT_201 = "(setReq));" + NL + "\t}";
+ protected final String TEXT_202 = NL + "}";
+ protected final String TEXT_203 = NL;
public String generate(Object argument)
{
@@ -246,74 +256,107 @@ GenPackage genPackage = genDiagram.getDomainMetaModel();
for (Iterator nodes = childContainer.getChildNodes().iterator(); nodes.hasNext(); ) {
GenNode genChildNode = (GenNode) nodes.next();
TypeModelFacet modelFacet = genChildNode.getModelFacet();
+ GenFeature containmentMetaFeature = modelFacet.getContainmentMetaFeature();
+ int upperBound = containmentMetaFeature.getEcoreFeature().getUpperBound();
stringBuffer.append(TEXT_12);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
stringBuffer.append(TEXT_13);
stringBuffer.append(genChildNode.getUniqueIdentifier());
stringBuffer.append(TEXT_14);
- stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
+
+ if (upperBound > 0) {
+ String containerInterfaceName = importManager.getImportedName(containerNode.getModelFacet().getMetaClass().getQualifiedInterfaceName());
+
stringBuffer.append(TEXT_15);
- stringBuffer.append(modelFacet.getContainmentMetaFeature().getFeatureAccessorName());
+ stringBuffer.append(containerInterfaceName);
stringBuffer.append(TEXT_16);
- stringBuffer.append(modelFacet.getMetaClass().getName());
+ stringBuffer.append(containerInterfaceName);
stringBuffer.append(TEXT_17);
-}
+ if (upperBound == 1) {
stringBuffer.append(TEXT_18);
+ stringBuffer.append(containmentMetaFeature.getGetAccessor());
+ stringBuffer.append(TEXT_19);
+
+ } else {
+
+ stringBuffer.append(TEXT_20);
+ stringBuffer.append(containmentMetaFeature.getGetAccessor());
+ stringBuffer.append(TEXT_21);
+ stringBuffer.append(upperBound);
+ stringBuffer.append(TEXT_22);
+
+ }
+
+ stringBuffer.append(TEXT_23);
+
+ }
+
+ stringBuffer.append(TEXT_24);
+ stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
+ stringBuffer.append(TEXT_25);
+ stringBuffer.append(modelFacet.getContainmentMetaFeature().getFeatureAccessorName());
+ stringBuffer.append(TEXT_26);
+ stringBuffer.append(modelFacet.getMetaClass().getName());
+ stringBuffer.append(TEXT_27);
+
+}
+
+ stringBuffer.append(TEXT_28);
for (Iterator nodes = childContainer.getChildNodes().iterator(); nodes.hasNext(); ) {
GenNode genChildNode = (GenNode) nodes.next();
TypeModelFacet modelFacet = genChildNode.getModelFacet();
- stringBuffer.append(TEXT_19);
+ stringBuffer.append(TEXT_29);
stringBuffer.append(modelFacet.getMetaClass().getName());
- stringBuffer.append(TEXT_20);
+ stringBuffer.append(TEXT_30);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.commands.core.commands.MSLCreateElementCommand"));
- stringBuffer.append(TEXT_21);
+ stringBuffer.append(TEXT_31);
stringBuffer.append(modelFacet.getMetaClass().getName());
- stringBuffer.append(TEXT_22);
+ stringBuffer.append(TEXT_32);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_23);
+ stringBuffer.append(TEXT_33);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_24);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(containerNode.getModelFacet().getMetaClass().getClassifierAccessorName());
- stringBuffer.append(TEXT_25);
+ stringBuffer.append(TEXT_35);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_36);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_27);
+ stringBuffer.append(TEXT_37);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_28);
+ stringBuffer.append(TEXT_38);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View"));
- stringBuffer.append(TEXT_29);
+ stringBuffer.append(TEXT_39);
if (modelFacet.getModelElementInitializer() != null) {
- stringBuffer.append(TEXT_30);
+ stringBuffer.append(TEXT_40);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_31);
+ stringBuffer.append(TEXT_41);
String metaClassName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName());
- stringBuffer.append(TEXT_32);
+ stringBuffer.append(TEXT_42);
stringBuffer.append(metaClassName);
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_43);
stringBuffer.append(metaClassName);
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_44);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_45);
stringBuffer.append(genChildNode.getUniqueIdentifier());
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_46);
}
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_47);
}
}
- stringBuffer.append(TEXT_38);
+ stringBuffer.append(TEXT_48);
GenPackage genPackage = genDiagram.getDomainMetaModel();
GenClass nodeMetaClass = genNode.getModelFacet().getMetaClass();
final String OUTGOING_TOKEN = "Outgoing";
final String INCOMING_TOKEN = "Incoming";
- stringBuffer.append(TEXT_39);
+ stringBuffer.append(TEXT_49);
for (Iterator links = genDiagram.getLinks().iterator(); links.hasNext(); ) {
GenLink genLink = (GenLink) links.next();
@@ -336,20 +379,20 @@ for (Iterator links = genDiagram.getLinks().iterator(); links.hasNext(); ) {
if (namePart != null) {
namePart += genLink.getVisualID();
- stringBuffer.append(TEXT_40);
+ stringBuffer.append(TEXT_50);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_41);
+ stringBuffer.append(TEXT_51);
stringBuffer.append(genLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_42);
+ stringBuffer.append(TEXT_52);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_43);
+ stringBuffer.append(TEXT_53);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_44);
+ stringBuffer.append(TEXT_54);
}
}
- stringBuffer.append(TEXT_45);
+ stringBuffer.append(TEXT_55);
for (Iterator links = genDiagram.getLinks().iterator(); links.hasNext(); ) {
GenLink genLink = (GenLink) links.next();
@@ -363,195 +406,195 @@ for (Iterator links = genDiagram.getLinks().iterator(); links.hasNext(); ) {
if (nodeMetaClass.equals(outgoingClass)) {
namePart = OUTGOING_TOKEN + modelFacet.getMetaClass().getName() + genLink.getVisualID();
- stringBuffer.append(TEXT_46);
+ stringBuffer.append(TEXT_56);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_47);
+ stringBuffer.append(TEXT_57);
// check that containment feature is not set / has capacity for the new element
if (upperBound > 0) { // consider UNBOUNDED_MULTIPLICITY and UNSPECIFIED_MULTIPLICITY
String outgoingClassName = importManager.getImportedName(outgoingClass.getQualifiedInterfaceName());
- stringBuffer.append(TEXT_48);
+ stringBuffer.append(TEXT_58);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_49);
+ stringBuffer.append(TEXT_59);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_50);
+ stringBuffer.append(TEXT_60);
if (upperBound == 1) {
- stringBuffer.append(TEXT_51);
+ stringBuffer.append(TEXT_61);
stringBuffer.append(containmentFeature.getAccessorName());
- stringBuffer.append(TEXT_52);
+ stringBuffer.append(TEXT_62);
} else {
- stringBuffer.append(TEXT_53);
+ stringBuffer.append(TEXT_63);
stringBuffer.append(containmentFeature.getAccessorName());
- stringBuffer.append(TEXT_54);
+ stringBuffer.append(TEXT_64);
stringBuffer.append(upperBound);
- stringBuffer.append(TEXT_55);
+ stringBuffer.append(TEXT_65);
}
- stringBuffer.append(TEXT_56);
+ stringBuffer.append(TEXT_66);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_57);
+ stringBuffer.append(TEXT_67);
}
// create always executable command
- stringBuffer.append(TEXT_58);
+ stringBuffer.append(TEXT_68);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_59);
+ stringBuffer.append(TEXT_69);
// check that source is valid
- stringBuffer.append(TEXT_60);
+ stringBuffer.append(TEXT_70);
stringBuffer.append(importManager.getImportedName(incomingClass.getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_71);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_62);
+ stringBuffer.append(TEXT_72);
// check that containment feature is not set / has capacity for the new element
if (upperBound > 0) { // consider UNBOUNDED_MULTIPLICITY and UNSPECIFIED_MULTIPLICITY
String outgoingClassName = importManager.getImportedName(outgoingClass.getQualifiedInterfaceName());
- stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_73);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_64);
+ stringBuffer.append(TEXT_74);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_65);
+ stringBuffer.append(TEXT_75);
if (upperBound == 1) {
- stringBuffer.append(TEXT_66);
+ stringBuffer.append(TEXT_76);
stringBuffer.append(containmentFeature.getAccessorName());
- stringBuffer.append(TEXT_67);
+ stringBuffer.append(TEXT_77);
} else {
- stringBuffer.append(TEXT_68);
+ stringBuffer.append(TEXT_78);
stringBuffer.append(containmentFeature.getAccessorName());
- stringBuffer.append(TEXT_69);
+ stringBuffer.append(TEXT_79);
stringBuffer.append(upperBound);
- stringBuffer.append(TEXT_70);
+ stringBuffer.append(TEXT_80);
}
- stringBuffer.append(TEXT_71);
+ stringBuffer.append(TEXT_81);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_72);
+ stringBuffer.append(TEXT_82);
}
// create semantic command
- stringBuffer.append(TEXT_73);
+ stringBuffer.append(TEXT_83);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_74);
+ stringBuffer.append(TEXT_84);
stringBuffer.append(modelFacet.getContainmentMetaFeature().getFeatureAccessorName());
- stringBuffer.append(TEXT_75);
+ stringBuffer.append(TEXT_85);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_76);
+ stringBuffer.append(TEXT_86);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_77);
+ stringBuffer.append(TEXT_87);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.commands.core.commands.MSLCreateRelationshipCommand"));
- stringBuffer.append(TEXT_78);
+ stringBuffer.append(TEXT_88);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_79);
+ stringBuffer.append(TEXT_89);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_80);
+ stringBuffer.append(TEXT_90);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_81);
+ stringBuffer.append(TEXT_91);
stringBuffer.append(outgoingClass.getClassifierAccessorName());
- stringBuffer.append(TEXT_82);
+ stringBuffer.append(TEXT_92);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_83);
+ stringBuffer.append(TEXT_93);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_84);
+ stringBuffer.append(TEXT_94);
String metaClassName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName());
- stringBuffer.append(TEXT_85);
+ stringBuffer.append(TEXT_95);
stringBuffer.append(metaClassName);
- stringBuffer.append(TEXT_86);
+ stringBuffer.append(TEXT_96);
stringBuffer.append(metaClassName);
- stringBuffer.append(TEXT_87);
+ stringBuffer.append(TEXT_97);
stringBuffer.append(modelFacet.getTargetMetaFeature().getAccessorName());
- stringBuffer.append(TEXT_88);
+ stringBuffer.append(TEXT_98);
stringBuffer.append(importManager.getImportedName(incomingClass.getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_89);
+ stringBuffer.append(TEXT_99);
if (modelFacet.getModelElementInitializer() != null) {
- stringBuffer.append(TEXT_90);
+ stringBuffer.append(TEXT_100);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_91);
+ stringBuffer.append(TEXT_101);
stringBuffer.append(genLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_92);
+ stringBuffer.append(TEXT_102);
}
- stringBuffer.append(TEXT_93);
+ stringBuffer.append(TEXT_103);
} else if (nodeMetaClass.equals(incomingClass)) {
namePart = INCOMING_TOKEN + modelFacet.getMetaClass().getName() + genLink.getVisualID();
- stringBuffer.append(TEXT_94);
+ stringBuffer.append(TEXT_104);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_95);
+ stringBuffer.append(TEXT_105);
// no feasible restrictions here
- stringBuffer.append(TEXT_96);
+ stringBuffer.append(TEXT_106);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_97);
+ stringBuffer.append(TEXT_107);
// check that source is valid
- stringBuffer.append(TEXT_98);
+ stringBuffer.append(TEXT_108);
stringBuffer.append(importManager.getImportedName(outgoingClass.getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_99);
+ stringBuffer.append(TEXT_109);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_100);
+ stringBuffer.append(TEXT_110);
// check that containment feature is not set / has capacity for the new element
if (upperBound > 0) { // consider UNBOUNDED_MULTIPLICITY and UNSPECIFIED_MULTIPLICITY
String outgoingClassName = importManager.getImportedName(outgoingClass.getQualifiedInterfaceName());
- stringBuffer.append(TEXT_101);
+ stringBuffer.append(TEXT_111);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_102);
+ stringBuffer.append(TEXT_112);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_103);
+ stringBuffer.append(TEXT_113);
if (upperBound == 1) {
- stringBuffer.append(TEXT_104);
+ stringBuffer.append(TEXT_114);
stringBuffer.append(containmentFeature.getAccessorName());
- stringBuffer.append(TEXT_105);
+ stringBuffer.append(TEXT_115);
} else {
- stringBuffer.append(TEXT_106);
+ stringBuffer.append(TEXT_116);
stringBuffer.append(containmentFeature.getAccessorName());
- stringBuffer.append(TEXT_107);
+ stringBuffer.append(TEXT_117);
stringBuffer.append(upperBound);
- stringBuffer.append(TEXT_108);
+ stringBuffer.append(TEXT_118);
}
- stringBuffer.append(TEXT_109);
+ stringBuffer.append(TEXT_119);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_110);
+ stringBuffer.append(TEXT_120);
}
// create semantic command
- stringBuffer.append(TEXT_111);
+ stringBuffer.append(TEXT_121);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_112);
+ stringBuffer.append(TEXT_122);
stringBuffer.append(modelFacet.getContainmentMetaFeature().getFeatureAccessorName());
- stringBuffer.append(TEXT_113);
+ stringBuffer.append(TEXT_123);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_114);
+ stringBuffer.append(TEXT_124);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_115);
+ stringBuffer.append(TEXT_125);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.commands.core.commands.MSLCreateRelationshipCommand"));
- stringBuffer.append(TEXT_116);
+ stringBuffer.append(TEXT_126);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_117);
+ stringBuffer.append(TEXT_127);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EClass"));
- stringBuffer.append(TEXT_118);
+ stringBuffer.append(TEXT_128);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_119);
+ stringBuffer.append(TEXT_129);
stringBuffer.append(outgoingClass.getClassifierAccessorName());
- stringBuffer.append(TEXT_120);
+ stringBuffer.append(TEXT_130);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_121);
+ stringBuffer.append(TEXT_131);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject"));
- stringBuffer.append(TEXT_122);
+ stringBuffer.append(TEXT_132);
String metaClassName = importManager.getImportedName(modelFacet.getMetaClass().getQualifiedInterfaceName());
- stringBuffer.append(TEXT_123);
+ stringBuffer.append(TEXT_133);
stringBuffer.append(metaClassName);
- stringBuffer.append(TEXT_124);
+ stringBuffer.append(TEXT_134);
stringBuffer.append(metaClassName);
- stringBuffer.append(TEXT_125);
+ stringBuffer.append(TEXT_135);
stringBuffer.append(modelFacet.getTargetMetaFeature().getAccessorName());
- stringBuffer.append(TEXT_126);
+ stringBuffer.append(TEXT_136);
stringBuffer.append(importManager.getImportedName(incomingClass.getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_127);
+ stringBuffer.append(TEXT_137);
if (modelFacet.getModelElementInitializer() != null) {
- stringBuffer.append(TEXT_128);
+ stringBuffer.append(TEXT_138);
stringBuffer.append(importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName()));
- stringBuffer.append(TEXT_129);
+ stringBuffer.append(TEXT_139);
stringBuffer.append(genLink.getUniqueIdentifier());
- stringBuffer.append(TEXT_130);
+ stringBuffer.append(TEXT_140);
}
- stringBuffer.append(TEXT_131);
+ stringBuffer.append(TEXT_141);
}
} else if (genLink.getModelFacet() instanceof FeatureModelFacet) {
@@ -562,153 +605,153 @@ for (Iterator links = genDiagram.getLinks().iterator(); links.hasNext(); ) {
if (nodeMetaClass.equals(outgoingClass)) {
namePart = OUTGOING_TOKEN + metaFeature.getFeatureAccessorName() + genLink.getVisualID();
- stringBuffer.append(TEXT_132);
+ stringBuffer.append(TEXT_142);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_133);
+ stringBuffer.append(TEXT_143);
// check that feature is not set / has capacity for the new value
if (upperBound > 0) { // consider UNBOUNDED_MULTIPLICITY and UNSPECIFIED_MULTIPLICITY
String outgoingClassName = importManager.getImportedName(outgoingClass.getQualifiedInterfaceName());
- stringBuffer.append(TEXT_134);
+ stringBuffer.append(TEXT_144);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_135);
+ stringBuffer.append(TEXT_145);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_136);
+ stringBuffer.append(TEXT_146);
if (upperBound == 1) {
- stringBuffer.append(TEXT_137);
+ stringBuffer.append(TEXT_147);
stringBuffer.append(metaFeature.getAccessorName());
- stringBuffer.append(TEXT_138);
+ stringBuffer.append(TEXT_148);
} else {
- stringBuffer.append(TEXT_139);
+ stringBuffer.append(TEXT_149);
stringBuffer.append(metaFeature.getAccessorName());
- stringBuffer.append(TEXT_140);
+ stringBuffer.append(TEXT_150);
stringBuffer.append(upperBound);
- stringBuffer.append(TEXT_141);
+ stringBuffer.append(TEXT_151);
}
- stringBuffer.append(TEXT_142);
+ stringBuffer.append(TEXT_152);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_143);
+ stringBuffer.append(TEXT_153);
}
// create always executable command
- stringBuffer.append(TEXT_144);
+ stringBuffer.append(TEXT_154);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_145);
+ stringBuffer.append(TEXT_155);
// check that source is valid
- stringBuffer.append(TEXT_146);
+ stringBuffer.append(TEXT_156);
stringBuffer.append(importManager.getImportedName(incomingClass.getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_147);
+ stringBuffer.append(TEXT_157);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_148);
+ stringBuffer.append(TEXT_158);
// check that feature is not set / has capacity for the new value
if (upperBound > 0) { // consider UNBOUNDED_MULTIPLICITY and UNSPECIFIED_MULTIPLICITY
String outgoingClassName = importManager.getImportedName(outgoingClass.getQualifiedInterfaceName());
- stringBuffer.append(TEXT_149);
+ stringBuffer.append(TEXT_159);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_150);
+ stringBuffer.append(TEXT_160);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_151);
+ stringBuffer.append(TEXT_161);
if (upperBound == 1) {
- stringBuffer.append(TEXT_152);
+ stringBuffer.append(TEXT_162);
stringBuffer.append(metaFeature.getAccessorName());
- stringBuffer.append(TEXT_153);
+ stringBuffer.append(TEXT_163);
} else {
- stringBuffer.append(TEXT_154);
+ stringBuffer.append(TEXT_164);
stringBuffer.append(metaFeature.getAccessorName());
- stringBuffer.append(TEXT_155);
+ stringBuffer.append(TEXT_165);
stringBuffer.append(upperBound);
if (metaFeature.getEcoreFeature().isUnique()) {
- stringBuffer.append(TEXT_156);
+ stringBuffer.append(TEXT_166);
stringBuffer.append(metaFeature.getAccessorName());
- stringBuffer.append(TEXT_157);
+ stringBuffer.append(TEXT_167);
}
- stringBuffer.append(TEXT_158);
+ stringBuffer.append(TEXT_168);
}
- stringBuffer.append(TEXT_159);
+ stringBuffer.append(TEXT_169);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_160);
+ stringBuffer.append(TEXT_170);
}
// create semantic command
- stringBuffer.append(TEXT_161);
+ stringBuffer.append(TEXT_171);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest"));
- stringBuffer.append(TEXT_162);
+ stringBuffer.append(TEXT_172);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest"));
- stringBuffer.append(TEXT_163);
+ stringBuffer.append(TEXT_173);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_164);
+ stringBuffer.append(TEXT_174);
stringBuffer.append(metaFeature.getFeatureAccessorName());
- stringBuffer.append(TEXT_165);
+ stringBuffer.append(TEXT_175);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand"));
- stringBuffer.append(TEXT_166);
+ stringBuffer.append(TEXT_176);
} else if (nodeMetaClass.equals(incomingClass)) {
namePart = INCOMING_TOKEN + metaFeature.getFeatureAccessorName() + genLink.getVisualID();
- stringBuffer.append(TEXT_167);
+ stringBuffer.append(TEXT_177);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_168);
+ stringBuffer.append(TEXT_178);
// no feasible restrictions here
- stringBuffer.append(TEXT_169);
+ stringBuffer.append(TEXT_179);
stringBuffer.append(namePart);
- stringBuffer.append(TEXT_170);
+ stringBuffer.append(TEXT_180);
// check that source is valid
- stringBuffer.append(TEXT_171);
+ stringBuffer.append(TEXT_181);
stringBuffer.append(importManager.getImportedName(outgoingClass.getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_172);
+ stringBuffer.append(TEXT_182);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_173);
+ stringBuffer.append(TEXT_183);
// check that feature is not set / has capacity for the new value
if (upperBound > 0) { // consider UNBOUNDED_MULTIPLICITY and UNSPECIFIED_MULTIPLICITY
String outgoingClassName = importManager.getImportedName(outgoingClass.getQualifiedInterfaceName());
- stringBuffer.append(TEXT_174);
+ stringBuffer.append(TEXT_184);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_175);
+ stringBuffer.append(TEXT_185);
stringBuffer.append(outgoingClassName);
- stringBuffer.append(TEXT_176);
+ stringBuffer.append(TEXT_186);
if (upperBound == 1) {
- stringBuffer.append(TEXT_177);
+ stringBuffer.append(TEXT_187);
stringBuffer.append(metaFeature.getAccessorName());
- stringBuffer.append(TEXT_178);
+ stringBuffer.append(TEXT_188);
} else {
- stringBuffer.append(TEXT_179);
+ stringBuffer.append(TEXT_189);
stringBuffer.append(metaFeature.getAccessorName());
- stringBuffer.append(TEXT_180);
+ stringBuffer.append(TEXT_190);
stringBuffer.append(upperBound);
if (metaFeature.getEcoreFeature().isUnique()) {
- stringBuffer.append(TEXT_181);
+ stringBuffer.append(TEXT_191);
stringBuffer.append(metaFeature.getAccessorName());
- stringBuffer.append(TEXT_182);
+ stringBuffer.append(TEXT_192);
}
- stringBuffer.append(TEXT_183);
+ stringBuffer.append(TEXT_193);
}
- stringBuffer.append(TEXT_184);
+ stringBuffer.append(TEXT_194);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.UnexecutableCommand"));
- stringBuffer.append(TEXT_185);
+ stringBuffer.append(TEXT_195);
}
// create semantic command
- stringBuffer.append(TEXT_186);
+ stringBuffer.append(TEXT_196);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest"));
- stringBuffer.append(TEXT_187);
+ stringBuffer.append(TEXT_197);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest"));
- stringBuffer.append(TEXT_188);
+ stringBuffer.append(TEXT_198);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName()));
- stringBuffer.append(TEXT_189);
+ stringBuffer.append(TEXT_199);
stringBuffer.append(metaFeature.getFeatureAccessorName());
- stringBuffer.append(TEXT_190);
+ stringBuffer.append(TEXT_200);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand"));
- stringBuffer.append(TEXT_191);
+ stringBuffer.append(TEXT_201);
}
}
}
- stringBuffer.append(TEXT_192);
+ stringBuffer.append(TEXT_202);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_193);
+ stringBuffer.append(TEXT_203);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.codegen/templates/parts/childContainerCanonicalEditPolicy.jetinc b/plugins/org.eclipse.gmf.codegen/templates/parts/childContainerCanonicalEditPolicy.jetinc
index 8ca6edbb3..60e6b763c 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/parts/childContainerCanonicalEditPolicy.jetinc
+++ b/plugins/org.eclipse.gmf.codegen/templates/parts/childContainerCanonicalEditPolicy.jetinc
@@ -14,6 +14,14 @@ String modelElementInterfaceName = importManager.getImportedName(containerNode.g
List result = new <%=importManager.getImportedName("java.util.LinkedList")%>();
<%
+/*
+ Since there could e several child nodes with the same childMetaFeatures, but different domainMetaClasses
+specified, we are creating a Map{GenFeature -> Collection{GenChildNodes}}. If GenChildNode without specified
+domainMetaClass found, all the rest of GenChildNodes with the same childMetaFeature will be ignored because
+all the elements from this childMetaFeature will be treated as "this" type of GenChildNodes (without specified
+domainMetaClass).
+*/
+
Map childFeature2NodesMap = new HashMap();
for (Iterator it = childContainer.getChildNodes().iterator(); it.hasNext();) {
GenChildNode nextChildNode = (GenChildNode) it.next();
@@ -37,38 +45,52 @@ for (Iterator it = childContainer.getChildNodes().iterator(); it.hasNext();) {
genChildNodes.add(nextChildNode);
}
+// For each childMetaFeature:
for (Iterator it = childFeature2NodesMap.entrySet().iterator(); it.hasNext();) {
Map.Entry nextEntry = (Map.Entry) it.next();
GenFeature nextFeature = (GenFeature) nextEntry.getKey();
List childNodes = (List) nextEntry.getValue();
if (childNodes.size() == 1 && ((GenChildNode) childNodes.get(0)).getDomainMetaClass() == null) {
+// GenChildNode without specified domainMetaClass found:
+ if (nextFeature.isListType()) {
%>
- result.<%=nextFeature.isListType() ? "addAll" : "add"%>(((<%=modelElementInterfaceName%>) modelElement).<%=nextFeature.getGetAccessor()%>());
+ result.addAll(modelElement.<%=nextFeature.getGetAccessor()%>());
<%
+ } else {
+%>
+ Object featureValue = modelElement.<%=nextFeature.getGetAccessor()%>();
+ if (featureValue != null) {
+ result.add(featureValue);
+ }
+<%
+ }
+// Continue with the next entry in the Map
continue;
}
-
+
+// GenChildNodes with specified domainMetaClass found:
if (nextFeature.isListType()) {
%>
- <%=importManager.getImportedName("java.util.Collection")%> featureValues = ((<%=modelElementInterfaceName%>) modelElement).<%=nextFeature.getGetAccessor()%>();
+ <%=importManager.getImportedName("java.util.Collection")%> featureValues = modelElement.<%=nextFeature.getGetAccessor()%>();
for (<%=importManager.getImportedName("java.util.Iterator")%> it = featureValues.iterator(); it.hasNext();) {
<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> nextValue = (<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%>) it.next();
<%
} else {
%>
- <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> nextValue = (<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%>) ((<%=modelElementInterfaceName%>) modelElement).<%=nextFeature.getGetAccessor()%>();
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%> nextValue = (<%=importManager.getImportedName("org.eclipse.emf.ecore.EObject")%>) modelElement.<%=nextFeature.getGetAccessor()%>();
<%
}
%>
- <%=importManager.getImportedName("org.eclipse.emf.ecore.EClass")%> nextEClass = nextValue.eClass();
+ if (nextValue != null) {
+ <%=importManager.getImportedName("org.eclipse.emf.ecore.EClass")%> nextEClass = nextValue.eClass();
<%
for (Iterator childNodesIterator = childNodes.iterator(); childNodesIterator.hasNext();) {
GenChildNode nextChildNode = (GenChildNode) childNodesIterator.next();
GenClass domainMetaclass = nextChildNode.getDomainMetaClass();
%>
- if (<%=importManager.getImportedName(domainMetaclass.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=domainMetaclass.getClassifierAccessorName()%>().equals(nextEClass)) {
- result.add(nextValue);
- } <%=childNodesIterator.hasNext() ? "else" : ""%>
+ if (<%=importManager.getImportedName(domainMetaclass.getGenPackage().getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=domainMetaclass.getClassifierAccessorName()%>().equals(nextEClass)) {
+ result.add(nextValue);
+ } <%=childNodesIterator.hasNext() ? "else" : ""%>
<%
}
if (nextFeature.isListType()) {
@@ -76,6 +98,9 @@ for (Iterator it = childFeature2NodesMap.entrySet().iterator(); it.hasNext();) {
}
<%
}
+%>
+ }
+<%
}
%>
return result;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/policies/childContainerCreateCommand.jetinc b/plugins/org.eclipse.gmf.codegen/templates/policies/childContainerCreateCommand.jetinc
index 741f8f739..ac0c1b08c 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/policies/childContainerCreateCommand.jetinc
+++ b/plugins/org.eclipse.gmf.codegen/templates/policies/childContainerCreateCommand.jetinc
@@ -7,8 +7,31 @@ GenPackage genPackage = genDiagram.getDomainMetaModel();
for (Iterator nodes = childContainer.getChildNodes().iterator(); nodes.hasNext(); ) {
GenNode genChildNode = (GenNode) nodes.next();
TypeModelFacet modelFacet = genChildNode.getModelFacet();
+ GenFeature containmentMetaFeature = modelFacet.getContainmentMetaFeature();
+ int upperBound = containmentMetaFeature.getEcoreFeature().getUpperBound();
%>
if (<%=importManager.getImportedName(genDiagram.getElementTypesQualifiedClassName())%>.<%=genChildNode.getUniqueIdentifier()%> == req.getElementType()) {
+<%
+ if (upperBound > 0) {
+ String containerInterfaceName = importManager.getImportedName(containerNode.getModelFacet().getMetaClass().getQualifiedInterfaceName());
+%>
+ <%=containerInterfaceName%> container = (<%=containerInterfaceName%>) req.getContainer();
+<%
+ if (upperBound == 1) {
+%>
+ if (container.<%=containmentMetaFeature.getGetAccessor()%>() != null) {
+<%
+ } else {
+%>
+ if (container.<%=containmentMetaFeature.getGetAccessor()%>().size() >= <%=upperBound%>) {
+<%
+ }
+%>
+ return super.getCreateCommand(req);
+ }
+<%
+ }
+%>
if (req.getContainmentFeature() == null) {
req.setContainmentFeature(<%=importManager.getImportedName(genPackage.getQualifiedPackageInterfaceName())%>.eINSTANCE.get<%=modelFacet.getContainmentMetaFeature().getFeatureAccessorName()%>());
}

Back to the top