Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2018-11-23 11:06:52 -0500
committerHenrik Rentz-Reichert2018-11-23 11:07:25 -0500
commitaa23c923f18cfecdde88ba04c1f6530b00a88b59 (patch)
tree39b86e51f7e9b7aa447cc8b81530fce4b39a59cc
parent30cf2c671a161f0be982d0ad5d746022adbf35d7 (diff)
downloadorg.eclipse.etrice-aa23c923f18cfecdde88ba04c1f6530b00a88b59.tar.gz
org.eclipse.etrice-aa23c923f18cfecdde88ba04c1f6530b00a88b59.tar.xz
org.eclipse.etrice-aa23c923f18cfecdde88ba04c1f6530b00a88b59.zip
fixed interpretation of genmodel path option
* tries to substitute string variables * then tries to resolve as platform path * if that fails the given path is used as platform path
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java19
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java2
2 files changed, 19 insertions, 2 deletions
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 c5a5a9998..0fe8edf3d 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
@@ -14,13 +14,16 @@
package org.eclipse.etrice.generator.launch;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -187,7 +190,21 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
}
if (configuration.getAttribute(GeneratorConfigTab.SAVE_GEN_MODEL, false)) {
argString.append(" -"+AbstractGeneratorOptions.SAVE_GEN_MODEL.getName());
- argString.append(" "+configuration.getAttribute(GeneratorConfigTab.GEN_MODEL_PATH, "?"));
+
+ // HOWTO: resolve path variables and convert to workspace relative path
+ String genModelPath = configuration.getAttribute(GeneratorConfigTab.GEN_MODEL_PATH, "?");
+ IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
+ String path = manager.performStringSubstitution(genModelPath);
+ java.nio.file.Path p = Paths.get(path);
+ IContainer[] containers = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(p.toUri());
+ if (containers.length>0) {
+ String folder = containers[0].toString().substring(2); // cut off leading P/
+ argString.append(" "+folder);
+ }
+ else {
+ // fall back to verbatim value
+ argString.append(" "+genModelPath);
+ }
}
if (!configuration.getAttribute(GeneratorConfigTab.MAIN_METHOD_NAME, AbstractGeneratorOptions.MAIN_NAME.getDefaultValue()).equals(AbstractGeneratorOptions.MAIN_NAME.getDefaultValue())) {
argString.append(" -"+AbstractGeneratorOptions.MAIN_NAME.getName());
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 486c0f8c6..33e0e27c0 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
@@ -236,7 +236,7 @@ public abstract class AbstractGenerator implements IGenerator, IDetailCodeTransl
translateDetailCodes(gmRoot, doTranslate);
- URI genModelURI = !genModelPath.isEmpty() ? URI.createFileURI(genModelPath) : URI.createFileURI("tmp.rim");
+ URI genModelURI = !genModelPath.isEmpty() ? URI.createPlatformResourceURI(genModelPath, true) : URI.createFileURI("tmp.rim");
Resource genResource = getResourceSet().createResource(genModelURI);
genResource.getContents().add(gmRoot);
if (!genModelPath.isEmpty()) {

Back to the top