Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/InnerClassViewmapProducer.java4
-rw-r--r--plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModelOperation.java6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen.ui/src/org/eclipse/gmf/internal/graphdef/codegen/ui/FigureGeneratorOptionsDialog.java2
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/.jetproperties4
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/.project6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java230
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/GraphDefDispatcher.java215
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/MapModeCodeGenStrategy.java20
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java3
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneEmitters.java129
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneGenerator.java16
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StaticFieldsManager.java77
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/BuildPropertiesGenerator.java25
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/ManifestMFGenerator.java85
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/PluginActivatorGenerator.java84
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/PluginPropertiesGenerator.java34
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomClassAttributesGenerator.java97
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomFigureAttrGenerator.java38
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java205
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java150
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java73
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutGenerator.java54
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java48
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutGenerator.java34
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitFlowLayoutGenerator.java147
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java116
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutGenerator.java85
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java87
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/LabelAttrGenerator.java41
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewCompoundBorderExpressionGenerator.java51
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewCustomBorderExpressionGenerator.java38
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewFigureGenerator.java52
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java50
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutGenerator.java63
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLineBorderExpressionGenerator.java122
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewMarginBorderExpressionGenerator.java65
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolygonDecorationAttrGenerator.java30
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineAttrGenerator.java54
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineDecorationAttrGenerator.java76
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/RoundedRectAttrGenerator.java51
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ShapeAttrGenerator.java97
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopConnectionGenerator.java136
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java132
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopGenerator.java148
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/Activator.java49
-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
104 files changed, 1303 insertions, 4189 deletions
diff --git a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/InnerClassViewmapProducer.java b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/InnerClassViewmapProducer.java
index 4233856b5..c9093617d 100644
--- a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/InnerClassViewmapProducer.java
+++ b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/InnerClassViewmapProducer.java
@@ -56,14 +56,14 @@ public class InnerClassViewmapProducer extends DefaultViewmapProducer {
private final Set<Figure> processedFigures;
public InnerClassViewmapProducer() {
- this(new RuntimeFQNSwitch(), new MapModeCodeGenStrategy.RuntimeUnspecifiedMapMode());
+ this(new RuntimeFQNSwitch(), MapModeCodeGenStrategy.DYNAMIC);
}
public InnerClassViewmapProducer(FigureQualifiedNameSwitch figureNameSwitch, MapModeCodeGenStrategy mapModeCodeGenStrategy) {
assert figureNameSwitch != null;
fqnSwitch = figureNameSwitch;
processedFigures = new HashSet<Figure>();
- figureGenerator = new FigureGenerator(fqnSwitch, mapModeCodeGenStrategy, true);
+ figureGenerator = new FigureGenerator(fqnSwitch, mapModeCodeGenStrategy, null, true);
}
public Viewmap create(Node node) {
diff --git a/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModelOperation.java b/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModelOperation.java
index 84b20b079..be529a956 100644
--- a/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModelOperation.java
+++ b/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/TransformToGenModelOperation.java
@@ -380,16 +380,16 @@ public class TransformToGenModelOperation {
if (getUseRuntimeFigures() != null && getUseMapMode() != null) {
// allow to run without dialogs
FigureQualifiedNameSwitch fSwitch = getUseRuntimeFigures().booleanValue() ? new RuntimeFQNSwitch() : new RuntimeLiteFQNSwitch();
- MapModeCodeGenStrategy mmStrategy = getUseMapMode().booleanValue() ? new MapModeCodeGenStrategy.RuntimeUnspecifiedMapMode() : new MapModeCodeGenStrategy.StaticIdentityMapMode();
+ MapModeCodeGenStrategy mmStrategy = getUseMapMode().booleanValue() ? MapModeCodeGenStrategy.DYNAMIC : MapModeCodeGenStrategy.STATIC;
return new InnerClassViewmapProducer(fSwitch, mmStrategy);
}
if (!checkLiteOptionPresent()) {
MapModeCodeGenStrategy strategy;
final String msg = "Would you like to use IMapMode?";
if (MessageDialog.openQuestion(shell, "Create Generator Model", msg)) {
- strategy = new MapModeCodeGenStrategy.RuntimeUnspecifiedMapMode();
+ strategy = MapModeCodeGenStrategy.DYNAMIC;
} else {
- strategy = new MapModeCodeGenStrategy.StaticIdentityMapMode();
+ strategy = MapModeCodeGenStrategy.STATIC;
}
return new InnerClassViewmapProducer(new RuntimeFQNSwitch(), strategy);
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen.ui/src/org/eclipse/gmf/internal/graphdef/codegen/ui/FigureGeneratorOptionsDialog.java b/plugins/org.eclipse.gmf.graphdef.codegen.ui/src/org/eclipse/gmf/internal/graphdef/codegen/ui/FigureGeneratorOptionsDialog.java
index 6b80c7190..28dd4e0ec 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen.ui/src/org/eclipse/gmf/internal/graphdef/codegen/ui/FigureGeneratorOptionsDialog.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen.ui/src/org/eclipse/gmf/internal/graphdef/codegen/ui/FigureGeneratorOptionsDialog.java
@@ -114,7 +114,7 @@ public class FigureGeneratorOptionsDialog extends TitleAreaDialog {
if (useMapMode) {
return MapModeCodeGenStrategy.DYNAMIC;
} else {
- return MapModeCodeGenStrategy.StaticIdentity;
+ return MapModeCodeGenStrategy.STATIC;
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/.jetproperties b/plugins/org.eclipse.gmf.graphdef.codegen/.jetproperties
deleted file mode 100644
index 5585019b3..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/.jetproperties
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jet-settings>
- <template-container>templates</template-container> <source-container>src</source-container>
-</jet-settings>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/.project b/plugins/org.eclipse.gmf.graphdef.codegen/.project
index 3e0365e47..83d1d07fc 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/.project
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/.project
@@ -6,11 +6,6 @@
</projects>
<buildSpec>
<buildCommand>
- <name>org.eclipse.emf.codegen.JETBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
@@ -27,7 +22,6 @@
</buildCommand>
</buildSpec>
<natures>
- <nature>org.eclipse.emf.codegen.jet.IJETNature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.graphdef.codegen/META-INF/MANIFEST.MF
index 4d7ae4416..98c00f205 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/META-INF/MANIFEST.MF
@@ -10,6 +10,9 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.gmf.common;bundle-version="[1.0.0,2.0.0)",
org.eclipse.gmf.graphdef;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
org.eclipse.emf.codegen;bundle-version="[2.2.0,3.0.0)",
- org.eclipse.draw2d;bundle-version="[3.2.0,4.0.0)"
+ org.eclipse.draw2d;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.gmf.xpand;bundle-version="[1.0.0,2.0.0)"
Export-Package: org.eclipse.gmf.graphdef.codegen,
org.eclipse.gmf.internal.graphdef.codegen;x-friends:="org.eclipse.gmf.graphdef.codegen.ui,org.eclipse.gmf.tests"
+Bundle-Activator: org.eclipse.gmf.internal.graphdef.codegen.Activator
+Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java
index 61019f466..dc5650870 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005 Borland Software Corporation
+ * 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
@@ -12,160 +12,82 @@
package org.eclipse.gmf.graphdef.codegen;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.gmf.common.UnexpectedBehaviourException;
import org.eclipse.gmf.common.codegen.ImportAssistant;
-import org.eclipse.gmf.gmfgraph.BorderLayout;
-import org.eclipse.gmf.gmfgraph.BorderLayoutData;
-import org.eclipse.gmf.gmfgraph.CompoundBorder;
-import org.eclipse.gmf.gmfgraph.CustomBorder;
-import org.eclipse.gmf.gmfgraph.CustomFigure;
-import org.eclipse.gmf.gmfgraph.CustomLayout;
-import org.eclipse.gmf.gmfgraph.CustomLayoutData;
import org.eclipse.gmf.gmfgraph.Figure;
-import org.eclipse.gmf.gmfgraph.FlowLayout;
-import org.eclipse.gmf.gmfgraph.GridLayout;
-import org.eclipse.gmf.gmfgraph.GridLayoutData;
-import org.eclipse.gmf.gmfgraph.Label;
-import org.eclipse.gmf.gmfgraph.LineBorder;
-import org.eclipse.gmf.gmfgraph.MarginBorder;
-import org.eclipse.gmf.gmfgraph.PolygonDecoration;
-import org.eclipse.gmf.gmfgraph.Polyline;
-import org.eclipse.gmf.gmfgraph.PolylineConnection;
-import org.eclipse.gmf.gmfgraph.PolylineDecoration;
-import org.eclipse.gmf.gmfgraph.RoundedRectangle;
-import org.eclipse.gmf.gmfgraph.Shape;
-import org.eclipse.gmf.gmfgraph.XYLayoutData;
import org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch;
-import org.eclipse.gmf.graphdef.codegen.templates.CustomClassAttributesGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.CustomFigureAttrGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.FigureAttrGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.FigureChildrenGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.InitBorderLayoutDataGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.InitBorderLayoutGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.InitCustomLayoutDataGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.InitCustomLayoutGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.InitFlowLayoutGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.InitGridLayoutDataGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.InitGridLayoutGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.InitXYLayoutDataGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.LabelAttrGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.NewCompoundBorderExpressionGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.NewCustomBorderExpressionGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.NewFigureGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.NewLayoutDataGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.NewLayoutGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.NewLineBorderExpressionGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.NewMarginBorderExpressionGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.PolygonDecorationAttrGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.PolylineAttrGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.PolylineDecorationAttrGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.RoundedRectAttrGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.ShapeAttrGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.TopConnectionGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.TopFigureGenerator;
-import org.eclipse.gmf.graphdef.codegen.templates.TopGenerator;
-import org.eclipse.gmf.internal.codegen.dispatch.CachingEmitterFactory;
-import org.eclipse.gmf.internal.codegen.dispatch.EmitterFactory;
-import org.eclipse.gmf.internal.codegen.dispatch.EmitterFactoryImpl;
-import org.eclipse.gmf.internal.codegen.dispatch.HierarchyKeyMap;
-import org.eclipse.gmf.internal.codegen.dispatch.KeyChain;
-import org.eclipse.gmf.internal.codegen.dispatch.KeyMap;
-import org.eclipse.gmf.internal.codegen.dispatch.StaticTemplateRegistry;
-import org.eclipse.gmf.internal.codegen.dispatch.TemplateRegistry;
import org.eclipse.gmf.internal.common.codegen.TextEmitter;
-import org.osgi.framework.Bundle;
+import org.eclipse.gmf.internal.graphdef.codegen.Activator;
+import org.eclipse.gmf.internal.xpand.BufferOutput;
+import org.eclipse.gmf.internal.xpand.XpandFacade;
+import org.eclipse.gmf.internal.xpand.expression.Variable;
-/**
- * @author artem
- *
- */
public class FigureGenerator implements TextEmitter {
- private static final String ENTRY_POINT = "main";
+ private final XpandFacade xpandFacade;
- private final GraphDefDispatcher myTopDispatcher;
- private final GraphDefDispatcher myInnerDispatcher;
- private final boolean myIsInnerClassCode;
+ private final StringBuilder result;
- public FigureGenerator(FigureQualifiedNameSwitch figureNameSwitch, boolean asInnerClass) {
- this(figureNameSwitch, MapModeCodeGenStrategy.DYNAMIC, asInnerClass);
- }
+ private Variable packageStatement;
- public FigureGenerator(FigureQualifiedNameSwitch figureNameSwitch, MapModeCodeGenStrategy mapModeStrategy, boolean placeStaticFieldsOutsideClassBody) {
- myIsInnerClassCode = placeStaticFieldsOutsideClassBody;
- final Bundle thisBundle = Platform.getBundle("org.eclipse.gmf.graphdef.codegen");
- final String[] variables = new String[] {
- "org.eclipse.gmf.graphdef",
- "org.eclipse.emf.ecore",
- "org.eclipse.emf.common",
- "org.eclipse.gmf.common",
- "org.eclipse.gmf.graphdef.codegen"
- };
+ private StringBuilder additionalMethods;
- KeyMap keyMap = new ClassesOrStringsKeyMap();
- String[] templatePath = new String[] {thisBundle.getEntry("/templates/").toString()};
- EmitterFactory topFactory = new CachingEmitterFactory(new EmitterFactoryImpl(templatePath, fillTopLevel(), true, variables));
- myTopDispatcher = new GraphDefDispatcher(topFactory, keyMap, figureNameSwitch, mapModeStrategy);
- EmitterFactory innerFactory = new CachingEmitterFactory(new EmitterFactoryImpl(templatePath, fillAttrs(), true, variables));
- myInnerDispatcher = new GraphDefDispatcher(innerFactory, keyMap, figureNameSwitch, mapModeStrategy);
- }
+ private final boolean myIsInnerClassCode;
- private static TemplateRegistry fillTopLevel() {
- StaticTemplateRegistry tr = new StaticTemplateRegistry(FigureGenerator.class.getClassLoader());
- tr.put(ENTRY_POINT, "/top/Top.javajet", TopGenerator.class);
- tr.put(PolylineConnection.class, "/top/PolylineConnection.javajet", TopConnectionGenerator.class);
- tr.put(Figure.class, "/top/Figure.javajet", TopFigureGenerator.class);
- return tr;
+ private StringBuilder additionalFields;
+
+ public FigureGenerator(FigureQualifiedNameSwitch fqnSwitch, boolean asInnerClass) {
+ this(fqnSwitch, MapModeCodeGenStrategy.DYNAMIC, "getMapMode().", asInnerClass);
}
-
- // XXX NOTE, the fact we use "instantiate" and "Children" strings
- // helps us to postpone resolution of the next problem (one we make these twwo overridable):
- // it's not possible to tell from single dispatcher.dispatch(Figure, args) what's the intention -
- // whether to instantiate, look for children or initialize attributes
- // Perhaps, we should have distinct methods in the Dispatcher, or add "hint" as another argument
- private static TemplateRegistry fillAttrs() {
- StaticTemplateRegistry tr = new StaticTemplateRegistry(FigureGenerator.class.getClassLoader());
- tr.put(Figure.class, "/attr/Figure.javajet", FigureAttrGenerator.class);
- tr.put(Shape.class, "/attr/Shape.javajet", ShapeAttrGenerator.class);
- tr.put(Label.class, "/attr/Label.javajet", LabelAttrGenerator.class);
- tr.put(Polyline.class, "/attr/Polyline.javajet", PolylineAttrGenerator.class);
- tr.put(RoundedRectangle.class, "/attr/RoundedRectangle.javajet", RoundedRectAttrGenerator.class);
- tr.put(PolygonDecoration.class, "/attr/PolygonDecoration.javajet", PolygonDecorationAttrGenerator.class);
- tr.put(PolylineDecoration.class, "/attr/PolylineDecoration.javajet", PolylineDecorationAttrGenerator.class);
- tr.put(CustomFigure.class, "/attr/CustomFigure.javajet", CustomFigureAttrGenerator.class);
- // instantiation templates - only single one now. FIXME - make it overridable
- tr.put("instantiate", "/new/Figure.javajet", NewFigureGenerator.class);
- // children templates - only single one now. FIXME - make it overridable
- tr.put("Children", "/children/Figure.javajet", FigureChildrenGenerator.class);
- // FIXME same template is registered twice
- tr.put("Shape", "/attr/Shape.javajet", ShapeAttrGenerator.class);
- tr.put("Figure", "/attr/Figure.javajet", FigureAttrGenerator.class);
- tr.put("PolylineDecoration", "/attr/PolylineDecoration.javajet", PolylineDecorationAttrGenerator.class);
- // Custom attributes support
- tr.put("customAttributes", "/attr/CustomConfigurableClass.javajet", CustomClassAttributesGenerator.class);
- // Layout related dispatching chain.
- tr.put("createLayout", "/new/Layout.javajet", NewLayoutGenerator.class);
- tr.put(GridLayout.class, "/layout/GridLayout.javajet", InitGridLayoutGenerator.class);
- tr.put(BorderLayout.class, "/layout/BorderLayout.javajet", InitBorderLayoutGenerator.class);
- tr.put(CustomLayout.class, "/layout/CustomLayout.javajet", InitCustomLayoutGenerator.class);
- tr.put(FlowLayout.class, "/layout/FlowLayout.javajet", InitFlowLayoutGenerator.class);
-
- tr.put("createLayoutData", "/new/LayoutData.javajet", NewLayoutDataGenerator.class);
- tr.put(GridLayoutData.class, "/layoutData/GridLayoutData.javajet", InitGridLayoutDataGenerator.class);
- tr.put(BorderLayoutData.class, "/layoutData/BorderLayoutData.javajet", InitBorderLayoutDataGenerator.class);
- tr.put(CustomLayoutData.class, "/layoutData/CustomLayoutData.javajet", InitCustomLayoutDataGenerator.class);
- tr.put(XYLayoutData.class, "/layoutData/XYLayoutData.javajet", InitXYLayoutDataGenerator.class);
-
- //Borders
- tr.put(LineBorder.class, "/new/LineBorder.javajet", NewLineBorderExpressionGenerator.class);
- tr.put(MarginBorder.class, "/new/MarginBorder.javajet", NewMarginBorderExpressionGenerator.class);
- tr.put(CompoundBorder.class, "/new/CompoundBorder.javajet", NewCompoundBorderExpressionGenerator.class);
- tr.put(CustomBorder.class, "/new/CustomBorder.javajet", NewCustomBorderExpressionGenerator.class);
+ public FigureGenerator(FigureQualifiedNameSwitch fqnSwitch, MapModeCodeGenStrategy mapModeStrategy, String mapModeAccessor, boolean asInnerClass) {
+ myIsInnerClassCode = asInnerClass;
+ if (mapModeStrategy == MapModeCodeGenStrategy.STATIC) {
+ if (mapModeAccessor != null && mapModeAccessor.trim().length() > 0) {
+ throw new IllegalArgumentException("Can't use map mode accessor with identity map mode");
+ }
+ }
+ final ArrayList<Variable> globals = new ArrayList<Variable>();
+ if (mapModeStrategy == MapModeCodeGenStrategy.DYNAMIC) {
+ globals.add(new Variable("mapModeAccessor", mapModeAccessor == null ? "" : mapModeAccessor));
+ }
+ globals.add(new Variable(FigureQualifiedNameSwitch.class.getSimpleName(), fqnSwitch));
+ packageStatement = new Variable("packageStatement", "");
+ globals.add(packageStatement);
+ additionalMethods = new StringBuilder();
+ globals.add(new Variable("outputAdditionalMethods", "") {
+ public Object getValue() {
+ return additionalMethods.toString();
+ }
+ });
+ additionalFields = new StringBuilder();
+ globals.add(new Variable("outputStaticFields", "") {
+ public Object getValue() {
+ return additionalFields.toString();
+ }
+ });
+ result = new StringBuilder(200);
+ Map<String, StringBuilder> slots = new HashMap<String, StringBuilder>();
+ slots.put("additionalMethods", additionalMethods);
+ slots.put("staticFields", additionalFields);
+ BufferOutput bufferOutput = new BufferOutput(result, slots);
+ xpandFacade = Activator.createTemplateEngine(mapModeStrategy, bufferOutput, globals);
+ }
- return tr;
+ public String go(Figure figure, ImportAssistant importAssistant) {
+ result.setLength(0);
+ additionalMethods.setLength(0);
+ additionalFields.setLength(0);
+ StringBuffer ss = new StringBuffer();
+ importAssistant.emitPackageStatement(ss);
+ packageStatement.setValue(ss.toString());
+ xpandFacade.evaluate("top::Figure::FigureClass", figure, new Object[] {myIsInnerClassCode});
+ final String resultString = result.toString();
+ return resultString;
}
public String generate(IProgressMonitor monitor, Object[] arguments) throws InterruptedException, InvocationTargetException, UnexpectedBehaviourException {
@@ -174,36 +96,4 @@ public class FigureGenerator implements TextEmitter {
}
return go((Figure) arguments[0], (ImportAssistant) arguments[1]);
}
-
- public String go(Figure fig, ImportAssistant importManager/*, Feedback feedback*/) {
- String res = null;
- myTopDispatcher.resetForNewClass(importManager);
- myInnerDispatcher.resetForNewClass(importManager);
- Object args = new Object[] {fig, myInnerDispatcher, myTopDispatcher, Boolean.valueOf(myIsInnerClassCode)};
- res = myTopDispatcher.dispatch(ENTRY_POINT, args);
- if (res == null) {
- throw new IllegalStateException();
- }
- return res;
- }
-
- private static class ClassesOrStringsKeyMap extends HierarchyKeyMap {
- /*
- * Capture knowledge that we use classes and strings as keys
- */
- public KeyChain map(Object key) {
- if (key instanceof String) {
- return super.map(key);
- } else {
- return super.map(key.getClass());
- }
- }
- }
-/*
- public static class Feedback {
- void registerChildAccessor(Figure parent, Figure child, String getterName, String setterName) {
- // do nothing
- }
- }
-*/
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/GraphDefDispatcher.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/GraphDefDispatcher.java
deleted file mode 100644
index 567ceb909..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/GraphDefDispatcher.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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
- */
-package org.eclipse.gmf.graphdef.codegen;
-
-import java.util.HashMap;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.common.codegen.ImportAssistant;
-import org.eclipse.gmf.gmfgraph.Figure;
-import org.eclipse.gmf.gmfgraph.Layout;
-import org.eclipse.gmf.gmfgraph.LayoutData;
-import org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch;
-import org.eclipse.gmf.internal.codegen.dispatch.DispatcherImpl;
-import org.eclipse.gmf.internal.codegen.dispatch.EmitterFactory;
-import org.eclipse.gmf.internal.codegen.dispatch.KeyMap;
-
-/**
- * @author artem
- */
-public class GraphDefDispatcher extends DispatcherImpl {
- private ImportAssistant myImportManager;
- private final FigureQualifiedNameSwitch myFqnSwitch;
- private final MapModeCodeGenStrategy myMapModeStrategy;
- private final StaticFieldsManager myStaticFieldsManager;
- private final AuxiliaryDataStorage myAuxiliaryDataStorage;
-
- public GraphDefDispatcher(EmitterFactory factory, KeyMap keyMap, FigureQualifiedNameSwitch fqnSwitch, MapModeCodeGenStrategy mapModeStrategy) {
- super(factory, keyMap);
- assert mapModeStrategy != null;
- myFqnSwitch = fqnSwitch;
- myMapModeStrategy = mapModeStrategy;
- myStaticFieldsManager = new StaticFieldsManager();
- myAuxiliaryDataStorage = new AuxiliaryDataStorage();
- }
-
- public StaticFieldsManager getStaticFieldsManager(){
- return myStaticFieldsManager;
- }
-
- public String DPtoLP(int deviceUnit){
- return String.valueOf(deviceUnit);
- }
-
- public String LPtoDP(int logicalUnit){
- return String.valueOf(logicalUnit);
- }
-
- public ImportAssistant getImportManager() {
- return myImportManager;
- }
-
- public AuxiliaryDataStorage getAuxiliaryDataStorage(){
- return myAuxiliaryDataStorage;
- }
-
- /**
- * Not good. Would be better to have importManager as part of Args, perhaps.
- */
- /*package-local*/ void resetForNewClass(ImportAssistant assistant) {
- setImportManager(assistant);
- myStaticFieldsManager.reset();
- myAuxiliaryDataStorage.reset();
- }
-
- public FigureQualifiedNameSwitch getFQNSwitch() {
- return myFqnSwitch;
- }
-
- public Args create(Figure figure, String figureVarName) {
- return new Args(this, figure, figureVarName);
- }
-
- public LayoutArgs getLayoutArgsFor(Args prototype) {
- return prototype instanceof LayoutArgs ? (LayoutArgs)prototype : new LayoutArgs(prototype);
- }
-
- public LayoutArgs createLayoutArgs(Figure figure, String figureVarName, String managerVarName, String constraintVarName) {
- return new LayoutArgs(this, figure, figureVarName, managerVarName, constraintVarName);
- }
-
- public LayoutArgs createLayoutArgs(Args inherit, String managerVarName, String constraintVarName) {
- return new LayoutArgs(inherit, managerVarName, constraintVarName);
- }
-
- private void setImportManager(ImportAssistant manager) {
- myImportManager = manager;
- }
-
- /**
- * "Write-once" map that allows to associate arbitrary data with some
- * gmfgraph instance.
- *
- * It allows to generate some auxiliary code (say, getter method) for given
- * gmfgraph instance in one template, store the getter name in the Storage
- * and retrieve it in different template to insert call for this getter into
- * different place.
- *
- * To avoid unexpected data loss, any key may be set only once and remains
- * available during generation of some compilation unit. It is the reason
- * for data to be declared as Object instead of String. If you need to
- * associate 2 different strings with given object use ad hoc class to store
- * data.
- *
- * NOTE: This data storage is automatically reset when owning dispatcher is
- * reset for new compilation unit generation.
- */
- public static class AuxiliaryDataStorage {
- private final HashMap<EObject, Object> myData;
-
- public AuxiliaryDataStorage(){
- myData = new HashMap<EObject, Object>();
- }
-
- public void registerData(EObject owner, Object data){
- if (myData.containsKey(owner)){
- throw new IllegalArgumentException("EObject: " + owner + " has registered data: " + myData.get(owner));
- }
- if (data == null){
- throw new NullPointerException("Null data for EObject: " + owner);
- }
- myData.put(owner, data);
- }
-
- public Object getRegisteredData(EObject owner){
- return myData.get(owner);
- }
-
- private void reset(){
- myData.clear();
- }
- }
-
- public static class Args {
- private final Figure myFigure;
- private final String myFigureVarName;
- private final GraphDefDispatcher myOwner;
-
- public Args(GraphDefDispatcher owner, Figure figure, String figureVarName) {
- myOwner = owner;
- myFigure = figure;
- myFigureVarName = figureVarName;
- }
-
- protected Args(Args other) {
- this(other.getDispatcher(), other.getFigure(), other.getVariableName());
- }
-
- public Figure getFigure() {
- return myFigure;
- }
-
- public String getVariableName() {
- return myFigureVarName;
- }
-
- public GraphDefDispatcher getDispatcher() {
- return myOwner;
- }
- }
-
- public static class LayoutArgs extends Args {
- private final String myLayoutVariableName;
- private final String myLayoutDataVariableName;
-
- /**
- * @param managerVariableName
- * name of layout manager variable defined somewhere in the
- * generated code, should not be <code>null</code>
- * @param constraintVariableName
- * optional name of the layout constraint variable, or
- * <code>null</code> if current context does not contain
- * constraint information.
- */
- private LayoutArgs(GraphDefDispatcher owner, Figure figure, String figureVarName, String managerVariableName, String constraintVariableName) {
- super(owner, figure, figureVarName);
- myLayoutVariableName = managerVariableName;
- myLayoutDataVariableName = constraintVariableName;
- }
-
- private LayoutArgs(Args inherit, String managerVariableName, String constraintVariableName) {
- super(inherit);
- myLayoutVariableName = managerVariableName;
- myLayoutDataVariableName = constraintVariableName;
- }
-
- private LayoutArgs(Args args) {
- this(args, args.getVariableName() + "Layouter", args.getVariableName() + "Constraint");
- }
-
- public Layout getLayout() {
- return getFigure().getLayout();
- }
-
- public LayoutData getData() {
- return getFigure().getLayoutData();
- }
-
- public String getManagerVariableName() {
- return myLayoutVariableName;
- }
-
- public String getConstraintVariableName() {
- return myLayoutDataVariableName;
- }
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/MapModeCodeGenStrategy.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/MapModeCodeGenStrategy.java
index 79c55a699..e4071d454 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/MapModeCodeGenStrategy.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/MapModeCodeGenStrategy.java
@@ -15,9 +15,21 @@ package org.eclipse.gmf.graphdef.codegen;
/**
* @author artem
*/
-public enum MapModeCodeGenStrategy {
-
- StaticIdentity,
+public enum MapModeCodeGenStrategy {
+ STATIC(""),
+ DYNAMIC("rt_mm");
- DYNAMIC,
+ private final String token;
+
+ private MapModeCodeGenStrategy(String token) {
+ assert token != null;
+ this.token = token;
+ }
+
+ /**
+ * @return identifying token of this strategy
+ */
+ public String getToken() {
+ return token;
+ }
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java
index 95d86b3ac..241865a49 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java
@@ -15,6 +15,9 @@ package org.eclipse.gmf.graphdef.codegen;
import org.eclipse.emf.codegen.util.CodeGenUtil;
import org.eclipse.gmf.gmfgraph.Figure;
+/**
+ * FIXME [artem] no reason for singleton
+ */
public class NamingStrategy {
public static NamingStrategy INSTANCE = new NamingStrategy();
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneEmitters.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneEmitters.java
index 0ec3981b5..54d4eaad2 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneEmitters.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneEmitters.java
@@ -8,71 +8,114 @@
*
* Contributors:
* Michael Golubev (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - migrating JET-Xpand
*/
package org.eclipse.gmf.graphdef.codegen;
-import org.eclipse.core.runtime.Platform;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.common.UnexpectedBehaviourException;
-import org.eclipse.gmf.graphdef.codegen.standalone.templates.BuildPropertiesGenerator;
-import org.eclipse.gmf.graphdef.codegen.standalone.templates.ManifestMFGenerator;
-import org.eclipse.gmf.graphdef.codegen.standalone.templates.PluginActivatorGenerator;
-import org.eclipse.gmf.graphdef.codegen.standalone.templates.PluginPropertiesGenerator;
-import org.eclipse.gmf.internal.codegen.dispatch.CachingEmitterFactory;
-import org.eclipse.gmf.internal.codegen.dispatch.EmitterFactory;
-import org.eclipse.gmf.internal.codegen.dispatch.EmitterFactoryImpl;
-import org.eclipse.gmf.internal.codegen.dispatch.NoSuchTemplateException;
-import org.eclipse.gmf.internal.codegen.dispatch.StaticTemplateRegistry;
-import org.eclipse.gmf.internal.codegen.dispatch.TemplateRegistry;
-import org.eclipse.gmf.internal.common.codegen.JETEmitterAdapter;
+import org.eclipse.gmf.graphdef.codegen.StandaloneGenerator.Config;
import org.eclipse.gmf.internal.common.codegen.TextEmitter;
+import org.eclipse.gmf.internal.graphdef.codegen.Activator;
+import org.eclipse.gmf.internal.xpand.BufferOutput;
+import org.eclipse.gmf.internal.xpand.XpandFacade;
+import org.eclipse.gmf.internal.xpand.expression.Variable;
-public class StandaloneEmitters {
- private final EmitterFactory myFactory;
+class StandaloneEmitters {
+ private final MapModeCodeGenStrategy myMapModeStrategy;
- public StandaloneEmitters(){
- myFactory = new CachingEmitterFactory(new EmitterFactoryImpl(getTemplatePath(), createTemplateRegistry()));
+ StandaloneEmitters(MapModeCodeGenStrategy mapModeStrategy) {
+ myMapModeStrategy = mapModeStrategy;
}
public TextEmitter getBuildPropertiesEmitter() throws UnexpectedBehaviourException {
- return getRegistered(BuildPropertiesGenerator.class);
+ return new XpandTextEmitter(myMapModeStrategy) {
+ public String generate(IProgressMonitor monitor, Object[] arguments) throws InterruptedException, InvocationTargetException, UnexpectedBehaviourException {
+ StringBuilder result = new StringBuilder();
+ createEngine(result).evaluate("plugin::BuildProperties::Init", new Object(), null);
+ return result.toString();
+ }
+ };
}
public TextEmitter getPluginPropertiesEmitter() throws UnexpectedBehaviourException {
- return getRegistered(PluginPropertiesGenerator.class);
+ return new XpandTextEmitter(myMapModeStrategy) {
+ public String generate(IProgressMonitor monitor, Object[] arguments) throws InterruptedException, InvocationTargetException, UnexpectedBehaviourException {
+ assert arguments != null && arguments.length > 0 && arguments[0] instanceof Config;
+ Config config = (Config) arguments[0];
+ StringBuilder result = new StringBuilder();
+ Object[] params = new Object[] {
+ config.getPluginFriendlyName(),
+ config.getPluginProviderName()
+ };
+ createEngine(result).evaluate("plugin::PluginProperties::Init", new Object(), params);
+ return result.toString();
+ }
+ };
}
public TextEmitter getManifestMFEmitter() throws UnexpectedBehaviourException {
- return getRegistered(ManifestMFGenerator.class);
+ return new XpandTextEmitter(myMapModeStrategy) {
+ public String generate(IProgressMonitor monitor, Object[] arguments) throws InterruptedException, InvocationTargetException, UnexpectedBehaviourException {
+ assert arguments != null && arguments.length > 0 && arguments[0] instanceof Object[];
+ Object[] actualArgs = (Object[]) arguments[0];
+ assert actualArgs.length > 1 && actualArgs[0] instanceof Config && actualArgs[1] instanceof String[];
+ Config config = (Config) actualArgs[0];
+ List<String> requiredBundles = new LinkedList<String>();
+ if (config.needsMapMode()) {
+ requiredBundles.add("org.eclipse.gmf.runtime.draw2d.ui");
+ }
+ requiredBundles.addAll(Arrays.asList((String[]) actualArgs[1]));
+ List<String> exportedPackages = (config.getMainPackageName() == null || config.getMainPackageName().trim().length() == 0) ? Collections.singletonList(config.getPluginActivatorPackageName()) : Arrays.asList(config.getPluginActivatorPackageName(), config.getMainPackageName());
+ StringBuilder result = new StringBuilder();
+ Object[] params = new Object[] {
+ config.getPluginID(),
+ config.getPluginActivatorPackageName() + '.' + config.getPluginActivatorClassName(),
+ exportedPackages,
+ requiredBundles,
+ };
+ createEngine(result).evaluate("plugin::Manifest::Init", new Object(), params);
+ return result.toString();
+ }
+ };
}
public TextEmitter getPluginActivatorEmitter() throws UnexpectedBehaviourException {
- return getRegistered(PluginActivatorGenerator.class);
+ return new XpandTextEmitter(myMapModeStrategy) {
+ public String generate(IProgressMonitor monitor, Object[] arguments) throws InterruptedException, InvocationTargetException, UnexpectedBehaviourException {
+ // we do not use ImportAssistant argument
+ assert arguments != null && arguments.length > 0 && arguments[0] instanceof Object[];
+ Config config = (Config) ((Object[]) arguments[0])[0];
+ StringBuilder result = new StringBuilder();
+ Object[] params = new Object[] {
+ config.getPluginActivatorPackageName(),
+ config.getPluginActivatorClassName(),
+ config.getPluginID(),
+ };
+ createEngine(result).evaluate("plugin::Activator::Init", new Object(), params);
+ return result.toString();
+ }
+ };
}
- private TextEmitter getRegistered(Class key) throws UnexpectedBehaviourException {
- try {
- return new JETEmitterAdapter(myFactory.acquireEmitter(key));
- } catch (NoSuchTemplateException ex) {
- throw new UnexpectedBehaviourException(ex.getMessage(), ex);
- }
- }
+ private static abstract class XpandTextEmitter implements TextEmitter {
+ protected final MapModeCodeGenStrategy myMapModeStrategy;
- private static String[] getTemplatePath() {
- // XXX for precompiled templates we use at the moment, there's no much value
- return new String[] { Platform.getBundle("org.eclipse.gmf.graphdef.codegen").getEntry("/templates").toString() };
- }
+ protected XpandTextEmitter(MapModeCodeGenStrategy mapModeStrategy) {
+ myMapModeStrategy = mapModeStrategy;
+ }
- private static TemplateRegistry createTemplateRegistry() {
- StaticTemplateRegistry result = new StaticTemplateRegistry(StandaloneEmitters.class.getClassLoader());
- registerTemplate(result, BuildPropertiesGenerator.class, "/plugin/build.propertiesjet");
- registerTemplate(result, ManifestMFGenerator.class, "/plugin/manifest.mfjet");
- registerTemplate(result, PluginPropertiesGenerator.class, "/plugin/plugin.propertiesjet");
- registerTemplate(result, PluginActivatorGenerator.class, "/plugin/plugin.javajet");
- return result;
- }
-
- private static void registerTemplate(StaticTemplateRegistry registry, Class compiled, String path){
- registry.put(compiled, path, compiled);
+ protected XpandFacade createEngine(StringBuilder result) {
+ final Map<String, StringBuilder> slots = Collections.emptyMap();
+ final List<Variable> globals = Collections.emptyList();
+ return Activator.createTemplateEngine(myMapModeStrategy, new BufferOutput(result, slots), globals);
+ }
}
-
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneGenerator.java
index 9380784e7..8d85bea67 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneGenerator.java
@@ -43,7 +43,7 @@ public class StandaloneGenerator extends GeneratorBase {
public String getPluginActivatorClassName();
public String getPluginActivatorPackageName();
- public boolean needsMapMode(); // FIXME remove
+ public boolean needsMapMode(); // FIXME remove or (?) return MapModeCodeGenStrategy
}
public static class ConfigImpl implements Config {
@@ -124,19 +124,18 @@ public class StandaloneGenerator extends GeneratorBase {
myFigureNameSwitch = fqnSwitch;
String pluginActivatorFQN = composePluginActivatorClassFQN(config);
MapModeCodeGenStrategy strategy;
+ String accessor;
if (config.needsMapMode()) {
myMapModeImportHack = new DelegateImportManager();
strategy = MapModeCodeGenStrategy.DYNAMIC;
+ accessor = pluginActivatorFQN + ".getDefault().";
} else {
- strategy = MapModeCodeGenStrategy.StaticIdentity;
+ strategy = MapModeCodeGenStrategy.STATIC;
+ accessor = null;
}
- myFigureGenerator = createFigureGenerator(fqnSwitch, strategy);
- myAuxiliaryGenerators = new StandaloneEmitters();
- }
-
- protected TextEmitter createFigureGenerator(FigureQualifiedNameSwitch fqnSwitch, MapModeCodeGenStrategy strategy) {
- return new FigureGenerator(fqnSwitch, strategy, false);
+ myFigureGenerator = new FigureGenerator(fqnSwitch, strategy, accessor, false);
+ myAuxiliaryGenerators = new StandaloneEmitters(strategy);
}
/**
@@ -176,6 +175,7 @@ public class StandaloneGenerator extends GeneratorBase {
doGenerateJavaClass(myAuxiliaryGenerators.getPluginActivatorEmitter(), myArgs.getPluginActivatorPackageName(), myArgs.getPluginActivatorClassName(), new Object[] {args});
}
+ // FIXME do not wrap array of arguments into another array (new Object[] { new Object[] {)
protected void generatePluginStructure() throws UnexpectedBehaviourException, InterruptedException {
doGenerateFile(myAuxiliaryGenerators.getBuildPropertiesEmitter(), new Path("build.properties"), new Object[] { myArgs });
doGenerateFile(myAuxiliaryGenerators.getManifestMFEmitter(), new Path("META-INF/MANIFEST.MF"), new Object[] { new Object[] { myArgs, myProcessor.getRequiredBundles(myFigureNameSwitch) } });
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StaticFieldsManager.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StaticFieldsManager.java
deleted file mode 100644
index 5c3309aff..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StaticFieldsManager.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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
- */
-
-package org.eclipse.gmf.graphdef.codegen;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class StaticFieldsManager {
- private final Map<String, StaticField> myFields = new HashMap<String, StaticField>();
- private final Map<String, StaticField> myFieldsRO = Collections.unmodifiableMap(myFields);
- private final String myDeclaringClassPrefix;
-
- public StaticFieldsManager(String declaringClassName){
- myDeclaringClassPrefix = (declaringClassName == null || declaringClassName.length() == 0) ?
- "" : declaringClassName + ".";
- }
-
- public StaticFieldsManager(){
- this(null);
- }
-
- public String addStaticField(String type, String nameHint, String value) {
- int suffix = 0;
- String actualName;
- do {
- actualName = nameHint + ((suffix == 0) ? "" : "_" + suffix);
- suffix++;
- } while (myFields.containsKey(actualName));
- StaticField field = new StaticField(type, actualName, value);
- myFields.put(actualName, field);
- return myDeclaringClassPrefix + actualName;
- }
-
- public void reset() {
- myFields.clear();
- }
-
- public Iterator<StaticField> allFields() {
- return myFieldsRO.values().iterator();
- }
-
- public static class StaticField {
- private final String myType;
- private final String myName;
- private final String myValue;
-
- public StaticField(String type, String name, String value){
- myType = type;
- myName = name;
- myValue = value;
- }
-
- public String getName() {
- return myName;
- }
-
- public String getType() {
- return myType;
- }
-
- public String getValue() {
- return myValue;
- }
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/BuildPropertiesGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/BuildPropertiesGenerator.java
deleted file mode 100644
index 8b6157d23..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/BuildPropertiesGenerator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.standalone.templates;
-
-public class BuildPropertiesGenerator
-{
- protected static String nl;
- public static synchronized BuildPropertiesGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- BuildPropertiesGenerator result = new BuildPropertiesGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "source.. = src/" + NL + "output.. = bin/" + NL + "bin.includes = META-INF/,\\" + NL + " .,\\";
- protected final String TEXT_2 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
- stringBuffer.append(TEXT_1);
- stringBuffer.append(TEXT_2);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/ManifestMFGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/ManifestMFGenerator.java
deleted file mode 100644
index 84e23e007..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/ManifestMFGenerator.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.standalone.templates;
-
-import java.util.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class ManifestMFGenerator
-{
- protected static String nl;
- public static synchronized ManifestMFGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- ManifestMFGenerator result = new ManifestMFGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "Manifest-Version: 1.0" + NL + "Bundle-ManifestVersion: 2" + NL + "Bundle-Name: %pluginName" + NL + "Bundle-SymbolicName: ";
- protected final String TEXT_2 = "; singleton:=true" + NL + "Bundle-Version: 1.0.0" + NL + "Bundle-Vendor: %providerName" + NL + "Bundle-Activator: ";
- protected final String TEXT_3 = ".";
- protected final String TEXT_4 = NL + "Bundle-Localization: plugin";
- protected final String TEXT_5 = NL + "Export-Package: ";
- protected final String TEXT_6 = NL + "Require-Bundle: ";
- protected final String TEXT_7 = NL + "Eclipse-LazyStart: true";
- protected final String TEXT_8 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(config.getPluginID());
- stringBuffer.append(TEXT_2);
- stringBuffer.append(config.getPluginActivatorPackageName());
- stringBuffer.append(TEXT_3);
- stringBuffer.append(config.getPluginActivatorClassName());
- stringBuffer.append(TEXT_4);
-
- HashSet exportedPackages = new HashSet();
- if (config.getMainPackageName() != null && config.getMainPackageName().trim().length() > 0) {
- exportedPackages.add(config.getMainPackageName());
- }
- exportedPackages.add(config.getPluginActivatorPackageName());
-
- stringBuffer.append(TEXT_5);
- stringBuffer.append(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");
-}
-
- stringBuffer.append(TEXT_6);
- stringBuffer.append(listComposer.composeList(allRequiredBundles));
- stringBuffer.append(TEXT_7);
- stringBuffer.append(TEXT_8);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/PluginActivatorGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/PluginActivatorGenerator.java
deleted file mode 100644
index 74e326125..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/PluginActivatorGenerator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.standalone.templates;
-
-import org.eclipse.gmf.graphdef.codegen.*;
-import org.eclipse.gmf.common.codegen.ImportAssistant;
-
-public class PluginActivatorGenerator
-{
- protected static String nl;
- public static synchronized PluginActivatorGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- PluginActivatorGenerator result = new PluginActivatorGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = NL + "import org.eclipse.core.runtime.Plugin;" + NL;
- protected final String TEXT_2 = NL + "import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;" + NL + "import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes;";
- protected final String TEXT_3 = NL + NL + "import org.osgi.framework.BundleContext;";
- protected final String TEXT_4 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_5 = " extends Plugin {" + NL;
- protected final String TEXT_6 = NL + "\tprivate IMapMode myMapMode = MapModeTypes.IDENTITY_MM;";
- protected final String TEXT_7 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final String ID = \"";
- protected final String TEXT_8 = "\"; //$NON-NLS-1$" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static ";
- protected final String TEXT_9 = " ourInstance;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_10 = "() {" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void start(BundleContext context) throws Exception {" + NL + "\t\tsuper.start(context);" + NL + "\t\tif (ourInstance != null){" + NL + "\t\t\tthrow new IllegalStateException(\"Plugin: \" + ID + \" already started\");" + NL + "\t\t}" + NL + "\t\tourInstance = this;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void stop(BundleContext context) throws Exception {" + NL + "\t\tif (ourInstance == null){" + NL + "\t\t\tthrow new IllegalStateException(\"Plugin: \" + ID + \" is not started\");" + NL + "\t\t}" + NL + "\t\tourInstance = null;" + NL + "\t\tsuper.stop(context);" + NL + "\t}" + NL + "\t";
- protected final String TEXT_11 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setMapMode(IMapMode mapMode) {" + NL + "\t\tmyMapMode = mapMode;" + NL + "\t\tif (myMapMode == null){" + NL + "\t\t\tmyMapMode = MapModeTypes.IDENTITY_MM;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IMapMode getMapMode() {" + NL + "\t\treturn myMapMode;" + NL + "\t}" + NL;
- protected final String TEXT_12 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static ";
- protected final String TEXT_13 = " getDefault() {" + NL + "\t\treturn ourInstance;" + NL + "\t}" + NL + "}";
- protected final String TEXT_14 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-final Object[] passedArgs = (Object[]) argument;
-final StandaloneGenerator.Config config = (StandaloneGenerator.Config) passedArgs[0];
-final ImportAssistant importManager = (ImportAssistant) passedArgs[1];
-
-importManager.emitPackageStatement(stringBuffer);
-
- stringBuffer.append(TEXT_1);
-
-if (config.needsMapMode()){
-
- stringBuffer.append(TEXT_2);
-
-}
-
- stringBuffer.append(TEXT_3);
- importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_4);
- stringBuffer.append(importManager.getCompilationUnitName());
- stringBuffer.append(TEXT_5);
-
-if (config.needsMapMode()){
-
- stringBuffer.append(TEXT_6);
-
-}
-
- stringBuffer.append(TEXT_7);
- stringBuffer.append(config.getPluginID());
- stringBuffer.append(TEXT_8);
- stringBuffer.append(config.getPluginActivatorClassName());
- stringBuffer.append(TEXT_9);
- stringBuffer.append(config.getPluginActivatorClassName());
- stringBuffer.append(TEXT_10);
-
-if (config.needsMapMode()){
-
- stringBuffer.append(TEXT_11);
-
-}
-
- stringBuffer.append(TEXT_12);
- stringBuffer.append(config.getPluginActivatorClassName());
- stringBuffer.append(TEXT_13);
- importManager.emitSortedImports();
- stringBuffer.append(TEXT_14);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/PluginPropertiesGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/PluginPropertiesGenerator.java
deleted file mode 100644
index 1d977b7e8..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/standalone/templates/PluginPropertiesGenerator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.standalone.templates;
-
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class PluginPropertiesGenerator
-{
- protected static String nl;
- public static synchronized PluginPropertiesGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- PluginPropertiesGenerator result = new PluginPropertiesGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "pluginName = ";
- protected final String TEXT_2 = NL + "providerName = ";
- protected final String TEXT_3 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-final StandaloneGenerator.Config config = (StandaloneGenerator.Config) argument;
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(config.getPluginFriendlyName());
- stringBuffer.append(TEXT_2);
- stringBuffer.append(config.getPluginProviderName());
- stringBuffer.append(TEXT_3);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomClassAttributesGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomClassAttributesGenerator.java
deleted file mode 100644
index 3a19c610c..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomClassAttributesGenerator.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.emf.codegen.util.CodeGenUtil;
-import java.util.*;
-
-public class CustomClassAttributesGenerator
-{
- protected static String nl;
- public static synchronized CustomClassAttributesGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- CustomClassAttributesGenerator result = new CustomClassAttributesGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "\t\t{";
- protected final String TEXT_2 = NL + "\t\t\t";
- protected final String TEXT_3 = ";";
- protected final String TEXT_4 = NL + "\t\t\t";
- protected final String TEXT_5 = ".";
- protected final String TEXT_6 = " = ";
- protected final String TEXT_7 = ";\t\t";
- protected final String TEXT_8 = NL + "\t\t\t";
- protected final String TEXT_9 = ".set";
- protected final String TEXT_10 = "(";
- protected final String TEXT_11 = ");";
- protected final String TEXT_12 = "\t";
- protected final String TEXT_13 = NL + "\t\t}";
- protected final String TEXT_14 = NL;
- protected final String TEXT_15 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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) {
- stringBuffer.append(TEXT_1);
- }
-
-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;
-
- stringBuffer.append(TEXT_2);
- stringBuffer.append(java.text.MessageFormat.format(next.getValue(), new Object[] {varValue}));
- stringBuffer.append(TEXT_3);
- } else {
- varValue = next.getValue();
-}
- if (next.isDirectAccess()) {
-
- stringBuffer.append(TEXT_4);
- stringBuffer.append(varName);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_6);
- stringBuffer.append(varValue);
- stringBuffer.append(TEXT_7);
-
- } else {
-
- stringBuffer.append(TEXT_8);
- stringBuffer.append(varName);
- stringBuffer.append(TEXT_9);
- stringBuffer.append(CodeGenUtil.capName(next.getName()));
- stringBuffer.append(TEXT_10);
- stringBuffer.append(varValue);
- stringBuffer.append(TEXT_11);
-
- }
-
- stringBuffer.append(TEXT_12);
-
-} //for
-
- if (insertingArbitraryCode) {
- stringBuffer.append(TEXT_13);
- }
- stringBuffer.append(TEXT_14);
- stringBuffer.append(TEXT_15);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomFigureAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomFigureAttrGenerator.java
deleted file mode 100644
index 2fa86e93b..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/CustomFigureAttrGenerator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
-
-public class CustomFigureAttrGenerator
-{
- protected static String nl;
- public static synchronized CustomFigureAttrGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- CustomFigureAttrGenerator result = new CustomFigureAttrGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL;
- protected final String TEXT_3 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-final CustomFigure figureInstance = (CustomFigure) args.getFigure();
-final String figureVarName = args.getVariableName();
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(dispatcher.dispatch("customAttributes", new Object[] {figureInstance, dispatcher, figureVarName}));
- stringBuffer.append(TEXT_2);
- stringBuffer.append(dispatcher.dispatch("Figure", args));
- stringBuffer.append(TEXT_3);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java
deleted file mode 100644
index 9c576df39..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
-
-public class FigureAttrGenerator
-{
- protected static String nl;
- public static synchronized FigureAttrGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- FigureAttrGenerator result = new FigureAttrGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "\t\t";
- protected final String TEXT_2 = ".setForegroundColor(";
- protected final String TEXT_3 = NL + ");";
- protected final String TEXT_4 = NL + "\t\t";
- protected final String TEXT_5 = ".setBackgroundColor(";
- protected final String TEXT_6 = NL + ");";
- protected final String TEXT_7 = NL + "\t\t";
- protected final String TEXT_8 = ".setPreferredSize(";
- protected final String TEXT_9 = ", ";
- protected final String TEXT_10 = ");";
- protected final String TEXT_11 = NL + "\t\t";
- protected final String TEXT_12 = ".setSize(";
- protected final String TEXT_13 = ", ";
- protected final String TEXT_14 = ");";
- protected final String TEXT_15 = NL + "\t\t";
- protected final String TEXT_16 = ".setMaximumSize(new ";
- protected final String TEXT_17 = "(";
- protected final String TEXT_18 = ", ";
- protected final String TEXT_19 = "));";
- protected final String TEXT_20 = NL + "\t\t";
- protected final String TEXT_21 = ".setMinimumSize(new ";
- protected final String TEXT_22 = "(";
- protected final String TEXT_23 = ", ";
- protected final String TEXT_24 = "));";
- protected final String TEXT_25 = NL + "\t\t";
- protected final String TEXT_26 = ".setFont(" + NL + "\t\t\t";
- protected final String TEXT_27 = ");";
- protected final String TEXT_28 = NL + "\t\t";
- protected final String TEXT_29 = ".setBorder(new ";
- protected final String TEXT_30 = "(";
- protected final String TEXT_31 = ", ";
- protected final String TEXT_32 = ", ";
- protected final String TEXT_33 = ", ";
- protected final String TEXT_34 = "));";
- protected final String TEXT_35 = NL + "\t\t";
- protected final String TEXT_36 = ".setBorder(";
- protected final String TEXT_37 = ");";
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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";
- stringBuffer.append(TEXT_1);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_2);
-
-//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() + ")";
-
- stringBuffer.append(dispatcher.getStaticFieldsManager().addStaticField(staticFieldType, staticFieldName, staticFieldValue));
- } else if (colorVal instanceof ConstantColor) {
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants") + "." + ((ConstantColor) colorVal).getValue().getLiteral());
- } else {
- throw new IllegalStateException("Unknown color: " + colorVal);
- }
-
- stringBuffer.append(TEXT_3);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_BackgroundColor())) {
- colorVal = figureInstance.getBackgroundColor();
- colorName = figureInstance.getName().toUpperCase() + "_BACK";
- stringBuffer.append(TEXT_4);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_5);
-
-//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() + ")";
-
- stringBuffer.append(dispatcher.getStaticFieldsManager().addStaticField(staticFieldType, staticFieldName, staticFieldValue));
- } else if (colorVal instanceof ConstantColor) {
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants") + "." + ((ConstantColor) colorVal).getValue().getLiteral());
- } else {
- throw new IllegalStateException("Unknown color: " + colorVal);
- }
-
- stringBuffer.append(TEXT_6);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_PreferredSize())) {
- Dimension d = figureInstance.getPreferredSize();
- stringBuffer.append(TEXT_7);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_8);
- stringBuffer.append(dispatcher.DPtoLP(d.getDx()));
- stringBuffer.append(TEXT_9);
- stringBuffer.append(dispatcher.DPtoLP(d.getDy()));
- stringBuffer.append(TEXT_10);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_Size())) {
- Point p = figureInstance.getSize();
- stringBuffer.append(TEXT_11);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_12);
- stringBuffer.append(dispatcher.DPtoLP(p.getX()));
- stringBuffer.append(TEXT_13);
- stringBuffer.append(dispatcher.DPtoLP(p.getY()));
- stringBuffer.append(TEXT_14);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_MaximumSize())) {
- Dimension d = figureInstance.getMaximumSize();
- stringBuffer.append(TEXT_15);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_16);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension"));
- stringBuffer.append(TEXT_17);
- stringBuffer.append(dispatcher.DPtoLP(d.getDx()));
- stringBuffer.append(TEXT_18);
- stringBuffer.append(dispatcher.DPtoLP(d.getDy()));
- stringBuffer.append(TEXT_19);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_MinimumSize())) {
- Dimension d = figureInstance.getMinimumSize();
- stringBuffer.append(TEXT_20);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_21);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension"));
- stringBuffer.append(TEXT_22);
- stringBuffer.append(dispatcher.DPtoLP(d.getDx()));
- stringBuffer.append(TEXT_23);
- stringBuffer.append(dispatcher.DPtoLP(d.getDy()));
- stringBuffer.append(TEXT_24);
- } 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();
- }
- }
-
- stringBuffer.append(TEXT_25);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_26);
- stringBuffer.append(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() + ")"
- ));
- stringBuffer.append(TEXT_27);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_Insets())) {
- Insets insets = figureInstance.getInsets();
- stringBuffer.append(TEXT_28);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_29);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.MarginBorder"));
- stringBuffer.append(TEXT_30);
- stringBuffer.append(dispatcher.DPtoLP(insets.getTop()));
- stringBuffer.append(TEXT_31);
- stringBuffer.append(dispatcher.DPtoLP(insets.getLeft()));
- stringBuffer.append(TEXT_32);
- stringBuffer.append(dispatcher.DPtoLP(insets.getBottom()));
- stringBuffer.append(TEXT_33);
- stringBuffer.append(dispatcher.DPtoLP(insets.getRight()));
- stringBuffer.append(TEXT_34);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_Border())) {
- Border border = figureInstance.getBorder();
- stringBuffer.append(TEXT_35);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_36);
- stringBuffer.append(dispatcher.dispatch(border, new Object[] {border, dispatcher}));
- stringBuffer.append(TEXT_37);
- }
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java
deleted file mode 100644
index 0fe2ea227..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.gmfgraph.util.*;
-import org.eclipse.emf.codegen.util.CodeGenUtil;
-import java.util.*;
-
-public class FigureChildrenGenerator
-{
- protected static String nl;
- public static synchronized FigureChildrenGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- FigureChildrenGenerator result = new FigureChildrenGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createContents(){";
- protected final String TEXT_2 = NL + "\t\t";
- protected final String TEXT_3 = NL + "\t\tsetFigure";
- protected final String TEXT_4 = "(";
- protected final String TEXT_5 = ");";
- protected final String TEXT_6 = NL + "\t\t";
- protected final String TEXT_7 = NL + "\t\t";
- protected final String TEXT_8 = ".add(";
- protected final String TEXT_9 = ", ";
- protected final String TEXT_10 = ");";
- protected final String TEXT_11 = NL + "\t}" + NL + "\t";
- protected final String TEXT_12 = NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_13 = " f";
- protected final String TEXT_14 = "; " + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_15 = " ";
- protected final String TEXT_16 = "() {" + NL + "\t\treturn f";
- protected final String TEXT_17 = ";" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setFigure";
- protected final String TEXT_18 = "(";
- protected final String TEXT_19 = " fig){" + NL + "\t\tf";
- protected final String TEXT_20 = " = fig;" + NL + "\t}" + NL;
- protected final String TEXT_21 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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);
-
-
- stringBuffer.append(TEXT_1);
-
-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);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(dispatcher.dispatch("instantiate", nextLevelArgs));
-
-if (fieldSupport.isFieldRequired(nextChild)){
- fieldsRequired.add(nextChild);
- stringBuffer.append(TEXT_3);
- stringBuffer.append(nextChild.getName());
- stringBuffer.append(TEXT_4);
- stringBuffer.append(childVarName);
- stringBuffer.append(TEXT_5);
- }
- stringBuffer.append(TEXT_6);
- stringBuffer.append(dispatcher.dispatch("createLayoutData", nextLevelArgs));
- stringBuffer.append(TEXT_7);
- stringBuffer.append(parentArgs.getVariableName());
- stringBuffer.append(TEXT_8);
- stringBuffer.append(childVarName);
- stringBuffer.append(TEXT_9);
- stringBuffer.append(childConstraint);
- stringBuffer.append(TEXT_10);
-
- 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
-
- stringBuffer.append(TEXT_11);
-
- final FigureQualifiedNameSwitch fqnSwitch = dispatcher.getFQNSwitch();
- for (Iterator fieldFigures = fieldsRequired.iterator(); fieldFigures.hasNext();){
- Figure next = (Figure)fieldFigures.next();
- final String nextClassName = fqnSwitch.get(next, importManager);
- stringBuffer.append(TEXT_12);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_13);
- stringBuffer.append(CodeGenUtil.capName(next.getName()));
- stringBuffer.append(TEXT_14);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_15);
- stringBuffer.append(namingStrategy.getChildFigureGetterName(next));
- stringBuffer.append(TEXT_16);
- stringBuffer.append(CodeGenUtil.capName(next.getName()));
- stringBuffer.append(TEXT_17);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_18);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_19);
- stringBuffer.append(CodeGenUtil.capName(next.getName()));
- stringBuffer.append(TEXT_20);
- }
- stringBuffer.append(TEXT_21);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java
deleted file mode 100644
index 1e8cbe084..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class InitBorderLayoutDataGenerator
-{
- protected static String nl;
- public static synchronized InitBorderLayoutDataGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- InitBorderLayoutDataGenerator result = new InitBorderLayoutDataGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "\tObject ";
- protected final String TEXT_3 = " = ";
- protected final String TEXT_4 = ".";
- protected final String TEXT_5 = ";" + NL;
- protected final String TEXT_6 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final BorderLayoutData gmfLayoutData = (BorderLayoutData) argsBundle.getData();
-final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-
- stringBuffer.append(TEXT_1);
-
-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());
-}
-
- stringBuffer.append(TEXT_2);
- stringBuffer.append(argsBundle.getConstraintVariableName());
- stringBuffer.append(TEXT_3);
- stringBuffer.append(dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout"));
- stringBuffer.append(TEXT_4);
- stringBuffer.append(constantName);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(TEXT_6);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutGenerator.java
deleted file mode 100644
index b56721ba5..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutGenerator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class InitBorderLayoutGenerator
-{
- protected static String nl;
- public static synchronized InitBorderLayoutGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- InitBorderLayoutGenerator result = new InitBorderLayoutGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "\t\t";
- protected final String TEXT_3 = ".setHorizontalSpacing(";
- protected final String TEXT_4 = ");" + NL + "\t\t";
- protected final String TEXT_5 = ".setVerticalSpacing(";
- protected final String TEXT_6 = ");";
- protected final String TEXT_7 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final BorderLayout gmfLayout = (BorderLayout) argsBundle.getLayout();
-final String layouterVarName = argsBundle.getManagerVariableName();
-
- stringBuffer.append(TEXT_1);
-
-Dimension spacing = gmfLayout.getSpacing();
-if (spacing != null){
-
- stringBuffer.append(TEXT_2);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_3);
- stringBuffer.append(spacing.getDx());
- stringBuffer.append(TEXT_4);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(spacing.getDy());
- stringBuffer.append(TEXT_6);
-
-}
-
- stringBuffer.append(TEXT_7);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java
deleted file mode 100644
index 837a3456f..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class InitCustomLayoutDataGenerator
-{
- protected static String nl;
- public static synchronized InitCustomLayoutDataGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- InitCustomLayoutDataGenerator result = new InitCustomLayoutDataGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = " ";
- protected final String TEXT_3 = " = new ";
- protected final String TEXT_4 = "();";
- protected final String TEXT_5 = NL;
- protected final String TEXT_6 = NL;
- protected final String TEXT_7 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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());
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(layoutImplClassName);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(args.getConstraintVariableName());
- stringBuffer.append(TEXT_3);
- stringBuffer.append(layoutImplClassName);
- stringBuffer.append(TEXT_4);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(dispatcher.dispatch("customAttributes", new Object[] {layoutData, dispatcher, args.getConstraintVariableName()}));
- stringBuffer.append(TEXT_6);
- stringBuffer.append(TEXT_7);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutGenerator.java
deleted file mode 100644
index 89d9aed5a..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutGenerator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class InitCustomLayoutGenerator
-{
- protected static String nl;
- public static synchronized InitCustomLayoutGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- InitCustomLayoutGenerator result = new InitCustomLayoutGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final CustomLayout layout = (CustomLayout) argsBundle.getLayout();
-final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(dispatcher.dispatch("customAttributes", new Object[] {layout, dispatcher, argsBundle.getManagerVariableName()} ));
- stringBuffer.append(TEXT_2);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitFlowLayoutGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitFlowLayoutGenerator.java
deleted file mode 100644
index 671125fe0..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitFlowLayoutGenerator.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class InitFlowLayoutGenerator
-{
- protected static String nl;
- public static synchronized InitFlowLayoutGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- InitFlowLayoutGenerator result = new InitFlowLayoutGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "\t\t";
- protected final String TEXT_2 = ".setStretchMinorAxis(";
- protected final String TEXT_3 = ");" + NL + "\t\t";
- protected final String TEXT_4 = ".setMinorAlignment(";
- protected final String TEXT_5 = ".";
- protected final String TEXT_6 = ");";
- protected final String TEXT_7 = "\t\t" + NL + "\t\t";
- protected final String TEXT_8 = ".setSpacing(";
- protected final String TEXT_9 = ");" + NL + "\t\t";
- protected final String TEXT_10 = ".setVertical(";
- protected final String TEXT_11 = ");";
- protected final String TEXT_12 = NL + "\t\t";
- protected final String TEXT_13 = ".setMajorAlignment(";
- protected final String TEXT_14 = ".";
- protected final String TEXT_15 = ");" + NL + "\t\t";
- protected final String TEXT_16 = ".setMajorSpacing(";
- protected final String TEXT_17 = ");" + NL + "\t\t";
- protected final String TEXT_18 = ".setMinorSpacing(";
- protected final String TEXT_19 = ");" + NL + "\t\t";
- protected final String TEXT_20 = ".setHorizontal(";
- protected final String TEXT_21 = ");";
- protected final String TEXT_22 = NL + NL;
- protected final String TEXT_23 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(gmfLayout.isMatchMinorSize());
- stringBuffer.append(TEXT_3);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_4);
- stringBuffer.append(layouterClassName);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(alignmentFacade.convert(gmfLayout, gmfLayout.getMinorAlignment()));
- stringBuffer.append(TEXT_6);
-
-if (gmfLayout.isForceSingleLine()){
-
- stringBuffer.append(TEXT_7);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_8);
- stringBuffer.append(gmfLayout.getMajorSpacing());
- stringBuffer.append(TEXT_9);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_10);
- stringBuffer.append(gmfLayout.isVertical());
- stringBuffer.append(TEXT_11);
-
-} else {
-
- stringBuffer.append(TEXT_12);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_13);
- stringBuffer.append(layouterClassName);
- stringBuffer.append(TEXT_14);
- stringBuffer.append(alignmentFacade.convert(gmfLayout, gmfLayout.getMajorAlignment()));
- stringBuffer.append(TEXT_15);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_16);
- stringBuffer.append(gmfLayout.getMajorSpacing());
- stringBuffer.append(TEXT_17);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_18);
- stringBuffer.append(gmfLayout.getMinorSpacing());
- stringBuffer.append(TEXT_19);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_20);
- stringBuffer.append(!gmfLayout.isVertical());
- stringBuffer.append(TEXT_21);
-
-}
-
- stringBuffer.append(TEXT_22);
- stringBuffer.append(TEXT_23);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java
deleted file mode 100644
index b9b5043d9..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class InitGridLayoutDataGenerator
-{
- protected static String nl;
- public static synchronized InitGridLayoutDataGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- InitGridLayoutDataGenerator result = new InitGridLayoutDataGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "\t\t\t";
- protected final String TEXT_2 = " ";
- protected final String TEXT_3 = " = new ";
- protected final String TEXT_4 = "();" + NL + "\t\t\t";
- protected final String TEXT_5 = ".verticalAlignment = ";
- protected final String TEXT_6 = ".";
- protected final String TEXT_7 = ";" + NL + "\t\t\t";
- protected final String TEXT_8 = ".horizontalAlignment = ";
- protected final String TEXT_9 = ".";
- protected final String TEXT_10 = ";";
- protected final String TEXT_11 = NL + "\t\t\t";
- protected final String TEXT_12 = ".widthHint = ";
- protected final String TEXT_13 = ";" + NL + "\t\t\t";
- protected final String TEXT_14 = ".heightHint = ";
- protected final String TEXT_15 = ";";
- protected final String TEXT_16 = NL + "\t\t\t";
- protected final String TEXT_17 = ".horizontalIndent = ";
- protected final String TEXT_18 = ";" + NL + "\t\t\t";
- protected final String TEXT_19 = ".horizontalSpan = ";
- protected final String TEXT_20 = ";" + NL + "\t\t\t";
- protected final String TEXT_21 = ".verticalSpan = ";
- protected final String TEXT_22 = ";" + NL + "\t\t\t";
- protected final String TEXT_23 = ".grabExcessHorizontalSpace = ";
- protected final String TEXT_24 = ";" + NL + "\t\t\t";
- protected final String TEXT_25 = ".grabExcessVerticalSpace = ";
- protected final String TEXT_26 = ";" + NL;
- protected final String TEXT_27 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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());
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(layoutImplClassName);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_3);
- stringBuffer.append(layoutImplClassName);
- stringBuffer.append(TEXT_4);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(layoutImplClassName);
- stringBuffer.append(TEXT_6);
- stringBuffer.append(gmfLayoutData.getVerticalAlignment().getName());
- stringBuffer.append(TEXT_7);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_8);
- stringBuffer.append(layoutImplClassName);
- stringBuffer.append(TEXT_9);
- stringBuffer.append(gmfLayoutData.getHorizontalAlignment().getName());
- stringBuffer.append(TEXT_10);
-
-Dimension sizeHint = gmfLayoutData.getSizeHint();
-if (sizeHint != null){
-
- stringBuffer.append(TEXT_11);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_12);
- stringBuffer.append(sizeHint.getDx());
- stringBuffer.append(TEXT_13);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_14);
- stringBuffer.append(sizeHint.getDy());
- stringBuffer.append(TEXT_15);
-
-}
-
- stringBuffer.append(TEXT_16);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_17);
- stringBuffer.append(gmfLayoutData.getHorizontalIndent());
- stringBuffer.append(TEXT_18);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_19);
- stringBuffer.append(gmfLayoutData.getHorizontalSpan());
- stringBuffer.append(TEXT_20);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_21);
- stringBuffer.append(gmfLayoutData.getVerticalSpan());
- stringBuffer.append(TEXT_22);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_23);
- stringBuffer.append(gmfLayoutData.isGrabExcessHorizontalSpace());
- stringBuffer.append(TEXT_24);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_25);
- stringBuffer.append(gmfLayoutData.isGrabExcessVerticalSpace());
- stringBuffer.append(TEXT_26);
- stringBuffer.append(TEXT_27);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutGenerator.java
deleted file mode 100644
index 769350fd7..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutGenerator.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class InitGridLayoutGenerator
-{
- protected static String nl;
- public static synchronized InitGridLayoutGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- InitGridLayoutGenerator result = new InitGridLayoutGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "\t\t";
- protected final String TEXT_2 = ".numColumns = ";
- protected final String TEXT_3 = ";" + NL + "\t\t";
- protected final String TEXT_4 = ".makeColumnsEqualWidth = ";
- protected final String TEXT_5 = ";";
- protected final String TEXT_6 = NL + "\t\t";
- protected final String TEXT_7 = ".marginWidth = ";
- protected final String TEXT_8 = ";" + NL + "\t\t";
- protected final String TEXT_9 = ".marginHeight = ";
- protected final String TEXT_10 = ";";
- protected final String TEXT_11 = NL + "\t\t";
- protected final String TEXT_12 = ".horizontalSpacing = ";
- protected final String TEXT_13 = ";" + NL + "\t\t";
- protected final String TEXT_14 = ".verticalSpacing = ";
- protected final String TEXT_15 = ";";
- protected final String TEXT_16 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
-final GridLayout gmfLayout = (GridLayout) argsBundle.getLayout();
-final String layouterVarName = argsBundle.getManagerVariableName();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(gmfLayout.getNumColumns());
- stringBuffer.append(TEXT_3);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_4);
- stringBuffer.append(gmfLayout.isEqualWidth());
- stringBuffer.append(TEXT_5);
-
-Dimension margins = gmfLayout.getMargins();
-if (margins != null){
-
- stringBuffer.append(TEXT_6);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_7);
- stringBuffer.append(margins.getDx());
- stringBuffer.append(TEXT_8);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_9);
- stringBuffer.append(margins.getDy());
- stringBuffer.append(TEXT_10);
-
-}
-Dimension spacing = gmfLayout.getSpacing();
-if (spacing != null){
-
- stringBuffer.append(TEXT_11);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_12);
- stringBuffer.append(spacing.getDx());
- stringBuffer.append(TEXT_13);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_14);
- stringBuffer.append(spacing.getDy());
- stringBuffer.append(TEXT_15);
-
-}
-
- stringBuffer.append(TEXT_16);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java
deleted file mode 100644
index eec36debc..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class InitXYLayoutDataGenerator
-{
- protected static String nl;
- public static synchronized InitXYLayoutDataGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- InitXYLayoutDataGenerator result = new InitXYLayoutDataGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "\t\t\t";
- protected final String TEXT_2 = " ";
- protected final String TEXT_3 = " = new ";
- protected final String TEXT_4 = "();";
- protected final String TEXT_5 = NL + "\t\t\t";
- protected final String TEXT_6 = ".x = ";
- protected final String TEXT_7 = ";" + NL + "\t\t\t";
- protected final String TEXT_8 = ".y = ";
- protected final String TEXT_9 = ";";
- protected final String TEXT_10 = NL + "\t\t\t";
- protected final String TEXT_11 = ".width = ";
- protected final String TEXT_12 = ";" + NL + "\t\t\t";
- protected final String TEXT_13 = ".height = ";
- protected final String TEXT_14 = ";";
- protected final String TEXT_15 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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());
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(layoutImplClassName);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_3);
- stringBuffer.append(layoutImplClassName);
- stringBuffer.append(TEXT_4);
-
-Point topLeft = gmfLayoutData.getTopLeft();
-if (topLeft != null){
-
- stringBuffer.append(TEXT_5);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_6);
- stringBuffer.append(topLeft.getX());
- stringBuffer.append(TEXT_7);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_8);
- stringBuffer.append(topLeft.getY());
- stringBuffer.append(TEXT_9);
-
-}
-
-
-Dimension size = gmfLayoutData.getSize();
-if (size != null){
-
- stringBuffer.append(TEXT_10);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_11);
- stringBuffer.append(size.getDx());
- stringBuffer.append(TEXT_12);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_13);
- stringBuffer.append(size.getDy());
- stringBuffer.append(TEXT_14);
-
-}
-
- stringBuffer.append(TEXT_15);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/LabelAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/LabelAttrGenerator.java
deleted file mode 100644
index f588707b6..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/LabelAttrGenerator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
-
-public class LabelAttrGenerator
-{
- protected static String nl;
- public static synchronized LabelAttrGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- LabelAttrGenerator result = new LabelAttrGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = ".setText(\"";
- protected final String TEXT_3 = "\");";
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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())) {
- stringBuffer.append(TEXT_1);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(figureInstance.getText());
- stringBuffer.append(TEXT_3);
- }
- stringBuffer.append(dispatcher.dispatch("Figure", args));
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewCompoundBorderExpressionGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewCompoundBorderExpressionGenerator.java
deleted file mode 100644
index ab3a7a130..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewCompoundBorderExpressionGenerator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-import org.eclipse.gmf.common.codegen.ImportAssistant;
-
-public class NewCompoundBorderExpressionGenerator
-{
- protected static String nl;
- public static synchronized NewCompoundBorderExpressionGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- NewCompoundBorderExpressionGenerator result = new NewCompoundBorderExpressionGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "\t";
- protected final String TEXT_2 = NL + "new ";
- protected final String TEXT_3 = "(" + NL + "\t";
- protected final String TEXT_4 = ", " + NL + "\t";
- protected final String TEXT_5 = NL + ")";
- protected final String TEXT_6 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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.
-
- stringBuffer.append(TEXT_1);
- Border outer = border.getOuter();
- Border inner = border.getInner();
-
- stringBuffer.append(TEXT_2);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.CompoundBorder"));
- stringBuffer.append(TEXT_3);
- stringBuffer.append( (outer == null) ? "null" : dispatcher.dispatch(outer, new Object[]{outer, dispatcher}));
- stringBuffer.append(TEXT_4);
- stringBuffer.append( (inner == null) ? "null" : dispatcher.dispatch(inner, new Object[]{inner, dispatcher}));
- stringBuffer.append(TEXT_5);
- stringBuffer.append(TEXT_6);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewCustomBorderExpressionGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewCustomBorderExpressionGenerator.java
deleted file mode 100644
index 5c3505185..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewCustomBorderExpressionGenerator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class NewCustomBorderExpressionGenerator
-{
- protected static String nl;
- public static synchronized NewCustomBorderExpressionGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- NewCustomBorderExpressionGenerator result = new NewCustomBorderExpressionGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "()";
- protected final String TEXT_2 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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
-
- stringBuffer.append(dispatcher.getAuxiliaryDataStorage().getRegisteredData(border));
- stringBuffer.append(TEXT_1);
- stringBuffer.append(TEXT_2);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewFigureGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewFigureGenerator.java
deleted file mode 100644
index e9cbfc076..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewFigureGenerator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class NewFigureGenerator
-{
- protected static String nl;
- public static synchronized NewFigureGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- NewFigureGenerator result = new NewFigureGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = " ";
- protected final String TEXT_3 = " = new ";
- protected final String TEXT_4 = "();";
- protected final String TEXT_5 = NL;
- protected final String TEXT_6 = NL;
- protected final String TEXT_7 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(figureClassName);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_3);
- stringBuffer.append(figureClassName);
- stringBuffer.append(TEXT_4);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(args.getDispatcher().dispatch(figureInstance, args));
- stringBuffer.append(TEXT_6);
- stringBuffer.append(args.getDispatcher().dispatch("createLayout", dispatcher.getLayoutArgsFor(args)));
- stringBuffer.append(TEXT_7);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java
deleted file mode 100644
index 46b2373c9..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class NewLayoutDataGenerator
-{
- protected static String nl;
- public static synchronized NewLayoutDataGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- NewLayoutDataGenerator result = new NewLayoutDataGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = "\t\t\t";
- protected final String TEXT_3 = NL + "\t\tObject ";
- protected final String TEXT_4 = " = null;";
- protected final String TEXT_5 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-// 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) {
- stringBuffer.append(TEXT_1);
- stringBuffer.append(dispatcher.dispatch(gmfLayoutData, argsBundle));
- stringBuffer.append(TEXT_2);
- } else {
- stringBuffer.append(TEXT_3);
- stringBuffer.append(argsBundle.getConstraintVariableName());
- stringBuffer.append(TEXT_4);
- }
- stringBuffer.append(TEXT_5);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutGenerator.java
deleted file mode 100644
index 5fc0be716..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutGenerator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-
-public class NewLayoutGenerator
-{
- protected static String nl;
- public static synchronized NewLayoutGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- NewLayoutGenerator result = new NewLayoutGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "\t\t";
- protected final String TEXT_3 = " ";
- protected final String TEXT_4 = " = new ";
- protected final String TEXT_5 = "();" + NL + "\t\t";
- protected final String TEXT_6 = "\t" + NL + "\t\t";
- protected final String TEXT_7 = ".setLayoutManager(";
- protected final String TEXT_8 = ");";
- protected final String TEXT_9 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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();
-
- stringBuffer.append(TEXT_1);
-
-Layout gmfLayout= figureMarker.getLayout();
-if (gmfLayout != null){
- final String layouterImplClass = dispatcher.getFQNSwitch().get(gmfLayout, dispatcher.getImportManager());
-
- stringBuffer.append(TEXT_2);
- stringBuffer.append(layouterImplClass);
- stringBuffer.append(TEXT_3);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_4);
- stringBuffer.append(layouterImplClass);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(argsBundle.getDispatcher().dispatch(gmfLayout, argsBundle));
- stringBuffer.append(TEXT_6);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_7);
- stringBuffer.append(layouterVarName);
- stringBuffer.append(TEXT_8);
-
-}
-
- stringBuffer.append(TEXT_9);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLineBorderExpressionGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLineBorderExpressionGenerator.java
deleted file mode 100644
index 1a4aa54a2..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLineBorderExpressionGenerator.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-import org.eclipse.gmf.common.codegen.ImportAssistant;
-
-public class NewLineBorderExpressionGenerator
-{
- protected static String nl;
- public static synchronized NewLineBorderExpressionGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- NewLineBorderExpressionGenerator result = new NewLineBorderExpressionGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "new ";
- protected final String TEXT_2 = "(";
- protected final String TEXT_3 = NL + ", ";
- protected final String TEXT_4 = ")";
- protected final String TEXT_5 = NL + "new ";
- protected final String TEXT_6 = "(";
- protected final String TEXT_7 = NL + ")";
- protected final String TEXT_8 = NL + "new ";
- protected final String TEXT_9 = "(";
- protected final String TEXT_10 = ")";
- protected final String TEXT_11 = NL + "new ";
- protected final String TEXT_12 = "()";
- protected final String TEXT_13 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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){
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(borderClazz);
- stringBuffer.append(TEXT_2);
-
-//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() + ")";
-
- stringBuffer.append(dispatcher.getStaticFieldsManager().addStaticField(staticFieldType, staticFieldName, staticFieldValue));
- } else if (colorVal instanceof ConstantColor) {
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants") + "." + ((ConstantColor) colorVal).getValue().getLiteral());
- } else {
- throw new IllegalStateException("Unknown color: " + colorVal);
- }
-
- stringBuffer.append(TEXT_3);
- stringBuffer.append(dispatcher.DPtoLP(border.getWidth()));
- stringBuffer.append(TEXT_4);
-
- } else if (hasColor && !hasWidth) {
-
- stringBuffer.append(TEXT_5);
- stringBuffer.append(borderClazz);
- stringBuffer.append(TEXT_6);
-
-//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() + ")";
-
- stringBuffer.append(dispatcher.getStaticFieldsManager().addStaticField(staticFieldType, staticFieldName, staticFieldValue));
- } else if (colorVal instanceof ConstantColor) {
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.ColorConstants") + "." + ((ConstantColor) colorVal).getValue().getLiteral());
- } else {
- throw new IllegalStateException("Unknown color: " + colorVal);
- }
-
- stringBuffer.append(TEXT_7);
-
- } else if (!hasColor && hasWidth){
-
- stringBuffer.append(TEXT_8);
- stringBuffer.append(borderClazz);
- stringBuffer.append(TEXT_9);
- stringBuffer.append(dispatcher.DPtoLP(border.getWidth()));
- stringBuffer.append(TEXT_10);
-
- } else {
-
- stringBuffer.append(TEXT_11);
- stringBuffer.append(borderClazz);
- stringBuffer.append(TEXT_12);
-
- }
-
- stringBuffer.append(TEXT_13);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewMarginBorderExpressionGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewMarginBorderExpressionGenerator.java
deleted file mode 100644
index fe2b8e968..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewMarginBorderExpressionGenerator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-import org.eclipse.gmf.common.codegen.ImportAssistant;
-
-public class NewMarginBorderExpressionGenerator
-{
- protected static String nl;
- public static synchronized NewMarginBorderExpressionGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- NewMarginBorderExpressionGenerator result = new NewMarginBorderExpressionGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "\t" + NL + "new ";
- protected final String TEXT_2 = "(";
- protected final String TEXT_3 = ", ";
- protected final String TEXT_4 = ", ";
- protected final String TEXT_5 = ", ";
- protected final String TEXT_6 = ")";
- protected final String TEXT_7 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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();
- }
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.MarginBorder"));
- stringBuffer.append(TEXT_2);
- stringBuffer.append(dispatcher.DPtoLP(top));
- stringBuffer.append(TEXT_3);
- stringBuffer.append(dispatcher.DPtoLP(left));
- stringBuffer.append(TEXT_4);
- stringBuffer.append(dispatcher.DPtoLP(bottom));
- stringBuffer.append(TEXT_5);
- stringBuffer.append(dispatcher.DPtoLP(right));
- stringBuffer.append(TEXT_6);
- stringBuffer.append(TEXT_7);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolygonDecorationAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolygonDecorationAttrGenerator.java
deleted file mode 100644
index 19b191913..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolygonDecorationAttrGenerator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
-
-public class PolygonDecorationAttrGenerator
-{
- protected static String nl;
- public static synchronized PolygonDecorationAttrGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- PolygonDecorationAttrGenerator result = new PolygonDecorationAttrGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
-final GraphDefDispatcher dispatcher = args.getDispatcher();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(dispatcher.dispatch("PolylineDecoration", args));
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineAttrGenerator.java
deleted file mode 100644
index 0b99366a7..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineAttrGenerator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
-
-public class PolylineAttrGenerator
-{
- protected static String nl;
- public static synchronized PolylineAttrGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- PolylineAttrGenerator result = new PolylineAttrGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "\t\t";
- protected final String TEXT_3 = ".addPoint(new ";
- protected final String TEXT_4 = "(";
- protected final String TEXT_5 = ", ";
- protected final String TEXT_6 = "));";
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(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();
- stringBuffer.append(TEXT_2);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_3);
- stringBuffer.append(pointClassName);
- stringBuffer.append(TEXT_4);
- stringBuffer.append(p.getX());
- stringBuffer.append(TEXT_5);
- stringBuffer.append(p.getY());
- stringBuffer.append(TEXT_6);
- }}
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineDecorationAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineDecorationAttrGenerator.java
deleted file mode 100644
index 32080aed6..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineDecorationAttrGenerator.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
-import java.util.*;
-
-public class PolylineDecorationAttrGenerator
-{
- protected static String nl;
- public static synchronized PolylineDecorationAttrGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- PolylineDecorationAttrGenerator result = new PolylineDecorationAttrGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "// dispatchNext?";
- protected final String TEXT_2 = NL;
- protected final String TEXT_3 = NL + "\t\t";
- protected final String TEXT_4 = " pl = new ";
- protected final String TEXT_5 = "();";
- protected final String TEXT_6 = NL + "\t\tpl.addPoint(";
- protected final String TEXT_7 = ", ";
- protected final String TEXT_8 = ");";
- protected final String TEXT_9 = NL + "\t\t";
- protected final String TEXT_10 = ".setTemplate(pl);" + NL + "\t\t";
- protected final String TEXT_11 = ".setScale(";
- protected final String TEXT_12 = ", ";
- protected final String TEXT_13 = ");";
- protected final String TEXT_14 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(dispatcher.dispatch("Shape", args));
- if (!figureInstance.getTemplate().isEmpty()) {
- stringBuffer.append(TEXT_3);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.PointList"));
- stringBuffer.append(TEXT_4);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.PointList"));
- stringBuffer.append(TEXT_5);
- for (Iterator pointIt = figureInstance.getTemplate().iterator(); pointIt.hasNext(); ) {
- Point p = (Point) pointIt.next();
- stringBuffer.append(TEXT_6);
- stringBuffer.append(p.getX());
- stringBuffer.append(TEXT_7);
- stringBuffer.append(p.getY());
- stringBuffer.append(TEXT_8);
- } /*for*/
- stringBuffer.append(TEXT_9);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_10);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_11);
- stringBuffer.append(dispatcher.DPtoLP(7));
- stringBuffer.append(TEXT_12);
- stringBuffer.append(dispatcher.DPtoLP(3));
- stringBuffer.append(TEXT_13);
- } /*!if getTemplate().isEmpty()*/
- stringBuffer.append(TEXT_14);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/RoundedRectAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/RoundedRectAttrGenerator.java
deleted file mode 100644
index ca01bb8df..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/RoundedRectAttrGenerator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
-
-public class RoundedRectAttrGenerator
-{
- protected static String nl;
- public static synchronized RoundedRectAttrGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- RoundedRectAttrGenerator result = new RoundedRectAttrGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL;
- protected final String TEXT_3 = ".setCornerDimensions(new ";
- protected final String TEXT_4 = "(";
- protected final String TEXT_5 = ", ";
- protected final String TEXT_6 = "));";
- protected final String TEXT_7 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(dispatcher.dispatch("Shape", args));
- stringBuffer.append(TEXT_2);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_3);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension"));
- stringBuffer.append(TEXT_4);
- stringBuffer.append(dispatcher.DPtoLP(figureInstance.getCornerWidth()));
- stringBuffer.append(TEXT_5);
- stringBuffer.append(dispatcher.DPtoLP(figureInstance.getCornerHeight()));
- stringBuffer.append(TEXT_6);
- stringBuffer.append(TEXT_7);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ShapeAttrGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ShapeAttrGenerator.java
deleted file mode 100644
index 1238d5524..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ShapeAttrGenerator.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
-
-public class ShapeAttrGenerator
-{
- protected static String nl;
- public static synchronized ShapeAttrGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- ShapeAttrGenerator result = new ShapeAttrGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "\t\t";
- protected final String TEXT_2 = ".setFill(";
- protected final String TEXT_3 = ");";
- protected final String TEXT_4 = NL + "\t\t";
- protected final String TEXT_5 = ".setOutline(";
- protected final String TEXT_6 = ");";
- protected final String TEXT_7 = NL + "\t\t";
- protected final String TEXT_8 = ".setLineWidth(";
- protected final String TEXT_9 = ");";
- protected final String TEXT_10 = NL + "\t\t";
- protected final String TEXT_11 = ".setLineStyle(";
- protected final String TEXT_12 = ".";
- protected final String TEXT_13 = ");";
- protected final String TEXT_14 = NL + "\t\t";
- protected final String TEXT_15 = ".setFillXOR(";
- protected final String TEXT_16 = ");";
- protected final String TEXT_17 = NL + "\t\t";
- protected final String TEXT_18 = ".setOutlineXOR(";
- protected final String TEXT_19 = ");";
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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())) {
- stringBuffer.append(TEXT_1);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(figureInstance.isFill());
- stringBuffer.append(TEXT_3);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Outline())) {
- stringBuffer.append(TEXT_4);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(figureInstance.isOutline());
- stringBuffer.append(TEXT_6);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineWidth())) {
- stringBuffer.append(TEXT_7);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_8);
- stringBuffer.append(figureInstance.getLineWidth());
- stringBuffer.append(TEXT_9);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineKind())) {
- stringBuffer.append(TEXT_10);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_11);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Graphics"));
- stringBuffer.append(TEXT_12);
- stringBuffer.append(figureInstance.getLineKind().getName());
- stringBuffer.append(TEXT_13);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorFill())) {
- stringBuffer.append(TEXT_14);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_15);
- stringBuffer.append(figureInstance.isXorFill());
- stringBuffer.append(TEXT_16);
- } if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorOutline())) {
- stringBuffer.append(TEXT_17);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_18);
- stringBuffer.append(figureInstance.isXorOutline());
- stringBuffer.append(TEXT_19);
- }
- stringBuffer.append(dispatcher.dispatch("Figure", args));
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopConnectionGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopConnectionGenerator.java
deleted file mode 100644
index 39a7ceafd..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopConnectionGenerator.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.gmfgraph.util.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-import org.eclipse.emf.ecore.*;
-import java.util.Iterator;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.codegen.util.CodeGenUtil;;
-
-public class TopConnectionGenerator
-{
- protected static String nl;
- public static synchronized TopConnectionGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- TopConnectionGenerator result = new TopConnectionGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL;
- protected final String TEXT_3 = "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_4 = " ";
- protected final String TEXT_5 = "() {" + NL + "\t\t";
- protected final String TEXT_6 = " result = new ";
- protected final String TEXT_7 = "();" + NL + "\t\t";
- protected final String TEXT_8 = NL + "\t\treturn result;" + NL + "\t}";
- protected final String TEXT_9 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_10 = "() {";
- protected final String TEXT_11 = NL;
- protected final String TEXT_12 = NL + "\t\tsetSourceDecoration(createSourceDecoration());";
- protected final String TEXT_13 = NL + "\t\tsetTargetDecoration(createTargetDecoration());";
- protected final String TEXT_14 = NL + "\t}" + NL;
- protected final String TEXT_15 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_16 = " createSourceDecoration() {";
- protected final String TEXT_17 = NL;
- protected final String TEXT_18 = NL + "\t\treturn df;" + NL + "\t}";
- protected final String TEXT_19 = NL;
- protected final String TEXT_20 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_21 = " createTargetDecoration() {";
- protected final String TEXT_22 = NL;
- protected final String TEXT_23 = NL + "\t\treturn df;" + NL + "\t}";
- protected final String TEXT_24 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(TEXT_2);
-
-//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++);
-
-
- stringBuffer.append(TEXT_3);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Border"));
- stringBuffer.append(TEXT_4);
- stringBuffer.append(bfmNextMethodName);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(bfmNextImplClass);
- stringBuffer.append(TEXT_6);
- stringBuffer.append(bfmNextImplClass);
- stringBuffer.append(TEXT_7);
- stringBuffer.append(dispatcher.dispatch("customAttributes", new Object[] {bfmNext, dispatcher, "result"} ));
- stringBuffer.append(TEXT_8);
-
- dispatcher.getAuxiliaryDataStorage().registerData(bfmNext, bfmNextMethodName);
- }
-} //end of namespace
-
- stringBuffer.append(TEXT_9);
- stringBuffer.append(figure.getName());
- stringBuffer.append(TEXT_10);
- stringBuffer.append(TEXT_11);
- stringBuffer.append(dispatcher.dispatch("Shape", dispatcher.create(figure, "this")));
- if (figure.getSourceDecoration() != null) {
- stringBuffer.append(TEXT_12);
- }
-if (figure.getTargetDecoration() != null) {
- stringBuffer.append(TEXT_13);
- }
- stringBuffer.append(TEXT_14);
- if (figure.getSourceDecoration() != null) {
- final String className = fqnSwitch.get(figure.getSourceDecoration(), importManager);
- stringBuffer.append(TEXT_15);
- stringBuffer.append(className);
- stringBuffer.append(TEXT_16);
- stringBuffer.append(TEXT_17);
- stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create(figure.getSourceDecoration(), "df")));
- stringBuffer.append(TEXT_18);
- } /*if sourceDecoration != null */
- stringBuffer.append(TEXT_19);
- if (figure.getTargetDecoration() != null) {
- final String className = fqnSwitch.get(figure.getTargetDecoration(), importManager);
- stringBuffer.append(TEXT_20);
- stringBuffer.append(className);
- stringBuffer.append(TEXT_21);
- stringBuffer.append(TEXT_22);
- stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create(figure.getTargetDecoration(), "df")));
- stringBuffer.append(TEXT_23);
- }
- stringBuffer.append(TEXT_24);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
deleted file mode 100644
index fc95a3cc5..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-import org.eclipse.emf.ecore.*;
-import java.util.Iterator;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.codegen.util.CodeGenUtil;;
-
-public class TopFigureGenerator
-{
- protected static String nl;
- public static synchronized TopFigureGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- TopFigureGenerator result = new TopFigureGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL;
- protected final String TEXT_3 = "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_4 = " ";
- protected final String TEXT_5 = "() {" + NL + "\t\t";
- protected final String TEXT_6 = " result = new ";
- protected final String TEXT_7 = "();" + NL + "\t\t";
- protected final String TEXT_8 = NL + "\t\treturn result;" + NL + "\t}";
- protected final String TEXT_9 = NL;
- protected final String TEXT_10 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final org.eclipse.draw2d.geometry.PointList myTemplate = new org.eclipse.draw2d.geometry.PointList();" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate org.eclipse.draw2d.geometry.Rectangle myTemplateBounds;" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPoint(org.eclipse.draw2d.geometry.Point point){" + NL + "\t\tmyTemplate.addPoint(point);" + NL + "\t\tmyTemplateBounds = null;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void fillShape(org.eclipse.draw2d.Graphics graphics) {" + NL + "\t\torg.eclipse.draw2d.geometry.Rectangle bounds = getBounds();" + NL + "\t\tgraphics.pushState();" + NL + "\t\tgraphics.translate(bounds.x, bounds.y);" + NL + "\t\tgraphics.fillPolygon(scalePointList());" + NL + "\t\tgraphics.popState();" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void outlineShape(org.eclipse.draw2d.Graphics graphics) {" + NL + "\t\torg.eclipse.draw2d.geometry.Rectangle bounds = getBounds();" + NL + "\t\tgraphics.pushState();" + NL + "\t\tgraphics.translate(bounds.x, bounds.y);" + NL + "\t\tgraphics.drawPolygon(scalePointList());" + NL + "\t\tgraphics.popState();" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate org.eclipse.draw2d.geometry.Rectangle getTemplateBounds(){" + NL + "\t\tif (myTemplateBounds == null) {" + NL + "\t\t\tmyTemplateBounds = myTemplate.getBounds().getCopy().union(0, 0);" + NL + "\t\t\t//just safety -- we are going to use this as divider " + NL + "\t\t\tif (myTemplateBounds.width < 1){" + NL + "\t\t\t\tmyTemplateBounds.width = 1;" + NL + "\t\t\t}" + NL + "\t\t\tif (myTemplateBounds.height < 1){" + NL + "\t\t\t\tmyTemplateBounds.height = 1;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn myTemplateBounds;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate int[] scalePointList() {" + NL + "\t\torg.eclipse.draw2d.geometry.Rectangle pointsBounds = getTemplateBounds();" + NL + "\t\torg.eclipse.draw2d.geometry.Rectangle actualBounds = getBounds();" + NL + "" + NL + "\t\tfloat xScale = ((float) actualBounds.width) / pointsBounds.width;" + NL + "\t\tfloat yScale = ((float) actualBounds.height) / pointsBounds.height;" + NL + "" + NL + "\t\tif (xScale == 1 && yScale == 1) {" + NL + "\t\t\treturn myTemplate.toIntArray();" + NL + "\t\t}" + NL + "\t\tint[] scaled = (int[]) myTemplate.toIntArray().clone();" + NL + "\t\tfor (int i = 0; i < scaled.length; i += 2) {" + NL + "\t\t\tscaled[i] = (int) Math.floor(scaled[i] * xScale);" + NL + "\t\t\tscaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale);" + NL + "\t\t}" + NL + "\t\treturn scaled;" + NL + "\t}";
- protected final String TEXT_11 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_12 = "() {";
- protected final String TEXT_13 = NL + "\t\t";
- protected final String TEXT_14 = NL + "\t\t";
- protected final String TEXT_15 = NL + "\t\tcreateContents();" + NL + "\t}" + NL;
- protected final String TEXT_16 = NL;
- protected final String TEXT_17 = NL;
- protected final String TEXT_18 = NL;
- protected final String TEXT_19 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myUseLocalCoordinates = ";
- protected final String TEXT_20 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean useLocalCoordinates() {" + NL + "\t\treturn myUseLocalCoordinates;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setUseLocalCoordinates(boolean useLocalCoordinates) {" + NL + "\t\tmyUseLocalCoordinates = useLocalCoordinates;" + NL + "\t}" + NL + "\t";
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-final GraphDefDispatcher.Args innerArgs = (GraphDefDispatcher.Args) ((Object[]) argument)[0];
-final Figure figure = innerArgs.getFigure();
-final GraphDefDispatcher dispatcher = innerArgs.getDispatcher();
-final ImportAssistant importManager = dispatcher.getImportManager();
-
- stringBuffer.append(TEXT_1);
- stringBuffer.append(TEXT_2);
-
-//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++);
-
-
- stringBuffer.append(TEXT_3);
- stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.Border"));
- stringBuffer.append(TEXT_4);
- stringBuffer.append(bfmNextMethodName);
- stringBuffer.append(TEXT_5);
- stringBuffer.append(bfmNextImplClass);
- stringBuffer.append(TEXT_6);
- stringBuffer.append(bfmNextImplClass);
- stringBuffer.append(TEXT_7);
- stringBuffer.append(dispatcher.dispatch("customAttributes", new Object[] {bfmNext, dispatcher, "result"} ));
- stringBuffer.append(TEXT_8);
-
- dispatcher.getAuxiliaryDataStorage().registerData(bfmNext, bfmNextMethodName);
- }
-} //end of namespace
-
- if (figure instanceof ScalablePolygon) {
- stringBuffer.append(TEXT_9);
- stringBuffer.append(TEXT_10);
- }
- stringBuffer.append(TEXT_11);
- stringBuffer.append(figure.getName());
- stringBuffer.append(TEXT_12);
-
-GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "myGenLayoutManager", null);
-
- stringBuffer.append(TEXT_13);
- stringBuffer.append(dispatcher.dispatch("createLayout", dispatcherArgs));
- stringBuffer.append(TEXT_14);
- stringBuffer.append(dispatcher.dispatch(figure, dispatcherArgs));
- stringBuffer.append(TEXT_15);
- stringBuffer.append(TEXT_16);
- stringBuffer.append(dispatcher.dispatch("Children", dispatcherArgs));
- stringBuffer.append(TEXT_17);
- if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/
- stringBuffer.append(TEXT_18);
-
-// simple heuristic to detect need for local coordinates
-boolean useLocalDefaultValue = false;
-for (java.util.Iterator it = figure.getChildren().iterator(); it.hasNext(); ) {
- if (it.next() instanceof Polyline) {
- useLocalDefaultValue = true;
- break;
- }
-}
-
- stringBuffer.append(TEXT_19);
- stringBuffer.append(useLocalDefaultValue);
- stringBuffer.append(TEXT_20);
- }
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopGenerator.java
deleted file mode 100644
index 6174012d1..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopGenerator.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.gmf.graphdef.codegen.templates;
-
-import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.gmfgraph.util.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.*;
-import org.eclipse.emf.ecore.*;
-import java.util.Iterator;
-import org.eclipse.emf.ecore.util.EcoreUtil;;
-
-public class TopGenerator
-{
- protected static String nl;
- public static synchronized TopGenerator create(String lineSeparator)
- {
- nl = lineSeparator;
- TopGenerator result = new TopGenerator();
- nl = null;
- return result;
- }
-
- protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ";
- protected final String TEXT_3 = " extends ";
- protected final String TEXT_4 = " {" + NL;
- protected final String TEXT_5 = NL;
- protected final String TEXT_6 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class ScalablePolygon extends org.eclipse.draw2d.Shape {";
- protected final String TEXT_7 = NL;
- protected final String TEXT_8 = "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate final org.eclipse.draw2d.geometry.PointList myTemplate = new org.eclipse.draw2d.geometry.PointList();" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate org.eclipse.draw2d.geometry.Rectangle myTemplateBounds;" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPoint(org.eclipse.draw2d.geometry.Point point){" + NL + "\t\tmyTemplate.addPoint(point);" + NL + "\t\tmyTemplateBounds = null;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void fillShape(org.eclipse.draw2d.Graphics graphics) {" + NL + "\t\torg.eclipse.draw2d.geometry.Rectangle bounds = getBounds();" + NL + "\t\tgraphics.pushState();" + NL + "\t\tgraphics.translate(bounds.x, bounds.y);" + NL + "\t\tgraphics.fillPolygon(scalePointList());" + NL + "\t\tgraphics.popState();" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void outlineShape(org.eclipse.draw2d.Graphics graphics) {" + NL + "\t\torg.eclipse.draw2d.geometry.Rectangle bounds = getBounds();" + NL + "\t\tgraphics.pushState();" + NL + "\t\tgraphics.translate(bounds.x, bounds.y);" + NL + "\t\tgraphics.drawPolygon(scalePointList());" + NL + "\t\tgraphics.popState();" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate org.eclipse.draw2d.geometry.Rectangle getTemplateBounds(){" + NL + "\t\tif (myTemplateBounds == null) {" + NL + "\t\t\tmyTemplateBounds = myTemplate.getBounds().getCopy().union(0, 0);" + NL + "\t\t\t//just safety -- we are going to use this as divider " + NL + "\t\t\tif (myTemplateBounds.width < 1){" + NL + "\t\t\t\tmyTemplateBounds.width = 1;" + NL + "\t\t\t}" + NL + "\t\t\tif (myTemplateBounds.height < 1){" + NL + "\t\t\t\tmyTemplateBounds.height = 1;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn myTemplateBounds;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate int[] scalePointList() {" + NL + "\t\torg.eclipse.draw2d.geometry.Rectangle pointsBounds = getTemplateBounds();" + NL + "\t\torg.eclipse.draw2d.geometry.Rectangle actualBounds = getBounds();" + NL + "" + NL + "\t\tfloat xScale = ((float) actualBounds.width) / pointsBounds.width;" + NL + "\t\tfloat yScale = ((float) actualBounds.height) / pointsBounds.height;" + NL + "" + NL + "\t\tif (xScale == 1 && yScale == 1) {" + NL + "\t\t\treturn myTemplate.toIntArray();" + NL + "\t\t}" + NL + "\t\tint[] scaled = (int[]) myTemplate.toIntArray().clone();" + NL + "\t\tfor (int i = 0; i < scaled.length; i += 2) {" + NL + "\t\t\tscaled[i] = (int) Math.floor(scaled[i] * xScale);" + NL + "\t\t\tscaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale);" + NL + "\t\t}" + NL + "\t\treturn scaled;" + NL + "\t}" + NL + "}";
- protected final String TEXT_9 = NL;
- protected final String TEXT_10 = NL;
- protected final String TEXT_11 = NL;
- protected final String TEXT_12 = NL + "}" + NL + "\t";
- protected final String TEXT_13 = NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final ";
- protected final String TEXT_14 = " ";
- protected final String TEXT_15 = " = ";
- protected final String TEXT_16 = ";";
- protected final String TEXT_17 = NL + "\t";
- protected final String TEXT_18 = NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final ";
- protected final String TEXT_19 = " ";
- protected final String TEXT_20 = " = ";
- protected final String TEXT_21 = ";";
- protected final String TEXT_22 = NL + "}";
- protected final String TEXT_23 = NL;
-
- public String generate(Object argument)
- {
- final StringBuffer stringBuffer = new StringBuffer();
-
-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);
- stringBuffer.append(TEXT_1);
- importManager.markImportLocation(stringBuffer);
- stringBuffer.append(TEXT_2);
- stringBuffer.append(importManager.getCompilationUnitName());
- stringBuffer.append(TEXT_3);
- stringBuffer.append(fqnSwitch.get(figure, importManager));
- stringBuffer.append(TEXT_4);
- stringBuffer.append(TEXT_5);
-
-//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) {
-
- stringBuffer.append(TEXT_6);
- stringBuffer.append(TEXT_7);
- stringBuffer.append(TEXT_8);
-
- }
-} // end of namespace
-
- stringBuffer.append(TEXT_9);
- /*NOTE: class structure is selected by topDispatcher, but children, attributes etc -- by inner dispatcher*/
- stringBuffer.append(TEXT_10);
- stringBuffer.append(topDispatcher.dispatch(figure, new Object[] {
- /*inner*/dispatcher.create(figure, "this"),
- topDispatcher.create(figure, "this")
-}));
- stringBuffer.append(TEXT_11);
-
-if (isStaticFieldsOutsideClassBody){ /*put fields out of inner class body*/
- stringBuffer.append(TEXT_12);
-
-//input: [oeg].graphdef.codegen GraphDefDispatcher dispatcher
-for (Iterator allFields = dispatcher.getStaticFieldsManager().allFields(); allFields.hasNext();) {
- StaticFieldsManager.StaticField next = (StaticFieldsManager.StaticField)allFields.next();
- stringBuffer.append(TEXT_13);
- stringBuffer.append(next.getType());
- stringBuffer.append(TEXT_14);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_15);
- stringBuffer.append(next.getValue());
- stringBuffer.append(TEXT_16);
-
-}
-
- } else {
- stringBuffer.append(TEXT_17);
-
-//input: [oeg].graphdef.codegen GraphDefDispatcher dispatcher
-for (Iterator allFields = dispatcher.getStaticFieldsManager().allFields(); allFields.hasNext();) {
- StaticFieldsManager.StaticField next = (StaticFieldsManager.StaticField)allFields.next();
- stringBuffer.append(TEXT_18);
- stringBuffer.append(next.getType());
- stringBuffer.append(TEXT_19);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_20);
- stringBuffer.append(next.getValue());
- stringBuffer.append(TEXT_21);
-
-}
-
- stringBuffer.append(TEXT_22);
- }
- importManager.emitSortedImports();
- stringBuffer.append(TEXT_23);
- return stringBuffer.toString();
- }
-}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/Activator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/Activator.java
new file mode 100644
index 000000000..8946c9e52
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/Activator.java
@@ -0,0 +1,49 @@
+package org.eclipse.gmf.internal.graphdef.codegen;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.gmf.graphdef.codegen.MapModeCodeGenStrategy;
+import org.eclipse.gmf.internal.xpand.ResourceManager;
+import org.eclipse.gmf.internal.xpand.XpandFacade;
+import org.eclipse.gmf.internal.xpand.expression.Variable;
+import org.eclipse.gmf.internal.xpand.model.Output;
+import org.eclipse.gmf.internal.xpand.model.XpandExecutionContext;
+import org.eclipse.gmf.internal.xpand.model.XpandExecutionContextImpl;
+import org.eclipse.gmf.internal.xpand.util.BundleResourceManager;
+import org.eclipse.gmf.internal.xpand.util.ContextFactory;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+ private static Activator instance;
+
+ public Activator() {
+ instance = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ instance = null;
+ super.stop(context);
+ }
+
+ public static XpandFacade createTemplateEngine(MapModeCodeGenStrategy strategy, Output output, Collection<Variable> globals) {
+ try {
+ URL baseURL = instance.getBundle().getEntry("/templates/");
+ ArrayList<URL> urls = new ArrayList<URL>(3);
+ if (strategy.getToken().length() > 0) {
+ urls.add(new URL(baseURL, strategy.getToken() + '/'));
+ }
+ urls.add(baseURL);
+ ResourceManager resourceManager = new BundleResourceManager(urls.toArray(new URL[urls.size()]));
+ final XpandExecutionContext xpandContext = ContextFactory.createXpandContext(resourceManager, output, globals);
+ ((XpandExecutionContextImpl) xpandContext).setContextClassLoader(instance.getClass().getClassLoader());
+ return new XpandFacade(xpandContext);
+ } catch (MalformedURLException ex) {
+ throw new Error();
+ }
+ }
+}
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