Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-04-21 17:47:08 +0000
committeratikhomirov2006-04-21 17:47:08 +0000
commit29bf71d4a993be6068badd6225882ae974ab0e47 (patch)
tree1d33c0c9677347391b38146b43c138a940861bb4 /plugins
parent8d768fa51c93c82e6cedaa88d86f1441f88c1e63 (diff)
downloadorg.eclipse.gmf-tooling-29bf71d4a993be6068badd6225882ae974ab0e47.tar.gz
org.eclipse.gmf-tooling-29bf71d4a993be6068badd6225882ae974ab0e47.tar.xz
org.eclipse.gmf-tooling-29bf71d4a993be6068badd6225882ae974ab0e47.zip
#137840 uncompiliable code if CustomFigure contains Label - gmfgen expects getters generated for figure's children; besides, it makes no much sense to keep both Figure.javajet and Shape.javajet, with sole difference in the way they process children
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java2
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java112
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopShapeGenerator.java163
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet59
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet79
5 files changed, 148 insertions, 267 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java
index 7c2895033..6b72c7bc7 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java
@@ -61,7 +61,6 @@ import org.eclipse.gmf.graphdef.codegen.templates.RoundedRectAttrGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.ShapeAttrGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.TopConnectionGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.TopFigureGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.TopShapeGenerator;
import org.eclipse.gmf.internal.codegen.dispatch.EmitterFactory;
import org.eclipse.gmf.internal.codegen.dispatch.HierarchyKeyMap;
import org.eclipse.gmf.internal.codegen.dispatch.KeyChain;
@@ -123,7 +122,6 @@ public class FigureGenerator {
private static TemplateRegistry fillTopLevel() {
StaticTemplateRegistry tr = new StaticTemplateRegistry(FigureGenerator.class.getClassLoader());
tr.put(PolylineConnection.class, "/top/PolylineConnection.javajet", TopConnectionGenerator.class);
- tr.put(Shape.class, "/top/Shape.javajet", TopShapeGenerator.class);
tr.put(Figure.class, "/top/Figure.javajet", TopFigureGenerator.class);
return tr;
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
index 194ab4609..a32256d44 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
@@ -3,7 +3,8 @@ package org.eclipse.gmf.graphdef.codegen.templates;
import org.eclipse.gmf.gmfgraph.*;
import org.eclipse.gmf.gmfgraph.util.*;
import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
+import org.eclipse.gmf.graphdef.codegen.*;
+import java.util.*;
public class TopFigureGenerator
{
@@ -22,15 +23,38 @@ public class TopFigureGenerator
protected final String TEXT_3 = " extends ";
protected final String TEXT_4 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
protected final String TEXT_5 = "() {";
- protected final String TEXT_6 = NL + "\t\t";
- protected final String TEXT_7 = "\t" + NL + "\t\t";
- protected final String TEXT_8 = NL + "\t\t";
- protected final String TEXT_9 = NL + "\t}";
- protected final String TEXT_10 = NL;
- protected final String TEXT_11 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myUseLocalCoordinates = ";
- protected final String TEXT_12 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean useLocalCoordinates() {" + NL + "\t\treturn myUseLocalCoordinates;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setUseLocalCoordinates(boolean useLocalCoordinates) {" + NL + "\t\tmyUseLocalCoordinates = useLocalCoordinates;" + NL + "\t}" + NL + "\t";
- protected final String TEXT_13 = NL + "}";
- protected final String TEXT_14 = NL;
+ protected final String TEXT_6 = "\t" + NL + "\t\t";
+ protected final String TEXT_7 = NL + "\t\t";
+ protected final String TEXT_8 = NL + "\t\t" + NL + "\t\t";
+ protected final String TEXT_9 = " ";
+ protected final String TEXT_10 = " = createFigure";
+ protected final String TEXT_11 = "();" + NL + "\t\tsetFigure";
+ protected final String TEXT_12 = "(";
+ protected final String TEXT_13 = ");" + NL + "\t\tadd(";
+ protected final String TEXT_14 = ");" + NL + "\t\t";
+ protected final String TEXT_15 = "\t\t";
+ protected final String TEXT_16 = NL + "\t}" + NL;
+ protected final String TEXT_17 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_18 = " f";
+ protected final String TEXT_19 = "; " + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_20 = " getFigure";
+ protected final String TEXT_21 = "() {" + NL + "\t\treturn f";
+ protected final String TEXT_22 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFigure";
+ protected final String TEXT_23 = "(";
+ protected final String TEXT_24 = " figure) {" + NL + "\t\tf";
+ protected final String TEXT_25 = " = figure;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_26 = " createFigure";
+ protected final String TEXT_27 = "() {";
+ protected final String TEXT_28 = NL;
+ protected final String TEXT_29 = NL;
+ protected final String TEXT_30 = NL + "\t\treturn ";
+ protected final String TEXT_31 = ";" + NL + "\t}" + NL;
+ protected final String TEXT_32 = NL;
+ protected final String TEXT_33 = NL;
+ protected final String TEXT_34 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myUseLocalCoordinates = ";
+ protected final String TEXT_35 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean useLocalCoordinates() {" + NL + "\t\treturn myUseLocalCoordinates;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setUseLocalCoordinates(boolean useLocalCoordinates) {" + NL + "\t\tmyUseLocalCoordinates = useLocalCoordinates;" + NL + "\t}" + NL + "\t";
+ protected final String TEXT_36 = NL + "}";
+ protected final String TEXT_37 = NL;
public String generate(Object argument)
{
@@ -52,17 +76,71 @@ final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
stringBuffer.append(figure.getName());
stringBuffer.append(TEXT_5);
-GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "genLayoutManager", null);
+GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "myGenLayoutManager", null);
stringBuffer.append(TEXT_6);
stringBuffer.append(dispatcher.dispatch("createLayout", dispatcherArgs));
stringBuffer.append(TEXT_7);
stringBuffer.append(dispatcher.dispatch(figure, dispatcherArgs));
+
+for (Iterator it = figure.getChildren().iterator(); it.hasNext();) {
+ Figure next = (Figure) it.next();
+ final String childVarName = "child" + next.getName();
stringBuffer.append(TEXT_8);
- stringBuffer.append(dispatcher.dispatch("Children", new Object[] {figure.getChildren(), dispatcher, dispatcherArgs}));
+ stringBuffer.append(fqnSwitch.get(next, importManager));
stringBuffer.append(TEXT_9);
- if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/
+ stringBuffer.append(childVarName);
stringBuffer.append(TEXT_10);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_11);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_12);
+ stringBuffer.append(childVarName);
+ stringBuffer.append(TEXT_13);
+ stringBuffer.append(childVarName);
+ stringBuffer.append(TEXT_14);
+ stringBuffer.append(dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(next, childVarName, dispatcherArgs.getManagerVariableName(), "layoutData" + next.getName())));
+ stringBuffer.append(TEXT_15);
+ }
+ stringBuffer.append(TEXT_16);
+
+int fc = 0;
+for (Iterator it = figure.getChildren().iterator(); it.hasNext(); fc++) {
+ Figure next = (Figure) it.next();
+ final String nextClassName = fqnSwitch.get(next, importManager);
+ stringBuffer.append(TEXT_17);
+ stringBuffer.append(nextClassName);
+ stringBuffer.append(TEXT_18);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_19);
+ stringBuffer.append(nextClassName);
+ stringBuffer.append(TEXT_20);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_21);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_22);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_23);
+ stringBuffer.append(nextClassName);
+ stringBuffer.append(TEXT_24);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_25);
+ stringBuffer.append(nextClassName);
+ stringBuffer.append(TEXT_26);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_27);
+ GraphDefDispatcher.LayoutArgs childFigureArgs = dispatcher.createLayoutArgs(next, next.getName(), "layoutManager" + next.getName(), null);
+ stringBuffer.append(TEXT_28);
+ stringBuffer.append(dispatcher.dispatch("instantiate", childFigureArgs));
+ stringBuffer.append(TEXT_29);
+ stringBuffer.append(dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, childFigureArgs}));
+ stringBuffer.append(TEXT_30);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_31);
+ }
+ stringBuffer.append(TEXT_32);
+ if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/
+ stringBuffer.append(TEXT_33);
// simple heuristic to detect need for local coordinates
boolean useLocalDefaultValue = false;
@@ -73,13 +151,13 @@ for (java.util.Iterator it = figure.getChildren().iterator(); it.hasNext(); ) {
}
}
- stringBuffer.append(TEXT_11);
+ stringBuffer.append(TEXT_34);
stringBuffer.append(useLocalDefaultValue);
- stringBuffer.append(TEXT_12);
+ stringBuffer.append(TEXT_35);
}
- stringBuffer.append(TEXT_13);
+ stringBuffer.append(TEXT_36);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_14);
+ stringBuffer.append(TEXT_37);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopShapeGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopShapeGenerator.java
deleted file mode 100644
index c9199fc7a..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopShapeGenerator.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.gmfgraph.util.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-import java.util.*;
-
-public class TopShapeGenerator
-{
- protected static String nl;
- public static synchronized TopShapeGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- TopShapeGenerator result = new TopShapeGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_3 = " extends ";
- protected final String TEXT_4 = " {" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_5 = "() {";
- protected final String TEXT_6 = "\t" + NL + "\t\t";
- protected final String TEXT_7 = NL + "\t\t";
- protected final String TEXT_8 = NL + "\t\t" + NL + "\t\t";
- protected final String TEXT_9 = " ";
- protected final String TEXT_10 = " = createFigure";
- protected final String TEXT_11 = "();" + NL + "\t\tsetFigure";
- protected final String TEXT_12 = "(";
- protected final String TEXT_13 = ");" + NL + "\t\tadd(";
- protected final String TEXT_14 = ");" + NL + "\t\t";
- protected final String TEXT_15 = "\t\t";
- protected final String TEXT_16 = NL + "\t}" + NL;
- protected final String TEXT_17 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_18 = " f";
- protected final String TEXT_19 = "; " + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_20 = " getFigure";
- protected final String TEXT_21 = "() {" + NL + "\t\treturn f";
- protected final String TEXT_22 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFigure";
- protected final String TEXT_23 = "(";
- protected final String TEXT_24 = " figure) {" + NL + "\t\tf";
- protected final String TEXT_25 = " = figure;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_26 = " createFigure";
- protected final String TEXT_27 = "() {";
- protected final String TEXT_28 = NL;
- protected final String TEXT_29 = NL;
- protected final String TEXT_30 = NL + "\t\treturn ";
- protected final String TEXT_31 = ";" + NL + "\t}" + NL;
- protected final String TEXT_32 = NL;
- protected final String TEXT_33 = NL;
- protected final String TEXT_34 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myUseLocalCoordinates = ";
- protected final String TEXT_35 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean useLocalCoordinates() {" + NL + "\t\treturn myUseLocalCoordinates;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setUseLocalCoordinates(boolean useLocalCoordinates) {" + NL + "\t\tmyUseLocalCoordinates = useLocalCoordinates;" + NL + "\t}" + NL + "\t";
- protected final String TEXT_36 = NL + "}";
- protected final String TEXT_37 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-Object[] args = (Object[]) argument;
-Shape figure = (Shape) args[0];
-final ImportAssistant importManager = (ImportAssistant) args[1];
-final FigureQualifiedNameSwitch fqnSwitch = (FigureQualifiedNameSwitch) args[2];
-final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
-
- stringBuffer.append(TEXT_1);
- importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(figure.getName());
- stringBuffer.append(TEXT_3);
- stringBuffer.append(fqnSwitch.get(figure, importManager));
- stringBuffer.append(TEXT_4);
- stringBuffer.append(figure.getName());
- stringBuffer.append(TEXT_5);
-
-GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "myGenLayoutManager", null);
-
- stringBuffer.append(TEXT_6);
- stringBuffer.append(dispatcher.dispatch("createLayout", dispatcherArgs));
- stringBuffer.append(TEXT_7);
- stringBuffer.append(dispatcher.dispatch(figure, dispatcherArgs));
-
-for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext();) {
- Figure next = (Figure) it.next();
- final String childVarName = "child" + next.getName();
- stringBuffer.append(TEXT_8);
- stringBuffer.append(fqnSwitch.get(next, importManager));
- stringBuffer.append(TEXT_9);
- stringBuffer.append(childVarName);
- stringBuffer.append(TEXT_10);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_11);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_12);
- stringBuffer.append(childVarName);
- stringBuffer.append(TEXT_13);
- stringBuffer.append(childVarName);
- stringBuffer.append(TEXT_14);
- stringBuffer.append(dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(next, childVarName, dispatcherArgs.getManagerVariableName(), "layoutData" + next.getName())));
- stringBuffer.append(TEXT_15);
- }
- stringBuffer.append(TEXT_16);
-
-int fc = 0;
-for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext(); fc++) {
- Figure next = (Figure) it.next();
- final String nextClassName = fqnSwitch.get(next, importManager);
- stringBuffer.append(TEXT_17);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_18);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_19);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_20);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_21);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_22);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_23);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_24);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_25);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_26);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_27);
- GraphDefDispatcher.LayoutArgs childFigureArgs = dispatcher.createLayoutArgs(next, next.getName(), "layoutManager" + next.getName(), null);
- stringBuffer.append(TEXT_28);
- stringBuffer.append(dispatcher.dispatch("instantiate", childFigureArgs));
- stringBuffer.append(TEXT_29);
- stringBuffer.append(dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, childFigureArgs}));
- stringBuffer.append(TEXT_30);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_31);
- }
- stringBuffer.append(TEXT_32);
- if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/
- stringBuffer.append(TEXT_33);
-
-// simple heuristic to detect need for local coordinates
-boolean useLocalDefaultValue = false;
-for (java.util.Iterator it = figure.getChildren().iterator(); it.hasNext(); ) {
- if (it.next() instanceof Polyline) {
- useLocalDefaultValue = true;
- break;
- }
-}
-
- stringBuffer.append(TEXT_34);
- stringBuffer.append(useLocalDefaultValue);
- stringBuffer.append(TEXT_35);
- }
- stringBuffer.append(TEXT_36);
- importManager.emitSortedImports();
- stringBuffer.append(TEXT_37);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
index 40ce8a681..757c0f9c9 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
@@ -1,5 +1,5 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="TopFigureGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="TopFigureGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.* java.util.*"%>
<%
Object[] args = (Object[]) argument;
Figure figure = (Figure) args[0];
@@ -20,12 +20,59 @@ public class <%=figure.getName()%> extends <%=fqnSwitch.get(figure, importManage
*/
public <%=figure.getName()%>() {
<%
-GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "genLayoutManager", null);
-%>
- <%=dispatcher.dispatch("createLayout", dispatcherArgs)%>
+GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "myGenLayoutManager", null);
+%>
+ <%=dispatcher.dispatch("createLayout", dispatcherArgs)%>
<%=dispatcher.dispatch(figure, dispatcherArgs)%>
- <%=dispatcher.dispatch("Children", new Object[] {figure.getChildren(), dispatcher, dispatcherArgs})%>
+<%
+for (Iterator it = figure.getChildren().iterator(); it.hasNext();) {
+ Figure next = (Figure) it.next();
+ final String childVarName = "child" + next.getName();%>
+
+ <%=fqnSwitch.get(next, importManager)%> <%=childVarName%> = createFigure<%=next.getName()%>();
+ setFigure<%=next.getName()%>(<%=childVarName%>);
+ add(<%=childVarName%>);
+ <%=dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(next, childVarName, dispatcherArgs.getManagerVariableName(), "layoutData" + next.getName()))%>
+<%}%>
+ }
+
+<%
+int fc = 0;
+for (Iterator it = figure.getChildren().iterator(); it.hasNext(); fc++) {
+ Figure next = (Figure) it.next();
+ final String nextClassName = fqnSwitch.get(next, importManager);%>
+
+ /**
+ * @generated
+ */
+ private <%=nextClassName%> f<%=next.getName()%>;
+
+ /**
+ * @generated
+ */
+ public <%=nextClassName%> getFigure<%=next.getName()%>() {
+ return f<%=next.getName()%>;
}
+
+ /**
+ * @generated
+ */
+ protected void setFigure<%=next.getName()%>(<%=nextClassName%> figure) {
+ f<%=next.getName()%> = figure;
+ }
+
+ /**
+ * @generated
+ */
+ private <%=nextClassName%> createFigure<%=next.getName()%>() {
+<% GraphDefDispatcher.LayoutArgs childFigureArgs = dispatcher.createLayoutArgs(next, next.getName(), "layoutManager" + next.getName(), null);%>
+<%=dispatcher.dispatch("instantiate", childFigureArgs)%>
+<%=dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, childFigureArgs})%>
+ return <%=next.getName()%>;
+ }
+
+<%}%>
+
<%if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/%>
<%@ include file="localCoordinates.jetinc"%>
<%}%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet
deleted file mode 100644
index 47a062230..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet
+++ /dev/null
@@ -1,79 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="TopShapeGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.* java.util.*"%>
-<%
-Object[] args = (Object[]) argument;
-Shape figure = (Shape) args[0];
-final ImportAssistant importManager = (ImportAssistant) args[1];
-final FigureQualifiedNameSwitch fqnSwitch = (FigureQualifiedNameSwitch) args[2];
-final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
-%>
-
-<%importManager.markImportLocation(stringBuffer);%>
-
-/**
- * @generated
- */
-public class <%=figure.getName()%> extends <%=fqnSwitch.get(figure, importManager)%> {
-
- /**
- * @generated
- */
- public <%=figure.getName()%>() {
-<%
-GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "myGenLayoutManager", null);
-%>
- <%=dispatcher.dispatch("createLayout", dispatcherArgs)%>
- <%=dispatcher.dispatch(figure, dispatcherArgs)%>
-<%
-for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext();) {
- Figure next = (Figure) it.next();
- final String childVarName = "child" + next.getName();%>
-
- <%=fqnSwitch.get(next, importManager)%> <%=childVarName%> = createFigure<%=next.getName()%>();
- setFigure<%=next.getName()%>(<%=childVarName%>);
- add(<%=childVarName%>);
- <%=dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(next, childVarName, dispatcherArgs.getManagerVariableName(), "layoutData" + next.getName()))%>
-<%}%>
- }
-
-<%
-int fc = 0;
-for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext(); fc++) {
- Figure next = (Figure) it.next();
- final String nextClassName = fqnSwitch.get(next, importManager);%>
-
- /**
- * @generated
- */
- private <%=nextClassName%> f<%=next.getName()%>;
-
- /**
- * @generated
- */
- public <%=nextClassName%> getFigure<%=next.getName()%>() {
- return f<%=next.getName()%>;
- }
-
- /**
- * @generated
- */
- protected void setFigure<%=next.getName()%>(<%=nextClassName%> figure) {
- f<%=next.getName()%> = figure;
- }
-
- /**
- * @generated
- */
- private <%=nextClassName%> createFigure<%=next.getName()%>() {
-<% GraphDefDispatcher.LayoutArgs childFigureArgs = dispatcher.createLayoutArgs(next, next.getName(), "layoutManager" + next.getName(), null);%>
-<%=dispatcher.dispatch("instantiate", childFigureArgs)%>
-<%=dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, childFigureArgs})%>
- return <%=next.getName()%>;
- }
-
-<%}%>
-
-<%if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/%>
-<%@ include file="localCoordinates.jetinc"%>
-<%}%>
-}<%importManager.emitSortedImports();%>

Back to the top