## 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.