Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Problem with external tools launcher
Problem with external tools launcher [message #292968] Fri, 14 October 2005 06:49 Go to next message
Eclipse UserFriend
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);
Re: Problem with external tools launcher [message #292969 is a reply to message #292968] Fri, 14 October 2005 07:00 Go to previous message
Eclipse UserFriend
Originally posted by: henrik.jonsson.se.transport.bombardier.com

Sorry for the duplicates. :-)

I got some errors from my news software, so I didn't thought the msaage was
sent.

Regards

Henrik
Previous Topic:find library for given IType
Next Topic:Builder generates java resource, how to get it to compile?
Goto Forum:
  


Current Time: Fri Sep 27 05:56:17 GMT 2024

Powered by FUDForum. Page generated in 0.04481 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top