Search in sources :

Example 26 with ILaunchManager

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()));
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) IRemoteCommandLauncher(org.eclipse.linuxtools.profiling.launch.IRemoteCommandLauncher) ILaunchManager(org.eclipse.debug.core.ILaunchManager) File(java.io.File)

Aggregations

ILaunchManager (org.eclipse.debug.core.ILaunchManager)26 ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)14 ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)13 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)10 CoreException (org.eclipse.core.runtime.CoreException)8 ArrayList (java.util.ArrayList)7 ILaunch (org.eclipse.debug.core.ILaunch)6 File (java.io.File)4 IPath (org.eclipse.core.runtime.IPath)4 Path (org.eclipse.core.runtime.Path)4 LinkedList (java.util.LinkedList)3 IProcess2 (org.talend.core.model.process.IProcess2)3 Map (java.util.Map)2 IStatus (org.eclipse.core.runtime.IStatus)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 Status (org.eclipse.core.runtime.Status)2 IVMInstall (org.eclipse.jdt.launching.IVMInstall)2 IRemoteCommandLauncher (org.eclipse.linuxtools.profiling.launch.IRemoteCommandLauncher)2 ProcessItem (org.talend.core.model.properties.ProcessItem)2 Project (org.talend.core.model.properties.Project)2