Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend13
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend13
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend13
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java10
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java3
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/GeneratorPreferencePage.java5
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceConstants.java1
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceInitializer.java1
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptions.java8
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptionsHelper.java4
10 files changed, 62 insertions, 9 deletions
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
index 7fb278604..b1aa47ff5 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/CExtensions.xtend
@@ -42,12 +42,15 @@ import org.eclipse.etrice.core.room.RoomModel
import org.eclipse.etrice.core.room.util.RoomHelpers
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.xtext.util.Pair
+import org.eclipse.etrice.generator.c.setup.GeneratorOptionsHelper
+import org.eclipse.etrice.generator.c.Main
@Singleton
class CExtensions implements ILanguageExtension {
@Inject protected IDiagnostician diagnostician
@Inject protected extension RoomHelpers
+ @Inject protected extension GeneratorOptionsHelper
override String getTypedDataDefinition(EObject msg) {
if (msg instanceof Message) {
@@ -343,9 +346,13 @@ class CExtensions implements ILanguageExtension {
}
}
- val dataArg = ", "+GENERIC_DATA_NAME
- val typedData = typeName+" "+GENERIC_DATA_NAME + " = "+deRef+"(("+castTypeName+") generic_data__et);\n"
- val typedArgList = ", "+typeName+" "+GENERIC_DATA_NAME
+ val dataName = if (Main.settings.isOldStyleTransitionData && data.deprecatedName!==null && !data.deprecatedName.trim.empty)
+ data.deprecatedName
+ else
+ GENERIC_DATA_NAME
+ val dataArg = ", "+dataName
+ val typedData = typeName+" "+dataName + " = "+deRef+"(("+castTypeName+") generic_data__et);\n"
+ val typedArgList = ", "+typeName+" "+dataName
return newArrayList(dataArg, typedData, typedArgList);
}
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
index 4b254627b..e88a2feed 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
@@ -42,6 +42,8 @@ import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.xtext.util.Pair
import org.eclipse.xtext.util.Strings
+import org.eclipse.etrice.generator.cpp.Main
+import org.eclipse.etrice.generator.cpp.setup.GeneratorOptionsHelper
@Singleton
class CppExtensions implements ILanguageExtension {
@@ -50,6 +52,7 @@ class CppExtensions implements ILanguageExtension {
@Inject extension TypeHelpers
@Inject extension RoomHelpers
@Inject extension RoomExtensions
+ @Inject protected extension GeneratorOptionsHelper
override String getTypedDataDefinition(EObject msg) {
generateArglistAndTypedData((msg as Message).data).get(TypedDataKind.DECLARATION_AND_INITIALIZATION.ordinal)
@@ -222,9 +225,13 @@ class CppExtensions implements ILanguageExtension {
}
var deRef = if(!data.refType.ref) '*' else ''
- val dataArg = ''', «GENERIC_DATA_NAME»'''
- val typedData = '''«typeExpr» «GENERIC_DATA_NAME» = «deRef»(static_cast<«castExpr»>(generic_data__et));''' + NEWLINE
- val typedArgList = ''', «typeExpr» «GENERIC_DATA_NAME»'''
+ val dataName = if (Main.settings.isOldStyleTransitionData && data.deprecatedName!==null && !data.deprecatedName.trim.empty)
+ data.deprecatedName
+ else
+ GENERIC_DATA_NAME
+ val dataArg = ''', «dataName»'''
+ val typedData = '''«typeExpr» «dataName» = «deRef»(static_cast<«castExpr»>(generic_data__et));''' + NEWLINE
+ val typedArgList = ''', «typeExpr» «dataName»'''
return #[dataArg, typedData, typedArgList]
}
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend
index 923fa4a3b..5f2a5e64b 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/JavaExtensions.xtend
@@ -38,11 +38,14 @@ import org.eclipse.etrice.core.room.RoomClass
import org.eclipse.etrice.generator.generic.ILanguageExtension
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.xtext.util.Pair
+import org.eclipse.etrice.generator.java.Main
+import org.eclipse.etrice.generator.java.setup.GeneratorOptionsHelper
@Singleton
class JavaExtensions implements ILanguageExtension {
@Inject TypeHelpers typeHelpers
+ @Inject protected extension GeneratorOptionsHelper
override String getTypedDataDefinition(EObject msg) {
if (msg instanceof Message) {
@@ -261,9 +264,13 @@ class JavaExtensions implements ILanguageExtension {
castTypeName = (data.refType.type as EnumerationType).castType
}
- val dataArg = ", " + GENERIC_DATA_NAME
- val typedData = typeName + " " + GENERIC_DATA_NAME + " = ("+castTypeName+") generic_data__et;\n"
- val typedArgList = ", " + typeName + " " + GENERIC_DATA_NAME
+ val dataName = if (Main.settings.isOldStyleTransitionData && data.deprecatedName!==null && !data.deprecatedName.trim.empty)
+ data.deprecatedName
+ else
+ GENERIC_DATA_NAME
+ val dataArg = ", " + dataName
+ val typedData = typeName + " " + dataName + " = ("+castTypeName+") generic_data__et;\n"
+ val typedArgList = ", " + typeName + " " + dataName
return newArrayList(dataArg, typedData, typedArgList)
}
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
index da563b65f..2d691205b 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
@@ -70,6 +70,7 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
public static final String DATA_INSTR = "DataLogging";
public static final String VERBOSE = "Verbose";
public static final String USE_TRAANSLATION = "UseTranslation";
+ public static final String OLD_STYLE_TRANSITION_DATA = "OldStyleTransitionData";
public static final String OVERRIDE_DIRECTORIES = "OverrideDirectories";
public static final String GEN_DEPS_WITHIN_PROJECT = "GenerateDepsWithinProject";
public static final String SRCGEN_PATH = "SrcgenPath";
@@ -87,6 +88,7 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
private Text srcgenPath;
protected Button dataButton;
private Text mainMethodName;
+ private Button useOldStyleTransitionDataButton;
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
@@ -147,6 +149,10 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
useTranslationButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
useTranslationButton.addSelectionListener(new UpdateConfig());
+ useOldStyleTransitionDataButton = createCheckButton(mainComposite, "use old style transition data names");
+ useOldStyleTransitionDataButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
+ useOldStyleTransitionDataButton.addSelectionListener(new UpdateConfig());
+
debugButton = createCheckButton(mainComposite, "generate debug output");
debugButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
debugButton.addSelectionListener(new UpdateConfig());
@@ -305,6 +311,9 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
boolean useTranslation = prefStore.getBoolean(PreferenceConstants.GEN_USE_TRANSLATION);
useTranslationButton.setSelection(configuration.getAttribute(USE_TRAANSLATION, useTranslation));
+ boolean useOldStyleTransitionData = prefStore.getBoolean(PreferenceConstants.GEN_OLD_STYLE_TRANSITION_DATA);
+ useOldStyleTransitionDataButton.setSelection(configuration.getAttribute(OLD_STYLE_TRANSITION_DATA, useOldStyleTransitionData));
+
boolean override = configuration.getAttribute(OVERRIDE_DIRECTORIES, false);
String srcgenDir = prefStore.getString(PreferenceConstants.GEN_DIR);
overrideDirectories.setSelection(override);
@@ -337,6 +346,7 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
configuration.setAttribute(DATA_INSTR, dataButton.getSelection());
configuration.setAttribute(VERBOSE, verboseButton.getSelection());
configuration.setAttribute(USE_TRAANSLATION, useTranslationButton.getSelection());
+ configuration.setAttribute(OLD_STYLE_TRANSITION_DATA, useOldStyleTransitionDataButton.getSelection());
boolean override = overrideDirectories.getSelection();
configuration.setAttribute(OVERRIDE_DIRECTORIES, override);
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
index bc3ced09f..c5a5a9998 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
@@ -209,6 +209,9 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
if (!configuration.getAttribute(GeneratorConfigTab.USE_TRAANSLATION, true)) {
argString.append(" -"+AbstractGeneratorOptions.NOTRANSLATE.getName());
}
+ if (!configuration.getAttribute(GeneratorConfigTab.OLD_STYLE_TRANSITION_DATA, true)) {
+ argString.append(" -"+AbstractGeneratorOptions.OLD_STYLE_TRANSITION_DATA.getName());
+ }
ScopedPreferenceStore prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui");
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/GeneratorPreferencePage.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/GeneratorPreferencePage.java
index ca8a5c774..a8f356e3f 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/GeneratorPreferencePage.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/GeneratorPreferencePage.java
@@ -39,6 +39,11 @@ public class GeneratorPreferencePage
"Let wizard create new launchers with detail code translation on initially",
getFieldEditorParent()));
addField(
+ new BooleanFieldEditor(
+ PreferenceConstants.GEN_OLD_STYLE_TRANSITION_DATA,
+ "Let wizard create new launchers with old style transition data generation on initially",
+ getFieldEditorParent()));
+ addField(
new StringFieldEditor(
PreferenceConstants.GEN_DIR,
"The directory for &generated code:",
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceConstants.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceConstants.java
index f1b72f185..cfce11f2d 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceConstants.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceConstants.java
@@ -8,6 +8,7 @@ public class PreferenceConstants {
public static final String GEN_DIR = "GenerationDirectory";
public static final String GEN_DOC_DIR = "GeneratedDocuDirectory";
public static final String GEN_USE_TRANSLATION = "GenerateUsingTranslation";
+ public static final String GEN_OLD_STYLE_TRANSITION_DATA = "GenerateOldStyleTransitionData";
/**
* The kind of build with the two possibilities {@link #MAVEN} and {@link #JDT}
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceInitializer.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceInitializer.java
index a2e36e141..6d1243bfc 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceInitializer.java
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceInitializer.java
@@ -20,6 +20,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(PreferenceConstants.GEN_DIR, "src-gen");
store.setDefault(PreferenceConstants.GEN_DOC_DIR, "doc-gen");
store.setDefault(PreferenceConstants.GEN_USE_TRANSLATION, true);
+ store.setDefault(PreferenceConstants.GEN_OLD_STYLE_TRANSITION_DATA, false);
}
}
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 2c7dd3663..c2407c1d5 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
@@ -75,6 +75,13 @@ public class AbstractGeneratorOptions extends GeneratorOptions {
"if specified the detail codes won't be translated",
false);
+ public static final BooleanOption OLD_STYLE_TRANSITION_DATA = new BooleanOption(
+ GROUP_ETRICE,
+ "oldtransitiondata",
+ "oldStyleTransitionData",
+ "if specified the transition data are named like the message data (if specified), not 'transitionData'",
+ false);
+
@Override
public void configure(List<Option<?>> options) {
super.configure(options);
@@ -86,5 +93,6 @@ public class AbstractGeneratorOptions extends GeneratorOptions {
options.add(DATA_INSTR);
options.add(VERBOSE_RT);
options.add(NOTRANSLATE);
+ options.add(OLD_STYLE_TRANSITION_DATA);
}
}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptionsHelper.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptionsHelper.java
index 656ab1a0a..7bdab0ea4 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptionsHelper.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGeneratorOptionsHelper.java
@@ -46,4 +46,8 @@ public class AbstractGeneratorOptionsHelper {
public boolean isGenerateWithVerboseOutput(Arguments args) {
return args.get(AbstractGeneratorOptions.VERBOSE_RT);
}
+
+ public boolean isOldStyleTransitionData(Arguments args) {
+ return args.get(AbstractGeneratorOptions.OLD_STYLE_TRANSITION_DATA);
+ }
}

Back to the top