Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-03-07 20:07:34 +0000
committeratikhomirov2006-03-07 20:07:34 +0000
commitb5c34957cc5f7ca0883a9a5ceb60cb4269e0db3d (patch)
tree1587a1e1a367a592ad5abc27e2e523f32f8ab2e3 /plugins/org.eclipse.gmf.graphdef.codegen/src
parent03101b15fadab810f8d0dbf008af1f7436dd04a8 (diff)
downloadorg.eclipse.gmf-tooling-b5c34957cc5f7ca0883a9a5ceb60cb4269e0db3d.tar.gz
org.eclipse.gmf-tooling-b5c34957cc5f7ca0883a9a5ceb60cb4269e0db3d.tar.xz
org.eclipse.gmf-tooling-b5c34957cc5f7ca0883a9a5ceb60cb4269e0db3d.zip
support multiple galleries as input
respect needsMap when creating strategy
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/src')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneGenerator.java44
1 files changed, 30 insertions, 14 deletions
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 551f2269c..58ec3cea1 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
@@ -31,7 +31,7 @@ import org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch;
public class StandaloneGenerator extends GeneratorBase {
private final Config myArgs;
- private final FigureGallery myInput;
+ private final FigureGallery[] myInput;
private final Emitter myFigureGenerator;
private final StandaloneEmitters myAuxiliaryGenerators;
private boolean mySkipPluginStructire;
@@ -61,7 +61,11 @@ public class StandaloneGenerator extends GeneratorBase {
private final boolean myNeedsMapMode;
public ConfigImpl(String pluginId, String mainPackageName){
- this(pluginId, mainPackageName, pluginId, "", "PluginActivator", mainPackageName + ".activator", true);
+ this(pluginId, mainPackageName, true);
+ }
+
+ public ConfigImpl(String pluginId, String mainPackageName, boolean useMapMode) {
+ this(pluginId, mainPackageName, pluginId, "", "PluginActivator", mainPackageName + ".activator", useMapMode);
}
public ConfigImpl(String pluginId, String mainPackageName, String pluginFriendlyName, String pluginProviderName, String pluginActivatorClassName, String pluginActivatorPackageName, boolean needsMapMode){
@@ -102,16 +106,24 @@ public class StandaloneGenerator extends GeneratorBase {
return myNeedsMapMode;
}
}
-
- public StandaloneGenerator(FigureGallery input, Config config, FigureQualifiedNameSwitch fqnSwitch){
- assert input != null && config != null && fqnSwitch != null;
+
+ public StandaloneGenerator(FigureGallery input, Config config, FigureQualifiedNameSwitch fqnSwitch) {
+ this(new FigureGallery[] {input}, config, fqnSwitch);
+ }
+
+ public StandaloneGenerator(FigureGallery[] input, Config config, FigureQualifiedNameSwitch fqnSwitch) {
+ assert input != null && config != null && fqnSwitch != null && !Arrays.asList(input).contains(null);
myArgs = config;
myInput = input;
myFigureNameSwitch = fqnSwitch;
ImportAssistant importAssistant = new ImportUtil(getPackageName());
String pluginActivatorFQN = composePluginActivatorClassFQN(config);
- MapModeCodeGenStrategy strategy = new MapModeCodeGenStrategy.RuntimeMapModeFromPluginClass( //
- importAssistant, pluginActivatorFQN);
+ MapModeCodeGenStrategy strategy;
+ if (config.needsMapMode()) {
+ strategy = new MapModeCodeGenStrategy.RuntimeMapModeFromPluginClass(importAssistant, pluginActivatorFQN);
+ } else {
+ strategy = new MapModeCodeGenStrategy.StaticIdentityMapMode(importAssistant);
+ }
myFigureGenerator = new FigureGeneratorAdapter( //
new FigureGenerator(getPackageName(), importAssistant, fqnSwitch, strategy)
@@ -171,18 +183,22 @@ public class StandaloneGenerator extends GeneratorBase {
private String[] getRequiredBundles() {
HashSet rv = new HashSet();
- if (myInput.getImplementationBundle() != null && myInput.getImplementationBundle().trim().length() > 0) {
- rv.add(myInput.getImplementationBundle());
+ for (int i = 0; i < myInput.length; i++) {
+ if (myInput[i].getImplementationBundle() != null && myInput[i].getImplementationBundle().trim().length() > 0) {
+ rv.add(myInput[i].getImplementationBundle());
+ }
+ String[] additional = (String[]) myFigureNameSwitch.doSwitch(myInput[i]);
+ rv.addAll(Arrays.asList(additional));
}
- String[] additional = (String[]) myFigureNameSwitch.doSwitch(myInput);
- rv.addAll(Arrays.asList(additional));
return (String[]) rv.toArray(new String[rv.size()]);
}
private void generateTopLevelFigures() throws InterruptedException {
- for (Iterator it = myInput.getFigures().iterator(); it.hasNext();){
- Figure next = (Figure) it.next();
- visitFigure(next);
+ for (int i = 0; i < myInput.length; i++) {
+ for (Iterator it = myInput[i].getFigures().iterator(); it.hasNext();){
+ Figure next = (Figure) it.next();
+ visitFigure(next);
+ }
}
}

Back to the top