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

Contributing a sample handler

We will now contribute a very basic status handler just to illustrate the steps needed to contribute a status handler implementation to the Workbench. To do this:

  1. use the org.eclipse.ui.statusHandlers extension point to register a status handler implementation and bind it to your product
  2. extend the org.eclipse.ui.statushandlers.AbstractStatusHandler class and use as the class attribute in the above extension point contribution
  3. run your Eclipse based product with the correct product id

Here is the org.eclipse.ui.statusHandlers extension point markup:

   <extension point="org.eclipse.ui.statusHandlers"> 

A statusHandler is registered with the Workbench. The statusHandlerProductBinding contribution tells the Workbench that the status handler we just defined is bound to our product with the id "productId". The status handling facility uses lazy initialization, so the handler will be instantiated during first access to the facility in the product.

The class defined by the class attribute extends org.eclipse.ui.statushandlers.AbstractStatusHandler. The following is sample code that simply writes to the console the message set in the status adapter.

   public void handle(final StatusAdapter statusAdapter, int style) {

When you run the product with the id defined in the statusHandlerProductBinding you will start to use your product handler. For example, if you are self hosting, create a new runtime-workbench launch configuration, choose the "Run a product" option, and select productId from the dropdown.

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