Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2014-04-05 13:28:30 +0000
committerHenrik Rentz-Reichert2014-04-05 14:24:22 +0000
commit4cd2e58dfbd33bd964a845e066e82af9e770a083 (patch)
tree752e03227684223f137c281717df1f1a9176a7c4
parent7d7132b2595d7b4ca7719d1c17144ff0d6a6bd59 (diff)
downloadorg.eclipse.etrice-4cd2e58dfbd33bd964a845e066e82af9e770a083.tar.gz
org.eclipse.etrice-4cd2e58dfbd33bd964a845e066e82af9e770a083.tar.xz
org.eclipse.etrice-4cd2e58dfbd33bd964a845e066e82af9e770a083.zip
Bug 431754: add possibility to deactivate detail code translation for C generator
https://bugs.eclipse.org/431754 Change-Id: I0e68d4046ce9116b7cc27d917a00f8eefb753c18
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java14
-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.java4
-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.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend7
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java75
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java9
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.java9
9 files changed, 92 insertions, 35 deletions
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 5290b8dea..49318d5e3 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
@@ -15,10 +15,12 @@ package org.eclipse.etrice.generator.launch;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.etrice.generator.ui.preferences.PreferenceConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -30,6 +32,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
/**
* @author Henrik Rentz-Reichert
@@ -67,6 +70,7 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
public static final String DEBUG = "Debug";
public static final String MSC = "MSC";
public static final String VERBOSE = "Verbose";
+ public static final String USE_TRAANSLATION = "UseTranslation";
private Button libButton;
private Button documentationButton;
@@ -76,6 +80,7 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
private Button debugButton;
private Button mscButton;
private Button verboseButton;
+ private Button useTranslationButton;
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
@@ -135,6 +140,10 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
documentationButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
documentationButton.addSelectionListener(new UpdateConfig());
+ useTranslationButton = createCheckButton(mainComposite, "perform code translation");
+ useTranslationButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
+ useTranslationButton.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());
@@ -229,6 +238,10 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
debugButton.setSelection(configuration.getAttribute(DEBUG, false));
mscButton.setSelection(configuration.getAttribute(MSC, true));
verboseButton.setSelection(configuration.getAttribute(VERBOSE, false));
+
+ ScopedPreferenceStore prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui");
+ boolean useTranslation = prefStore.getBoolean(PreferenceConstants.GEN_USE_TRANSLATION);
+ useTranslationButton.setSelection(configuration.getAttribute(USE_TRAANSLATION, useTranslation));
}
catch (CoreException e) {
e.printStackTrace();
@@ -248,6 +261,7 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
configuration.setAttribute(DEBUG, debugButton.getSelection());
configuration.setAttribute(MSC, mscButton.getSelection());
configuration.setAttribute(VERBOSE, verboseButton.getSelection());
+ configuration.setAttribute(USE_TRAANSLATION, useTranslationButton.getSelection());
}
/* (non-Javadoc)
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 c245640b1..d41999e6c 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
@@ -210,6 +210,9 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
if (configuration.getAttribute(GeneratorConfigTab.VERBOSE, false)) {
argString.append(" "+AbstractGenerator.OPTION_VERBOSE_RT);
}
+ if (!configuration.getAttribute(GeneratorConfigTab.USE_TRAANSLATION, false)) {
+ argString.append(" "+AbstractGenerator.OPTION_NOTRANSLATE);
+ }
ScopedPreferenceStore prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui");
if (prefStore.getBoolean(PreferenceConstants.GEN_INCREMENTAL)) {
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 4c8dd47b1..1f1d3e0ff 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
"Generate &incrementally",
getFieldEditorParent()));
addField(
+ new BooleanFieldEditor(
+ PreferenceConstants.GEN_USE_TRANSLATION,
+ "Let wizard create new launchers with detail code translation 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 2824addae..7ec1ac5b8 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
@@ -6,12 +6,10 @@ package org.eclipse.etrice.generator.ui.preferences;
public class PreferenceConstants {
public static final String GEN_DIR = "GenerationDirectory";
-
public static final String GEN_INFO_DIR = "GenerationInfoDirectory";
-
public static final String GEN_INCREMENTAL = "GenerateIncremental";
-
public static final String GEN_DOC_DIR = "GeneratedDocuDirectory";
+ public static final String GEN_USE_TRANSLATION = "GenerateUsingTranslation";
/**
* 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 43fb1292e..766c174ed 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
@@ -21,6 +21,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(PreferenceConstants.GEN_DIR, "src-gen");
store.setDefault(PreferenceConstants.GEN_INFO_DIR, "src-gen-info");
store.setDefault(PreferenceConstants.GEN_DOC_DIR, "doc-gen");
+ store.setDefault(PreferenceConstants.GEN_USE_TRANSLATION, true);
}
}
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend
index 8eb78345a..3f2e59390 100644
--- a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.xtend
@@ -12,6 +12,10 @@
package org.eclipse.etrice.generator.ui.wizard
+import org.eclipse.ui.preferences.ScopedPreferenceStore
+import org.eclipse.core.runtime.preferences.InstanceScope
+import org.eclipse.etrice.generator.ui.preferences.PreferenceConstants
+
/**
* @author Henrik Rentz-Reichert
*
@@ -79,10 +83,13 @@ class ProjectFileFragments {
}
def static String getGeneratorLaunchConfig(String targetLanguage, String modelPath, String baseName, String[] addLines) {
+ val prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui");
+ val useTranslation = prefStore.getBoolean(PreferenceConstants::GEN_USE_TRANSLATION)
'''
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.etrice.generator.launch.«targetLanguage».launchConfigurationType">
<booleanAttribute key="MSC" value="true"/>
+ <booleanAttribute key="UseTranslation" value="«useTranslation»"/>
<listAttribute key="ModelFiles">
<listEntry value="${workspace_loc:«modelPath»/«baseName».etmap}"/>
</listAttribute>
diff --git a/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java b/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java
index 2eebec675..6f1e93c5f 100644
--- a/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java
+++ b/plugins/org.eclipse.etrice.generator.ui/xtend-gen/org/eclipse/etrice/generator/ui/wizard/ProjectFileFragments.java
@@ -10,6 +10,9 @@
*/
package org.eclipse.etrice.generator.ui.wizard;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.etrice.generator.ui.preferences.PreferenceConstants;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.xtend2.lib.StringConcatenation;
/**
@@ -175,40 +178,50 @@ public class ProjectFileFragments {
}
public static String getGeneratorLaunchConfig(final String targetLanguage, final String modelPath, final String baseName, final String[] addLines) {
- StringConcatenation _builder = new StringConcatenation();
- _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
- _builder.newLine();
- _builder.append("<launchConfiguration type=\"org.eclipse.etrice.generator.launch.");
- _builder.append(targetLanguage, "");
- _builder.append(".launchConfigurationType\">");
- _builder.newLineIfNotEmpty();
- _builder.append("<booleanAttribute key=\"MSC\" value=\"true\"/>");
- _builder.newLine();
- _builder.append("<listAttribute key=\"ModelFiles\">");
- _builder.newLine();
- _builder.append("<listEntry value=\"${workspace_loc:");
- _builder.append(modelPath, "");
- _builder.append("/");
- _builder.append(baseName, "");
- _builder.append(".etmap}\"/>");
- _builder.newLineIfNotEmpty();
- _builder.append("</listAttribute>");
- _builder.newLine();
- _builder.append("<listAttribute key=\"org.eclipse.debug.ui.favoriteGroups\">");
- _builder.newLine();
- _builder.append("<listEntry value=\"org.eclipse.debug.ui.launchGroup.run\"/>");
- _builder.newLine();
- _builder.append("</listAttribute>");
- _builder.newLine();
+ String _xblockexpression = null;
{
- for(final String line : addLines) {
- _builder.append(line, "");
- _builder.newLineIfNotEmpty();
+ final ScopedPreferenceStore prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui");
+ final boolean useTranslation = prefStore.getBoolean(PreferenceConstants.GEN_USE_TRANSLATION);
+ StringConcatenation _builder = new StringConcatenation();
+ _builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
+ _builder.newLine();
+ _builder.append("<launchConfiguration type=\"org.eclipse.etrice.generator.launch.");
+ _builder.append(targetLanguage, "");
+ _builder.append(".launchConfigurationType\">");
+ _builder.newLineIfNotEmpty();
+ _builder.append("<booleanAttribute key=\"MSC\" value=\"true\"/>");
+ _builder.newLine();
+ _builder.append("<booleanAttribute key=\"UseTranslation\" value=\"");
+ _builder.append(useTranslation, "");
+ _builder.append("\"/>");
+ _builder.newLineIfNotEmpty();
+ _builder.append("<listAttribute key=\"ModelFiles\">");
+ _builder.newLine();
+ _builder.append("<listEntry value=\"${workspace_loc:");
+ _builder.append(modelPath, "");
+ _builder.append("/");
+ _builder.append(baseName, "");
+ _builder.append(".etmap}\"/>");
+ _builder.newLineIfNotEmpty();
+ _builder.append("</listAttribute>");
+ _builder.newLine();
+ _builder.append("<listAttribute key=\"org.eclipse.debug.ui.favoriteGroups\">");
+ _builder.newLine();
+ _builder.append("<listEntry value=\"org.eclipse.debug.ui.launchGroup.run\"/>");
+ _builder.newLine();
+ _builder.append("</listAttribute>");
+ _builder.newLine();
+ {
+ for(final String line : addLines) {
+ _builder.append(line, "");
+ _builder.newLineIfNotEmpty();
+ }
}
+ _builder.append("</launchConfiguration>");
+ _builder.newLine();
+ _xblockexpression = _builder.toString();
}
- _builder.append("</launchConfiguration>");
- _builder.newLine();
- return _builder.toString();
+ return _xblockexpression;
}
public static String getLaunchJavaApplicationConfig(final String project, final String mdlName, final String mainClass) {
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java
index b49ff73c8..e538cb72a 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java
@@ -79,6 +79,7 @@ public abstract class AbstractGenerator {
public static final String OPTION_MSC = "-msc_instr";
public static final String OPTION_VERBOSE_RT = "-gen_as_verbose";
public static final String OPTION_DEBUG = "-debug";
+ public static final String OPTION_NOTRANSLATE = "-notranslate";
/**
* constant used as return value of {@link #runGenerator())}
@@ -205,6 +206,7 @@ public abstract class AbstractGenerator {
* The following options are recognized
* <ul>
* <li>{@value #OPTION_DEBUG}</li>
+ * <li>{@value #OPTION_NOTRANSLATE}</li>
* <li>{@value #OPTION_DOCUMENTATION}</li>
* <li>{@value #OPTION_GEN_DIR}</li>
* <li>{@value #OPTION_GEN_DOC_DIR}</li>
@@ -270,6 +272,9 @@ public abstract class AbstractGenerator {
else if (arg.equals(OPTION_MSC)) {
generatorSettings.setGenerateMSCInstrumentation(true);
}
+ else if (arg.equals(OPTION_NOTRANSLATE)) {
+ generatorSettings.setNoTranslation(true);
+ }
else if (arg.equals(OPTION_VERBOSE_RT)) {
generatorSettings.setGenerateWithVerboseOutput(true);
}
@@ -443,7 +448,9 @@ public abstract class AbstractGenerator {
return null;
}
- translateDetailCodes(gmRoot);
+ if (!generatorSettings.isNoTranslation()) {
+ translateDetailCodes(gmRoot);
+ }
URI genModelURI = genModelPath!=null? URI.createFileURI(genModelPath) : URI.createFileURI("tmp.rim");
Resource genResource = getResourceSet().createResource(genModelURI);
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.java
index 3873af028..635fd5ca7 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/GlobalGeneratorSettings.java
@@ -29,6 +29,7 @@ public class GlobalGeneratorSettings {
private boolean generateDocumentation = false;
private boolean generateAsLibrary = false;
private boolean debugMode = false;
+ private boolean noTranslation = false;
public boolean generateMSCInstrumentation() {
return generateMSCInstrumentation;
@@ -83,4 +84,12 @@ public class GlobalGeneratorSettings {
this.debugMode = debugMode;
}
+ public void setNoTranslation(boolean b) {
+ this.noTranslation = b;
+ }
+
+ public boolean isNoTranslation() {
+ return noTranslation;
+ }
+
}

Back to the top