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/org.eclipse.gmf.graphdef.codegen/templates
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/org.eclipse.gmf.graphdef.codegen/templates')
-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
2 files changed, 53 insertions, 85 deletions
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