Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-08-28 17:20:15 +0000
committeratikhomirov2006-08-28 17:20:15 +0000
commite8182d41999a59a11f55a219a405dba321424c88 (patch)
treeae9e14177409c4679f74efb14dc247474be83c15 /plugins/org.eclipse.gmf.codegen.ui
parentac4abb6ec39144cde9de61b9088f6330050e16c5 (diff)
downloadorg.eclipse.gmf-tooling-e8182d41999a59a11f55a219a405dba321424c88.tar.gz
org.eclipse.gmf-tooling-e8182d41999a59a11f55a219a405dba321424c88.tar.xz
org.eclipse.gmf-tooling-e8182d41999a59a11f55a219a405dba321424c88.zip
caching behavior extracted to keep separate from *generation iterator* functionality
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen.ui')
-rw-r--r--plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/CodeGenUIPlugin.java21
-rw-r--r--plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/ExecuteTemplatesAction.java2
2 files changed, 22 insertions, 1 deletions
diff --git a/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/CodeGenUIPlugin.java b/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/CodeGenUIPlugin.java
index 97896e19e..8206a7a02 100644
--- a/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/CodeGenUIPlugin.java
+++ b/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/CodeGenUIPlugin.java
@@ -16,6 +16,9 @@ import java.text.MessageFormat;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
+import org.eclipse.gmf.codegen.util.CodegenEmitters;
+import org.eclipse.gmf.codegen.util.EmitterSource;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -23,11 +26,17 @@ public class CodeGenUIPlugin extends AbstractUIPlugin {
private static CodeGenUIPlugin plugin;
+ private EmitterSource<GenEditorGenerator, CodegenEmitters> emitterSource;
+
public CodeGenUIPlugin() {
plugin = this;
}
public void stop(BundleContext context) throws Exception {
+ if (emitterSource != null) {
+ emitterSource.dispose();
+ emitterSource = null;
+ }
super.stop(context);
plugin = null;
}
@@ -71,4 +80,16 @@ public class CodeGenUIPlugin extends AbstractUIPlugin {
public static boolean needsReconcile() {
return !Boolean.FALSE.toString().equals(Platform.getDebugOption(getPluginID() + "/reconcile"));
}
+
+ public CodegenEmitters getEmitters(GenEditorGenerator genModel) {
+ if (emitterSource == null) {
+ emitterSource = new EmitterSource<GenEditorGenerator, CodegenEmitters>() {
+ @Override
+ protected CodegenEmitters newEmitters(GenEditorGenerator genModel) {
+ return new CodegenEmitters(!genModel.isDynamicTemplates(), genModel.getTemplateDirectory());
+ }
+ };
+ }
+ return emitterSource.getEmitters(genModel, genModel.isDynamicTemplates());
+ }
}
diff --git a/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/ExecuteTemplatesAction.java b/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/ExecuteTemplatesAction.java
index a4101e722..d1fcd0224 100644
--- a/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/ExecuteTemplatesAction.java
+++ b/plugins/org.eclipse.gmf.codegen.ui/src/org/eclipse/gmf/internal/codegen/popup/actions/ExecuteTemplatesAction.java
@@ -116,7 +116,7 @@ public class ExecuteTemplatesAction implements IObjectActionDelegate, IRunnableW
}
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- Generator g = new Generator(getGenModel());
+ Generator g = new Generator(getGenModel(), CodeGenUIPlugin.getDefault().getEmitters(getGenModel()));
g.run(monitor);
myRunStatus = g.getRunStatus();
}

Back to the top