diff options
author | Jan Belle | 2018-10-11 10:15:37 +0000 |
---|---|---|
committer | Jan Belle | 2019-03-08 16:12:05 +0000 |
commit | d47fab84d8d7df4b9d2270d8d153ee57b92f4a83 (patch) | |
tree | 58f0001cf31425426070eca41913be8b62a7ad0f /plugins/org.eclipse.etrice.generator.launch | |
parent | c511bcf1062cc5d8af65be5092a164d62cc017f3 (diff) | |
download | org.eclipse.etrice-d47fab84d8d7df4b9d2270d8d153ee57b92f4a83.tar.gz org.eclipse.etrice-d47fab84d8d7df4b9d2270d8d153ee57b92f4a83.tar.xz org.eclipse.etrice-d47fab84d8d7df4b9d2270d8d153ee57b92f4a83.zip |
[core] Implement uri independent import system
Bug 544947
Change-Id: Ibc5cbbef902247e4b8fc8f7e17b9b5a2b8d95eaa
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.launch')
2 files changed, 24 insertions, 2 deletions
diff --git a/plugins/org.eclipse.etrice.generator.launch/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.generator.launch/META-INF/MANIFEST.MF index 2daa273f8..2c496aafc 100644 --- a/plugins/org.eclipse.etrice.generator.launch/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.etrice.generator.launch/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.etrice.generator;bundle-version="2.0.0", org.eclipse.core.variables, org.eclipse.jdt.launching, org.eclipse.ui.ide, - org.eclipse.etrice.generator.base;bundle-version="2.0.0" + org.eclipse.etrice.generator.base;bundle-version="2.0.0", + org.eclipse.etrice.core.common.ui Import-Package: org.eclipse.xtext.xbase.lib Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 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 0fe8edf3d..96adb23a3 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 @@ -20,6 +20,7 @@ import java.util.Collections; import java.util.List; 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; @@ -36,6 +37,8 @@ import org.eclipse.core.variables.VariablesPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.ui.RefreshTab; +import org.eclipse.etrice.core.common.ui.modelpath.ModelPathManager; +import org.eclipse.etrice.core.common.ui.modelpath.WorkspaceModelPath; import org.eclipse.etrice.generator.base.AbstractGeneratorOptions; import org.eclipse.etrice.generator.base.io.ILineOutput; import org.eclipse.etrice.generator.base.setup.GeneratorApplicationOptions; @@ -88,9 +91,10 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL StringBuffer argString = new StringBuffer(); addModels(configuration, entry.getValue(), argString); addArguments(configuration, entry.getKey(), argString); + addModelpath(entry.getKey(), argString); String[] args = splitCommandLine(argString.toString()); - output.println("\n*** generating project " + entry.getKey().getName() + " ***"); + output.println("\n*** generating project " + entry.getKey().getName() + " ***\n"); runGenerator(args, output); // check for cancellation @@ -246,6 +250,23 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL } /** + * Parses the modelpath of the specified project and appends it to the generator arguments. + */ + protected void addModelpath(IProject project, StringBuffer argString) throws CoreException { + WorkspaceModelPath modelpath = ModelPathManager.INSTANCE.getModelPath(project); + String[] paths = modelpath.getPaths().stream() + .map(container -> container.getLocation()) + .filter(Objects::nonNull) + .map(path -> path.toOSString()) + .toArray(size -> new String[size]); + + if(paths.length > 0) { + String modelpathArg = String.join(";", paths); + argString.append(" -modelpath \"").append(modelpathArg).append('"'); + } + } + + /** * split at single spaces but keep strings in double quotes as single argument * (with double quotes removed) */ |