mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 06:45:43 +02:00
silent abort prompting launch
This commit is contained in:
parent
ea6cb36860
commit
a3f0a610ed
2 changed files with 27 additions and 26 deletions
|
@ -59,39 +59,38 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
ICProject cproject = getCProject(config);
|
ICProject cproject = getCProject(config);
|
||||||
|
|
||||||
String path = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null);
|
String path = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null);
|
||||||
IPath corefile;
|
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
corefile = promptForCoreFilePath((IProject)cproject.getResource());
|
IPath corefile = promptForCoreFilePath((IProject)cproject.getResource(), debugConfig);
|
||||||
if (corefile == null) {
|
if (corefile == null) {
|
||||||
cancel(LaunchMessages.getString("CoreFileLaunchDelegate.No_Corefile_selected"), //$NON-NLS-1$
|
cancel(LaunchMessages.getString("CoreFileLaunchDelegate.No_Corefile_selected"), //$NON-NLS-1$
|
||||||
ICDTLaunchConfigurationConstants.ERR_NO_COREFILE);
|
ICDTLaunchConfigurationConstants.ERR_NO_COREFILE);
|
||||||
}
|
}
|
||||||
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
|
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
|
||||||
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, corefile.toString());
|
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, corefile.toString());
|
||||||
launch(wc, mode, launch, new SubProgressMonitor(monitor, 9));
|
wc.launch(mode, new SubProgressMonitor(monitor, 9));
|
||||||
return;
|
cancel("", -1); //$NON-NLS-1$
|
||||||
}
|
} else {
|
||||||
corefile = new Path(path);
|
dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile, new SubProgressMonitor(monitor, 8));
|
||||||
dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile, new SubProgressMonitor(monitor, 8));
|
|
||||||
try {
|
|
||||||
// set the source locator
|
|
||||||
setDefaultSourceLocator(launch, config);
|
|
||||||
ICDITarget[] targets = dsession.getTargets();
|
|
||||||
for (int i = 0; i < targets.length; i++) {
|
|
||||||
Process process = targets[i].getProcess();
|
|
||||||
IProcess iprocess = null;
|
|
||||||
if (process != null) {
|
|
||||||
iprocess = DebugPlugin.newProcess(launch, process, renderProcessLabel(exePath.toOSString()));
|
|
||||||
}
|
|
||||||
CDIDebugModel.newDebugTarget(launch, project.getProject(), targets[i], renderTargetLabel(debugConfig), iprocess,
|
|
||||||
exeFile, false, false, false);
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
try {
|
try {
|
||||||
dsession.terminate();
|
// set the source locator
|
||||||
} catch (CDIException cdi) {
|
setDefaultSourceLocator(launch, config);
|
||||||
|
ICDITarget[] targets = dsession.getTargets();
|
||||||
|
for (int i = 0; i < targets.length; i++) {
|
||||||
|
Process process = targets[i].getProcess();
|
||||||
|
IProcess iprocess = null;
|
||||||
|
if (process != null) {
|
||||||
|
iprocess = DebugPlugin.newProcess(launch, process, renderProcessLabel(exePath.toOSString()));
|
||||||
|
}
|
||||||
|
CDIDebugModel.newDebugTarget(launch, project.getProject(), targets[i], renderTargetLabel(debugConfig),
|
||||||
|
iprocess, exeFile, false, false, false);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
try {
|
||||||
|
dsession.terminate();
|
||||||
|
} catch (CDIException cdi) {
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
monitor.done();
|
monitor.done();
|
||||||
|
@ -99,7 +98,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IPath promptForCoreFilePath(final IProject project) throws CoreException {
|
protected IPath promptForCoreFilePath(final IProject project, final ICDebugConfiguration debugConfig) throws CoreException {
|
||||||
final Shell shell = LaunchUIPlugin.getShell();
|
final Shell shell = LaunchUIPlugin.getShell();
|
||||||
final String res[] = {null};
|
final String res[] = {null};
|
||||||
if (shell == null) {
|
if (shell == null) {
|
||||||
|
@ -121,6 +120,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
if (initPath == null || initPath.equals("")) { //$NON-NLS-1$
|
if (initPath == null || initPath.equals("")) { //$NON-NLS-1$
|
||||||
initPath = project.getLocation().toString();
|
initPath = project.getLocation().toString();
|
||||||
}
|
}
|
||||||
|
dialog.setFilterExtensions(debugConfig.getCoreFileExtensions());
|
||||||
dialog.setFilterPath(initPath);
|
dialog.setFilterPath(initPath);
|
||||||
res[0] = dialog.open();
|
res[0] = dialog.open();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class LocalAttachLaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
|
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
|
||||||
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, pid);
|
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, pid);
|
||||||
wc.launch(mode, new SubProgressMonitor(monitor, 9));
|
wc.launch(mode, new SubProgressMonitor(monitor, 9));
|
||||||
|
cancel("", -1); //$NON-NLS-1$\
|
||||||
} else {
|
} else {
|
||||||
dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile,
|
dsession = debugConfig.createDebugger().createDebuggerSession(launch, exeFile,
|
||||||
new SubProgressMonitor(monitor, 8));
|
new SubProgressMonitor(monitor, 8));
|
||||||
|
|
Loading…
Add table
Reference in a new issue