Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2006-03-29 07:56:04 -0500
committerashatalin2006-03-29 07:56:04 -0500
commit59c06b7b5b3781480d874c81224d0917baade95f (patch)
tree8bbf13d307c260e12dad1da56da55caac3c408c7 /plugins/org.eclipse.gmf.graphdef.codegen
parenta7870a082c04b3c4379fe1ee806b7d5d3fd6881c (diff)
downloadorg.eclipse.gmf-tooling-59c06b7b5b3781480d874c81224d0917baade95f.tar.gz
org.eclipse.gmf-tooling-59c06b7b5b3781480d874c81224d0917baade95f.tar.xz
org.eclipse.gmf-tooling-59c06b7b5b3781480d874c81224d0917baade95f.zip
[mgolubev] #133290 customAttributes is not being dispatched.
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java3
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomFigureAttrGenerator.java38
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomFigure.javajet10
3 files changed, 51 insertions, 0 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 de46bd9ba..12b957a6b 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
@@ -16,6 +16,7 @@ import org.eclipse.emf.codegen.jet.JETException;
import org.eclipse.gmf.common.codegen.ImportAssistant;
import org.eclipse.gmf.gmfgraph.BorderLayout;
import org.eclipse.gmf.gmfgraph.BorderLayoutData;
+import org.eclipse.gmf.gmfgraph.CustomFigure;
import org.eclipse.gmf.gmfgraph.CustomLayout;
import org.eclipse.gmf.gmfgraph.CustomLayoutData;
import org.eclipse.gmf.gmfgraph.Figure;
@@ -32,6 +33,7 @@ import org.eclipse.gmf.gmfgraph.Shape;
import org.eclipse.gmf.gmfgraph.XYLayoutData;
import org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch;
import org.eclipse.gmf.graphdef.codegen.templates.CustomClassAttributesGenerator;
+import org.eclipse.gmf.graphdef.codegen.templates.CustomFigureAttrGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.FigureAttrGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.FigureChildrenGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.InitBorderLayoutDataGenerator;
@@ -134,6 +136,7 @@ public class FigureGenerator {
tr.put(RoundedRectangle.class, "/attr/RoundedRectangle.javajet", RoundedRectAttrGenerator.class);
tr.put(PolygonDecoration.class, "/attr/PolygonDecoration.javajet", PolygonDecorationAttrGenerator.class);
tr.put(PolylineDecoration.class, "/attr/PolylineDecoration.javajet", PolylineDecorationAttrGenerator.class);
+ tr.put(CustomFigure.class, "/attr/CustomFigure.javajet", CustomFigureAttrGenerator.class);
// instantiation templates - only single one now. FIXME - make it overridable
tr.put("instantiate", "/new/Figure.javajet", NewFigureGenerator.class);
// children templates - only single one now. FIXME - make it overridable
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomFigureAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomFigureAttrGenerator.java
new file mode 100644
index 000000000..6894f757f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomFigureAttrGenerator.java
@@ -0,0 +1,38 @@
+package org.eclipse.gmf.graphdef.codegen.templates;
+
+import org.eclipse.gmf.gmfgraph.*;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
+
+public class CustomFigureAttrGenerator
+{
+ protected static String nl;
+ public static synchronized CustomFigureAttrGenerator create(String lineSeparator)
+ {
+ nl = lineSeparator;
+ CustomFigureAttrGenerator result = new CustomFigureAttrGenerator();
+ 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;
+ protected final String TEXT_3 = NL;
+
+ public String generate(Object argument)
+ {
+ StringBuffer stringBuffer = new StringBuffer();
+
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
+final CustomFigure figureInstance = (CustomFigure) args.getFigure();
+final String figureVarName = args.getVariableName();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+
+ stringBuffer.append(TEXT_1);
+ stringBuffer.append(dispatcher.dispatch("customAttributes", new Object[] {figureInstance, dispatcher, figureVarName}));
+ stringBuffer.append(TEXT_2);
+ stringBuffer.append(dispatcher.dispatch("Figure", args));
+ stringBuffer.append(TEXT_3);
+ return stringBuffer.toString();
+ }
+}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomFigure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomFigure.javajet
new file mode 100644
index 000000000..cc599b288
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomFigure.javajet
@@ -0,0 +1,10 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="CustomFigureAttrGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
+<%
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
+final CustomFigure figureInstance = (CustomFigure) args.getFigure();
+final String figureVarName = args.getVariableName();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+%>
+<%=dispatcher.dispatch("customAttributes", new Object[] {figureInstance, dispatcher, figureVarName})%>
+<%=dispatcher.dispatch("Figure", args)%>

Back to the top