Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2007-03-02 16:51:13 +0000
committeratikhomirov2007-03-02 16:51:13 +0000
commit484dc9f2dc00600ec75cc8ce8a49900dbde09851 (patch)
tree00acb13956f4caf062cf5573e802fbd10e0098bb
parent63bcdd857f242bb94e8aac4b4e07068a8fdb550b (diff)
downloadorg.eclipse.gmf-tooling-484dc9f2dc00600ec75cc8ce8a49900dbde09851.tar.gz
org.eclipse.gmf-tooling-484dc9f2dc00600ec75cc8ce8a49900dbde09851.tar.xz
org.eclipse.gmf-tooling-484dc9f2dc00600ec75cc8ce8a49900dbde09851.zip
pass list of generated figures qualified names in case activator needs to reference them
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneEmitters.java10
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/StandaloneGenerator.java15
2 files changed, 19 insertions, 6 deletions
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 051202e4e..ede226eda 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
@@ -76,9 +76,15 @@ class StandaloneEmitters {
public TextEmitter getPluginActivatorEmitter() throws UnexpectedBehaviourException {
return new XpandTextEmitter(myResourceManager, "plugin::Activator::Init", getClass().getClassLoader()) {
@Override
+ protected Object extractTarget(Object[] arguments) {
+ assert arguments != null && arguments.length >= 2;
+ assert arguments[2] instanceof List;
+ return arguments[2];
+ }
+ @Override
protected Object[] extractArguments(Object[] arguments) {
- assert arguments != null && arguments.length > 0 && arguments[0] instanceof Object[];
- Config config = (Config) ((Object[]) arguments[0])[0];
+ assert arguments != null && arguments.length > 0 && arguments[0] instanceof Config;
+ Config config = (Config) arguments[0];
return new Object[] {
config.getPluginActivatorPackageName(),
config.getPluginActivatorClassName(),
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 800a2827b..f35b97b0e 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
@@ -12,6 +12,9 @@
package org.eclipse.gmf.graphdef.codegen;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.codegen.merge.java.JControlModel;
@@ -36,6 +39,7 @@ public class StandaloneGenerator extends GeneratorBase {
private boolean mySkipPluginStructire;
protected final FigureQualifiedNameSwitch myFigureNameSwitch;
protected Processor myProcessor;
+ private final Map<String, Figure> myCallbackFigures = new LinkedHashMap<String, Figure>();
public interface Config {
public String getPluginID();
@@ -169,16 +173,16 @@ public class StandaloneGenerator extends GeneratorBase {
generatePluginStructure();
}
try {
- generatePluginActivator();
generateTopLevelFigures();
+ generatePluginActivator();
} catch (IllegalStateException e){
throw new UnexpectedBehaviourException(e);
}
}
protected void generatePluginActivator() throws UnexpectedBehaviourException, InterruptedException{
- Object[] args = new Object[] {myArgs, new ImportUtil(myArgs.getPluginActivatorPackageName(), myArgs.getPluginActivatorClassName())};
- doGenerateJavaClass(myAuxiliaryGenerators.getPluginActivatorEmitter(), myArgs.getPluginActivatorPackageName(), myArgs.getPluginActivatorClassName(), new Object[] {args});
+ Object[] args = new Object[] {myArgs, new ImportUtil(myArgs.getPluginActivatorPackageName(), myArgs.getPluginActivatorClassName()), new ArrayList<String>(myCallbackFigures.keySet())};
+ doGenerateJavaClass(myAuxiliaryGenerators.getPluginActivatorEmitter(), myArgs.getPluginActivatorPackageName(), myArgs.getPluginActivatorClassName(), args);
}
protected void generatePluginStructure() throws UnexpectedBehaviourException, InterruptedException {
@@ -188,6 +192,7 @@ public class StandaloneGenerator extends GeneratorBase {
}
private void generateTopLevelFigures() throws InterruptedException {
+ myCallbackFigures.clear(); // just in case
myProcessor.go(new ProcessorCallback() {
public String visitFigure(Figure f) throws InterruptedException {
return StandaloneGenerator.this.visitFigure(f);
@@ -199,7 +204,9 @@ public class StandaloneGenerator extends GeneratorBase {
final ImportAssistant importAssistant = new ImportUtil(getPackageName(), CodeGenUtil.validJavaIdentifier(figure.getName()));
Object[] args = new Object[] { figure, importAssistant };
doGenerateJavaClass(myFigureGenerator, getPackageName(), importAssistant.getCompilationUnitName(), args);
- return composeFQN(getPackageName(), importAssistant.getCompilationUnitName());
+ final String qualifiedName = composeFQN(getPackageName(), importAssistant.getCompilationUnitName());
+ myCallbackFigures.put(qualifiedName, figure);
+ return qualifiedName;
}
private String getPackageName(){

Back to the top