Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java15
-rw-r--r--plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/GeneratorApplication.java3
-rw-r--r--plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/Options.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/io/GeneratorFileIO.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/setup/GeneratorOptions.java19
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend7
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java4
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocTranslationProvider.xtend80
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend3
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/DocGeneratorOptions.java (renamed from plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptions.java)2
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/DocGeneratorOptionsHelper.java (renamed from plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptionsHelper.java)4
-rw-r--r--plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java66
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java3
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java6
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend8
15 files changed, 158 insertions, 69 deletions
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java
index 25957339f..0b46ce978 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/builder/GeneratorModelBuilder.java
@@ -128,8 +128,10 @@ public class GeneratorModelBuilder {
* an instance of a diagnostician
*/
private IDiagnostician diagnostician;
-
+
private boolean debug;
+
+ private Injector roomInjector = new RoomStandaloneSetup().createInjectorAndDoEMFRegistration();
/**
* the only constructor takes a logger and a diagnostician as arguments
@@ -1263,12 +1265,11 @@ public class GeneratorModelBuilder {
+" of "+((RoomModel)ac.eContainer()).getName());
ExpandedActorClass xpac = ETriceGenFactory.eINSTANCE.createExpandedActorClass();
- Injector injector = new RoomStandaloneSetup().createInjectorAndDoEMFRegistration();
- ExtendedFsmGenBuilder builder = new ExtendedFsmGenBuilder(injector, diagnostician);
- GraphContainer gc = builder.createTransformedModel(ac);
- builder.withChainHeads(gc);
- builder.withCommonData(gc);
- builder.withTriggersInStates(gc);
+ ExtendedFsmGenBuilder fsmGenBuilder = new ExtendedFsmGenBuilder(roomInjector, diagnostician);
+ GraphContainer gc = fsmGenBuilder.createTransformedModel(ac);
+ fsmGenBuilder.withChainHeads(gc);
+ fsmGenBuilder.withCommonData(gc);
+ fsmGenBuilder.withTriggersInStates(gc);
xpac.setGraphContainer(gc);
return xpac;
diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/GeneratorApplication.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/GeneratorApplication.java
index 83007deec..985a5d620 100644
--- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/GeneratorApplication.java
+++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/GeneratorApplication.java
@@ -21,7 +21,6 @@ import java.util.List;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.etrice.generator.base.args.Arguments;
-import org.eclipse.etrice.generator.base.args.IOptionModule;
import org.eclipse.etrice.generator.base.args.Options;
import org.eclipse.etrice.generator.base.cli.CommandLineParseException;
import org.eclipse.etrice.generator.base.cli.ICommandLineParser;
@@ -83,7 +82,7 @@ public class GeneratorApplication {
@Inject
public GeneratorApplication(@GeneratorName String name,
- @GeneratorOptions IOptionModule optionsModule, ICommandLineParser commandLineParser,
+ GeneratorOptions optionsModule, ICommandLineParser commandLineParser,
IHelpFormatter helpFormatter, Provider<Logger> loggerProvider,
Provider<GeneratorFileIO> fileIOProvider, Provider<IGenerator> generatorProvider,
IGeneratorResourceLoader resourceLoader, IGeneratorResourceValidator resourceValidator) {
diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/Options.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/Options.java
index 5d640287b..408f9b521 100644
--- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/Options.java
+++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/Options.java
@@ -27,8 +27,6 @@ import java.util.List;
*/
public class Options implements IOptionModule, Iterable<Option<?>> {
- public static class EmptyOptions extends Options {}
-
private final LinkedHashMap<String, Option<?>> name2Option;
/**
diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/io/GeneratorFileIO.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/io/GeneratorFileIO.java
index c00a14900..1b3cb1f18 100644
--- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/io/GeneratorFileIO.java
+++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/io/GeneratorFileIO.java
@@ -156,7 +156,10 @@ public class GeneratorFileIO implements IGeneratorFileIO {
private void writeFile(Path path, String content) {
try {
- Files.createDirectories(path.getParent());
+ Path parent = path.getParent();
+ if(parent != null) {
+ Files.createDirectories(parent);
+ }
BufferedWriter writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8);
writer.append(content);
writer.close();
diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/setup/GeneratorOptions.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/setup/GeneratorOptions.java
index 45e64cff2..6a31f41fe 100644
--- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/setup/GeneratorOptions.java
+++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/setup/GeneratorOptions.java
@@ -15,19 +15,16 @@
package org.eclipse.etrice.generator.base.setup;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.util.List;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
+import org.eclipse.etrice.generator.base.args.IOptionModule;
+import org.eclipse.etrice.generator.base.args.Option;
-import com.google.inject.BindingAnnotation;
+public class GeneratorOptions implements IOptionModule {
-@BindingAnnotation
-@Retention(RUNTIME)
-@Target({ FIELD, PARAMETER, METHOD })
-public @interface GeneratorOptions {
+ @Override
+ public void configure(List<Option<?>> options) {
+
+ }
}
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
index 09516bec3..22b3c60c1 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/ProtocolClassGen.xtend
@@ -24,13 +24,13 @@ import org.eclipse.etrice.core.room.ProtocolClass
import org.eclipse.etrice.core.room.RoomModel
import org.eclipse.etrice.generator.base.io.IGeneratorFileIO
import org.eclipse.etrice.generator.base.logging.ILogger
-import org.eclipse.etrice.generator.base.AbstractGenerator
import org.eclipse.etrice.generator.c.Main
import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
+import org.eclipse.etrice.generator.fsm.generic.IDetailCodeTranslator
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
@@ -41,6 +41,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
@Inject extension ProcedureHelpers
@Inject extension TypeHelpers
@Inject protected extension GeneratorOptionsHelper
+ @Inject protected extension IDetailCodeTranslator
@Inject ILogger logger
def doGenerate(Root root) {
@@ -372,7 +373,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
«messageSignature(portClassName, message.name, "", data)» {
«IF hdlr !== null»
- «AbstractGenerator::getInstance().getTranslatedCode(hdlr.detailCode)»
+ «hdlr.detailCode.translatedCode»
«ELSE»
ET_MSC_LOGGER_SYNC_ENTRY("«portClassName»", "«message.name»")
«sendMessageCall(hasData, "self", memberInUse(pc.name, dir+message.name), typeName+refp, refa+"data__et")»
@@ -480,7 +481,7 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
/* receiver handlers */
«FOR h:pc.getReceiveHandlers(conj)»
void «portClassName»_«h.msg.name»_receiveHandler(«portClassName»* self, const etMessage* msg, void * actor, etActorReceiveMessage receiveMessageFunc){
- «AbstractGenerator::getInstance().getTranslatedCode(h.detailCode)»
+ «h.detailCode.translatedCode»
/* hand over the message to the actor: */
/* (*receiveMessageFunc)(actor, self, msg); */
}
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java
index aa25169d7..fdeb85099 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/Main.java
@@ -25,7 +25,7 @@ import org.eclipse.etrice.generator.base.logging.ILogger;
import org.eclipse.etrice.generator.doc.gen.InstanceDiagramGen;
import org.eclipse.etrice.generator.doc.gen.MainGen;
import org.eclipse.etrice.generator.doc.setup.GeneratorModule;
-import org.eclipse.etrice.generator.doc.setup.GeneratorOptions;
+import org.eclipse.etrice.generator.doc.setup.DocGeneratorOptions;
import com.google.inject.Inject;
@@ -57,7 +57,7 @@ public class Main extends AbstractGenerator {
logger.logInfo("-- starting code generation");
mainGenerator.doGenerate(genModel.eResource());
- if (arguments.get(GeneratorOptions.GEN_INST_DIAG)) {
+ if (arguments.get(DocGeneratorOptions.GEN_INST_DIAG)) {
instanceDiagramGenerator.doGenerate(genModel);
}
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocTranslationProvider.xtend b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocTranslationProvider.xtend
new file mode 100644
index 000000000..6c114f4d2
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/DocTranslationProvider.xtend
@@ -0,0 +1,80 @@
+/*******************************************************************************
+* Copyright (c) 2018 protos software gmbh (http://www.protos.de).
+* All rights reserved.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+*
+* CONTRIBUTORS:
+* Jan Belle (initial contribution)
+*
+ *******************************************************************************/
+
+package org.eclipse.etrice.generator.doc.gen
+
+import org.eclipse.etrice.generator.base.ITranslationProvider
+import org.eclipse.etrice.core.room.Attribute
+import org.eclipse.etrice.core.room.EnumLiteral
+import org.eclipse.etrice.core.room.InterfaceItem
+import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem
+import org.eclipse.etrice.core.room.PortOperation
+import java.util.List
+import org.eclipse.etrice.core.room.Operation
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.etrice.core.fsm.fSM.DetailCode
+
+class DocTranslationProvider implements ITranslationProvider {
+
+ override getAttributeGetter(Attribute att, String index, String orig) {
+ ""
+ }
+
+ override getAttributeSetter(Attribute att, String index, String value, String orig) {
+ ""
+ }
+
+ override getEnumText(EnumLiteral literal) {
+ ""
+ }
+
+ override getInterfaceItemMessageValue(InterfaceItem item, Message msg, String orig) {
+ ""
+ }
+
+ override getInterfaceItemOperationText(AbstractInterfaceItem item, PortOperation op, List<String> args, String orig) {
+ ""
+ }
+
+ override getOperationText(Operation op, List<String> args, String orig) {
+ ""
+ }
+
+ override translateEnums() {
+ false
+ }
+
+ override getInterfaceItemMessageText(AbstractInterfaceItem item, EObject msg, List<String> args, String index, String orig) {
+ ""
+ }
+
+ override setContainerClass(EObject container) {
+
+ }
+
+ override translateMembers() {
+ false
+ }
+
+ override translateTag(String tag, DetailCode code) {
+ ""
+ }
+
+ override translateTags() {
+ false
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend
index bdc8f62ff..3011ae551 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/gen/InstanceDiagramGen.xtend
@@ -43,8 +43,7 @@ class InstanceDiagramGen {
var batchFile = "dot2jpg.bat"
for (sys : root.systemInstances) {
var file = sys.name+"_instanceTree.dot"
- logger.logInfo("generating instance tree diagram: '"+file+"' in '"+path+"'")
- fileIO.generateFile(path + file, root.generate(sys))
+ fileIO.generateFile("generating instance tree diagram", path + file, root.generate(sys))
}
fileIO.generateFile(path + batchFile, root.generate2jpg())
runDot2Jpg(path, batchFile)
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptions.java b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/DocGeneratorOptions.java
index 802d65409..33a565fba 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptions.java
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/DocGeneratorOptions.java
@@ -21,7 +21,7 @@ import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
import org.eclipse.etrice.generator.base.args.BooleanOption;
import org.eclipse.etrice.generator.base.args.Option;
-public class GeneratorOptions extends AbstractGeneratorOptions {
+public class DocGeneratorOptions extends AbstractGeneratorOptions {
public static final String GROUP_ETRICE_DOC = "eTrice Documentation";
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptionsHelper.java b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/DocGeneratorOptionsHelper.java
index e2fb6e74e..40c13c615 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorOptionsHelper.java
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/DocGeneratorOptionsHelper.java
@@ -18,9 +18,9 @@ package org.eclipse.etrice.generator.doc.setup;
import org.eclipse.etrice.generator.base.AbstractGeneratorOptionsHelper;
import org.eclipse.etrice.generator.base.args.Arguments;
-public class GeneratorOptionsHelper extends AbstractGeneratorOptionsHelper {
+public class DocGeneratorOptionsHelper extends AbstractGeneratorOptionsHelper {
public boolean isGenerateInstanceDiagram(Arguments args) {
- return args.get(GeneratorOptions.GEN_INST_DIAG);
+ return args.get(DocGeneratorOptions.GEN_INST_DIAG);
}
}
diff --git a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java
index 28367f199..c1d09a019 100644
--- a/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java
+++ b/plugins/org.eclipse.etrice.generator.doc/src/org/eclipse/etrice/generator/doc/setup/GeneratorModule.java
@@ -14,43 +14,53 @@
package org.eclipse.etrice.generator.doc.setup;
-import org.eclipse.etrice.generator.base.AbstractGenerator;
-import org.eclipse.etrice.generator.base.AbstractGeneratorBaseModule;
-import org.eclipse.etrice.generator.base.AbstractGeneratorOptions;
-import org.eclipse.etrice.generator.base.IDataConfiguration;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician;
+import org.eclipse.etrice.generator.base.EMFSetup;
+import org.eclipse.etrice.generator.base.GenerationEMFDiagnostician;
+import org.eclipse.etrice.generator.base.IGenerator;
import org.eclipse.etrice.generator.base.ITranslationProvider;
+import org.eclipse.etrice.generator.base.ModelLoader;
+import org.eclipse.etrice.generator.base.ModelValidator;
+import org.eclipse.etrice.generator.base.io.GeneratorFileIO;
+import org.eclipse.etrice.generator.base.io.IGeneratorEMFSetup;
+import org.eclipse.etrice.generator.base.io.IGeneratorResourceLoader;
+import org.eclipse.etrice.generator.base.logging.Logger;
+import org.eclipse.etrice.generator.base.setup.GeneratorName;
+import org.eclipse.etrice.generator.base.setup.GeneratorOptions;
+import org.eclipse.etrice.generator.base.validation.IGeneratorResourceValidator;
import org.eclipse.etrice.generator.doc.Main;
-import org.eclipse.etrice.generator.generic.ILanguageExtension;
+import org.eclipse.etrice.generator.doc.gen.DocTranslationProvider;
+import org.eclipse.etrice.generator.fsm.base.Diagnostician;
import com.google.inject.Binder;
+import com.google.inject.Module;
+import com.google.inject.Singleton;
-public class GeneratorModule extends AbstractGeneratorBaseModule {
+public class GeneratorModule implements Module {
+ public static final String GENERATOR_NAME = "eTrice Documentation Generator";
+
@Override
public void configure(Binder binder) {
- super.configure(binder);
+ binder.bind(String.class).annotatedWith(GeneratorName.class).toInstance(GENERATOR_NAME);
+ binder.bind(GeneratorOptions.class).to(DocGeneratorOptions.class);
+ binder.bind(IGeneratorResourceLoader.class).to(ModelLoader.class);
+ binder.bind(IGeneratorEMFSetup.class).to(EMFSetup.class);
+ binder.bind(IGeneratorResourceValidator.class).to(ModelValidator.class);
+ binder.bind(IGenerator.class).to(Main.class);
- binder.bind(AbstractGeneratorOptions.class).to(GeneratorOptions.class);
- }
-
- @Override
- public Class<? extends AbstractGenerator> bindAbstractGenerator() {
- return Main.class;
- }
-
- @Override
- public Class<? extends ILanguageExtension> bindILanguageExtension() {
- return null;
- }
-
- @Override
- public Class<? extends ITranslationProvider> bindITranslationProvider() {
- return null;
- }
-
- @Override
- public Class<? extends IDataConfiguration> bindIDataConfiguration() {
- return null;
+ binder.bind(ResourceSet.class).to(ResourceSetImpl.class);
+ binder.bind(Logger.class).in(Singleton.class);
+ binder.bind(GeneratorFileIO.class).in(Singleton.class);
+ binder.bind(IDiagnostician.class).to(Diagnostician.class);
+ binder.bind(Diagnostician.class).in(Singleton.class);
+ binder.bind(ITranslationProvider.class).to(DocTranslationProvider.class);
+
+ binder.bind(EValidator.Registry.class).toInstance(EValidator.Registry.INSTANCE);
+ binder.bind(org.eclipse.emf.ecore.util.Diagnostician.class).to(GenerationEMFDiagnostician.class).asEagerSingleton();
}
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java
index 56f4dc6b1..cb1f266a8 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorBaseModule.java
@@ -17,7 +17,6 @@ package org.eclipse.etrice.generator.base;
import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.etrice.core.genmodel.fsm.IDiagnostician;
-import org.eclipse.etrice.generator.base.args.IOptionModule;
import org.eclipse.etrice.generator.base.io.GeneratorFileIO;
import org.eclipse.etrice.generator.base.io.IGeneratorEMFSetup;
import org.eclipse.etrice.generator.base.io.IGeneratorResourceLoader;
@@ -73,7 +72,7 @@ public abstract class AbstractGeneratorBaseModule implements Module {
binder.bind(IGeneratorEMFSetup.class).to(bindIGeneratorEMFSetup());
}
binder.bind(String.class).annotatedWith(GeneratorName.class).toInstance(bindGeneratorName());
- binder.bind(IOptionModule.class).annotatedWith(GeneratorOptions.class).to(bindGeneratorOptions());
+ binder.bind(GeneratorOptions.class).to(bindGeneratorOptions());
binder.bind(IGeneratorResourceLoader.class).to(ModelLoader.class);
binder.bind(IGeneratorResourceValidator.class).to(ModelValidator.class);
binder.bind(Diagnostician.class).in(Singleton.class);
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java
index 1e02bc5c9..2c7dd3663 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java
@@ -18,11 +18,11 @@ package org.eclipse.etrice.generator.base;
import java.util.List;
import org.eclipse.etrice.generator.base.args.BooleanOption;
-import org.eclipse.etrice.generator.base.args.IOptionModule;
import org.eclipse.etrice.generator.base.args.Option;
import org.eclipse.etrice.generator.base.args.StringOption;
+import org.eclipse.etrice.generator.base.setup.GeneratorOptions;
-public class AbstractGeneratorOptions implements IOptionModule {
+public class AbstractGeneratorOptions extends GeneratorOptions {
public static final String GROUP_ETRICE = "eTrice";
@@ -77,6 +77,8 @@ public class AbstractGeneratorOptions implements IOptionModule {
@Override
public void configure(List<Option<?>> options) {
+ super.configure(options);
+
options.add(LIB);
options.add(SAVE_GEN_MODEL);
options.add(MAIN_NAME);
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
index 69226b839..35a8d2993 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/ProcedureHelpers.xtend
@@ -28,8 +28,8 @@ import org.eclipse.etrice.core.room.ProtocolClass
import org.eclipse.etrice.core.room.RefableType
import org.eclipse.etrice.core.room.RoomClass
import org.eclipse.etrice.core.room.util.RoomHelpers
-import org.eclipse.etrice.generator.base.AbstractGenerator
import org.eclipse.etrice.generator.base.logging.ILogger
+import org.eclipse.etrice.generator.fsm.generic.IDetailCodeTranslator
/**
* A collection of methods for generation of user code, attributes with getters and setters
@@ -42,6 +42,7 @@ class ProcedureHelpers {
@Inject protected extension RoomHelpers
@Inject protected extension TypeHelpers
+ @Inject protected extension IDetailCodeTranslator
@Inject protected ILanguageExtension languageExt
@Inject protected ILogger logger
@@ -286,7 +287,7 @@ class ProcedureHelpers {
/*--------------------- operations ---------------------*/
«FOR operation : operations»
«operationSignature(operation, classname, false)» {
- «AbstractGenerator::getInstance().getTranslatedCode(operation.detailCode)»
+ «operation.detailCode.translatedCode»
}
«ENDFOR»
'''
@@ -363,8 +364,7 @@ class ProcedureHelpers {
val comment = '''/* user defined «IF ctor»con«ELSE»de«ENDIF»structor body */'''
val implementedStructors = cls.getStructors(!languageExt.usesInheritance).filter[isConstructor == ctor]
- val translatedCodes = implementedStructors.map[detailCode].map[
- AbstractGenerator::getInstance().getTranslatedCode(it)]
+ val translatedCodes = implementedStructors.map[detailCode].map[getTranslatedCode]
return comment + NEWLINE + translatedCodes.map[if(translatedCodes.size > 1) asBlock else it].join
}

Back to the top