Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Belle2019-03-12 12:09:32 -0400
committerJan Belle2019-03-12 12:22:46 -0400
commitd26bec8b94967dba8f5011aa8f5c268018c4836e (patch)
tree097e30644f9f0d2db010ce4fcfc8879aa160b762
parentdf4990e4690b28cd109a39804a403a232134c44d (diff)
downloadorg.eclipse.etrice-d26bec8b94967dba8f5011aa8f5c268018c4836e.tar.gz
org.eclipse.etrice-d26bec8b94967dba8f5011aa8f5c268018c4836e.tar.xz
org.eclipse.etrice-d26bec8b94967dba8f5011aa8f5c268018c4836e.zip
[ui] Change type of genmodel path selection dialog in run configuration
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java24
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java23
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/AbstractGenerator.java2
3 files changed, 14 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 2d691205b..1eb87a754 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
@@ -14,9 +14,7 @@
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;
@@ -35,7 +33,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+import org.eclipse.ui.dialogs.SaveAsDialog;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
/**
@@ -262,23 +260,17 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
*
*/
protected void handlePathButtonSelected() {
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(),
- ResourcesPlugin.getWorkspace().getRoot(),
- false,
- "select a container for the generator model");
- dialog.showClosedProjects(false);
+ SaveAsDialog dialog = new SaveAsDialog(getShell());
+ dialog.setOriginalName("genmodel.rim");
dialog.open();
- Object[] results = dialog.getResult();
- if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
- IPath path = (IPath)results[0];
- //path = path.append("genmodel.rim");
- String fname = path.toString();
- fname = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", fname);
- genModelPath.setText(fname);
+ if(dialog.getResult() != null) {
+ String fname = dialog.getResult().toString();
+ String path = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", null) + fname;
+ genModelPath.setText(path);
setErrorMessage(null);
setDirty(true);
updateLaunchConfigurationDialog();
- }
+ }
}
/* (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 96adb23a3..d6d78e6af 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,7 +14,6 @@
package org.eclipse.etrice.generator.launch;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -22,13 +21,12 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
-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;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -193,22 +191,11 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
argString.append(" -"+AbstractGeneratorOptions.LIB.getName());
}
if (configuration.getAttribute(GeneratorConfigTab.SAVE_GEN_MODEL, false)) {
- argString.append(" -"+AbstractGeneratorOptions.SAVE_GEN_MODEL.getName());
-
- // 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);
- }
+ genModelPath = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(genModelPath);
+ String path = new Path(genModelPath).toOSString();
+ argString.append(" -"+AbstractGeneratorOptions.SAVE_GEN_MODEL.getName());
+ argString.append(" "+path);
}
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 fcd73ea86..2f8f12ae7 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
@@ -237,7 +237,7 @@ public abstract class AbstractGenerator implements IGenerator, IDetailCodeTransl
translateDetailCodes(gmRoot, doTranslate);
- URI genModelURI = !genModelPath.isEmpty() ? URI.createPlatformResourceURI(genModelPath, true) : URI.createFileURI("tmp.rim");
+ URI genModelURI = !genModelPath.isEmpty() ? URI.createFileURI(genModelPath) : URI.createFileURI("tmp.rim");
Resource genResource = getResourceSet().createResource(genModelURI);
genResource.getContents().add(gmRoot);
if (!genModelPath.isEmpty()) {

Back to the top