Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-08-30 15:12:08 +0000
committeratikhomirov2006-08-30 15:12:08 +0000
commit04b8ad0d702b014e7d422b7e64800ac7113bf526 (patch)
treec9b5203f50a855875b390cf417e14215d74775d0 /plugins/org.eclipse.gmf.graphdef.codegen
parent01cdd801296685ff74a408b0a5eda348d221fa44 (diff)
downloadorg.eclipse.gmf-tooling-04b8ad0d702b014e7d422b7e64800ac7113bf526.tar.gz
org.eclipse.gmf-tooling-04b8ad0d702b014e7d422b7e64800ac7113bf526.tar.xz
org.eclipse.gmf-tooling-04b8ad0d702b014e7d422b7e64800ac7113bf526.zip
extracted caching behaviour outside from the factory - moving towards support for different template engines, #114207
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneEmitters.java11
2 files changed, 11 insertions, 6 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/FigureGenerator.java
index 739d697ad..a1e46aed7 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
@@ -67,7 +67,9 @@ 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;
@@ -104,9 +106,9 @@ public class FigureGenerator implements TextEmitter {
KeyMap keyMap = new ClassesOrStringsKeyMap();
String[] templatePath = new String[] {thisBundle.getEntry("/templates/").toString()};
- EmitterFactory topFactory = new EmitterFactory(templatePath, fillTopLevel(), true, variables, true);
+ EmitterFactory topFactory = new CachingEmitterFactory(new EmitterFactoryImpl(templatePath, fillTopLevel(), true, variables));
myTopDispatcher = new GraphDefDispatcher(topFactory, keyMap, figureNameSwitch, mapModeStrategy);
- EmitterFactory innerFactory = new EmitterFactory(templatePath, fillAttrs(), true, variables, true);
+ EmitterFactory innerFactory = new CachingEmitterFactory(new EmitterFactoryImpl(templatePath, fillAttrs(), true, variables));
myInnerDispatcher = new GraphDefDispatcher(innerFactory, keyMap, figureNameSwitch, mapModeStrategy);
}
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 215779bbf..0ec3981b5 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
@@ -17,17 +17,20 @@ import org.eclipse.gmf.graphdef.codegen.standalone.templates.BuildPropertiesGene
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.internal.common.codegen.TextEmitter;
-public class StandaloneEmitters extends EmitterFactory {
-
+public class StandaloneEmitters {
+ private final EmitterFactory myFactory;
+
public StandaloneEmitters(){
- super(getTemplatePath(), createTemplateRegistry());
+ myFactory = new CachingEmitterFactory(new EmitterFactoryImpl(getTemplatePath(), createTemplateRegistry()));
}
public TextEmitter getBuildPropertiesEmitter() throws UnexpectedBehaviourException {
@@ -48,7 +51,7 @@ public class StandaloneEmitters extends EmitterFactory {
private TextEmitter getRegistered(Class key) throws UnexpectedBehaviourException {
try {
- return new JETEmitterAdapter(acquireEmitter(key));
+ return new JETEmitterAdapter(myFactory.acquireEmitter(key));
} catch (NoSuchTemplateException ex) {
throw new UnexpectedBehaviourException(ex.getMessage(), ex);
}

Back to the top