Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Handling errors from a launched program

If you have defined your own type of launch configuration, it's likely that you will want to handle errors or other status information that arises during the running of the program. For example, you may want to prompt or alert the user when certain types of errors occur during a launch, or provide information messages for certain status changes in the program. Since it's good practice to separate UI handling from core function, you do not want to have direct references from your launch delegate to status handling classes.

This problem is addressed by the org.eclipse.debug.core.statusHandlers extension point. It allows you to associate a status handler with a specific status code. Using this extension point, you can define all of the possible status and error codes in your launch delegate and core classes, while registering unique handlers for the different status codes from another plug-in.

The extension point does not designate any association between a status handler and a launch configuration. It is up to the implementation of the launch delegate to detect errors, find the appropriate status handler, and invoke it. The extension merely provides a registry so that the status handlers can be found for particular status codes. DebugPlugin provides a utility method for obtaining a specific status handler.

IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(status);

Status handlers should implement IStatusHandler. The status handling class is specified in the extension definition, along with its associated status code and the plug-in that is expected to generate the status codes.

The following markup shows how the Java tools declare status handlers:

<extension point = "org.eclipse.debug.core.statusHandlers">
		plugin ="org.eclipse.jdt.launching"

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire