use of org.eclipse.debug.core.ILaunchManager in project linuxtools by eclipse.
the class GprofLaunchConfigurationDelegate method launch.
/**
* Checks if neccessary flags are set in Managed Build/Autotools <br>
* If they are not, asks the user if he want's to have them addded. <br>
* If so, it enables the option, rebuilds the project and continues with launch </p>
*
* <p> Otherwise by this time the project is already build and it proceeds with launch of the plugin. </p>
*/
@Override
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
// Save passed variables. useful later.
this.config = config;
this.project = getProject();
// then cancle the launch process as there won't a gmon.out anyway.
if (!preRequisiteCheck()) {
return;
}
IPath exePath = getExePath(config);
/*
* this code written by QNX Software Systems and others and was
* originally in the CDT under LocalCDILaunchDelegate::RunLocalApplication
*/
// set up and launch the local c/c++ program
IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(getProject());
File workDir = getWorkingDirectory(config);
if (workDir == null) {
// $NON-NLS-1$ //$NON-NLS-2$
workDir = new File(System.getProperty("user.home", "."));
}
String[] arguments = getProgramArgumentsArray(config);
// add a listener for termination of the launch
ILaunchManager lmgr = DebugPlugin.getDefault().getLaunchManager();
lmgr.addLaunchListener(new LaunchTerminationWatcher(launch, exePath));
// gmon.out is generated here:
Process process = launcher.execute(exePath, arguments, getEnvironment(config), new Path(workDir.getAbsolutePath()), monitor);
DebugPlugin.newProcess(launch, process, renderProcessLabel(exePath.toOSString()));
}
Aggregations