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
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

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

  




 

 

Eclipse Plug-in Developer Guide
Previous Page Home Next Page

Defining a status handler

There are two ways for contributing handlers to the Workbench:

  1. using the org.eclipse.ui.statusHandlers extension point, see User assistance and status handling
  2. using a custom workbench advisor and overriding its getWorkbenchErrorHandler() method

Contributing a status handler using the custom advisor

First, a custom workbench advisor for your application has to be created. In this new custom advisor override getWorkbenchErrorHandler(). This will now return the default error handler.

   public class CustomWorkbenchAdvisor extends WorkbenchAdvisor {
      public AbstractStatusHandler getWorkbenchErrorHandler() {
         ...
         
         return customStatusHandler;
      }
   }

In the custom application use your new advisor when creating the Workbench.

   public class CustomApplication implements IApplication{
      public Object start(IApplicationContext appContext) throws Exception {
         ...
         Display display = createDisplay();
         PlatformUI.createAndRunWorkbench(display, new CustomWorkbenchAdvisor());
         ...
      }

      protected Display createDisplay() {
         return PlatformUI.createDisplay();
      }
   }

For details how to run a custom application see the org.eclipse.core.runtime.applications extension point documentation.

When the status handling facility is accessed, the facility will get instance of the handler that is provided by the custom advisor. This handler will be used for handling of status or error occurred in the application.


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