Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-04-03 14:56:33 +0000
committerHenrik Rentz-Reichert2013-04-03 15:03:24 +0000
commitee213d0eebbdcb9eb9e68c2a6446076f077d6bef (patch)
tree3b752b2b7cc58b4d839b56668ff8cb0b0e07dd80
parent5aceef8fd710f71f58f88d52938b05183d5379e6 (diff)
downloadorg.eclipse.etrice-ee213d0eebbdcb9eb9e68c2a6446076f077d6bef.tar.gz
org.eclipse.etrice-ee213d0eebbdcb9eb9e68c2a6446076f077d6bef.tar.xz
org.eclipse.etrice-ee213d0eebbdcb9eb9e68c2a6446076f077d6bef.zip
[generator.*] bug 367446: move parameters for codegenerators from generators to preferences
https://bugs.eclipse.org/bugs/show_bug.cgi?id=367446 for - incremental generation - directory for generated code - directory for generated info - directory for generated documentation
-rw-r--r--features/org.eclipse.etrice.feature/feature.xml7
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/Main.java72
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java82
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java19
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java17
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/.classpath7
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/.gitignore1
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/.project28
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/about.html28
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/build.properties5
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/plugin.xml20
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/Activator.java31
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/GeneratorPreferencePage.java73
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceConstants.java15
-rw-r--r--plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceInitializer.java25
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend29
-rw-r--r--plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java48
21 files changed, 498 insertions, 34 deletions
diff --git a/features/org.eclipse.etrice.feature/feature.xml b/features/org.eclipse.etrice.feature/feature.xml
index 519c8b28f..ba589f18b 100644
--- a/features/org.eclipse.etrice.feature/feature.xml
+++ b/features/org.eclipse.etrice.feature/feature.xml
@@ -316,4 +316,11 @@ http://www.eclipse.org/legal/epl-v10.html
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.etrice.generator.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
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 64baaad6e..34b213f7b 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
@@ -18,8 +18,10 @@ import java.util.List;
import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.IDataConfiguration;
+import org.eclipse.etrice.generator.base.IncrementalGenerationFileIo;
import org.eclipse.etrice.generator.c.gen.Validator;
import org.eclipse.etrice.generator.c.setup.GeneratorModule;
+import org.eclipse.etrice.generator.generic.RoomExtensions;
import org.eclipse.xtext.generator.IGenerator;
import com.google.inject.Inject;
@@ -67,18 +69,26 @@ public class Main extends AbstractGenerator {
public static final String OPTION_NOEXIT = "-noexit";
public static final String OPTION_GEN_INST_DIAG = "-genInstDiag";
public static final String OPTION_SAVE_GEN_MODEL = "-saveGenModel";
+ public static final String OPTION_GEN_INCREMENTAL = "-inc";
+ public static final String OPTION_GEN_DIR = "-genDir";
+ public static final String OPTION_GEN_INFO_DIR = "-genInfoDir";
+ public static final String OPTION_GEN_DOC_DIR = "-genDocDir";
/**
* print usage message to stderr
*/
private static void printUsage() {
- output.println(Main.class.getName()+" [-saveGenModel <genmodel path>] [-genInstDiag] [-lib] <list of model file paths>");
- output.println(" <list of model file paths> # model file paths may be specified as");
- output.println(" # e.g. C:\\path\\to\\model\\mymodel.room");
- output.println(" -saveGenModel <genmodel path> # if specified the generator model will be saved to this location");
- output.println(" -genInstDiag # if specified an instance diagram is created for each subsystem");
- output.println(" -lib # if specified all classes are generated and no instances");
- output.println(" -noexit # if specified the JVM is not exited");
+ output.println(Main.class.getName()+" [-saveGenModel <genmodel path>] [-genInstDiag] [-lib] [-inc] [-genDir <generation directory>] [-genInfoDir <generation info directory>] [-genInfoDir <gen documentation directory>] <list of model file paths>");
+ output.println(" <list of model file paths> # model file paths may be specified as");
+ output.println(" # e.g. C:\\path\\to\\model\\mymodel.room");
+ output.println(" -saveGenModel <genmodel path> # if specified the generator model will be saved to this location");
+ output.println(" -genInstDiag # if specified an instance diagram is created for each subsystem");
+ output.println(" -lib # if specified all classes are generated and no instances");
+ output.println(" -noexit # if specified the JVM is not exited");
+ output.println(" -inc # if specified the generation is incremental");
+ output.println(" -genDir <generation directory> # the directory for generated files");
+ output.println(" -genInfoDir <generation info dir> # the directory for generated info files");
+ output.println(" -genDocDir <gen documentation dir> # the directory for generated documentation files");
}
public static void main(String[] args) {
@@ -102,21 +112,55 @@ public class Main extends AbstractGenerator {
public int runGenerator(String[] args) {
if (args.length == 0) {
- logger.logError(Main.class.getName()+" - aborting: no arguments!", null);
- printUsage();
- return GENERATOR_ERROR;
+ return usageError("no arguments!");
}
- // parsing arguments
+ // setting defaults
String genModelPath = null;
List<String> uriList = new ArrayList<String>();
boolean genInstDiag = false;
boolean asLibrary = false;
+ IncrementalGenerationFileIo.setGenerateIncremental(false);
+ RoomExtensions.setDefaultGenDir();
+ RoomExtensions.setDefaultGenInfoDir();
+ RoomExtensions.setDefaultGenDocDir();
+
+ // parsing arguments
for (int i=0; i<args.length; ++i) {
if (args[i].equals(OPTION_SAVE_GEN_MODEL)) {
if (++i<args.length) {
genModelPath = args[i]+"/genmodel.egm";
}
+ else {
+ return usageError(OPTION_SAVE_GEN_MODEL+" needs path");
+ }
+ }
+ else if (args[i].equals(OPTION_GEN_DIR)) {
+ if (++i<args.length) {
+ RoomExtensions.setGenDir(args[i]);
+ }
+ else {
+ return usageError(OPTION_GEN_DIR+" needs directory");
+ }
+ }
+ else if (args[i].equals(OPTION_GEN_INFO_DIR)) {
+ if (++i<args.length) {
+ RoomExtensions.setGenInfoDir(args[i]);
+ }
+ else {
+ return usageError(OPTION_GEN_INFO_DIR+" needs directory");
+ }
+ }
+ else if (args[i].equals(OPTION_GEN_DOC_DIR)) {
+ if (++i<args.length) {
+ RoomExtensions.setGenDocDir(args[i]);
+ }
+ else {
+ return usageError(OPTION_GEN_DOC_DIR+" needs directory");
+ }
+ }
+ else if (args[i].equals(OPTION_GEN_INCREMENTAL)) {
+ IncrementalGenerationFileIo.setGenerateIncremental(true);
}
else if (args[i].equals(OPTION_GEN_INST_DIAG)) {
genInstDiag = true;
@@ -141,6 +185,12 @@ public class Main extends AbstractGenerator {
return GENERATOR_OK;
}
+ protected int usageError(String text) {
+ logger.logError(Main.class.getName() + " - aborting: " + text, null);
+ printUsage();
+ return GENERATOR_ERROR;
+ }
+
protected boolean runGenerator(List<String> uriList, String genModelPath, boolean genInstDiag, boolean asLibrary) {
loadModels(uriList);
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java
index 009f35065..23c6488ba 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/Main.java
@@ -23,6 +23,8 @@ import org.eclipse.etrice.core.genmodel.etricegen.Root;
import org.eclipse.etrice.generator.base.AbstractGenerator;
import org.eclipse.etrice.generator.base.IDataConfiguration;
import org.eclipse.etrice.generator.base.IResourceURIAcceptor;
+import org.eclipse.etrice.generator.base.IncrementalGenerationFileIo;
+import org.eclipse.etrice.generator.generic.RoomExtensions;
import org.eclipse.etrice.generator.java.gen.GlobalSettings;
import org.eclipse.etrice.generator.java.gen.Validator;
import org.eclipse.etrice.generator.java.setup.GeneratorModule;
@@ -37,6 +39,10 @@ public class Main extends AbstractGenerator {
public static final String OPTION_NOEXIT = "-noexit";
public static final String OPTION_DOCUMENTATION = "-genDocu";
public static final String OPTION_SAVE_GEN_MODEL = "-saveGenModel";
+ public static final String OPTION_GEN_INCREMENTAL = "-inc";
+ public static final String OPTION_GEN_DIR = "-genDir";
+ public static final String OPTION_GEN_INFO_DIR = "-genInfoDir";
+ public static final String OPTION_GEN_DOC_DIR = "-genDocDir";
public static final String OPTION_DEBUG = "-debug";
public static final String OPTION_MSC = "-msc_instr";
public static final String OPTION_VERBOSE_RT = "-gen_as_verbose";
@@ -45,24 +51,32 @@ public class Main extends AbstractGenerator {
* print usage message to stderr
*/
private static void printUsage() {
- output.println(Main.class.getName()+" [-saveGenModel <genmodel path>]"
+ output.println(Main.class.getName()+" ["+OPTION_SAVE_GEN_MODEL+" <genmodel path>]"
+" ["+OPTION_DOCUMENTATION+"]"
+" ["+OPTION_LIB+"]"
+" ["+OPTION_NOEXIT+"]"
+" ["+OPTION_SAVE_GEN_MODEL+" <genmodel path>]"
+ +" ["+OPTION_GEN_INCREMENTAL
+ +" ["+OPTION_GEN_DIR+" <generation directory>]"
+ +" ["+OPTION_GEN_INFO_DIR+" <generation info directory>]"
+ +" ["+OPTION_GEN_DOC_DIR+" <gen documentation directory>]"
+" ["+OPTION_DEBUG+"]"
+" ["+OPTION_MSC+"]"
+" ["+OPTION_VERBOSE_RT+"]"
+" <list of model file paths>");
- output.println(" <list of model file paths> # model file paths may be specified as");
- output.println(" # e.g. C:\\path\\to\\model\\mymodel.room");
- output.println(" -genDocu # if specified documentation is created");
- output.println(" -lib # if specified all classes are generated and no instances");
- output.println(" -noexit # if specified the JVM is not exited");
- output.println(" -saveGenModel <genmodel path> # if specified the generator model will be saved to this location");
- output.println(" -debug # if specified create debug output");
- output.println(" -msc_instr # generate instrumentation for MSC generation");
- output.println(" -gen_as_verbose # generate instrumentation for verbose console output");
+ output.println(" <list of model file paths> # model file paths may be specified as");
+ output.println(" # e.g. C:\\path\\to\\model\\mymodel.room");
+ output.println(" -genDocu # if specified documentation is created");
+ output.println(" -lib # if specified all classes are generated and no instances");
+ output.println(" -noexit # if specified the JVM is not exited");
+ output.println(" -saveGenModel <genmodel path> # if specified the generator model will be saved to this location");
+ output.println(" -inc # if specified the generation is incremental");
+ output.println(" -genDir <generation directory> # the directory for generated files");
+ output.println(" -genInfoDir <generation info dir> # the directory for generated info files");
+ output.println(" -genDocDir <gen documentation dir> # the directory for generated documentation files");
+ output.println(" -debug # if specified create debug output");
+ output.println(" -msc_instr # generate instrumentation for MSC generation");
+ output.println(" -gen_as_verbose # generate instrumentation for verbose console output");
}
public static void main(String[] args) {
@@ -88,22 +102,56 @@ public class Main extends AbstractGenerator {
public int runGenerator(String[] args) {
if (args.length == 0) {
- logger.logError(Main.class.getName()+" - aborting: no arguments!", null);
- printUsage();
- return GENERATOR_ERROR;
+ return usageError("no arguments!");
}
- // parsing arguments
+ // setting defaults
String genModelPath = null;
List<String> uriList = new ArrayList<String>();
boolean genDocumentation = false;
boolean asLibrary = false;
boolean debug = false;
+ IncrementalGenerationFileIo.setGenerateIncremental(false);
+ RoomExtensions.setDefaultGenDir();
+ RoomExtensions.setDefaultGenInfoDir();
+ RoomExtensions.setDefaultGenDocDir();
+
+ // parsing arguments
for (int i=0; i<args.length; ++i) {
if (args[i].equals(OPTION_SAVE_GEN_MODEL)) {
if (++i<args.length) {
genModelPath = args[i]+"/genmodel.egm";
}
+ else {
+ return usageError(OPTION_SAVE_GEN_MODEL+" needs path");
+ }
+ }
+ else if (args[i].equals(OPTION_GEN_DIR)) {
+ if (++i<args.length) {
+ RoomExtensions.setGenDir(args[i]);
+ }
+ else {
+ return usageError(OPTION_GEN_DIR+" needs directory");
+ }
+ }
+ else if (args[i].equals(OPTION_GEN_INFO_DIR)) {
+ if (++i<args.length) {
+ RoomExtensions.setGenInfoDir(args[i]);
+ }
+ else {
+ return usageError(OPTION_GEN_INFO_DIR+" needs directory");
+ }
+ }
+ else if (args[i].equals(OPTION_GEN_DOC_DIR)) {
+ if (++i<args.length) {
+ RoomExtensions.setGenDocDir(args[i]);
+ }
+ else {
+ return usageError(OPTION_GEN_DOC_DIR+" needs directory");
+ }
+ }
+ else if (args[i].equals(OPTION_GEN_INCREMENTAL)) {
+ IncrementalGenerationFileIo.setGenerateIncremental(true);
}
else if (args[i].equals(OPTION_DOCUMENTATION)) {
genDocumentation = true;
@@ -137,6 +185,12 @@ public class Main extends AbstractGenerator {
return GENERATOR_OK;
}
+ protected int usageError(String text) {
+ logger.logError(Main.class.getName() + " - aborting: " + text, null);
+ printUsage();
+ return GENERATOR_ERROR;
+ }
+
protected boolean runGenerator(List<String> uriList, String genModelPath, boolean genDocumentation, boolean asLibrary, boolean debug) {
loadModels(uriList);
diff --git a/plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF
index 63055e931..d5881014f 100644
--- a/plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.launch.c/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.etrice.generator;bundle-version="0.3.0",
org.eclipse.debug.ui,
org.eclipse.jdt.ui;bundle-version="3.7.0",
org.eclipse.jdt.core;bundle-version="3.7.0",
- org.eclipse.core.variables;bundle-version="3.2.500"
+ org.eclipse.core.variables;bundle-version="3.2.500",
+ org.eclipse.etrice.generator.ui;bundle-version="0.3.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.jdt.launching,
diff --git a/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java
index 49f76c448..7421b957a 100644
--- a/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch.c/src/org/eclipse/etrice/generator/launch/c/CGeneratorLaunchConfigurationDelegate.java
@@ -13,10 +13,13 @@
package org.eclipse.etrice.generator.launch.c;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.etrice.generator.base.ILineOutput;
import org.eclipse.etrice.generator.c.Main;
import org.eclipse.etrice.generator.launch.GeneratorLaunchConfigurationDelegate;
+import org.eclipse.etrice.generator.ui.preferences.PreferenceConstants;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
/**
* @author Henrik Rentz-Reichert
@@ -27,7 +30,7 @@ public class CGeneratorLaunchConfigurationDelegate extends GeneratorLaunchConfig
/* (non-Javadoc)
* @see org.eclipse.etrice.generator.launch.GeneratorLaunchConfigurationDelegate#addArguments(org.eclipse.debug.core.ILaunchConfiguration, java.lang.StringBuffer)
*/
- @SuppressWarnings("deprecation") // need this for backwar compatibility
+ @SuppressWarnings("deprecation") // need this for backward compatibility
@Override
protected void addArguments(ILaunchConfiguration configuration, StringBuffer argString) throws CoreException {
if (configuration.getAttribute(CGeneratorConfigTab.LIB, false)) {
@@ -40,6 +43,20 @@ public class CGeneratorLaunchConfigurationDelegate extends GeneratorLaunchConfig
if (configuration.getAttribute(CGeneratorConfigTab.GEN_DOCUMENTATION, false)
|| configuration.getAttribute(CGeneratorConfigTab.GEN_INSTANCE_DIAGRAM, false))
argString.append(" "+Main.OPTION_GEN_INST_DIAG);
+
+ ScopedPreferenceStore prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui");
+ if (prefStore.getBoolean(PreferenceConstants.GEN_INCREMENTAL)) {
+ argString.append(" "+Main.OPTION_GEN_INCREMENTAL);
+ }
+
+ argString.append(" "+Main.OPTION_GEN_DIR);
+ argString.append(" "+prefStore.getString(PreferenceConstants.GEN_DIR));
+
+ argString.append(" "+Main.OPTION_GEN_INFO_DIR);
+ argString.append(" "+prefStore.getString(PreferenceConstants.GEN_INFO_DIR));
+
+ argString.append(" "+Main.OPTION_GEN_DOC_DIR);
+ argString.append(" "+prefStore.getString(PreferenceConstants.GEN_DOC_DIR));
}
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF
index 4281b2b55..84daa8ff3 100644
--- a/plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.generator.launch.java/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.etrice.generator;bundle-version="0.1.0",
org.eclipse.debug.ui,
org.eclipse.jdt.ui;bundle-version="3.7.0",
org.eclipse.jdt.core;bundle-version="3.7.0",
- org.eclipse.core.variables;bundle-version="3.2.500"
+ org.eclipse.core.variables;bundle-version="3.2.500",
+ org.eclipse.etrice.generator.ui;bundle-version="0.3.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.jdt.launching,
diff --git a/plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java
index 13c957bbf..5a8cfe32d 100644
--- a/plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch.java/src/org/eclipse/etrice/generator/launch/java/JavaGeneratorLaunchConfigurationDelegate.java
@@ -13,10 +13,13 @@
package org.eclipse.etrice.generator.launch.java;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.etrice.generator.base.ILineOutput;
import org.eclipse.etrice.generator.java.Main;
import org.eclipse.etrice.generator.launch.GeneratorLaunchConfigurationDelegate;
+import org.eclipse.etrice.generator.ui.preferences.PreferenceConstants;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
/**
* @author Henrik Rentz-Reichert
@@ -49,6 +52,20 @@ public class JavaGeneratorLaunchConfigurationDelegate extends GeneratorLaunchCon
if (configuration.getAttribute(JavaGeneratorConfigTab.VERBOSE, false)) {
argString.append(" "+Main.OPTION_VERBOSE_RT);
}
+
+ ScopedPreferenceStore prefStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.etrice.generator.ui");
+ if (prefStore.getBoolean(PreferenceConstants.GEN_INCREMENTAL)) {
+ argString.append(" "+Main.OPTION_GEN_INCREMENTAL);
+ }
+
+ argString.append(" "+Main.OPTION_GEN_DIR);
+ argString.append(" "+prefStore.getString(PreferenceConstants.GEN_DIR));
+
+ argString.append(" "+Main.OPTION_GEN_INFO_DIR);
+ argString.append(" "+prefStore.getString(PreferenceConstants.GEN_INFO_DIR));
+
+ argString.append(" "+Main.OPTION_GEN_DOC_DIR);
+ argString.append(" "+prefStore.getString(PreferenceConstants.GEN_DOC_DIR));
}
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.etrice.generator.ui/.classpath b/plugins/org.eclipse.etrice.generator.ui/.classpath
new file mode 100644
index 000000000..8a8f1668c
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.etrice.generator.ui/.gitignore b/plugins/org.eclipse.etrice.generator.ui/.gitignore
new file mode 100644
index 000000000..092357e47
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/.gitignore
@@ -0,0 +1 @@
+bin
diff --git a/plugins/org.eclipse.etrice.generator.ui/.project b/plugins/org.eclipse.etrice.generator.ui/.project
new file mode 100644
index 000000000..cd32aceb6
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.etrice.generator.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.etrice.generator.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.etrice.generator.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..f287d53cf
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..ffbdb205a
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Generator UI
+Bundle-SymbolicName: org.eclipse.etrice.generator.ui;singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: eTrice (Incubation)
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.etrice.generator.ui.Activator
+Export-Package: org.eclipse.etrice.generator.ui.preferences
diff --git a/plugins/org.eclipse.etrice.generator.ui/about.html b/plugins/org.eclipse.etrice.generator.ui/about.html
new file mode 100644
index 000000000..f47dbddbb
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.generator.ui/build.properties b/plugins/org.eclipse.etrice.generator.ui/build.properties
new file mode 100644
index 000000000..6f20375d6
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/plugins/org.eclipse.etrice.generator.ui/plugin.xml b/plugins/org.eclipse.etrice.generator.ui/plugin.xml
new file mode 100644
index 000000000..248ad6c9a
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.etrice.ui.common.preferences.ETricePreferencePage"
+ class="org.eclipse.etrice.generator.ui.preferences.GeneratorPreferencePage"
+ id="org.eclipse.etrice.generator.ui.preferences.GeneratorPreferencePage"
+ name="Generators">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.etrice.generator.ui.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/Activator.java b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/Activator.java
new file mode 100644
index 000000000..bb4460507
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/Activator.java
@@ -0,0 +1,31 @@
+package org.eclipse.etrice.generator.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends AbstractUIPlugin {
+
+ private static Activator instance = null;
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ instance = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ instance = null;
+
+ super.stop(context);
+ }
+
+ public static Activator getInstance() {
+ return instance;
+ }
+
+ public static void setInstance(Activator instance) {
+ Activator.instance = instance;
+ }
+}
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
new file mode 100644
index 000000000..fc9f6ab76
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/GeneratorPreferencePage.java
@@ -0,0 +1,73 @@
+package org.eclipse.etrice.generator.ui.preferences;
+
+import org.eclipse.etrice.generator.ui.Activator;
+import org.eclipse.jface.preference.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class GeneratorPreferencePage
+ extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
+
+ public GeneratorPreferencePage() {
+ super(GRID);
+ setPreferenceStore(Activator.getInstance().getPreferenceStore());
+ setDescription("eTrice general generator preferences");
+ }
+
+ public void createFieldEditors() {
+ addLabel("");
+
+ addField(
+ new BooleanFieldEditor(
+ PreferenceConstants.GEN_INCREMENTAL,
+ "Generate &incrementally:",
+ getFieldEditorParent()));
+ addField(
+ new StringFieldEditor(
+ PreferenceConstants.GEN_DIR,
+ "The directory for &generated code:",
+ getFieldEditorParent()));
+ addField(
+ new StringFieldEditor(
+ PreferenceConstants.GEN_INFO_DIR,
+ "The directory for i&nformation about generated code:",
+ getFieldEditorParent()));
+ addField(
+ new StringFieldEditor(
+ PreferenceConstants.GEN_DOC_DIR,
+ "The directory for generated &documentation:",
+ getFieldEditorParent()));
+
+// addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
+// "&Directory preference:", getFieldEditorParent()));
+//
+// addField(new RadioGroupFieldEditor(
+// PreferenceConstants.P_CHOICE,
+// "An example of a multiple-choice preference",
+// 1,
+// new String[][] { { "&Choice 1", "choice1" }, {
+// "C&hoice 2", "choice2" }
+// }, getFieldEditorParent()));
+ }
+
+ private void addLabel(String message) {
+ Label label = new Label(getFieldEditorParent(), SWT.None);
+ GridData data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false, 2, 1);
+ label.setLayoutData(data);
+ //label.setForeground(ColorConstants.red);
+ if (message != null)
+ label.setText(message);
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+} \ No newline at end of file
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
new file mode 100644
index 000000000..cccf07239
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceConstants.java
@@ -0,0 +1,15 @@
+package org.eclipse.etrice.generator.ui.preferences;
+
+/**
+ * Constant definitions for plug-in 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";
+}
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
new file mode 100644
index 000000000..fec9b4188
--- /dev/null
+++ b/plugins/org.eclipse.etrice.generator.ui/src/org/eclipse/etrice/generator/ui/preferences/PreferenceInitializer.java
@@ -0,0 +1,25 @@
+package org.eclipse.etrice.generator.ui.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.etrice.generator.ui.Activator;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Class used to initialize default preference values.
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = Activator.getInstance().getPreferenceStore();
+ store.setDefault(PreferenceConstants.GEN_INCREMENTAL, true);
+ store.setDefault(PreferenceConstants.GEN_DIR, "src-gen");
+ store.setDefault(PreferenceConstants.GEN_INFO_DIR, "src-gen-info");
+ store.setDefault(PreferenceConstants.GEN_DOC_DIR, "doc-gen");
+ }
+
+}
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
index 2829b5092..540bbd9fc 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/generic/RoomExtensions.xtend
@@ -48,6 +48,29 @@ import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
@Singleton
class RoomExtensions {
+ private static String genDir = "/src-gen/"
+ private static String genInfoDir = "/src-gen-info/"
+ private static String genDocDir = "/doc-gen/"
+
+ def static setDefaultGenDir() {
+ genDir = "/src-gen/"
+ }
+ def static setDefaultGenInfoDir() {
+ genInfoDir = "/src-gen-info/"
+ }
+ def static setDefaultGenDocDir() {
+ genDocDir = "/doc-gen/"
+ }
+ def static setGenDir(String dir) {
+ genDir = "/"+dir+"/"
+ }
+ def static setGenInfoDir(String dir) {
+ genInfoDir = "/"+dir+"/"
+ }
+ def static setGenDocDir(String dir) {
+ genDocDir = "/"+dir+"/"
+ }
+
//-------------------------------------------------------
// union methods
@@ -109,21 +132,21 @@ class RoomExtensions {
* @return the relative path to the destination folder for the generated code
*/
def String getGenerationPathSegment() {
- return "/src-gen/"
+ genDir
}
/**
* @return the relative path to the destination folder for the generated code
*/
def String getGenerationInfoSegment() {
- return "/src-gen-info/"
+ genInfoDir
}
/**
* @return the relative path to the destination folder for the generated documentation
*/
def String getDocGenerationPathSegment() {
- return "/doc-gen/"
+ genDocDir
}
/**
diff --git a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
index 524426dcb..4afadfb19 100644
--- a/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
+++ b/plugins/org.eclipse.etrice.generator/xtend-gen/org/eclipse/etrice/generator/generic/RoomExtensions.java
@@ -58,6 +58,48 @@ import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@Singleton
@SuppressWarnings("all")
public class RoomExtensions {
+ private static String genDir = "/src-gen/";
+
+ private static String genInfoDir = "/src-gen-info/";
+
+ private static String genDocDir = "/doc-gen/";
+
+ public static String setDefaultGenDir() {
+ String _genDir = RoomExtensions.genDir = "/src-gen/";
+ return _genDir;
+ }
+
+ public static String setDefaultGenInfoDir() {
+ String _genInfoDir = RoomExtensions.genInfoDir = "/src-gen-info/";
+ return _genInfoDir;
+ }
+
+ public static String setDefaultGenDocDir() {
+ String _genDocDir = RoomExtensions.genDocDir = "/doc-gen/";
+ return _genDocDir;
+ }
+
+ public static String setGenDir(final String dir) {
+ String _plus = ("/" + dir);
+ String _plus_1 = (_plus + "/");
+ String _genDir = RoomExtensions.genDir = _plus_1;
+ return _genDir;
+ }
+
+ public static String setGenInfoDir(final String dir) {
+ String _plus = ("/" + dir);
+ String _plus_1 = (_plus + "/");
+ String _genInfoDir = RoomExtensions.genInfoDir = _plus_1;
+ return _genInfoDir;
+ }
+
+ public static String setGenDocDir(final String dir) {
+ String _plus = ("/" + dir);
+ String _plus_1 = (_plus + "/");
+ String _genDocDir = RoomExtensions.genDocDir = _plus_1;
+ return _genDocDir;
+ }
+
/**
* the template type is T
* @param l an iterable of type T
@@ -123,21 +165,21 @@ public class RoomExtensions {
* @return the relative path to the destination folder for the generated code
*/
public String getGenerationPathSegment() {
- return "/src-gen/";
+ return RoomExtensions.genDir;
}
/**
* @return the relative path to the destination folder for the generated code
*/
public String getGenerationInfoSegment() {
- return "/src-gen-info/";
+ return RoomExtensions.genInfoDir;
}
/**
* @return the relative path to the destination folder for the generated documentation
*/
public String getDocGenerationPathSegment() {
- return "/doc-gen/";
+ return RoomExtensions.genDocDir;
}
/**

Back to the top