Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-11-02 16:58:29 -0500
committeratikhomirov2006-11-02 16:58:29 -0500
commit87f9ae89b931710cf24bd695b81ab8e3d219c88a (patch)
treec0382fe2792d9359c1ee17ca9a346eb22bf21b29 /plugins/org.eclipse.gmf.graphdef.codegen/templates
parentbfa530a7515d8bc44f9d0c4d89d6db7ad9403dda (diff)
downloadorg.eclipse.gmf-tooling-87f9ae89b931710cf24bd695b81ab8e3d219c88a.tar.gz
org.eclipse.gmf-tooling-87f9ae89b931710cf24bd695b81ab8e3d219c88a.tar.xz
org.eclipse.gmf-tooling-87f9ae89b931710cf24bd695b81ab8e3d219c88a.zip
JET templates for gmfgraph model replaced with Xpand counterparts.
MapMode handling simplified
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Attrs.xpt50
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Border.xpt55
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Children.xpt86
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Color.jetinc16
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Decoration.xpt34
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Extras.xpt46
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Layout.xpt71
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/LayoutData.xpt58
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/MapMode.xpt35
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Util.ext93
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomClass.javajet43
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomClass.xpt37
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomFigure.javajet10
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Decoration.xpt51
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet56
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.xpt84
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet11
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet7
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet16
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet21
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet11
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet27
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.xpt47
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet98
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/BorderLayout.javajet17
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/CustomLayout.javajet8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/FlowLayout.javajet71
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/GridLayout.javajet25
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/BorderLayoutData.javajet39
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/CustomLayoutData.javajet11
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet29
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/XYLayoutData.javajet29
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/CompoundBorder.javajet17
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/CustomBorder.javajet11
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet14
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Layout.javajet21
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LayoutData.javajet18
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LineBorder.javajet35
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/MarginBorder.javajet24
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Activator.xpt63
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/BuildProperties.xpt18
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Manifest.xpt38
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet107
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/PluginProperties.xpt16
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet5
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/manifest.mfjet53
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/plugin.propertiesjet7
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/rt_mm/MapMode.xpt58
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/rt_mm/MapModeUtil.ext17
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet31
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.xpt95
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/PolylineConnection.javajet46
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Top.javajet53
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/customBorderFactoryMethods.jetinc38
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/localCoordinates.jetinc29
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/scalablePolygonAsInnerClass.jetinc20
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/staticFields.jetinc12
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/xtras/ScalablePolygon.xpt (renamed from plugins/org.eclipse.gmf.graphdef.codegen/templates/top/scalablePolygonBehavior.jetinc)20
58 files changed, 1071 insertions, 1087 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Attrs.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Attrs.xpt
new file mode 100644
index 000000000..d746b366c
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Attrs.xpt
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«REM»Define attributes for Figures (for DecorationFigure subclasses see Decoration.xpt)«ENDREM»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::Figure»
+«REM»Polymorphic entry point for any Figure's subclass attributes«ENDREM»
+«EXPAND attr::Figure::figureAttrs(figureVarName)»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::Shape-»
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::Label-»
+«figureVarName».setText("«text»");
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::RoundedRectangle-»
+«figureVarName».setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map FOR cornerWidth», «EXPAND MapMode::map FOR cornerHeight»));
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::CustomFigure-»
+«EXPAND attr::CustomClass::Init(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::Polyline-»
+«FOREACH template AS pt-»
+«figureVarName».addPoint(new org.eclipse.draw2d.geometry.Point(«EXPAND MapMode::map FOR pt»));
+«ENDFOREACH-»
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Border.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Border.xpt
new file mode 100644
index 000000000..59d31bbcd
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Border.xpt
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::Border-»
+«figureVarName».setBorder(«EXPAND border(figureVarName)»);
+«ENDDEFINE»
+
+«DEFINE border(EString figureVarName) FOR gmfgraph::Border»
+«ERROR "This is an abstract definition"»
+«ENDDEFINE»
+
+«DEFINE border(EString figureVarName) FOR gmfgraph::LineBorder-»
+new org.eclipse.draw2d.LineBorder(«IF null == color»null«ELSE»«EXPAND attr::Figure::color(figureVarName + "_BORDER") FOR color»«ENDIF», «EXPAND MapMode::map FOR width»)
+«ENDDEFINE»
+
+«DEFINE border(EString figureVarName) FOR gmfgraph::CompoundBorder-»
+new org.eclipse.draw2d.CompoundBorder(«IF null == outer»null«ELSE»«EXPAND border(figureVarName) FOR outer»«ENDIF», «IF null == inner»null«ELSE»«EXPAND border(figureVarName) FOR inner»«ENDIF»)
+«ENDDEFINE»
+
+«DEFINE border(EString figureVarName) FOR gmfgraph::MarginBorder-»
+new org.eclipse.draw2d.MarginBorder(«EXPAND MapMode::map FOR insets»)
+«ENDDEFINE»
+
+«DEFINE border(EString figureVarName) FOR gmfgraph::CustomBorder-»
+«LET methodName(figureVarName) AS methodName-»
+«methodName»()
+«EXPAND customBorderMethod(methodName)-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE customBorderMethod(String methodName) FOR gmfgraph::CustomBorder-»
+«FILE "" additionalMethods-»
+ /**
+ * @generated
+ */
+ private org.eclipse.draw2d.Border «methodName»() {
+ «qualifiedClassNameGEF()» result = new «qualifiedClassNameGEF()»();
+ «EXPAND attr::CustomClass::Init("result")»
+ return result;
+ }
+«ENDFILE-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Children.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Children.xpt
new file mode 100644
index 000000000..bc3af93ea
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Children.xpt
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE CreateChildren FOR gmfgraph::Figure-»
+ /**
+ * @generated
+ */
+ private void createContents(){
+«EXPAND instantiate(0, this, "this") FOREACH children.typeSelect(gmfgraph::Figure)»
+ }
+«EXPAND accessors FOREACH children.typeSelect(gmfgraph::Figure)»
+«ENDDEFINE»
+
+«DEFINE instantiate(EInt count, gmfgraph::Figure parentFigure, String parentFigureVariable) FOR gmfgraph::FigureMarker»
+«ERROR "Placeholder, though should never get here as long as there\'s typeSelect above"»
+«ENDDEFINE»
+
+«DEFINE accessors FOR gmfgraph::FigureMarker»
+«ERROR "Placeholder, though should never get here as long as there\'s typeSelect above"»
+«ENDDEFINE»
+
+«DEFINE instantiate(EInt count, gmfgraph::Figure parentFigure, EString parentFigureVariable) FOR gmfgraph::Figure»
+«LET figureVariableName(count) AS figureVarName»
+«EXPAND newFigureInstance(figureVarName)-»
+«EXPAND Attrs::Init(figureVarName)-»
+«IF null == layoutData || null == parentFigure.layout-»«REM»Check for (parentLayout != null) to avoid generating data that won't be used. Not sure it's essential, but it was that way with old jet templates«ENDREM»
+«parentFigureVariable».add(«figureVarName»);
+«ELSE-»
+«EXPAND LayoutData::Init(parentFigureVariable, figureVarName) FOR layoutData-»
+«ENDIF-»
+«IF !referencingElements.isEmpty()»«figureFieldSetter()»(«figureVarName»);«ENDIF-»
+«EXPAND Layout::Init(figureVarName) FOR layout-»
+«EXPAND instantiate(count + 1, this, figureVarName) FOREACH children.typeSelect(gmfgraph::Figure)-»
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE newFigureInstance(String figureVarName) FOR gmfgraph::Figure»
+«qualifiedClassNameGEF()» «figureVarName» = new «qualifiedClassNameGEF()»();
+«ENDDEFINE»
+
+«DEFINE newFigureInstance(String figureVarName) FOR gmfgraph::ScalablePolygon»
+«LET figureVarName.toFirstUpper() + "Class" AS localClassName-»
+class «localClassName» extends «qualifiedClassNameGEF()» {
+«EXPAND xtras::ScalablePolygon::behaviour-»
+};
+«localClassName» «figureVarName» = new «localClassName»();
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE accessors FOR gmfgraph::Figure-»
+«IF !referencingElements.isEmpty()-»
+ /**
+ * @generated
+ */
+ private «qualifiedClassNameGEF()» «figureFieldName()»;
+
+ /**
+ * @generated
+ */
+ public «qualifiedClassNameGEF()» «figureFieldGetter()»() {
+ return «figureFieldName()»;
+ }
+
+ /**
+ * @generated
+ */
+ private void «figureFieldSetter()»(«qualifiedClassNameGEF()» fig){
+ «figureFieldName()» = fig;
+ }
+«ENDIF-»
+«EXPAND accessors FOREACH children.typeSelect(gmfgraph::Figure)»
+«ENDDEFINE»
+
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Color.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Color.jetinc
deleted file mode 100644
index 4ea5c8915..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Color.jetinc
+++ /dev/null
@@ -1,16 +0,0 @@
-<%
-//input: [oeg].gmfgraph.Color colorVal
-//input: String colorName
-//input: [oeg].common.codegen.ImportAssistant importManager
-//input: [oeg].graphdef.codegen GraphDefDispatcher dispatcher
-
- if (colorVal instanceof RGBColor) {
- String staticFieldType = importManager.getImportedName("org.eclipse.swt.graphics.Color");
- String staticFieldName = (colorName == null) ? "COLOR" : colorName;
- String staticFieldValue = "new " + staticFieldType + "(null, " + ((RGBColor)colorVal).getRed() + ", " + ((RGBColor)colorVal).getGreen() + ", " + ((RGBColor)colorVal).getBlue() + ")";
-%><%=dispatcher.getStaticFieldsManager().addStaticField(staticFieldType, staticFieldName, staticFieldValue)%>
-<% } else if (colorVal instanceof ConstantColor) {%><%=importManager.getImportedName("org.eclipse.draw2d.ColorConstants") + "." + ((ConstantColor) colorVal).getValue().getLiteral()%>
-<% } else {
- throw new IllegalStateException("Unknown color: " + colorVal);
- }
-%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Decoration.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Decoration.xpt
new file mode 100644
index 000000000..ab19dd447
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Decoration.xpt
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«REM»Instantiate and define attributes for DecorationFigures«ENDREM»
+
+«DEFINE Instantiate(EString figureVarName) FOR gmfgraph::DecorationFigure-»
+«qualifiedClassNameGEF()» «figureVarName» = new «qualifiedClassNameGEF()»();
+«EXPAND Attrs::Init(figureVarName)»
+«ENDDEFINE»
+
+«REM»Guess, can't delegate to attrs through Attrs::Init because there's already Init for Polyline«ENDREM»
+«DEFINE Instantiate(EString figureVarName) FOR gmfgraph::PolylineDecoration-»
+«qualifiedClassNameGEF()» «figureVarName» = new «qualifiedClassNameGEF()»();
+«EXPAND attr::Decoration::polylineAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«REM»Copy of above template for PolylineDecoration, just because PolygonDecoration doesn't extend PolylineDecoration in draw2d and gmfgraph«ENDREM»
+«DEFINE Instantiate(EString figureVarName) FOR gmfgraph::PolygonDecoration-»
+«qualifiedClassNameGEF()» «figureVarName» = new «qualifiedClassNameGEF()»();
+«EXPAND attr::Decoration::polylineAttrs(figureVarName)-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Extras.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Extras.xpt
new file mode 100644
index 000000000..056e1d5cc
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Extras.xpt
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE localCoordinates FOR gmfgraph::Figure»
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = «!children.typeSelect(Polyline).isEmpty()»;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+«ENDDEFINE»
+
+«DEFINE localCoordinates FOR gmfgraph::Polyline»
+«ENDDEFINE»
+
+
+«DEFINE extraMethods FOR gmfgraph::Figure-»
+«ENDDEFINE»
+
+«DEFINE extraMethods FOR gmfgraph::ScalablePolygon-»
+«EXPAND xtras::ScalablePolygon::behaviour-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Layout.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Layout.xpt
new file mode 100644
index 000000000..c9f99b0f6
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Layout.xpt
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::Layout»
+«owningFigureVariable».setLayoutManager(new «qualifiedClassNameGEF()»());
+«ENDDEFINE»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::BorderLayout»
+«LET "layout" + owningFigureVariable.toFirstUpper() AS layoutVarName»
+ «qualifiedClassNameGEF()» «layoutVarName» = new «qualifiedClassNameGEF()»();
+«IF null != spacing-»
+ «layoutVarName».setHorizontalSpacing(«spacing.dx»);// TODO mapMode?
+ «layoutVarName».setVerticalSpacing(«spacing.dy»);
+«ENDIF-»
+ «owningFigureVariable».setLayoutManager(«layoutVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::FlowLayout»
+«LET "layout" + owningFigureVariable.toFirstUpper() AS layoutVarName»
+ «qualifiedClassNameGEF()» «layoutVarName» = new «qualifiedClassNameGEF()»();
+ «layoutVarName».setStretchMinorAxis(«matchMinorSize»);
+ «layoutVarName».setMinorAlignment(«qualifiedClassNameGEF()».«EXPAND alignment(forceSingleLine) FOR minorAlignment»);
+«IF forceSingleLine»
+ «layoutVarName».setSpacing(«majorSpacing»);
+ «layoutVarName».setVertical(«vertical»);
+«ELSE»
+ «layoutVarName».setMajorAlignment(«qualifiedClassNameGEF()».«EXPAND alignment(forceSingleLine) FOR majorAlignment»);
+ «layoutVarName».setMajorSpacing(«majorSpacing»);
+ «layoutVarName».setMinorSpacing(«minorSpacing»);
+ «layoutVarName».setHorizontal(«!vertical»);
+«ENDIF»
+ «owningFigureVariable».setLayoutManager(«layoutVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::CustomLayout»
+«LET "layout" + owningFigureVariable.toFirstUpper() AS layoutVarName»
+ «qualifiedClassNameGEF()» «layoutVarName» = new «qualifiedClassNameGEF()»();
+«EXPAND attr::CustomClass::Init(layoutVarName)-»
+ «owningFigureVariable».setLayoutManager(«layoutVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE alignment(EBoolean forceSingleLine) FOR gmfgraph::Alignment»
+«IF value == Alignment::BEGINNING.value-»
+«IF forceSingleLine»ALIGN_TOPLEFT«ELSE»ALIGN_LEFTTOP«ENDIF-»
+«ELSEIF value == Alignment::END.value-»
+«IF forceSingleLine»ALIGN_BOTTOMRIGHT«ELSE»ALIGN_RIGHTBOTTOM«ENDIF-»
+«ELSE-»
+ALIGN_CENTER
+«ENDIF»
+«REM»XXX implement as extension
+switch (value) {
+ case Alignment.BEGINNING : ""
+ default : ""
+}«ENDREM»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/LayoutData.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/LayoutData.xpt
new file mode 100644
index 000000000..32793af02
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/LayoutData.xpt
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::LayoutData»
+«ERROR "Abstract definition, there should be specific template for " + this»
+«ENDDEFINE»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::BorderLayoutData»
+«parentFigureVariable».add(«owningFigureVariable», org.eclipse.draw2d.BorderLayout.«borderLayoutConstant(this)»);
+«ENDDEFINE»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::XYLayoutData»
+«parentFigureVariable».add(«owningFigureVariable», «EXPAND newRectangle»);
+«ENDDEFINE»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::CustomLayoutData»
+«qualifiedClassName» constraint«owningFigureVariable.toFirstUpper()» = new «qualifiedClassName»();
+«EXPAND attr::CustomClass::Init(owningFigureVariable)»
+«parentFigureVariable».add(«owningFigureVariable», constraint«owningFigureVariable.toFirstUpper()»));
+«ENDDEFINE»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::GridLayoutData»
+«LET "constraint" + owningFigureVariable.toFirstUpper() AS constraintVarName»
+«qualifiedClassNameGEF()» «constraintVarName» = new «qualifiedClassNameGEF()»();
+«constraintVarName».verticalAlignment = «qualifiedClassNameGEF()».«verticalAlignment.name»;«REM».literal, not .name!«ENDREM»
+«constraintVarName».horizontalAlignment = «qualifiedClassNameGEF()».«horizontalAlignment.name»;
+«constraintVarName».horizontalIndent = «horizontalIndent»;
+«constraintVarName».horizontalSpan = «horizontalSpan»;
+«constraintVarName».verticalSpan = «verticalSpan»;
+«constraintVarName».grabExcessHorizontalSpace = «grabExcessHorizontalSpace»;
+«constraintVarName».grabExcessVerticalSpace = «grabExcessVerticalSpace»;
+«IF null != sizeHint-»
+«constraintVarName».widthHint = «sizeHint.dx»;
+«constraintVarName».heightHint = «sizeHint.dy»;
+«ENDIF-»
+«parentFigureVariable».add(«owningFigureVariable», «constraintVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE newRectangle FOR gmfgraph::XYLayoutData»
+new org.eclipse.draw2d.geometry.Rectangle(«IF null != topLeft-»
+«EXPAND MapMode::map FOR topLeft», «ELSE»0, 0, «ENDIF-»
+«IF null != size-»
+«EXPAND MapMode::map FOR size»«ELSE»0, 0«ENDIF»)
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/MapMode.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/MapMode.xpt
new file mode 100644
index 000000000..e08557d81
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/MapMode.xpt
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«REM»No mapMode at all«ENDREM»
+
+«DEFINE map FOR gmfgraph::Dimension-»
+«dx», «dy-»
+«ENDDEFINE»
+
+«DEFINE map FOR gmfgraph::Point-»
+«x», «y-»
+«ENDDEFINE»
+
+«DEFINE map FOR EInt»
+«this-»
+«ENDDEFINE»
+
+«DEFINE map FOR gmfgraph::Insets-»
+«top», «left», «bottom», «right-»
+«ENDDEFINE»
+
+«DEFINE Activator FOR Object-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Util.ext b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Util.ext
new file mode 100644
index 000000000..238c638a1
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Util.ext
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2005/GraphicalDefinition";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+EString compilationUnitName(gmfgraph::Figure figure) :
+ figure.name.toFirstUpper()
+;
+
+String qualifiedClassNameGEF(gmfgraph::Figure figure) :
+JAVA [FigureQualifiedNameSwitch] org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch.get(org.eclipse.emf.ecore.EObject)
+;
+
+String qualifiedClassNameGEF(gmfgraph::ScalablePolygon figure) :
+ "org.eclipse.draw2d.Shape"
+;
+
+String qualifiedClassNameGEF(gmfgraph::Layout layout) :
+JAVA [FigureQualifiedNameSwitch] org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch.get(org.eclipse.emf.ecore.EObject)
+;
+
+String qualifiedClassNameGEF(gmfgraph::LayoutData layout) :
+JAVA [FigureQualifiedNameSwitch] org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch.get(org.eclipse.emf.ecore.EObject)
+;
+
+String qualifiedClassNameGEF(gmfgraph::Border border) :
+JAVA [FigureQualifiedNameSwitch] org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch.get(org.eclipse.emf.ecore.EObject)
+;
+
+Boolean hasSourceDecoration(gmfgraph::PolylineConnection figure) :
+ null != figure.sourceDecoration
+;
+
+String packageStatement() :
+GLOBALVAR packageStatement
+;
+
+String additionalMethods() :
+GLOBALVAR outputAdditionalMethods
+;
+
+String additionalStaticFields() :
+GLOBALVAR outputStaticFields
+;
+
+String methodName(gmfgraph::CustomBorder customBorder, String figureVarName) :
+ "createBorder" + figureVarName
+;
+
+EBoolean hasTargetDecoration(gmfgraph::PolylineConnection figure) :
+ null != figure.targetDecoration
+;
+
+
+//nonNull(ecore::EObject obj) :
+// {obj}.select(e | null != e)
+//;
+
+figureVariableName(gmfgraph::Figure figure, EInt count) :
+ figure.name.toFirstLower() + count
+;
+
+figureFieldName(gmfgraph::Figure figure) :
+ "f" + figure.name
+;
+figureFieldGetter(gmfgraph::Figure figure) :
+ "getFigure" + figure.name
+;
+figureFieldSetter(gmfgraph::Figure figure) :
+ "setFigure" + figure.name
+;
+
+String borderLayoutConstant(gmfgraph::BorderLayoutData layoutData) :
+ switch (layoutData.alignment) {
+ case Alignment::BEGINNING : ( layoutData.vertical ? "TOP" : "LEFT" )
+ case Alignment::END : ( layoutData.vertical ? "BOTTOM" : "RIGHT" )
+ default : "CENTER"
+ }
+;
+
+EString messageFormat(EString pattern, List[Object] argument) :
+ JAVA java.text.MessageFormat.format(java.lang.String, java.lang.Object.List)
+; \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomClass.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomClass.javajet
deleted file mode 100644
index afd9d391e..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomClass.javajet
+++ /dev/null
@@ -1,43 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="CustomClassAttributesGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.emf.codegen.util.CodeGenUtil java.util.* "%>
-<%
-final CustomClass instance = (CustomClass) ((Object[]) argument)[0];
-//final GraphDefDispatcher dispatcher = (GraphDefDispatcher) ((Object[]) argument)[1];
-final String varName = (String) ((Object[]) argument)[2];
-boolean insertingArbitraryCode = false;
-for (Iterator attributes = instance.getAttributes().iterator(); !insertingArbitraryCode && attributes.hasNext();){
- insertingArbitraryCode = ((CustomAttribute)attributes.next()).isMultiStatementValue();
-}
-%>
-<% if (insertingArbitraryCode) {%>
- {
-<% }%>
-<%
-int attrIndex = 0;
-for (Iterator attrs = instance.getAttributes().iterator(); attrs.hasNext(); attrIndex++){
- CustomAttribute next = (CustomAttribute) attrs.next();
- String varValue;
- if (next.isMultiStatementValue()){
- varValue = "attr" + attrIndex;
-%>
- <%=java.text.MessageFormat.format(next.getValue(), new Object[] {varValue})%>;
-<% } else {
- varValue = next.getValue();
-}
- if (next.isDirectAccess()) {
-%>
- <%=varName%>.<%=next.getName()%> = <%=varValue%>;
-<%
- } else {
-%>
- <%=varName%>.set<%=CodeGenUtil.capName(next.getName())%>(<%=varValue%>);
-<%
- }
-%>
-<%
-} //for
-%>
-<% if (insertingArbitraryCode) {%>
- }
-<% }%>
-
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomClass.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomClass.xpt
new file mode 100644
index 000000000..26b38b281
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomClass.xpt
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE Init(EString instanceVarName) FOR gmfgraph::CustomClass»
+«EXPAND customAttribute(instanceVarName) FOREACH attributes»
+«ENDDEFINE»
+
+«DEFINE customAttribute(EString instanceVarName) FOR gmfgraph::CustomAttribute»
+«EXPAND customAttrValueImpl-»
+«IF directAccess»
+«instanceVarName».«name» = «EXPAND customAttrValue»;
+«ELSE»
+«instanceVarName».set«name.toFirstUpper()»(«EXPAND customAttrValue»);
+«ENDIF»
+«ENDDEFINE»
+
+«DEFINE customAttrValueImpl FOR gmfgraph::CustomAttribute»
+«IF multiStatementValue-»
+«messageFormat(value, {"attr" + name.toFirstUpper()})-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE customAttrValue FOR gmfgraph::CustomAttribute»
+«IF multiStatementValue»attr«name.toFirstUpper()»«ELSE-»«value»«ENDIF-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomFigure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomFigure.javajet
deleted file mode 100644
index cc599b288..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/CustomFigure.javajet
+++ /dev/null
@@ -1,10 +0,0 @@
-<%@ 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)%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Decoration.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Decoration.xpt
new file mode 100644
index 000000000..4e9257c39
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Decoration.xpt
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+«EXTENSION Util»
+
+«DEFINE polylineAttrs(String figureVarName) FOR gmfgraph::PolylineDecoration-»
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND templatePoints(figureVarName)-»
+«EXPAND scale(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE polylineAttrs(String figureVarName) FOR gmfgraph::PolygonDecoration-»
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND templatePoints(figureVarName)-»
+«EXPAND scale(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE templatePoints(String figureVarName) FOR gmfgraph::Polyline-»
+«IF !template.isEmpty()-»
+org.eclipse.draw2d.geometry.PointList pl = new org.eclipse.draw2d.geometry.PointList();
+«EXPAND templatePoint("pl") FOREACH template-»
+«figureVarName».setTemplate(pl);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE templatePoint(String pointListVarName) FOR gmfgraph::Point-»
+«pointListVarName».addPoint(«EXPAND MapMode::map»);
+«ENDDEFINE»
+
+«DEFINE scale(String figureVarName) FOR gmfgraph::PolylineDecoration-»
+«IF !template.isEmpty()-»
+«figureVarName».setScale(«EXPAND MapMode::map FOR 7», «EXPAND MapMode::map FOR 3»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE scale(String figureVarName) FOR gmfgraph::PolygonDecoration-»
+«IF !template.isEmpty()-»
+«figureVarName».setScale(«EXPAND MapMode::map FOR 7», «EXPAND MapMode::map FOR 3»);
+«ENDIF-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet
deleted file mode 100644
index d15a4f8a5..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet
+++ /dev/null
@@ -1,56 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="FigureAttrGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
-<%
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-final Figure figureInstance = args.getFigure();
-final String figureVarName = args.getVariableName();
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-%>
-<%
-Color colorVal;
-String colorName;
-if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_ForegroundColor())) {
- colorVal = figureInstance.getForegroundColor();
- colorName = figureInstance.getName().toUpperCase() + "_FORE";%>
- <%=figureVarName%>.setForegroundColor(<%@ include file="../Color.jetinc"%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_BackgroundColor())) {
- colorVal = figureInstance.getBackgroundColor();
- colorName = figureInstance.getName().toUpperCase() + "_BACK";%>
- <%=figureVarName%>.setBackgroundColor(<%@ include file="../Color.jetinc"%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_PreferredSize())) {
- Dimension d = figureInstance.getPreferredSize();%>
- <%=figureVarName%>.setPreferredSize(<%=dispatcher.DPtoLP(d.getDx())%>, <%=dispatcher.DPtoLP(d.getDy())%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_Size())) {
- Point p = figureInstance.getSize();%>
- <%=figureVarName%>.setSize(<%=dispatcher.DPtoLP(p.getX())%>, <%=dispatcher.DPtoLP(p.getY())%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_MaximumSize())) {
- Dimension d = figureInstance.getMaximumSize();%>
- <%=figureVarName%>.setMaximumSize(new <%=importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension")%>(<%=dispatcher.DPtoLP(d.getDx())%>, <%=dispatcher.DPtoLP(d.getDy())%>));
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_MinimumSize())) {
- Dimension d = figureInstance.getMinimumSize();%>
- <%=figureVarName%>.setMinimumSize(new <%=importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension")%>(<%=dispatcher.DPtoLP(d.getDx())%>, <%=dispatcher.DPtoLP(d.getDy())%>));
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_Font())) {
- // XXX possible CCE when fonts other than Basic added to model
- BasicFont font = (BasicFont) figureInstance.getFont();
- String fontName = font.getFaceName();
- if (fontName == null || fontName.trim().length() == 0){
- org.eclipse.swt.graphics.Font system = org.eclipse.swt.widgets.Display.getDefault().getSystemFont();
- if (system != null && system.getFontData().length > 0){
- fontName = system.getFontData()[0].getName();
- }
- }
- %>
- <%=figureVarName%>.setFont(
- <%=dispatcher.getStaticFieldsManager().addStaticField(
- importManager.getImportedName("org.eclipse.swt.graphics.Font"),
- figureInstance.getName().toUpperCase() + "_FONT",
- "new " + importManager.getImportedName("org.eclipse.swt.graphics.Font") + "(" + importManager.getImportedName("org.eclipse.swt.widgets.Display") + ".getCurrent(), \"" + fontName + "\", " + font.getHeight() + ", " + importManager.getImportedName("org.eclipse.swt.SWT") + "." + font.getStyle().getLiteral() + ")"
- )%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_Insets())) {
- Insets insets = figureInstance.getInsets();%>
- <%=figureVarName%>.setBorder(new <%=importManager.getImportedName("org.eclipse.draw2d.MarginBorder")%>(<%=dispatcher.DPtoLP(insets.getTop())%>, <%=dispatcher.DPtoLP(insets.getLeft())%>, <%=dispatcher.DPtoLP(insets.getBottom())%>, <%=dispatcher.DPtoLP(insets.getRight())%>));
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_Border())) {
- Border border = figureInstance.getBorder();%>
- <%=figureVarName%>.setBorder(<%=dispatcher.dispatch(border, new Object[] {border, dispatcher})%>);
-<%}%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.xpt
new file mode 100644
index 000000000..844e8eeb2
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.xpt
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+«EXTENSION Util»
+
+«DEFINE figureAttrs(EString figureVarName) FOR gmfgraph::Figure-»
+«EXPAND foregroundColor(this, figureVarName) FOR foregroundColor-»
+«EXPAND backgroundColor(this, figureVarName) FOR backgroundColor-»
+«EXPAND font(this, figureVarName) FOR font-»
+«EXPAND preferredSize(figureVarName) FOR preferredSize-»
+«EXPAND maximumSize(figureVarName) FOR maximumSize-»
+«EXPAND minimumSize(figureVarName) FOR minimumSize-»
+«EXPAND size(figureVarName) FOR size-»
+«EXPAND insets(figureVarName) FOR insets-»
+«EXPAND Border::Init(figureVarName) FOR border-»
+«ENDDEFINE»
+
+«DEFINE foregroundColor(gmfgraph::Figure figure, String figureVarName) FOR gmfgraph::Color-»
+ «figureVarName».setForegroundColor(«EXPAND color(figure.name.toUpperCase() + "_FORE")»);
+«ENDDEFINE»
+«DEFINE backgroundColor(gmfgraph::Figure figure, String figureVarName) FOR gmfgraph::Color-»
+ «figureVarName».setBackgroundColor(«EXPAND color(figure.name.toUpperCase() + "_BACK")»);
+«ENDDEFINE»
+
+«DEFINE preferredSize(EString figureVarName) FOR gmfgraph::Dimension-»
+«figureVarName».setPreferredSize(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE maximumSize(EString figureVarName) FOR gmfgraph::Dimension-»
+«figureVarName».setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE minimumSize(EString figureVarName) FOR gmfgraph::Dimension-»
+«figureVarName».setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE size(EString figureVarName) FOR gmfgraph::Point-»
+«figureVarName».setSize(«EXPAND MapMode::map»);
+«ENDDEFINE»
+
+«DEFINE insets(EString figureVarName) FOR gmfgraph::Insets-»
+«REM»using MarginBorder for insets is not good idea«ENDREM»
+«figureVarName».setBorder(new org.eclipse.draw2d.MarginBorder(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE font(Figure figure, EString figureVarName) FOR gmfgraph::Font»
+«ERROR "This is abstact definition, just to overcome some xpand polymorphism limitations"»
+«ENDDEFINE»
+
+«DEFINE color(String variableName) FOR gmfgraph::Color»
+«ERROR "This is abstact definition, just to overcome some xpand polymorphism limitations"»
+«ENDDEFINE»
+
+«DEFINE color(String variableName) FOR gmfgraph::RGBColor-»
+«variableName-»
+«FILE "" staticFields»
+static final org.eclipse.swt.graphics.Color «variableName» = new org.eclipse.swt.graphics.Color(null, «red», «green», «blue»);
+«ENDFILE»
+«ENDDEFINE»
+
+«DEFINE color(String variableName) FOR gmfgraph::ConstantColor-»
+org.eclipse.draw2d.ColorConstants.«value.literal-»
+«ENDDEFINE»
+
+«DEFINE font(Figure figure, EString figureVarName) FOR gmfgraph::BasicFont-»
+«LET figure.name + "_FONT" AS variableName»
+«figureVarName».setFont(«variableName»);
+«FILE "" staticFields»
+static final org.eclipse.swt.graphics.Font «variableName» = new org.eclipse.swt.graphics.Font(org.eclipse.swt.widgets.Display.getCurrent(), «IF null == faceName || faceName.trim().length() == 0»org.eclipse.swt.widgets.Display.getDefault().getSystemFont().getFontData()[0].getName()«ELSE»"«faceName»"«ENDIF», «height», org.eclipse.swt.SWT.«style.literal»);
+«ENDFILE»
+«ENDLET»
+«ENDDEFINE»
+
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet
deleted file mode 100644
index ee6031beb..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet
+++ /dev/null
@@ -1,11 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="LabelAttrGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
-<%
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-final Label figureInstance = (Label) args.getFigure();
-final String figureVarName = args.getVariableName();
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-%>
-<%if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getLabel_Text())) {%>
-<%=figureVarName%>.setText("<%=figureInstance.getText()%>");
-<%}%><%=dispatcher.dispatch("Figure", args)%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet
deleted file mode 100644
index f6a79b709..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet
+++ /dev/null
@@ -1,7 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="PolygonDecorationAttrGenerator"
- imports="org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
-<%
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-%>
-<%=dispatcher.dispatch("PolylineDecoration", args)%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet
deleted file mode 100644
index 2fc5a5704..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet
+++ /dev/null
@@ -1,16 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="PolylineAttrGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
-<%
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-final Polyline figureInstance = (Polyline) args.getFigure();
-final String figureVarName = args.getVariableName();
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-%>
-<%=dispatcher.dispatch("Shape", args)%>
-<%if (!figureInstance.getTemplate().isEmpty()) {
- final String pointClassName = importManager.getImportedName("org.eclipse.draw2d.geometry.Point");
- for (java.util.Iterator pointIt = figureInstance.getTemplate().iterator(); pointIt.hasNext(); ) {
- Point p = (Point) pointIt.next();%>
- <%=figureVarName%>.addPoint(new <%=pointClassName%>(<%=p.getX()%>, <%=p.getY()%>));
-<%}}%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet
deleted file mode 100644
index d7f485228..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet
+++ /dev/null
@@ -1,21 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="PolylineDecorationAttrGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher java.util.*"%>
-<%
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-// not PolylineDecoration, as we use same template from PolygonDecoration
-final Polyline figureInstance = (Polyline) args.getFigure();
-final String figureVarName = args.getVariableName();
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-%>
-// dispatchNext?
-<%=dispatcher.dispatch("Shape", args)%>
-<%if (!figureInstance.getTemplate().isEmpty()) {%>
- <%=importManager.getImportedName("org.eclipse.draw2d.geometry.PointList")%> pl = new <%=importManager.getImportedName("org.eclipse.draw2d.geometry.PointList")%>();
-<% for (Iterator pointIt = figureInstance.getTemplate().iterator(); pointIt.hasNext(); ) {
- Point p = (Point) pointIt.next();%>
- pl.addPoint(<%=p.getX()%>, <%=p.getY()%>);
-<% } /*for*/ %>
- <%=figureVarName%>.setTemplate(pl);
- <%=figureVarName%>.setScale(<%=dispatcher.DPtoLP(7)%>, <%=dispatcher.DPtoLP(3)%>);
-<% } /*!if getTemplate().isEmpty()*/ %>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet
deleted file mode 100644
index 3267b4b51..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet
+++ /dev/null
@@ -1,11 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="RoundedRectAttrGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
-<%
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-final RoundedRectangle figureInstance = (RoundedRectangle) args.getFigure();
-final String figureVarName = args.getVariableName();
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-%>
-<%=dispatcher.dispatch("Shape", args)%>
-<%=figureVarName%>.setCornerDimensions(new <%=importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension")%>(<%=dispatcher.DPtoLP(figureInstance.getCornerWidth())%>, <%=dispatcher.DPtoLP(figureInstance.getCornerHeight())%>));
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet
deleted file mode 100644
index 934a11c6a..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet
+++ /dev/null
@@ -1,27 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="ShapeAttrGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
-<%
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-final Shape figureInstance = (Shape) args.getFigure();
-final String figureVarName = args.getVariableName();
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-%>
-<%
-// Most of the properties are set only if corresponding eProperty isSet.
-// The difference is in the default values. If default value of eProperty matches d2d one, the setter may be omitted.
-// d2d.Shape#fill == true (matches default of gmfgraph.Shape#fill), while d2d.Polyline#fill == false, thus we need additional check.
-// Note Polygon in the check instead of Polyline - (it looks like) there's no sense to setFill(true) for polylines in any case.
-%><%if (figureInstance instanceof Polygon ^ figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Fill())) {%>
- <%=figureVarName%>.setFill(<%=figureInstance.isFill()%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Outline())) {%>
- <%=figureVarName%>.setOutline(<%=figureInstance.isOutline()%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineWidth())) {%>
- <%=figureVarName%>.setLineWidth(<%=figureInstance.getLineWidth()%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineKind())) {%>
- <%=figureVarName%>.setLineStyle(<%=importManager.getImportedName("org.eclipse.draw2d.Graphics")%>.<%=figureInstance.getLineKind().getName()%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorFill())) {%>
- <%=figureVarName%>.setFillXOR(<%=figureInstance.isXorFill()%>);
-<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorOutline())) {%>
- <%=figureVarName%>.setOutlineXOR(<%=figureInstance.isXorOutline()%>);
-<%}%><%=dispatcher.dispatch("Figure", args)%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.xpt
new file mode 100644
index 000000000..0cc32c81f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.xpt
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+// XXX call figureAttrs from this?
+«DEFINE shapeAttrs(EString figureVarName) FOR Shape-»
+«EXPAND fill(figureVarName)-»
+«EXPAND xorFill(figureVarName)-»
+«EXPAND outline(figureVarName)-»
+«EXPAND xorOutline(figureVarName)-»
+«EXPAND lineWidth(figureVarName)-»
+«EXPAND lineKind(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE fill(EString figureVarName) FOR Shape-»
+«figureVarName».setFill(«fill»);
+«ENDDEFINE»
+
+«DEFINE xorFill(EString figureVarName) FOR Shape-»
+«figureVarName».setFillXOR(«xorFill»);
+«ENDDEFINE»
+
+«DEFINE outline(EString figureVarName) FOR Shape-»
+«figureVarName».setOutline(«outline»);
+«ENDDEFINE»
+
+«DEFINE xorOutline(EString figureVarName) FOR Shape-»
+«figureVarName».setOutlineXOR(«xorOutline»);
+«ENDDEFINE»
+
+«DEFINE lineWidth(EString figureVarName) FOR Shape-»
+«figureVarName».setLineWidth(«lineWidth»);
+«ENDDEFINE»
+
+«DEFINE lineKind(EString figureVarName) FOR Shape-»
+«figureVarName».setLineStyle(org.eclipse.draw2d.Graphics.«lineKind.literal»);
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
deleted file mode 100644
index b687ec355..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
+++ /dev/null
@@ -1,98 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="FigureChildrenGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.emf.codegen.util.CodeGenUtil java.util.*"%>
-<%
-GraphDefDispatcher.LayoutArgs parentArgs = (GraphDefDispatcher.LayoutArgs) argument;
-final Figure root = parentArgs.getFigure();
-final GraphDefDispatcher dispatcher = parentArgs.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-
-final List/*<Figure>*/ fieldsRequired = new LinkedList/*<Figure>*/();
-final Stack/*GraphDefDispatcher.LayoutArgs*/ contextStack = new Stack/*GraphDefDispatcher.LayoutArgs*/();
-final LinkedList queue = new LinkedList();
-final Object marker = new Object();
-final NamingStrategy namingStrategy = NamingStrategy.INSTANCE;
-
-class FieldSupport {
- private final Figure myRoot;
-
- public FieldSupport(Figure root){
- myRoot = root;
- }
-
- public boolean isFieldRequired(Figure descendant){
- return myRoot.equals(descendant.getParent()) || !descendant.getReferencingElements().isEmpty();
- }
-}
-final FieldSupport fieldSupport = new FieldSupport(root);
-
-%>
-
- /**
- * @generated
- */
- private void createContents(){
-<%
-queue.addAll(root.getChildren());
-int figureCount = 0;
-while (!queue.isEmpty()){
- Object _nxt = queue.removeFirst();
- if (_nxt == marker){
- parentArgs = (GraphDefDispatcher.LayoutArgs)contextStack.pop();
- continue;
- }
- if (_nxt instanceof FigureRef) {
- throw new IllegalStateException("FIXME: sorry, don't support FigureRef for a while");
- }
- final Figure nextChild = (Figure) _nxt;
- final String childVarName = "fig_" + figureCount;
- final String childLayoutManager = "layouter" + figureCount;
- final String childConstraint = "layData" + figureCount;
- figureCount++;
-
- // FIXME instantiate - FigureRef - dispatch to 'instantiate' template?
- GraphDefDispatcher.LayoutArgs nextLevelArgs = dispatcher.createLayoutArgs(nextChild, childVarName, childLayoutManager, childConstraint);%>
- <%=dispatcher.dispatch("instantiate", nextLevelArgs)%>
-<%
-if (fieldSupport.isFieldRequired(nextChild)){
- fieldsRequired.add(nextChild); %>
- setFigure<%=nextChild.getName()%>(<%=childVarName%>);
-<%}%>
- <%=dispatcher.dispatch("createLayoutData", nextLevelArgs)%>
- <%=parentArgs.getVariableName()%>.add(<%=childVarName%>, <%=childConstraint%>);
-<%
- if (!nextChild.getChildren().isEmpty()) {
- queue.addFirst(marker);
- queue.addAll(0, nextChild.getChildren());
- contextStack.push(parentArgs);
- parentArgs = nextLevelArgs; // go on processing children of new parentFigure
- }
-} // while
-%>
- }
-
-<%
- final FigureQualifiedNameSwitch fqnSwitch = dispatcher.getFQNSwitch();
- for (Iterator fieldFigures = fieldsRequired.iterator(); fieldFigures.hasNext();){
- Figure next = (Figure)fieldFigures.next();
- final String nextClassName = fqnSwitch.get(next, importManager);%>
-
- /**
- * @generated
- */
- private <%=nextClassName%> f<%=CodeGenUtil.capName(next.getName())%>;
-
- /**
- * @generated
- */
- public <%=nextClassName%> <%=namingStrategy.getChildFigureGetterName(next)%>() {
- return f<%=CodeGenUtil.capName(next.getName())%>;
- }
-
- /**
- * @generated
- */
- private void setFigure<%=next.getName()%>(<%=nextClassName%> fig){
- f<%=CodeGenUtil.capName(next.getName())%> = fig;
- }
-
-<% }%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/BorderLayout.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/BorderLayout.javajet
deleted file mode 100644
index f52f0e27c..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/BorderLayout.javajet
+++ /dev/null
@@ -1,17 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitBorderLayoutGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final BorderLayout gmfLayout = (BorderLayout) argsBundle.getLayout();
-final String layouterVarName = argsBundle.getManagerVariableName();
-%>
-
-<%
-Dimension spacing = gmfLayout.getSpacing();
-if (spacing != null){
-%>
- <%=layouterVarName%>.setHorizontalSpacing(<%=spacing.getDx()%>);
- <%=layouterVarName%>.setVerticalSpacing(<%=spacing.getDy()%>);
-<%
-}
-%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/CustomLayout.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/CustomLayout.javajet
deleted file mode 100644
index dd81216f0..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/CustomLayout.javajet
+++ /dev/null
@@ -1,8 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitCustomLayoutGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final CustomLayout layout = (CustomLayout) argsBundle.getLayout();
-final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-%>
-<%=dispatcher.dispatch("customAttributes", new Object[] {layout, dispatcher, argsBundle.getManagerVariableName()} )%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/FlowLayout.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/FlowLayout.javajet
deleted file mode 100644
index f6de3b9b1..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/FlowLayout.javajet
+++ /dev/null
@@ -1,71 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitFlowLayoutGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final FlowLayout gmfLayout = (FlowLayout) argsBundle.getLayout();
-final String layouterVarName = argsBundle.getManagerVariableName();
-final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-final String layouterClassName = dispatcher.getFQNSwitch().get(gmfLayout, dispatcher.getImportManager());
-
-class AlignmentConverter {
- private final String myBegin;
- private final String myCenter;
- private final String myEnd;
-
- public AlignmentConverter(String begin, String center, String end){
- myBegin = begin;
- myCenter = center;
- myEnd = end;
- }
-
- public String convert(Alignment alignment){
- if (alignment == null){
- alignment = Alignment.BEGINNING_LITERAL;
- }
- switch (alignment.getValue()){
- case Alignment.BEGINNING :
- return myBegin;
- case Alignment.END :
- return myEnd;
- case Alignment.FILL:
- case Alignment.CENTER:
- return myCenter;
- default:
- throw new IllegalArgumentException("Unknown alignment: " + alignment);
- }
- }
-}
-
-class AlignmentFacade {
- public String convert(FlowLayout layout, Alignment alignment){
- return getConverter(layout).convert(alignment);
- }
-
- private AlignmentConverter getConverter(FlowLayout layout){
- return layout.isForceSingleLine() ?
- new AlignmentConverter("ALIGN_TOPLEFT", "ALIGN_CENTER", "ALIGN_BOTTOMRIGHT") :
- new AlignmentConverter("ALIGN_LEFTTOP", "ALIGN_CENTER", "ALIGN_RIGHTBOTTOM");
- }
-}
-
-final AlignmentFacade alignmentFacade = new AlignmentFacade();
-%>
- <%=layouterVarName%>.setStretchMinorAxis(<%=gmfLayout.isMatchMinorSize()%>);
- <%=layouterVarName%>.setMinorAlignment(<%=layouterClassName%>.<%=alignmentFacade.convert(gmfLayout, gmfLayout.getMinorAlignment())%>);
-<%
-if (gmfLayout.isForceSingleLine()){
-%>
- <%=layouterVarName%>.setSpacing(<%=gmfLayout.getMajorSpacing()%>);
- <%=layouterVarName%>.setVertical(<%=gmfLayout.isVertical()%>);
-<%
-} else {
-%>
- <%=layouterVarName%>.setMajorAlignment(<%=layouterClassName%>.<%=alignmentFacade.convert(gmfLayout, gmfLayout.getMajorAlignment())%>);
- <%=layouterVarName%>.setMajorSpacing(<%=gmfLayout.getMajorSpacing()%>);
- <%=layouterVarName%>.setMinorSpacing(<%=gmfLayout.getMinorSpacing()%>);
- <%=layouterVarName%>.setHorizontal(<%=!gmfLayout.isVertical()%>);
-<%
-}
-%>
-
-
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/GridLayout.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/GridLayout.javajet
deleted file mode 100644
index 52c7ec1cd..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layout/GridLayout.javajet
+++ /dev/null
@@ -1,25 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitGridLayoutGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final GridLayout gmfLayout = (GridLayout) argsBundle.getLayout();
-final String layouterVarName = argsBundle.getManagerVariableName();
-%>
- <%=layouterVarName%>.numColumns = <%=gmfLayout.getNumColumns()%>;
- <%=layouterVarName%>.makeColumnsEqualWidth = <%=gmfLayout.isEqualWidth()%>;
-<%
-Dimension margins = gmfLayout.getMargins();
-if (margins != null){
-%>
- <%=layouterVarName%>.marginWidth = <%=margins.getDx()%>;
- <%=layouterVarName%>.marginHeight = <%=margins.getDy()%>;
-<%
-}
-Dimension spacing = gmfLayout.getSpacing();
-if (spacing != null){
-%>
- <%=layouterVarName%>.horizontalSpacing = <%=spacing.getDx()%>;
- <%=layouterVarName%>.verticalSpacing = <%=spacing.getDy()%>;
-<%
-}
-%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/BorderLayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/BorderLayoutData.javajet
deleted file mode 100644
index f747ec7df..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/BorderLayoutData.javajet
+++ /dev/null
@@ -1,39 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitBorderLayoutDataGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final BorderLayoutData gmfLayoutData = (BorderLayoutData) argsBundle.getData();
-final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-%>
-
-<%
-Alignment alignment = gmfLayoutData.getAlignment();
-if (alignment == null){
- alignment = Alignment.CENTER_LITERAL;
-}
-final String constantName;
-switch(alignment.getValue()){
- case Alignment.CENTER:
- case Alignment.FILL:
- constantName = "CENTER";
- break;
- case Alignment.BEGINNING:
- if (gmfLayoutData.isVertical()){
- constantName = "TOP";
- } else {
- constantName = "LEFT";
- }
- break;
- case Alignment.END:
- if (gmfLayoutData.isVertical()){
- constantName = "BOTTOM";
- } else {
- constantName = "RIGHT";
- }
- break;
- default:
- throw new IllegalArgumentException("Unknown Alignment: " + gmfLayoutData.getAlignment());
-}
-%>
- Object <%=argsBundle.getConstraintVariableName()%> = <%=dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout")%>.<%=constantName%>;
-
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/CustomLayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/CustomLayoutData.javajet
deleted file mode 100644
index 5708ddd79..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/CustomLayoutData.javajet
+++ /dev/null
@@ -1,11 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitCustomLayoutDataGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.LayoutArgs args = (GraphDefDispatcher.LayoutArgs) argument;
-final CustomLayoutData layoutData = (CustomLayoutData) args.getData();
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-final String layoutImplClassName = dispatcher.getFQNSwitch().get(layoutData, dispatcher.getImportManager());
-%>
-<%=layoutImplClassName%> <%=args.getConstraintVariableName()%> = new <%=layoutImplClassName%>();
-<%=dispatcher.dispatch("customAttributes", new Object[] {layoutData, dispatcher, args.getConstraintVariableName()})%>
-
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet
deleted file mode 100644
index 363996220..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet
+++ /dev/null
@@ -1,29 +0,0 @@
-
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitGridLayoutDataGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final GridLayoutData gmfLayoutData = (GridLayoutData) argsBundle.getData();
-final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-final String layoutConstraintVarName = argsBundle.getConstraintVariableName();
-
-final String layoutImplClassName = dispatcher.getFQNSwitch().get(gmfLayoutData, dispatcher.getImportManager());
-%>
- <%=layoutImplClassName%> <%=layoutConstraintVarName%> = new <%=layoutImplClassName%>();
- <%=layoutConstraintVarName%>.verticalAlignment = <%=layoutImplClassName%>.<%=gmfLayoutData.getVerticalAlignment().getName()%>;
- <%=layoutConstraintVarName%>.horizontalAlignment = <%=layoutImplClassName%>.<%=gmfLayoutData.getHorizontalAlignment().getName()%>;
-<%
-Dimension sizeHint = gmfLayoutData.getSizeHint();
-if (sizeHint != null){
-%>
- <%=layoutConstraintVarName%>.widthHint = <%=sizeHint.getDx()%>;
- <%=layoutConstraintVarName%>.heightHint = <%=sizeHint.getDy()%>;
-<%
-}
-%>
- <%=layoutConstraintVarName%>.horizontalIndent = <%=gmfLayoutData.getHorizontalIndent()%>;
- <%=layoutConstraintVarName%>.horizontalSpan = <%=gmfLayoutData.getHorizontalSpan()%>;
- <%=layoutConstraintVarName%>.verticalSpan = <%=gmfLayoutData.getVerticalSpan()%>;
- <%=layoutConstraintVarName%>.grabExcessHorizontalSpace = <%=gmfLayoutData.isGrabExcessHorizontalSpace()%>;
- <%=layoutConstraintVarName%>.grabExcessVerticalSpace = <%=gmfLayoutData.isGrabExcessVerticalSpace()%>;
-
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/XYLayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/XYLayoutData.javajet
deleted file mode 100644
index 24b12f7cd..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/XYLayoutData.javajet
+++ /dev/null
@@ -1,29 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitXYLayoutDataGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final XYLayoutData gmfLayoutData = (XYLayoutData) argsBundle.getData();
-final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-final String layoutConstraintVarName = argsBundle.getConstraintVariableName();
-
-final String layoutImplClassName = dispatcher.getFQNSwitch().get(gmfLayoutData, dispatcher.getImportManager());
-%>
- <%=layoutImplClassName%> <%=layoutConstraintVarName%> = new <%=layoutImplClassName%>();
-<%
-Point topLeft = gmfLayoutData.getTopLeft();
-if (topLeft != null){
-%>
- <%=layoutConstraintVarName%>.x = <%=topLeft.getX()%>;
- <%=layoutConstraintVarName%>.y = <%=topLeft.getY()%>;
-<%
-}
-%>
-<%
-Dimension size = gmfLayoutData.getSize();
-if (size != null){
-%>
- <%=layoutConstraintVarName%>.width = <%=size.getDx()%>;
- <%=layoutConstraintVarName%>.height = <%=size.getDy()%>;
-<%
-}
-%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/CompoundBorder.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/CompoundBorder.javajet
deleted file mode 100644
index b0c1953d3..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/CompoundBorder.javajet
+++ /dev/null
@@ -1,17 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewCompoundBorderExpressionGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.* org.eclipse.gmf.common.codegen.ImportAssistant"%>
-<%
-Object[] args = (Object[]) argument;
-final CompoundBorder border = (CompoundBorder)args[0];
-final GraphDefDispatcher dispatcher = (GraphDefDispatcher)args[1];
-final ImportAssistant importManager = dispatcher.getImportManager();
-
-//We want NEITHER insert any names into the scope NOR produce statement. We need expression instead.
-%>
- <% Border outer = border.getOuter();
- Border inner = border.getInner();
- %>
-new <%=importManager.getImportedName("org.eclipse.draw2d.CompoundBorder")%>(
- <%= (outer == null) ? "null" : dispatcher.dispatch(outer, new Object[]{outer, dispatcher})%>,
- <%= (inner == null) ? "null" : dispatcher.dispatch(inner, new Object[]{inner, dispatcher})%>
-)
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/CustomBorder.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/CustomBorder.javajet
deleted file mode 100644
index e77fec827..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/CustomBorder.javajet
+++ /dev/null
@@ -1,11 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewCustomBorderExpressionGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-Object[] args = (Object[]) argument;
-final CustomBorder border = (CustomBorder)args[0];
-final GraphDefDispatcher dispatcher = (GraphDefDispatcher)args[1];
-//final ImportAssistant importManager = dispatcher.getImportManager();
-
-//We want NEITHER insert any names into the scope NOR produce statement. We need expression instead.
-//@see customBorderFactoryMethod.jetinc
-%><%=dispatcher.getAuxiliaryDataStorage().getRegisteredData(border)%>()
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet
deleted file mode 100644
index 8fdb00dfc..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet
+++ /dev/null
@@ -1,14 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewFigureGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-final Figure figureInstance = args.getFigure();
-final String figureVarName = args.getVariableName();
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-final String figureClassName = dispatcher.getFQNSwitch().get(figureInstance, dispatcher.getImportManager());
-
-// PRODUCES instance AND (!) initializes attributes
-%>
-<%=figureClassName%> <%=figureVarName%> = new <%=figureClassName%>();
-<%=args.getDispatcher().dispatch(figureInstance, args)%>
-<%=args.getDispatcher().dispatch("createLayout", dispatcher.getLayoutArgsFor(args))%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Layout.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Layout.javajet
deleted file mode 100644
index e298ae16c..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Layout.javajet
+++ /dev/null
@@ -1,21 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewLayoutGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final FigureMarker figureMarker = argsBundle.getFigure();
-final String figureVarName = argsBundle.getVariableName();
-final String layouterVarName = argsBundle.getManagerVariableName();
-final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-%>
-
-<%
-Layout gmfLayout= figureMarker.getLayout();
-if (gmfLayout != null){
- final String layouterImplClass = dispatcher.getFQNSwitch().get(gmfLayout, dispatcher.getImportManager());
-%>
- <%=layouterImplClass%> <%=layouterVarName%> = new <%=layouterImplClass%>();
- <%=argsBundle.getDispatcher().dispatch(gmfLayout, argsBundle)%>
- <%=figureVarName%>.setLayoutManager(<%=layouterVarName%>);
-<%
-}
-%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LayoutData.javajet
deleted file mode 100644
index 5fca8b7ec..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LayoutData.javajet
+++ /dev/null
@@ -1,18 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewLayoutDataGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-// NOTE: this code expects that constrainted figure is already added to its parent
-
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-final LayoutData gmfLayoutData = argsBundle.getData();
-final Figure figureInstance = argsBundle.getFigure();
-
-// merely makes sure layoutData present
-// and parent figure got chance to have layout initialized
-
-if (gmfLayoutData != null && figureInstance.eContainer() instanceof Figure && ((Figure) figureInstance.eContainer()).getLayout() != null) {%>
-<%=dispatcher.dispatch(gmfLayoutData, argsBundle)%>
-<%} else {%>
- Object <%=argsBundle.getConstraintVariableName()%> = null;
-<%}%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LineBorder.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LineBorder.javajet
deleted file mode 100644
index 35824e222..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LineBorder.javajet
+++ /dev/null
@@ -1,35 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewLineBorderExpressionGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.* org.eclipse.gmf.common.codegen.ImportAssistant"%>
-<%
-Object[] args = (Object[]) argument;
-final LineBorder border = (LineBorder)args[0];
-final GraphDefDispatcher dispatcher = (GraphDefDispatcher)args[1];
-final ImportAssistant importManager = dispatcher.getImportManager();
-
-//We do not want to insert any names into the scope.
-//We want to provide EXPRESSION instead of statement
-%>
-<%
- String borderClazz = importManager.getImportedName("org.eclipse.draw2d.LineBorder");
- boolean hasColor = border.eIsSet(GMFGraphPackage.eINSTANCE.getLineBorder_Color());
- boolean hasWidth = border.eIsSet(GMFGraphPackage.eINSTANCE.getLineBorder_Width());
- Color colorVal = (hasColor) ? border.getColor() : null;
- String colorName = (hasColor) ? "BORDER" : null;
- if (hasColor && hasWidth){
-%>
-new <%=borderClazz%>(<%@ include file="../Color.jetinc"%>, <%=dispatcher.DPtoLP(border.getWidth())%>)
-<%
- } else if (hasColor && !hasWidth) {
-%>
-new <%=borderClazz%>(<%@ include file="../Color.jetinc"%>)
-<%
- } else if (!hasColor && hasWidth){
-%>
-new <%=borderClazz%>(<%=dispatcher.DPtoLP(border.getWidth())%>)
-<%
- } else {
-%>
-new <%=borderClazz%>()
-<%
- }
-%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/MarginBorder.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/MarginBorder.javajet
deleted file mode 100644
index 30a8c2a76..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/MarginBorder.javajet
+++ /dev/null
@@ -1,24 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewMarginBorderExpressionGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.* org.eclipse.gmf.common.codegen.ImportAssistant"%>
-<%
-Object[] args = (Object[]) argument;
-final MarginBorder border = (MarginBorder)args[0];
-final GraphDefDispatcher dispatcher = (GraphDefDispatcher)args[1];
-final ImportAssistant importManager = dispatcher.getImportManager();
-
-//Produces EXPRESSION instead of statement
-%>
-<%
- int top = 0;
- int left = 0;
- int bottom = 0;
- int right = 0;
- if (border.eIsSet(GMFGraphPackage.eINSTANCE.getMarginBorder_Insets())){
- Insets insets = border.getInsets();
- top = insets.getTop();
- left = insets.getLeft();
- bottom = insets.getBottom();
- right = insets.getRight();
- }
-%>
-new <%=importManager.getImportedName("org.eclipse.draw2d.MarginBorder")%>(<%=dispatcher.DPtoLP(top)%>, <%=dispatcher.DPtoLP(left)%>, <%=dispatcher.DPtoLP(bottom)%>, <%=dispatcher.DPtoLP(right)%>)
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Activator.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Activator.xpt
new file mode 100644
index 000000000..05d0b8b1c
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Activator.xpt
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+
+«DEFINE Init(String packageName, String pluginActivatorClassName, String pluginID) FOR Object-»
+package «packageName»;
+
+/**
+ * @generated
+ */
+public class «pluginActivatorClassName» extends org.eclipse.core.runtime.Plugin {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "«pluginID»"; //\u0024NON-NLS-1\u0024 XXX FIXME DollarSign support
+
+ /**
+ * @generated
+ */
+ private static «pluginActivatorClassName» ourInstance;
+
+ /**
+ * @generated
+ */
+ public «pluginActivatorClassName»() {
+ }
+
+ /**
+ * @generated
+ */
+ public void start(org.osgi.framework.BundleContext context) throws Exception {
+ super.start(context);
+ ourInstance = this;
+ }
+
+ /**
+ * @generated
+ */
+ public void stop(org.osgi.framework.BundleContext context) throws Exception {
+ ourInstance = null;
+ super.stop(context);
+ }
+
+ /**
+ * @generated
+ */
+ public static «pluginActivatorClassName» getDefault() {
+ return ourInstance;
+ }
+«EXPAND MapMode::Activator-»
+}
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/BuildProperties.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/BuildProperties.xpt
new file mode 100644
index 000000000..3781d4419
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/BuildProperties.xpt
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«DEFINE Init FOR Object-»
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Manifest.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Manifest.xpt
new file mode 100644
index 000000000..d5eb87bb3
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Manifest.xpt
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«DEFINE Init(String pluginID, String pluginActivatorQualifiedName, List[String] exportedPackages, List[String] requiredBundles) FOR Object-»
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: «pluginID»; singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: %providerName
+Bundle-Activator: «pluginActivatorQualifiedName»
+Bundle-Localization: plugin
+Export-Package:«EXPAND exportPackageHeader FOR exportedPackages»
+«LET requiredBundles.union({"org.eclipse.core.runtime","org.eclipse.draw2d"}) AS s-»
+Require-Bundle:«EXPAND requireBundleHeader FOR s»
+«ENDLET-»
+Eclipse-LazyStart: true
+«ENDDEFINE»
+
+«DEFINE exportPackageHeader FOR List[String]-»
+«EXPAND print FOREACH this SEPARATOR ",\n"-»
+«ENDDEFINE»
+
+«REM»FIXME Set[String] - improve union recognition«ENDREM»
+«DEFINE requireBundleHeader FOR Set[Object]-»
+«EXPAND print FOREACH this.typeSelect(String) SEPARATOR ",\n"-»
+«ENDDEFINE»
+
+«DEFINE print FOR string» «this»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet
deleted file mode 100644
index bcfa05018..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet
+++ /dev/null
@@ -1,107 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.standalone.templates" class="PluginActivatorGenerator"
- imports="org.eclipse.gmf.graphdef.codegen.* org.eclipse.gmf.common.codegen.ImportAssistant"%>
-<%
-final Object[] passedArgs = (Object[]) argument;
-final StandaloneGenerator.Config config = (StandaloneGenerator.Config) passedArgs[0];
-final ImportAssistant importManager = (ImportAssistant) passedArgs[1];
-
-importManager.emitPackageStatement(stringBuffer);
-%>
-
-import org.eclipse.core.runtime.Plugin;
-
-<%
-if (config.needsMapMode()){
-%>
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes;
-<%
-}
-%>
-
-import org.osgi.framework.BundleContext;
-<%importManager.markImportLocation(stringBuffer);%>
-
-/**
- * @generated
- */
-public class <%=importManager.getCompilationUnitName()%> extends Plugin {
-
-<%
-if (config.needsMapMode()){
-%>
- private IMapMode myMapMode = MapModeTypes.IDENTITY_MM;
-<%
-}
-%>
-
- /**
- * @generated
- */
- public static final String ID = "<%=config.getPluginID()%>"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private static <%=config.getPluginActivatorClassName()%> ourInstance;
-
- /**
- * @generated
- */
- public <%=config.getPluginActivatorClassName()%>() {
- }
-
- /**
- * @generated
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- if (ourInstance != null){
- throw new IllegalStateException("Plugin: " + ID + " already started");
- }
- ourInstance = this;
- }
-
- /**
- * @generated
- */
- public void stop(BundleContext context) throws Exception {
- if (ourInstance == null){
- throw new IllegalStateException("Plugin: " + ID + " is not started");
- }
- ourInstance = null;
- super.stop(context);
- }
-
-<%
-if (config.needsMapMode()){
-%>
- /**
- * @generated
- */
- public void setMapMode(IMapMode mapMode) {
- myMapMode = mapMode;
- if (myMapMode == null){
- myMapMode = MapModeTypes.IDENTITY_MM;
- }
- }
-
- /**
- * @generated
- */
- public IMapMode getMapMode() {
- return myMapMode;
- }
-
-<%
-}
-%>
-
- /**
- * @generated
- */
- public static <%=config.getPluginActivatorClassName()%> getDefault() {
- return ourInstance;
- }
-}
-<%importManager.emitSortedImports();%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/PluginProperties.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/PluginProperties.xpt
new file mode 100644
index 000000000..17aa50af1
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/PluginProperties.xpt
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«DEFINE Init(String pluginName, String providerName) FOR Object-»
+pluginName = «pluginName»
+providerName = «providerName»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet
deleted file mode 100644
index a1fead957..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet
+++ /dev/null
@@ -1,5 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.standalone.templates" class="BuildPropertiesGenerator"%>
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/manifest.mfjet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/manifest.mfjet
deleted file mode 100644
index 8b9fd5290..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/manifest.mfjet
+++ /dev/null
@@ -1,53 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.standalone.templates" class="ManifestMFGenerator"
- imports="java.util.* org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-final Object[] passedArgs = (Object[]) argument;
-final StandaloneGenerator.Config config = (StandaloneGenerator.Config) passedArgs[0];
-final String[] requiredBundles = (String[]) passedArgs[1];
-
-
-class ListComposer {
- public String composeList(Collection strings){
- StringBuffer result = new StringBuffer();
- for (Iterator it = strings.iterator(); it.hasNext();){
- result.append(" "); //do not miss required space here
- result.append(it.next());
- if (it.hasNext()){
- result.append(", " + NL);
- }
- }
- return result.toString();
- }
-}
-
-final ListComposer listComposer = new ListComposer();
-%>
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: <%=config.getPluginID()%>; singleton:=true
-Bundle-Version: 1.0.0
-Bundle-Vendor: %providerName
-Bundle-Activator: <%=config.getPluginActivatorPackageName()%>.<%=config.getPluginActivatorClassName()%>
-Bundle-Localization: plugin
-<%
- HashSet exportedPackages = new HashSet();
- if (config.getMainPackageName() != null && config.getMainPackageName().trim().length() > 0) {
- exportedPackages.add(config.getMainPackageName());
- }
- exportedPackages.add(config.getPluginActivatorPackageName());
-%>
-Export-Package: <%=listComposer.composeList(exportedPackages)%>
-<%
-final Set allRequiredBundles = new LinkedHashSet();
-allRequiredBundles.add("org.eclipse.gef");
-allRequiredBundles.add("org.eclipse.draw2d");
-allRequiredBundles.add("org.eclipse.osgi");
-allRequiredBundles.add("org.eclipse.core.runtime");
-allRequiredBundles.addAll(java.util.Arrays.asList(requiredBundles));
-if (config.needsMapMode()) {
- allRequiredBundles.add("org.eclipse.gmf.runtime.draw2d.ui");
-}
-%>
-Require-Bundle: <%=listComposer.composeList(allRequiredBundles)%>
-Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/plugin.propertiesjet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/plugin.propertiesjet
deleted file mode 100644
index b58cc057f..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/plugin.propertiesjet
+++ /dev/null
@@ -1,7 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.standalone.templates" class="PluginPropertiesGenerator"
- imports="org.eclipse.gmf.graphdef.codegen.*"%>
-<%
-final StandaloneGenerator.Config config = (StandaloneGenerator.Config) argument;
-%>
-pluginName = <%=config.getPluginFriendlyName()%>
-providerName = <%=config.getPluginProviderName()%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/rt_mm/MapMode.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/rt_mm/MapMode.xpt
new file mode 100644
index 000000000..feb2c53d3
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/rt_mm/MapMode.xpt
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION rt_mm::MapModeUtil»
+
+«REM»Using MapMode«ENDREM»
+
+«DEFINE map FOR gmfgraph::Dimension-»
+«EXPAND deviceToLogic FOR dx», «EXPAND deviceToLogic FOR dy-»
+«ENDDEFINE»
+
+«DEFINE map FOR gmfgraph::Point-»
+«EXPAND deviceToLogic FOR x», «EXPAND deviceToLogic FOR y-»
+«ENDDEFINE»
+
+«DEFINE map FOR int-»
+«EXPAND deviceToLogic-»
+«ENDDEFINE»
+
+«DEFINE map FOR gmfgraph::Insets-»
+«EXPAND deviceToLogic FOR top», «EXPAND deviceToLogic FOR left», «EXPAND deviceToLogic FOR bottom», «EXPAND deviceToLogic FOR right-»
+«ENDDEFINE»
+
+«DEFINE deviceToLogic FOR int-»
+«mapModeAccessor()»getMapMode().DPtoLP(«this»)
+«ENDDEFINE»
+
+«DEFINE Activator FOR Object-»
+ private org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode myMapMode = org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes.IDENTITY_MM;
+
+ /**
+ * @generated
+ */
+ public void setMapMode(org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode mapMode) {
+ myMapMode = mapMode;
+ if (myMapMode == null){
+ myMapMode = org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes.IDENTITY_MM;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode getMapMode() {
+ return myMapMode;
+ }
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/rt_mm/MapModeUtil.ext b/plugins/org.eclipse.gmf.graphdef.codegen/templates/rt_mm/MapModeUtil.ext
new file mode 100644
index 000000000..f911a9c2d
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/rt_mm/MapModeUtil.ext
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+String mapModeAccessor() :
+GLOBALVAR mapModeAccessor
+; \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
deleted file mode 100644
index 5feebb82a..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
+++ /dev/null
@@ -1,31 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="TopFigureGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.* org.eclipse.emf.ecore.* java.util.Iterator org.eclipse.emf.ecore.util.EcoreUtil org.eclipse.emf.codegen.util.CodeGenUtil; "%>
-<%
-final GraphDefDispatcher.Args innerArgs = (GraphDefDispatcher.Args) ((Object[]) argument)[0];
-final Figure figure = innerArgs.getFigure();
-final GraphDefDispatcher dispatcher = innerArgs.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-%>
-
-<%@ include file="customBorderFactoryMethods.jetinc"%>
-<%if (figure instanceof ScalablePolygon) {%>
-<%@ include file="scalablePolygonBehavior.jetinc"%>
-<%}%>
-
- /**
- * @generated
- */
- public <%=figure.getName()%>() {
-<%
-GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "myGenLayoutManager", null);
-%>
- <%=dispatcher.dispatch("createLayout", dispatcherArgs)%>
- <%=dispatcher.dispatch(figure, dispatcherArgs)%>
- createContents();
- }
-
-<%=dispatcher.dispatch("Children", dispatcherArgs)%>
-
-<%if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/%>
-<%@ include file="localCoordinates.jetinc"%>
-<%}%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.xpt
new file mode 100644
index 000000000..932398ae9
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.xpt
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+«EXTENSION Util»
+
+«DEFINE FigureClass(boolean isInnerClass) FOR gmfgraph::Figure»
+«packageStatement()»
+/**
+ * @generated
+ */
+public class «compilationUnitName()» extends «qualifiedClassNameGEF()» {
+ /**
+ * @generated
+ */
+ public «compilationUnitName()»() {
+ «EXPAND Layout::Init("this") FOR layout-»
+ «EXPAND Attrs::Init("this")-»
+«IF !children.typeSelect(Figure).isEmpty()-»
+ createContents();
+ }
+«EXPAND Children::CreateChildren-»
+«ELSE-»
+ }
+«ENDIF-»
+«additionalMethods()»
+«EXPAND Extras::extraMethods»
+«EXPAND Extras::localCoordinates»
+«IF isInnerClass-»
+}
+«additionalStaticFields()»
+«ELSE-»
+«additionalStaticFields()»
+}
+«ENDIF-»
+«ENDDEFINE»
+
+
+«DEFINE FigureClass(boolean isInnerClass) FOR gmfgraph::PolylineConnection»
+«packageStatement()»
+/**
+ * @generated
+ */
+public class «compilationUnitName()» extends «qualifiedClassNameGEF()» {
+
+ /**
+ * @generated
+ */
+ public «compilationUnitName()»() {
+ «EXPAND Attrs::Init("this")»
+«IF hasSourceDecoration()-»
+ setSourceDecoration(createSourceDecoration());
+«ENDIF-»
+«IF hasTargetDecoration()-»
+ setTargetDecoration(createTargetDecoration());
+«ENDIF-»
+ }
+«IF hasSourceDecoration()»
+ /**
+ * @generated
+ */
+ private org.eclipse.draw2d.RotatableDecoration createSourceDecoration() {
+ «EXPAND Decoration::Instantiate("df") FOR sourceDecoration-»
+ return df;
+ }
+«ENDIF-»
+«IF hasTargetDecoration()»
+ /**
+ * @generated
+ */
+ private org.eclipse.draw2d.RotatableDecoration createTargetDecoration() {
+ «EXPAND Decoration::Instantiate("df") FOR targetDecoration-»
+ return df;
+ }
+«ENDIF-»
+«additionalMethods()»
+«IF isInnerClass-»
+}
+«additionalStaticFields()»
+«ELSE-»
+«additionalStaticFields()»
+}
+«ENDIF-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/PolylineConnection.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/PolylineConnection.javajet
deleted file mode 100644
index b72f2c976..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/PolylineConnection.javajet
+++ /dev/null
@@ -1,46 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="TopConnectionGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.* org.eclipse.emf.ecore.* java.util.Iterator org.eclipse.emf.ecore.util.EcoreUtil org.eclipse.emf.codegen.util.CodeGenUtil;"%>
-<%
-final GraphDefDispatcher.Args innerArgs = (GraphDefDispatcher.Args) ((Object[]) argument)[0];
-final PolylineConnection figure = (PolylineConnection)innerArgs.getFigure();
-final GraphDefDispatcher dispatcher = innerArgs.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-final FigureQualifiedNameSwitch fqnSwitch = dispatcher.getFQNSwitch();
-%>
-
-<%@ include file="customBorderFactoryMethods.jetinc"%>
-
- /**
- * @generated
- */
- public <%=figure.getName()%>() {
-<%=dispatcher.dispatch("Shape", dispatcher.create(figure, "this"))%>
-<%if (figure.getSourceDecoration() != null) {%>
- setSourceDecoration(createSourceDecoration());
-<%}
-if (figure.getTargetDecoration() != null) {%>
- setTargetDecoration(createTargetDecoration());
-<%}%>
- }
-
-<%if (figure.getSourceDecoration() != null) {
- final String className = fqnSwitch.get(figure.getSourceDecoration(), importManager);%>
- /**
- * @generated
- */
- private <%=className%> createSourceDecoration() {
-<%=dispatcher.dispatch("instantiate", dispatcher.create(figure.getSourceDecoration(), "df"))%>
- return df;
- }
-<%} /*if sourceDecoration != null */ %>
-
-<%if (figure.getTargetDecoration() != null) {
- final String className = fqnSwitch.get(figure.getTargetDecoration(), importManager);%>
- /**
- * @generated
- */
- private <%=className%> createTargetDecoration() {
-<%=dispatcher.dispatch("instantiate", dispatcher.create(figure.getTargetDecoration(), "df"))%>
- return df;
- }
-<%}%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Top.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Top.javajet
deleted file mode 100644
index be427c250..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Top.javajet
+++ /dev/null
@@ -1,53 +0,0 @@
-<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="TopGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.* org.eclipse.emf.ecore.* java.util.Iterator org.eclipse.emf.ecore.util.EcoreUtil; "%>
-<%
-Object[] args = (Object[]) argument;
-Figure figure = (Figure) args[0];
-final GraphDefDispatcher /*inner*/dispatcher = (GraphDefDispatcher) args[1];
-final GraphDefDispatcher topDispatcher = (GraphDefDispatcher) args[2];
-final boolean isStaticFieldsOutsideClassBody = ((Boolean) args[3]).booleanValue();
-
-class Asserter {
- void makeAssert(boolean checkTrue){
- assert checkTrue;
- //temporarily use more forced way to ensure assertion
- //TODO: replace with single assert
- if (!checkTrue){
- throw new IllegalStateException("Enable Assertions");
- }
- }
-}
-
-final Asserter myAsserter = new Asserter();
-myAsserter.makeAssert(topDispatcher.getImportManager() == /*inner*/dispatcher.getImportManager());
-myAsserter.makeAssert(topDispatcher.getFQNSwitch() == /*inner*/dispatcher.getFQNSwitch());
-
-final ImportAssistant importManager = topDispatcher.getImportManager();
-final FigureQualifiedNameSwitch fqnSwitch = topDispatcher.getFQNSwitch();
-%>
-<%importManager.emitPackageStatement(stringBuffer);%>
-
-<%importManager.markImportLocation(stringBuffer);%>
-
-/**
- * @generated
- */
-public class <%=importManager.getCompilationUnitName()%> extends <%=fqnSwitch.get(figure, importManager)%> {
-
-<%@ include file="scalablePolygonAsInnerClass.jetinc"%>
-
-<% /*NOTE: class structure is selected by topDispatcher, but children, attributes etc -- by inner dispatcher*/ %>
-<%=topDispatcher.dispatch(figure, new Object[] {
- /*inner*/dispatcher.create(figure, "this"),
- topDispatcher.create(figure, "this")
-})%>
-
-<%
-if (isStaticFieldsOutsideClassBody){ /*put fields out of inner class body*/ %>
-}
- <%@ include file="staticFields.jetinc"%>
-<% } else { %>
- <%@ include file="staticFields.jetinc"%>
-}
-<%}%>
-<%importManager.emitSortedImports();%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/customBorderFactoryMethods.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/customBorderFactoryMethods.jetinc
deleted file mode 100644
index 78d4422f3..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/customBorderFactoryMethods.jetinc
+++ /dev/null
@@ -1,38 +0,0 @@
-<%
-//input: [oeg].common.codegen.ImportAssistant importManager
-//input: [oeg].graphdef.codegen GraphDefDispatcher dispatcher
-//input: [oeg].gmfgraph.Figure figure
-
-{ //namespace -- use "bfm" (stands for BorderFactoryMethod) to avoid name clashes
- int bfmNextIndex = 1;
- String bfmLastFigureName = "";
- for (Iterator bfmAllCustomBorders = EcoreUtil.getAllContents(figure, false); bfmAllCustomBorders.hasNext();){
- EObject bfmNext = (EObject)bfmAllCustomBorders.next();
- if (GMFGraphPackage.eINSTANCE.getFigure().isSuperTypeOf(bfmNext.eClass())){
- bfmLastFigureName = (String)bfmNext.eGet(GMFGraphPackage.eINSTANCE.getIdentity_Name());
- if (bfmLastFigureName == null){
- bfmLastFigureName = "";
- }
- }
- // XXX [artem] why not do this with ((Figure) bfmNext).getBorder()?
- if (bfmNext.eClass().getClassifierID() != GMFGraphPackage.CUSTOM_BORDER){
- continue;
- }
-
- String bfmNextImplClass = dispatcher.getFQNSwitch().get(bfmNext, importManager);
- String bfmNextMethodName = "createBorder_" + CodeGenUtil.capName(bfmLastFigureName) + "_" + (bfmNextIndex++);
-
-%>
- /**
- * @generated
- */
- private <%=importManager.getImportedName("org.eclipse.draw2d.Border")%> <%=bfmNextMethodName%>() {
- <%=bfmNextImplClass%> result = new <%=bfmNextImplClass%>();
- <%=dispatcher.dispatch("customAttributes", new Object[] {bfmNext, dispatcher, "result"} )%>
- return result;
- }
-<%
- dispatcher.getAuxiliaryDataStorage().registerData(bfmNext, bfmNextMethodName);
- }
-} //end of namespace
-%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/localCoordinates.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/localCoordinates.jetinc
deleted file mode 100644
index 94e33768e..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/localCoordinates.jetinc
+++ /dev/null
@@ -1,29 +0,0 @@
-<%
-// 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;
- }
-}
-%>
- /**
- * @generated
- */
- private boolean myUseLocalCoordinates = <%=useLocalDefaultValue%>;
-
- /**
- * @generated
- */
- protected boolean useLocalCoordinates() {
- return myUseLocalCoordinates;
- }
-
- /**
- * @generated
- */
- protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
- myUseLocalCoordinates = useLocalCoordinates;
- }
- \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/scalablePolygonAsInnerClass.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/scalablePolygonAsInnerClass.jetinc
deleted file mode 100644
index 77213ee45..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/scalablePolygonAsInnerClass.jetinc
+++ /dev/null
@@ -1,20 +0,0 @@
-<%
-//input: [oeg].gmfgraph.Figure figure
-{ //namespace, prefix spic (stands for Scalable Polygon as Inner Class) to avoid name clashes
- boolean spicFound = false;
- for (Iterator spicAllPolygons = EcoreUtil.getAllContents(figure, false); !spicFound && spicAllPolygons.hasNext();){
- EObject spicNext = (EObject)spicAllPolygons.next();
- spicFound = GMFGraphPackage.eINSTANCE.getScalablePolygon().isSuperTypeOf(spicNext.eClass());
- }
- if (spicFound) {
-%>
-/**
- * @generated
- */
-public class ScalablePolygon extends org.eclipse.draw2d.Shape {
-<%@ include file="scalablePolygonBehavior.jetinc"%>
-}
-<%
- }
-} // end of namespace
-%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/staticFields.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/staticFields.jetinc
deleted file mode 100644
index 2ddbf7166..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/staticFields.jetinc
+++ /dev/null
@@ -1,12 +0,0 @@
-<%
-//input: [oeg].graphdef.codegen GraphDefDispatcher dispatcher
-for (Iterator allFields = dispatcher.getStaticFieldsManager().allFields(); allFields.hasNext();) {
- StaticFieldsManager.StaticField next = (StaticFieldsManager.StaticField)allFields.next(); %>
-
- /**
- * @generated
- */
- public static final <%=next.getType()%> <%=next.getName()%> = <%=next.getValue()%>;
-<%
-}
-%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/scalablePolygonBehavior.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/xtras/ScalablePolygon.xpt
index 457cb650c..b3e48e828 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/scalablePolygonBehavior.jetinc
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/xtras/ScalablePolygon.xpt
@@ -1,3 +1,20 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Michael Golubev (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+
+«DEFINE behaviour FOR gmfgraph::ScalablePolygon-»
/**
* @generated
*/
@@ -41,7 +58,7 @@
* @generated
*/
private org.eclipse.draw2d.geometry.Rectangle getTemplateBounds(){
- if (myTemplateBounds == null) {
+ if (myTemplateBounds == null){
myTemplateBounds = myTemplate.getBounds().getCopy().union(0, 0);
//just safety -- we are going to use this as divider
if (myTemplateBounds.width < 1){
@@ -74,3 +91,4 @@
}
return scaled;
}
+«ENDDEFINE» \ No newline at end of file

Back to the top