Problem with external tools launcher [message #292968] |
Fri, 14 October 2005 06:49 |
Eclipse User |
|
|
|
Originally posted by: henrik.jonsson.se.transport.bombardier.com
Hi everyone!
I'm having trouble with launching an external process using the new external
tools API.
I'm having problems setting the name of the tool I use in my code. I have
created a plugin that is a kind of a grapchical warpper around some command line
tools. My external tools are all started with the same tool (startTool) . The
actual tool to execute is added as a parameter to the startTool program, e.g.
startTool -tool GLE (where GLE is the program to launch). I would like to set
the name of the launch configuration when I start the launch. There is a rename
method on the ILaunchConfigurationWorkingCopy interface, but that does not seems
to work. There is also a copy method, but I can't get that to work either.
Any ideas how I can set the name of the launch configuration?
Here's my code:
private void launch(String theCommand, String theArguments,
boolean runInBackground, String theFilename, boolean showInConsole)
throws CoreException
{
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager
..getLaunchConfigurationType(IExternalToolConstants.ID_PROGR AM_LAUNCH_CONFIGURATION_TYPE);
ILaunchConfigurationWorkingCopy wc = null;
try {
wc = type.newInstance(null, theCommand);
} catch (CoreException e) {
String tMessage = new String("Command: " + theCommand
+ ".\nException: " + e.getMessage());
Status tStatus = new Status(IStatus.ERROR,
ReadConfigConstants.PLUGIN_ID, 0, tMessage, null);
ErrorDialog.openError(shell, "Error",
"Can't create new launch configuration.", tStatus);
return;
}
Map tEnvironment = new HashMap();
tEnvironment.put("READCONFIG_ADDR", fAddress);
tEnvironment.put("CBX_PATH", fCbxPath);
wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
tEnvironment);
wc.setAttribute(IExternalToolConstants.ATTR_LOCATION, fCbxBin
+ File.separator + theCommand + getExecutableExtension());
wc.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS,
theArguments);
wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, runInBackground);
wc.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, showInConsole);
wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, showInConsole);
wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, theFilename);
wc.rename(theCommand + " " + theArguments);
// Saving will add the configuration to the external tools configurations
ILaunchConfiguration config;
config = wc.copy(theCommand + " " + theArguments);
ILaunch tLauncher = config.launch(ILaunchManager.RUN_MODE, null);
|
|
|
|
Powered by
FUDForum. Page generated in 0.03748 seconds