Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-02-06 17:21:39 -0500
committeratikhomirov2006-02-06 17:21:39 -0500
commit192b15753755a5c87fa73705ab2b4269aa77662d (patch)
tree927782e5cab2910450ce93ac30dc64d5214b2e17
parentab3cbec7ac30ebc2acac1565d3a11e5de969c32b (diff)
downloadorg.eclipse.gmf-tooling-192b15753755a5c87fa73705ab2b4269aa77662d.tar.gz
org.eclipse.gmf-tooling-192b15753755a5c87fa73705ab2b4269aa77662d.tar.xz
org.eclipse.gmf-tooling-192b15753755a5c87fa73705ab2b4269aa77662d.zip
refactor - moved EmitterFactory/Dispatcher infrastructure to gmf.common to enable its use in oeg.codegen
-rw-r--r--plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/bridge/genmodel/InnerClassViewmapProducer.java3
-rw-r--r--plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.gmf.common/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/ArrayKeyChain.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/ArrayKeyChain.java)2
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/Dispatcher.java20
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/DispatcherImpl.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/DispatcherImpl.java)17
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/DynamicTemplateRegistry.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/DynamicTemplateRegistry.java)2
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/EmitterFactory.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/YAEmitterFactory.java)6
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/HierarchyKeyMap.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/HierarchyKeyMap.java)2
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/KeyChain.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/KeyChain.java)2
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/KeyMap.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/KeyMap.java)2
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/NoSuchTemplateException.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/NoSuchTemplateException.java)2
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/StaticTemplateRegistry.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/StaticTemplateRegistry.java)2
-rw-r--r--plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/TemplateRegistry.java (renamed from plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/TemplateRegistry.java)2
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/Dispatcher.java67
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java38
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/GraphDefDispatcher.java70
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureAttrGenerator.java6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java12
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/LabelAttrGenerator.java6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewFigureGenerator.java9
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolygonDecorationAttrGenerator.java6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineAttrGenerator.java8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/PolylineDecorationAttrGenerator.java8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/RoundedRectAttrGenerator.java8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/ShapeAttrGenerator.java8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopConnectionGenerator.java12
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java10
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopShapeGenerator.java12
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet10
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet10
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/PolylineConnection.javajet12
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet12
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java7
43 files changed, 241 insertions, 224 deletions
diff --git a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/bridge/genmodel/InnerClassViewmapProducer.java b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/bridge/genmodel/InnerClassViewmapProducer.java
index 288d082b5..08a178d37 100644
--- a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/bridge/genmodel/InnerClassViewmapProducer.java
+++ b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/bridge/genmodel/InnerClassViewmapProducer.java
@@ -21,6 +21,7 @@ import org.eclipse.gmf.codegen.gmfgen.FigureViewmap;
import org.eclipse.gmf.codegen.gmfgen.GMFGenFactory;
import org.eclipse.gmf.codegen.gmfgen.InnerClassViewmap;
import org.eclipse.gmf.codegen.gmfgen.Viewmap;
+import org.eclipse.gmf.common.codegen.NullImportAssistant;
import org.eclipse.gmf.gmfgraph.Child;
import org.eclipse.gmf.gmfgraph.Connection;
import org.eclipse.gmf.gmfgraph.CustomFigure;
@@ -39,7 +40,7 @@ public class InnerClassViewmapProducer extends DefaultViewmapProducer {
private final FigureQualifiedNameSwitch fqnSwitch = new FigureQualifiedNameSwitch();
public InnerClassViewmapProducer() {
- figureGenerator = new FigureGenerator(null);
+ figureGenerator = new FigureGenerator(null, new NullImportAssistant(), fqnSwitch);
}
public Viewmap create(Node node) {
diff --git a/plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF
index fe403ea88..5ff7a6eaa 100644
--- a/plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF
@@ -16,5 +16,5 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.codegen.ecore;visibility:=reexport,
org.eclipse.emf.edit,
org.eclipse.gef,
- org.eclipse.gmf.common
+ org.eclipse.gmf.common;visibility:=reexport
Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.gmf.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.common/META-INF/MANIFEST.MF
index ac37496d9..1dff12f64 100644
--- a/plugins/org.eclipse.gmf.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.common/META-INF/MANIFEST.MF
@@ -5,7 +5,9 @@ Bundle-SymbolicName: org.eclipse.gmf.common
Bundle-Version: 1.0.0.qualifier
Bundle-Localization: plugin
Export-Package: org.eclipse.gmf.common,
- org.eclipse.gmf.common.codegen
-Require-Bundle: org.eclipse.emf.codegen,
+ org.eclipse.gmf.common.codegen,
+ org.eclipse.gmf.internal.codegen.dispatch;x-friends:="org.eclipse.gmf.codegen,org.eclipse.gmf.graphdef.codegen"
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.codegen,
org.eclipse.emf.codegen.ecore
Bundle-Vendor: %providerName
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/ArrayKeyChain.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/ArrayKeyChain.java
index a5a39b533..86dfcb79f 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/ArrayKeyChain.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/ArrayKeyChain.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
/**
* Although it's more straightforward just to override hasNext/next then to perform checks in advance,
diff --git a/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/Dispatcher.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/Dispatcher.java
new file mode 100644
index 000000000..b421564ef
--- /dev/null
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/Dispatcher.java
@@ -0,0 +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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.internal.codegen.dispatch;
+
+/**
+ * @author artem
+ */
+public interface Dispatcher {
+
+ String dispatch(Object key, Object argument);
+}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/DispatcherImpl.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/DispatcherImpl.java
index 0e22d84f0..bbd4fdea1 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/DispatcherImpl.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/DispatcherImpl.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -18,24 +18,25 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.emf.codegen.jet.JETEmitter;
import org.eclipse.emf.codegen.jet.JETException;
import org.eclipse.gmf.common.UnexpectedBehaviourException;
-import org.eclipse.gmf.graphdef.codegen.Dispatcher;
/**
+ * TODO collect errors and provide accessor - e.g. FigureGenerator could check
+ * whether {@link #dispatch(Object, Object)} was a success.
* @author artem
*/
-public class DispatcherImpl extends Dispatcher {
+public class DispatcherImpl implements Dispatcher {
- private final YAEmitterFactory myFactory;
+ private final EmitterFactory myFactory;
private final KeyMap myKeyMap;
- public DispatcherImpl(YAEmitterFactory factory, KeyMap keyMap) {
+ public DispatcherImpl(EmitterFactory factory, KeyMap keyMap) {
myFactory = factory;
myKeyMap = keyMap;
}
public String dispatch(Object key, Object argument) {
- final String pluginID = "org.eclipse.gmf.graphdef.codegen";
+ final String pluginID = "org.eclipse.gmf.common";
final ILog traceFacility = Platform.getLog(Platform.getBundle(pluginID));
try {
StringBuffer errors = new StringBuffer();
@@ -68,10 +69,6 @@ public class DispatcherImpl extends Dispatcher {
}
}
- public String dispatch(Object key, Args args) {
- return dispatch(key, (Object) args);
- }
-
private static String formatError(Exception ex) {
return ex.getClass().getSimpleName() + ": " + ex.getMessage();
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/DynamicTemplateRegistry.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/DynamicTemplateRegistry.java
index 4b845c648..3d97c8dc1 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/DynamicTemplateRegistry.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/DynamicTemplateRegistry.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
import java.text.MessageFormat;
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/YAEmitterFactory.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/EmitterFactory.java
index 9d270df99..a66451bb2 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/YAEmitterFactory.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/EmitterFactory.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
@@ -29,7 +29,7 @@ import org.eclipse.gmf.common.UnexpectedBehaviourException;
*
* @author artem
*/
-public class YAEmitterFactory {
+public class EmitterFactory {
private final URL myBaseURL;
@@ -49,7 +49,7 @@ public class YAEmitterFactory {
* @param usePrecompiled
* @param variables
*/
- public YAEmitterFactory(URL baseURL, TemplateRegistry templates, boolean usePrecompiled, List/* <String> */variables, boolean cache) {
+ public EmitterFactory(URL baseURL, TemplateRegistry templates, boolean usePrecompiled, List/* <String> */variables, boolean cache) {
assert baseURL != null && templates != null;
assert variables == null || !variables.contains(null);
myBaseURL = baseURL;
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/HierarchyKeyMap.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/HierarchyKeyMap.java
index 2c5cd0bba..ff682577d 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/HierarchyKeyMap.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/HierarchyKeyMap.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
import java.util.Arrays;
import java.util.LinkedHashSet;
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/KeyChain.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/KeyChain.java
index d189cf566..f42f05028 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/KeyChain.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/KeyChain.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
import java.util.Iterator;
import java.util.NoSuchElementException;
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/KeyMap.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/KeyMap.java
index e87a50f44..72bcf57b4 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/KeyMap.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/KeyMap.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
/**
* Logic of key extraction and prioritization.
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/NoSuchTemplateException.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/NoSuchTemplateException.java
index 6c7244b73..156ce2304 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/NoSuchTemplateException.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/NoSuchTemplateException.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
/**
* @author artem
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/StaticTemplateRegistry.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/StaticTemplateRegistry.java
index 5e5863c09..e8823e42c 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/StaticTemplateRegistry.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/StaticTemplateRegistry.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
import java.util.HashMap;
import java.util.Map;
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/TemplateRegistry.java b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/TemplateRegistry.java
index 1362fb8fc..6b5692489 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/TemplateRegistry.java
+++ b/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/codegen/dispatch/TemplateRegistry.java
@@ -9,7 +9,7 @@
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
*/
-package org.eclipse.gmf.internal.graphdef.codegen;
+package org.eclipse.gmf.internal.codegen.dispatch;
/**
* XXX hm, it's possible to have only one JETEmitter per key. What if we'd like to reference same emitter with different keys?
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 5780003d1..60c5f7b1b 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/META-INF/MANIFEST.MF
@@ -6,8 +6,8 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.emf.ecore,
org.eclipse.gmf.graphdef;visibility:=reexport,
- org.eclipse.emf.codegen,
- org.eclipse.gmf.common
+ org.eclipse.gmf.common,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.codegen
Export-Package: org.eclipse.gmf.graphdef.codegen
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/Dispatcher.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/Dispatcher.java
deleted file mode 100644
index eabbfe8fb..000000000
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/Dispatcher.java
+++ /dev/null
@@ -1,67 +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 org.eclipse.gmf.common.codegen.ImportAssistant;
-import org.eclipse.gmf.gmfgraph.Figure;
-import org.eclipse.gmf.gmfgraph.util.GMFGraphSwitch;
-
-/**
- * @author artem
- */
-public abstract class Dispatcher {
-
- public abstract String dispatch(Object key, Object argument);
-
- public abstract String dispatch(Object key, Args args);
-
- // TODO just keep importManager+fqnSwitch in the dispatcher (pure interface + subclass?) and shorten the list of args then
- public Args create(Figure figure, String figureVarName, ImportAssistant importManager, GMFGraphSwitch fqnSwitch) {
- return new Args(this, figure, figureVarName, importManager, fqnSwitch);
- }
-
- public class Args {
- private final String myFigureVarName;
- private final ImportAssistant myImportManager;
- private final GMFGraphSwitch myFqnSwitch;
- private final Dispatcher myOwner;
- private final Figure myFigure;
-
- public Args(Dispatcher owner, Figure figure, String figureVarName, ImportAssistant importManager, GMFGraphSwitch fqnSwitch) {
- myOwner = owner;
- myFigure = figure;
- myFigureVarName = figureVarName;
- myImportManager = importManager;
- myFqnSwitch = fqnSwitch;
- }
-
- public Figure getFigure() {
- return myFigure;
- }
-
- public String getVariableName() {
- return myFigureVarName;
- }
-
- public ImportAssistant getImportManager() {
- return myImportManager;
- }
-
- public GMFGraphSwitch getFQNSwitch() {
- return myFqnSwitch;
- }
-
- public Dispatcher getDispatcher() {
- return myOwner;
- }
- }
-}
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 71b0616a2..8128be304 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
@@ -25,6 +25,8 @@ 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.util.FigureQualifiedNameSwitch;
+import org.eclipse.gmf.gmfgraph.util.GMFGraphSwitch;
import org.eclipse.gmf.graphdef.codegen.templates.FigureAttrGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.FigureChildrenGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.LabelAttrGenerator;
@@ -37,13 +39,12 @@ import org.eclipse.gmf.graphdef.codegen.templates.ShapeAttrGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.TopConnectionGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.TopFigureGenerator;
import org.eclipse.gmf.graphdef.codegen.templates.TopShapeGenerator;
-import org.eclipse.gmf.internal.graphdef.codegen.DispatcherImpl;
-import org.eclipse.gmf.internal.graphdef.codegen.HierarchyKeyMap;
-import org.eclipse.gmf.internal.graphdef.codegen.KeyChain;
-import org.eclipse.gmf.internal.graphdef.codegen.KeyMap;
-import org.eclipse.gmf.internal.graphdef.codegen.StaticTemplateRegistry;
-import org.eclipse.gmf.internal.graphdef.codegen.TemplateRegistry;
-import org.eclipse.gmf.internal.graphdef.codegen.YAEmitterFactory;
+import org.eclipse.gmf.internal.codegen.dispatch.EmitterFactory;
+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.osgi.framework.Bundle;
/**
@@ -52,14 +53,14 @@ import org.osgi.framework.Bundle;
*/
public class FigureGenerator {
private final String packageName;
- private Dispatcher myTopDispatcher;
- private Dispatcher myInnerDispatcher;
+ private GraphDefDispatcher myTopDispatcher;
+ private GraphDefDispatcher myInnerDispatcher;
public FigureGenerator() {
- this(null);
+ this(null, new NullImportAssistant(), new FigureQualifiedNameSwitch());
}
- public FigureGenerator(String aPackageName) {
+ public FigureGenerator(String aPackageName, ImportAssistant importManager, GMFGraphSwitch figureNameSwitch) {
packageName = aPackageName;
final Bundle thisBundle = Platform.getBundle("org.eclipse.gmf.graphdef.codegen");
final ArrayList variables = new ArrayList();
@@ -81,10 +82,10 @@ public class FigureGenerator {
}
}
};
- YAEmitterFactory topFactory = new YAEmitterFactory(thisBundle.getEntry("/"), fillTopLevel(), true, variables, true);
- myTopDispatcher = new DispatcherImpl(topFactory, keyMap);
- YAEmitterFactory innerFactory = new YAEmitterFactory(thisBundle.getEntry("/"), fillAttrs(), true, variables, true);
- myInnerDispatcher = new DispatcherImpl(innerFactory, keyMap);
+ EmitterFactory topFactory = new EmitterFactory(thisBundle.getEntry("/"), fillTopLevel(), true, variables, true);
+ myTopDispatcher = new GraphDefDispatcher(topFactory, keyMap, importManager, figureNameSwitch);
+ EmitterFactory innerFactory = new EmitterFactory(thisBundle.getEntry("/"), fillAttrs(), true, variables, true);
+ myInnerDispatcher = new GraphDefDispatcher(innerFactory, keyMap, importManager, figureNameSwitch);
}
/**
@@ -128,12 +129,9 @@ public class FigureGenerator {
}
public String go(Figure fig) throws JETException {
- return go(fig, new NullImportAssistant());
- }
-
- public String go(Figure fig, ImportAssistant importManager) {
String res = null;
- res = myTopDispatcher.dispatch(fig, new Object[] {fig, importManager, myInnerDispatcher});
+ Object args = new Object[] {fig, myTopDispatcher.getImportManager(), myTopDispatcher.getFQNSwitch(), myInnerDispatcher};
+ res = myTopDispatcher.dispatch(fig, args);
if (res == null) {
throw new IllegalStateException();
}
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
new file mode 100644
index 000000000..045f2df90
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/GraphDefDispatcher.java
@@ -0,0 +1,70 @@
+/*
+ * 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 org.eclipse.gmf.common.codegen.ImportAssistant;
+import org.eclipse.gmf.gmfgraph.Figure;
+import org.eclipse.gmf.gmfgraph.util.GMFGraphSwitch;
+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 final ImportAssistant myImportManager;
+ private final GMFGraphSwitch myFqnSwitch;
+
+ public GraphDefDispatcher(EmitterFactory factory, KeyMap keyMap, ImportAssistant importManager, GMFGraphSwitch fqnSwitch) {
+ super(factory, keyMap);
+ myImportManager = importManager;
+ myFqnSwitch = fqnSwitch;
+ }
+
+ public ImportAssistant getImportManager() {
+ return myImportManager;
+ }
+
+ public GMFGraphSwitch getFQNSwitch() {
+ return myFqnSwitch;
+ }
+
+
+ public Args create(Figure figure, String figureVarName) {
+ return new Args(this, figure, figureVarName);
+ }
+
+ 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;
+ }
+
+ public Figure getFigure() {
+ return myFigure;
+ }
+
+ public String getVariableName() {
+ return myFigureVarName;
+ }
+
+ public GraphDefDispatcher getDispatcher() {
+ return myOwner;
+ }
+ }
+}
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
index db4ab0463..d2852b7b0 100644
--- 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
@@ -2,7 +2,7 @@ package org.eclipse.gmf.graphdef.codegen.templates;
import org.eclipse.gmf.gmfgraph.*;
import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
public class FigureAttrGenerator
{
@@ -43,10 +43,10 @@ public class FigureAttrGenerator
{
StringBuffer stringBuffer = new StringBuffer();
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Figure figureInstance = args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
+final ImportAssistant importManager = args.getDispatcher().getImportManager();
Color colorVal;
if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_ForegroundColor())) {
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
index 890dec135..23c834123 100644
--- 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
@@ -1,9 +1,7 @@
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.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
import java.util.*;
public class FigureChildrenGenerator
@@ -31,10 +29,8 @@ public class FigureChildrenGenerator
Object[] args = (Object[]) argument;
List/*<Figure>*/ figureChildren = (List) args[0];
-final ImportAssistant importManager = (ImportAssistant) args[1];
-final GMFGraphSwitch fqnSwitch = (GMFGraphSwitch) args[2];
-final Dispatcher dispatcher = (Dispatcher) args[3];
-String parentFigureVarName = (String) args[4];
+final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[1];
+String parentFigureVarName = (String) args[2];
stringBuffer.append(TEXT_1);
@@ -55,7 +51,7 @@ while (!l.isEmpty()) {
}
final String figureVarName = "fig" + (figureCount++);
stringBuffer.append(TEXT_2);
- stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create((Figure) figureMarker, figureVarName, importManager, fqnSwitch)));
+ stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create((Figure) figureMarker, figureVarName)));
stringBuffer.append(TEXT_3);
stringBuffer.append(parentFigureVarName);
stringBuffer.append(TEXT_4);
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
index b835c2d5a..f8b15904d 100644
--- 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
@@ -1,7 +1,7 @@
package org.eclipse.gmf.graphdef.codegen.templates;
import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.graphdef.codegen.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
public class LabelAttrGenerator
{
@@ -23,10 +23,10 @@ public class LabelAttrGenerator
{
StringBuffer stringBuffer = new StringBuffer();
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Label figureInstance = (Label) args.getFigure();
final String figureVarName = args.getVariableName();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getLabel_Text())) {
stringBuffer.append(TEXT_1);
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
index 8a89e28fc..5d631465c 100644
--- 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
@@ -1,8 +1,7 @@
package org.eclipse.gmf.graphdef.codegen.templates;
import org.eclipse.gmf.gmfgraph.*;
-import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
public class NewFigureGenerator
{
@@ -26,11 +25,11 @@ public class NewFigureGenerator
{
StringBuffer stringBuffer = new StringBuffer();
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Figure figureInstance = args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
-final String figureClassName = importManager.getImportedName((String) args.getFQNSwitch().doSwitch(figureInstance));
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final String figureClassName = dispatcher.getImportManager().getImportedName((String) dispatcher.getFQNSwitch().doSwitch(figureInstance));
// PRODUCES instance AND (!) initializes attributes
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
index 60cb54260..1cc867f7e 100644
--- 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
@@ -1,6 +1,6 @@
package org.eclipse.gmf.graphdef.codegen.templates;
-import org.eclipse.gmf.graphdef.codegen.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
public class PolygonDecorationAttrGenerator
{
@@ -20,8 +20,8 @@ public class PolygonDecorationAttrGenerator
{
StringBuffer stringBuffer = new StringBuffer();
-Dispatcher.Args args = (Dispatcher.Args) argument;
-final Dispatcher dispatcher = args.getDispatcher();
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
+final GraphDefDispatcher dispatcher = args.getDispatcher();
stringBuffer.append(TEXT_1);
stringBuffer.append(dispatcher.dispatch("PolylineDecoration", args));
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
index 7601603b3..c0fcc4782 100644
--- 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
@@ -2,7 +2,7 @@ package org.eclipse.gmf.graphdef.codegen.templates;
import org.eclipse.gmf.gmfgraph.*;
import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
public class PolylineAttrGenerator
{
@@ -27,11 +27,11 @@ public class PolylineAttrGenerator
{
StringBuffer stringBuffer = new StringBuffer();
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Polyline figureInstance = (Polyline) args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final ImportAssistant importManager = dispatcher.getImportManager();
stringBuffer.append(TEXT_1);
stringBuffer.append(dispatcher.dispatch("Shape", args));
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
index 7f95c37d4..940a09698 100644
--- 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
@@ -2,7 +2,7 @@ package org.eclipse.gmf.graphdef.codegen.templates;
import org.eclipse.gmf.gmfgraph.*;
import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
import java.util.*;
public class PolylineDecorationAttrGenerator
@@ -34,12 +34,12 @@ public class PolylineDecorationAttrGenerator
{
StringBuffer stringBuffer = new StringBuffer();
-Dispatcher.Args args = (Dispatcher.Args) argument;
+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 ImportAssistant importManager = args.getImportManager();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final ImportAssistant importManager = dispatcher.getImportManager();
stringBuffer.append(TEXT_1);
stringBuffer.append(TEXT_2);
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
index 76cf27418..b4682326e 100644
--- 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
@@ -2,7 +2,7 @@ package org.eclipse.gmf.graphdef.codegen.templates;
import org.eclipse.gmf.gmfgraph.*;
import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
public class RoundedRectAttrGenerator
{
@@ -27,11 +27,11 @@ public class RoundedRectAttrGenerator
{
StringBuffer stringBuffer = new StringBuffer();
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final RoundedRectangle figureInstance = (RoundedRectangle) args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final ImportAssistant importManager = dispatcher.getImportManager();
stringBuffer.append(TEXT_1);
stringBuffer.append(dispatcher.dispatch("Shape", args));
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
index fb351a958..26b23245f 100644
--- 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
@@ -2,7 +2,7 @@ package org.eclipse.gmf.graphdef.codegen.templates;
import org.eclipse.gmf.gmfgraph.*;
import org.eclipse.gmf.common.codegen.*;
-import org.eclipse.gmf.graphdef.codegen.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
public class ShapeAttrGenerator
{
@@ -40,11 +40,11 @@ public class ShapeAttrGenerator
{
StringBuffer stringBuffer = new StringBuffer();
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Shape figureInstance = (Shape) args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final ImportAssistant importManager = dispatcher.getImportManager();
// PERHAPS, do this with reflection?
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
index eab82c745..2824b2c07 100644
--- 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
@@ -3,7 +3,7 @@ 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.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
public class TopConnectionGenerator
{
@@ -44,8 +44,8 @@ public class TopConnectionGenerator
Object[] args = (Object[]) argument;
PolylineConnection figure = (PolylineConnection) args[0];
final ImportAssistant importManager = (ImportAssistant) args[1];
-final GMFGraphSwitch fqnSwitch = new FigureQualifiedNameSwitch();
-final Dispatcher dispatcher = (Dispatcher) args[2];
+final GMFGraphSwitch fqnSwitch = (GMFGraphSwitch) args[2];
+final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
stringBuffer.append(TEXT_1);
importManager.markImportLocation(stringBuffer);
@@ -57,7 +57,7 @@ final Dispatcher dispatcher = (Dispatcher) args[2];
stringBuffer.append(figure.getName());
stringBuffer.append(TEXT_5);
stringBuffer.append(TEXT_6);
- stringBuffer.append(dispatcher.dispatch("Shape", dispatcher.create(figure, "this", importManager, fqnSwitch)));
+ stringBuffer.append(dispatcher.dispatch("Shape", dispatcher.create(figure, "this")));
if (figure.getSourceDecoration() != null) {
stringBuffer.append(TEXT_7);
}
@@ -71,7 +71,7 @@ if (figure.getTargetDecoration() != null) {
stringBuffer.append(className);
stringBuffer.append(TEXT_11);
stringBuffer.append(TEXT_12);
- stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create(figure.getSourceDecoration(), "df", importManager, fqnSwitch)));
+ stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create(figure.getSourceDecoration(), "df")));
stringBuffer.append(TEXT_13);
} /*if sourceDecoration != null */
stringBuffer.append(TEXT_14);
@@ -81,7 +81,7 @@ if (figure.getTargetDecoration() != null) {
stringBuffer.append(className);
stringBuffer.append(TEXT_16);
stringBuffer.append(TEXT_17);
- stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create(figure.getTargetDecoration(), "df", importManager, fqnSwitch)));
+ stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create(figure.getTargetDecoration(), "df")));
stringBuffer.append(TEXT_18);
}
stringBuffer.append(TEXT_19);
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
index 7f4e2db48..a1aa1643e 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
@@ -3,7 +3,7 @@ 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.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
public class TopFigureGenerator
{
@@ -33,8 +33,8 @@ public class TopFigureGenerator
Object[] args = (Object[]) argument;
Figure figure = (Figure) args[0];
final ImportAssistant importManager = (ImportAssistant) args[1];
-final GMFGraphSwitch fqnSwitch = new FigureQualifiedNameSwitch();
-final Dispatcher dispatcher = (Dispatcher) args[2];
+final GMFGraphSwitch fqnSwitch = (GMFGraphSwitch) args[2];
+final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
stringBuffer.append(TEXT_1);
importManager.markImportLocation(stringBuffer);
@@ -45,9 +45,9 @@ final Dispatcher dispatcher = (Dispatcher) args[2];
stringBuffer.append(TEXT_4);
stringBuffer.append(figure.getName());
stringBuffer.append(TEXT_5);
- stringBuffer.append(dispatcher.dispatch(figure, dispatcher.create(figure, "this", importManager, fqnSwitch)));
+ stringBuffer.append(dispatcher.dispatch(figure, dispatcher.create(figure, "this")));
stringBuffer.append(TEXT_6);
- stringBuffer.append(dispatcher.dispatch("Children", new Object[] {figure.getChildren(), importManager, fqnSwitch, dispatcher, "this"}));
+ stringBuffer.append(dispatcher.dispatch("Children", new Object[] {figure.getChildren(), dispatcher, "this"}));
stringBuffer.append(TEXT_7);
importManager.emitSortedImports();
stringBuffer.append(TEXT_8);
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopShapeGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopShapeGenerator.java
index 0d1718e26..bacc7ee17 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopShapeGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopShapeGenerator.java
@@ -3,7 +3,7 @@ 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.Dispatcher;
+import org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher;
import java.util.*;
public class TopShapeGenerator
@@ -48,8 +48,8 @@ public class TopShapeGenerator
Object[] args = (Object[]) argument;
Shape figure = (Shape) args[0];
final ImportAssistant importManager = (ImportAssistant) args[1];
-final GMFGraphSwitch fqnSwitch = new FigureQualifiedNameSwitch();
-final Dispatcher dispatcher = (Dispatcher) args[2];
+final GMFGraphSwitch fqnSwitch = (GMFGraphSwitch) args[2];
+final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
stringBuffer.append(TEXT_1);
importManager.markImportLocation(stringBuffer);
@@ -60,7 +60,7 @@ final Dispatcher dispatcher = (Dispatcher) args[2];
stringBuffer.append(TEXT_4);
stringBuffer.append(figure.getName());
stringBuffer.append(TEXT_5);
- stringBuffer.append(dispatcher.dispatch(figure, dispatcher.create(figure, "this", importManager, fqnSwitch)));
+ stringBuffer.append(dispatcher.dispatch(figure, dispatcher.create(figure, "this")));
for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext();) {
Figure next = (Figure) it.next();
@@ -91,9 +91,9 @@ for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext(); fc++)
stringBuffer.append(next.getName());
stringBuffer.append(TEXT_17);
stringBuffer.append(TEXT_18);
- stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create(next, "rv", importManager, fqnSwitch)));
+ stringBuffer.append(dispatcher.dispatch("instantiate", dispatcher.create(next, "rv")));
stringBuffer.append(TEXT_19);
- stringBuffer.append(dispatcher.dispatch("Children", new Object[] {next.getChildren(), importManager, fqnSwitch, dispatcher, "rv"}));
+ stringBuffer.append(dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, "rv"}));
stringBuffer.append(TEXT_20);
}
stringBuffer.append(TEXT_21);
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet
index 7cd0f28ef..bf1bdab86 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet
@@ -1,10 +1,10 @@
<%@ 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.Dispatcher"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
<%
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Figure figureInstance = args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
+final ImportAssistant importManager = args.getDispatcher().getImportManager();
%>
<%Color colorVal;
if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_ForegroundColor())) {
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet
index 8d8582514..ee6031beb 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet
@@ -1,10 +1,10 @@
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="LabelAttrGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
<%
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Label figureInstance = (Label) args.getFigure();
final String figureVarName = args.getVariableName();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
%>
<%if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getLabel_Text())) {%>
<%=figureVarName%>.setText("<%=figureInstance.getText()%>");
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet
index 11eec09bb..f6a79b709 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet
@@ -1,7 +1,7 @@
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="PolygonDecorationAttrGenerator"
- imports="org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+ imports="org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
<%
-Dispatcher.Args args = (Dispatcher.Args) argument;
-final Dispatcher dispatcher = args.getDispatcher();
+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
index 497789253..2fc5a5704 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet
@@ -1,11 +1,11 @@
<%@ 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.Dispatcher"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
<%
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Polyline figureInstance = (Polyline) args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final ImportAssistant importManager = dispatcher.getImportManager();
%>
<%=dispatcher.dispatch("Shape", args)%>
<%if (!figureInstance.getTemplate().isEmpty()) {
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet
index 0a4b53871..b4edce689 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet
@@ -1,12 +1,12 @@
<%@ 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.Dispatcher java.util.*"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher java.util.*"%>
<%
-Dispatcher.Args args = (Dispatcher.Args) argument;
+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 ImportAssistant importManager = args.getImportManager();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final ImportAssistant importManager = dispatcher.getImportManager();
%>
// dispatchNext?
<%=dispatcher.dispatch("Shape", args)%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet
index fd4a27459..6f470f383 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet
@@ -1,11 +1,11 @@
<%@ 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.Dispatcher"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
<%
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final RoundedRectangle figureInstance = (RoundedRectangle) args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final ImportAssistant importManager = dispatcher.getImportManager();
%>
<%=dispatcher.dispatch("Shape", args)%>
<%=figureVarName%>.setCornerDimensions(new <%=importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension")%>(getMapMode().DPtoLP(<%=figureInstance.getCornerWidth()%>), getMapMode().DPtoLP(<%=figureInstance.getCornerHeight()%>))); \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet
index 288fe8fb7..0cca6aa6b 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet
@@ -1,11 +1,11 @@
<%@ 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.Dispatcher"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
<%
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Shape figureInstance = (Shape) args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
-final Dispatcher dispatcher = args.getDispatcher();
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final ImportAssistant importManager = dispatcher.getImportManager();
%>
<%
// PERHAPS, do this with reflection?
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
index b89aa0274..f2a51c57a 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet
@@ -1,12 +1,10 @@
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="FigureChildrenGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.Dispatcher java.util.*"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher java.util.*"%>
<%
Object[] args = (Object[]) argument;
List/*<Figure>*/ figureChildren = (List) args[0];
-final ImportAssistant importManager = (ImportAssistant) args[1];
-final GMFGraphSwitch fqnSwitch = (GMFGraphSwitch) args[2];
-final Dispatcher dispatcher = (Dispatcher) args[3];
-String parentFigureVarName = (String) args[4];
+final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[1];
+String parentFigureVarName = (String) args[2];
%>
<%
@@ -27,7 +25,7 @@ while (!l.isEmpty()) {
}
final String figureVarName = "fig" + (figureCount++);%>
// FIXME instantiate - FigureRef - dispatch to 'instantiate' template?
- <%=dispatcher.dispatch("instantiate", dispatcher.create((Figure) figureMarker, figureVarName, importManager, fqnSwitch))%>
+ <%=dispatcher.dispatch("instantiate", dispatcher.create((Figure) figureMarker, figureVarName))%>
<%=parentFigureVarName%>.add(<%=figureVarName%>);
<%
if (_nxt instanceof Figure && !((Figure) _nxt).getChildren().isEmpty()) {
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet
index 0c380c210..eecabf0fd 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet
@@ -1,11 +1,11 @@
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewFigureGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
<%
-Dispatcher.Args args = (Dispatcher.Args) argument;
+GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Figure figureInstance = args.getFigure();
final String figureVarName = args.getVariableName();
-final ImportAssistant importManager = args.getImportManager();
-final String figureClassName = importManager.getImportedName((String) args.getFQNSwitch().doSwitch(figureInstance));
+final GraphDefDispatcher dispatcher = args.getDispatcher();
+final String figureClassName = dispatcher.getImportManager().getImportedName((String) dispatcher.getFQNSwitch().doSwitch(figureInstance));
// PRODUCES instance AND (!) initializes attributes
%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
index d633f069f..61246ba1f 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Figure.javajet
@@ -1,11 +1,11 @@
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="TopFigureGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
<%
Object[] args = (Object[]) argument;
Figure figure = (Figure) args[0];
final ImportAssistant importManager = (ImportAssistant) args[1];
-final GMFGraphSwitch fqnSwitch = new FigureQualifiedNameSwitch();
-final Dispatcher dispatcher = (Dispatcher) args[2];
+final GMFGraphSwitch fqnSwitch = (GMFGraphSwitch) args[2];
+final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
%>
<%importManager.markImportLocation(stringBuffer);%>
@@ -18,7 +18,7 @@ public class <%=figure.getName()%> extends <%=importManager.getImportedName((Str
* @generated
*/
public <%=figure.getName()%>() {
- <%=dispatcher.dispatch(figure, dispatcher.create(figure, "this", importManager, fqnSwitch))%>
- <%=dispatcher.dispatch("Children", new Object[] {figure.getChildren(), importManager, fqnSwitch, dispatcher, "this"})%>
+ <%=dispatcher.dispatch(figure, dispatcher.create(figure, "this"))%>
+ <%=dispatcher.dispatch("Children", new Object[] {figure.getChildren(), dispatcher, "this"})%>
}
}<%importManager.emitSortedImports();%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/PolylineConnection.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/PolylineConnection.javajet
index fdae4a8ab..c794eab65 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/PolylineConnection.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/PolylineConnection.javajet
@@ -1,11 +1,11 @@
<%@ 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.Dispatcher"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
<%
Object[] args = (Object[]) argument;
PolylineConnection figure = (PolylineConnection) args[0];
final ImportAssistant importManager = (ImportAssistant) args[1];
-final GMFGraphSwitch fqnSwitch = new FigureQualifiedNameSwitch();
-final Dispatcher dispatcher = (Dispatcher) args[2];
+final GMFGraphSwitch fqnSwitch = (GMFGraphSwitch) args[2];
+final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
%>
<%importManager.markImportLocation(stringBuffer);%>
@@ -19,7 +19,7 @@ public class <%=figure.getName()%> extends <%=importManager.getImportedName("org
* @generated
*/
public <%=figure.getName()%>() {
-<%=dispatcher.dispatch("Shape", dispatcher.create(figure, "this", importManager, fqnSwitch))%>
+<%=dispatcher.dispatch("Shape", dispatcher.create(figure, "this"))%>
<%if (figure.getSourceDecoration() != null) {%>
setSourceDecoration(createSourceDecoration());
<%}
@@ -34,7 +34,7 @@ if (figure.getTargetDecoration() != null) {%>
* @generated
*/
private <%=className%> createSourceDecoration() {
-<%=dispatcher.dispatch("instantiate", dispatcher.create(figure.getSourceDecoration(), "df", importManager, fqnSwitch))%>
+<%=dispatcher.dispatch("instantiate", dispatcher.create(figure.getSourceDecoration(), "df"))%>
return df;
}
<%} /*if sourceDecoration != null */ %>
@@ -45,7 +45,7 @@ if (figure.getTargetDecoration() != null) {%>
* @generated
*/
private <%=className%> createTargetDecoration() {
-<%=dispatcher.dispatch("instantiate", dispatcher.create(figure.getTargetDecoration(), "df", importManager, fqnSwitch))%>
+<%=dispatcher.dispatch("instantiate", dispatcher.create(figure.getTargetDecoration(), "df"))%>
return df;
}
<%}%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet
index 755205349..34d9f1df9 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/top/Shape.javajet
@@ -1,11 +1,11 @@
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="TopShapeGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.Dispatcher java.util.*"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher java.util.*"%>
<%
Object[] args = (Object[]) argument;
Shape figure = (Shape) args[0];
final ImportAssistant importManager = (ImportAssistant) args[1];
-final GMFGraphSwitch fqnSwitch = new FigureQualifiedNameSwitch();
-final Dispatcher dispatcher = (Dispatcher) args[2];
+final GMFGraphSwitch fqnSwitch = (GMFGraphSwitch) args[2];
+final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
%>
<%importManager.markImportLocation(stringBuffer);%>
@@ -18,7 +18,7 @@ public class <%=figure.getName()%> extends <%=importManager.getImportedName((Str
* @generated
*/
public <%=figure.getName()%>() {
- <%=dispatcher.dispatch(figure, dispatcher.create(figure, "this", importManager, fqnSwitch))%>
+ <%=dispatcher.dispatch(figure, dispatcher.create(figure, "this"))%>
<%
for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext();) {
Figure next = (Figure) it.next();%>
@@ -52,8 +52,8 @@ for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext(); fc++)
* @generated
*/
private IFigure createFigure<%=next.getName()%>() {
-<%=dispatcher.dispatch("instantiate", dispatcher.create(next, "rv", importManager, fqnSwitch))%>
-<%=dispatcher.dispatch("Children", new Object[] {next.getChildren(), importManager, fqnSwitch, dispatcher, "rv"})%>
+<%=dispatcher.dispatch("instantiate", dispatcher.create(next, "rv"))%>
+<%=dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, "rv"})%>
return rv;
}
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java
index 48f9e141f..e7c711b83 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/FigureCodegenTest.java
@@ -14,6 +14,7 @@ package org.eclipse.gmf.tests.gen;
import junit.framework.TestCase;
import org.eclipse.emf.codegen.jet.JETException;
+import org.eclipse.gmf.common.codegen.ImportUtil;
import org.eclipse.gmf.gmfgraph.ConnectionFigure;
import org.eclipse.gmf.gmfgraph.CustomFigure;
import org.eclipse.gmf.gmfgraph.Ellipse;
@@ -27,6 +28,7 @@ import org.eclipse.gmf.gmfgraph.PolygonDecoration;
import org.eclipse.gmf.gmfgraph.PolylineConnection;
import org.eclipse.gmf.gmfgraph.Rectangle;
import org.eclipse.gmf.gmfgraph.RoundedRectangle;
+import org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch;
import org.eclipse.gmf.graphdef.codegen.FigureGenerator;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.AST;
@@ -62,7 +64,7 @@ public class FigureCodegenTest extends TestCase {
}
public void testGenFigureWithoutPackageStmt() {
- figureGenerator = new FigureGenerator(null);
+ figureGenerator = new FigureGenerator();
testGenComplexShape();
}
@@ -179,7 +181,8 @@ public class FigureCodegenTest extends TestCase {
private FigureGenerator getGenerator() {
if (figureGenerator == null) {
- figureGenerator = new FigureGenerator("org.eclipse.gmf.tests.sample.figures");
+ String packageName = "org.eclipse.gmf.tests.sample.figures";
+ figureGenerator = new FigureGenerator(packageName, new ImportUtil(packageName), new FigureQualifiedNameSwitch());
}
return figureGenerator;
}

Back to the top