diff options
author | Paul Pazderski | 2019-07-02 19:37:48 +0000 |
---|---|---|
committer | Paul Pazderski | 2019-07-03 16:04:02 +0000 |
commit | 9af85f069eb2845cb5e7a7d2cda8f3e32d8ba6a2 (patch) | |
tree | 7359c4f8d7abf9e540161f2ee73896cdc583a494 | |
parent | 1605af525409605090bed5f2aad81ecebf2b534e (diff) | |
download | eclipse.platform.debug-9af85f069eb2845cb5e7a7d2cda8f3e32d8ba6a2.tar.gz eclipse.platform.debug-9af85f069eb2845cb5e7a7d2cda8f3e32d8ba6a2.tar.xz eclipse.platform.debug-9af85f069eb2845cb5e7a7d2cda8f3e32d8ba6a2.zip |
Bug 548886 - Support 'Show Command Line' button for external toolY20190705-0620Y20190704-0900I20190704-1800I20190704-0245I20190703-1800
launches
Change-Id: I0f51d0a10187c86a310d75a40552a19021fa3af4
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
3 files changed, 36 insertions, 25 deletions
diff --git a/org.eclipse.core.externaltools/plugin.xml b/org.eclipse.core.externaltools/plugin.xml index b60e930e3..7dcbf78b4 100644 --- a/org.eclipse.core.externaltools/plugin.xml +++ b/org.eclipse.core.externaltools/plugin.xml @@ -23,6 +23,7 @@ category="org.eclipse.ui.externaltools" modes="run" id="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType" + allowCommandLine="true" allowOutputMerging="true"> </launchConfigurationType> <launchConfigurationType @@ -31,6 +32,7 @@ category="org.eclipse.ui.externaltools.builder" modes="run" id="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType" + allowCommandLine="true" allowOutputMerging="true"> </launchConfigurationType> </extension> @@ -39,10 +41,10 @@ name="%Builder.externalTools" point="org.eclipse.core.resources.builders"> <builder - isConfigurable= "true"> + isConfigurable= "true"> <run class="org.eclipse.core.externaltools.internal.model.ExternalToolBuilder"> </run> </builder> - </extension> + </extension> </plugin> diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java index b7a0e2968..5133bd9b4 100644 --- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java +++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java @@ -88,23 +88,12 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { return; } - // resolve arguments - String[] arguments = ExternalToolsCoreUtil.getArguments(configuration); + String[] cmdLine = buildCommandLine(configuration, location); if (monitor.isCanceled()) { return; } - int cmdLineLength = 1; - if (arguments != null) { - cmdLineLength += arguments.length; - } - String[] cmdLine = new String[cmdLineLength]; - cmdLine[0] = location.toOSString(); - if (arguments != null) { - System.arraycopy(arguments, 0, cmdLine, 1, arguments.length); - } - File workingDir = null; if (workingDirectory != null) { workingDir = workingDirectory.toFile(); @@ -180,6 +169,22 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { } } + private String[] buildCommandLine(ILaunchConfiguration configuration, IPath location) throws CoreException { + // resolve arguments + String[] arguments = ExternalToolsCoreUtil.getArguments(configuration); + + int cmdLineLength = 1; + if (arguments != null) { + cmdLineLength += arguments.length; + } + String[] cmdLine = new String[cmdLineLength]; + cmdLine[0] = location.toOSString(); + if (arguments != null) { + System.arraycopy(arguments, 0, cmdLine, 1, arguments.length); + } + return cmdLine; + } + private String generateCommandLine(String[] commandLine) { if (commandLine.length < 1) { return IExternalToolConstants.EMPTY_STRING; @@ -237,4 +242,11 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate { return super.saveBeforeLaunch(configuration, mode, monitor); } + @Override + public String showCommandLine(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { + IPath location = ExternalToolsCoreUtil.getLocation(configuration); + String[] cmd = buildCommandLine(configuration, location); + String cmdLine = generateCommandLine(cmd); + return cmdLine; + } } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java index a1089410f..e50c347e5 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILaunchConfigurationDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -56,14 +56,12 @@ public interface ILaunchConfigurationDelegate { /** * Gets the command line to launch the given configuration in the specified - * mode, contributing debug targets and/or processes to the given launch - * object. The launch object has already been registered with the launch - * manager. + * mode. * - * @param configuration the configuration to launch - * @param mode the mode in which to launch, one of the mode constants - * defined by <code>ILaunchManager</code> - <code>RUN_MODE</code> - * or <code>DEBUG_MODE</code>. + * @param configuration the configuration to build command line for + * @param mode the mode in which to build command line, one of the mode + * constants defined by <code>ILaunchManager</code> - + * <code>RUN_MODE</code> or <code>DEBUG_MODE</code>. * @param monitor progress monitor, or <code>null</code> progress monitor, * or <code>null</code>. A cancelable progress monitor is * provided by the Job framework. It should be noted that the @@ -74,10 +72,9 @@ public interface ILaunchConfigurationDelegate { * workspace batch jobs to be canceled, as the canceled flag is * propagated up the top-level parent monitor. The provided * monitor is not guaranteed to have been started. - * @param launch the launch object to contribute processes and debug targets - * to + * @param launch the launch to create command line for * @return the command line string - * @exception CoreException if launching fails + * @exception CoreException if building the command line failed * @since 3.13 */ public default String showCommandLine(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { |