1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

suppress error on cancel

This commit is contained in:
David Inglis 2002-09-27 19:25:38 +00:00
parent 14a8943722
commit 170cc44681
3 changed files with 14 additions and 8 deletions

View file

@ -95,6 +95,10 @@ abstract public class AbstractCLaunchDelegate implements ILaunchConfigurationDel
throw new CoreException(new Status(IStatus.ERROR, getPluginID(), code, newMessage, exception)); throw new CoreException(new Status(IStatus.ERROR, getPluginID(), code, newMessage, exception));
} }
protected void cancel(String message, int code) throws CoreException {
throw new CoreException(new Status(IStatus.OK, getPluginID(), code, message, null));
}
abstract protected String getPluginID(); abstract protected String getPluginID();

View file

@ -55,7 +55,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
IPath corefile = getCoreFilePath((IProject)cproject.getResource()); IPath corefile = getCoreFilePath((IProject)cproject.getResource());
if ( corefile == null ) { if ( corefile == null ) {
abort("No Corefile selected", null, ICDTLaunchConfigurationConstants.ERR_NO_COREFILE); cancel("No Corefile selected", ICDTLaunchConfigurationConstants.ERR_NO_COREFILE);
} }
try { try {
dsession = debugConfig.getDebugger().createCoreSession(config, exe, corefile); dsession = debugConfig.getDebugger().createCoreSession(config, exe, corefile);
@ -80,11 +80,12 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
false); false);
} }
private IPath getCoreFilePath(final IProject project) { private IPath getCoreFilePath(final IProject project) 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) {
return null; abort( "No Shell availible in Launch", null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
Display display = shell.getDisplay(); Display display = shell.getDisplay();
display.syncExec(new Runnable() { display.syncExec(new Runnable() {
public void run() { public void run() {

View file

@ -80,7 +80,7 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) { else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) {
int pid = getProcessID(); int pid = getProcessID();
if ( pid == -1 ) { if ( pid == -1 ) {
abort("No Process ID selected", null, ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID); cancel("No Process ID selected", ICDTLaunchConfigurationConstants.ERR_NO_PROCESSID);
} }
dsession = debugConfig.getDebugger().createAttachSession(config, exe, pid); dsession = debugConfig.getDebugger().createAttachSession(config, exe, pid);
} }
@ -117,11 +117,12 @@ public class LocalCLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
monitor.done(); monitor.done();
} }
private int getProcessID() { private int getProcessID() throws CoreException {
final Shell shell = LaunchUIPlugin.getShell(); final Shell shell = LaunchUIPlugin.getShell();
final int pid[] = {-1}; final int pid[] = {-1};
if ( shell == null ) if ( shell == null ) {
return -1; abort( "No Shell availible in Launch", null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
Display display = shell.getDisplay(); Display display = shell.getDisplay();
display.syncExec(new Runnable() { display.syncExec(new Runnable() {
public void run() { public void run() {