Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2017-06-28 11:43:53 +0000
committerJuergen Haug2017-06-28 12:21:32 +0000
commitcc5abdb0ab8d353b3a0144e9ec9f7121d0a71d25 (patch)
treeeedd341c4b63b69da0dfe2ca6bb14cacfbcca0a4 /plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c
parent0fe5268ec1a2d87441edcfee52e09d4f01f36edf (diff)
downloadorg.eclipse.etrice-cc5abdb0ab8d353b3a0144e9ec9f7121d0a71d25.tar.gz
org.eclipse.etrice-cc5abdb0ab8d353b3a0144e9ec9f7121d0a71d25.tar.xz
org.eclipse.etrice-cc5abdb0ab8d353b3a0144e9ec9f7121d0a71d25.zip
[generator] AbstractGenerator binding can be overridden
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c')
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java20
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java6
2 files changed, 21 insertions, 5 deletions
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java
index 1a023e51c..00a434446 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java
@@ -79,6 +79,13 @@ public class Main extends AbstractGenerator {
if (isTerminateOnError() && ret!=GENERATOR_OK)
System.exit(ret);
}
+
+ /**
+ * @return the unique {@link GlobalSettings}
+ */
+ public static GlobalGeneratorSettings getSettings() {
+ return (GlobalGeneratorSettings) getInstance().getGeneratorSettings();
+ }
@Inject
private MainGen mainGenerator;
@@ -95,11 +102,13 @@ public class Main extends AbstractGenerator {
@Inject
protected IDataConfiguration dataConfig;
+ private Root genModelResult = null;
+
/**
- * @return the unique {@link GlobalSettings}
+ * The resulting genmodel of {@linkplain #Main.runGenerator} if available.
*/
- public static GlobalGeneratorSettings getSettings() {
- return (GlobalGeneratorSettings) getInstance().getGeneratorSettings();
+ public Root getGenModel() {
+ return genModelResult;
}
/**
@@ -146,7 +155,7 @@ public class Main extends AbstractGenerator {
return GENERATOR_ERROR;
}
- Root genModel = createGeneratorModel(getSettings().isGenerateAsLibrary(), getSettings().getGeneratorModelPath());
+ Root genModel = createGeneratorModel(getSettings().isGenerateAsLibrary(), getSettings().getGeneratorModelPath());
if (diagnostician.isFailed() || genModel==null) {
logger.logInfo("errors during build of generator model");
logger.logError("-- terminating", null);
@@ -187,6 +196,9 @@ public class Main extends AbstractGenerator {
logger.logError("-- terminating", null);
return GENERATOR_ERROR;
}
+
+ genModelResult = genModel;
+
logger.logInfo("-- finished code generation");
}
finally {
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java
index 8bee75795..3eaa133a8 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/setup/GeneratorModule.java
@@ -34,10 +34,14 @@ public class GeneratorModule extends AbstractGeneratorBaseModule {
public void configure(Binder binder) {
super.configure(binder);
- binder.bind(AbstractGenerator.class).to(Main.class);
binder.bind(GenericProtocolClassGenerator.class).to(ProtocolClassGen.class);
binder.bind(GenericActorClassGenerator.class).to(ActorClassGen.class);
}
+
+ @Override
+ public Class<? extends AbstractGenerator> bindAbstractGenerator() {
+ return Main.class;
+ }
@Override
public Class<? extends ILanguageExtension> bindILanguageExtension() {

Back to the top