# Status Handlers

###### Identifier:

org.eclipse.ui.statusHandlers

###### Since:

3.3

###### Description:

This extension point is used to register implementations of status handlers in the workbench. A handler can be associated with a product and this association is also contributed via this extension point.

Status handlers are part of the status handling facility. The facility is responsible for handling errors and other important issues in Eclipse based applications. The handlers are responsible for presenting this errors by logging or showing error dialogs.

If there is no status handler associated with a product, the status handling facility uses the application handler defined in a workbench advisor.

###### Configuration Markup:

<!ELEMENT extension (statusHandler* , statusHandlerProductBinding*)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED

>

<!ELEMENT statusHandler (parameter*)>

<!ATTLIST statusHandler

id CDATA #REQUIRED

class CDATA #REQUIRED

>

This element is used to define a status handler.

- id -

  A unique identifier for this error handler. The id is used for setting default error handler in a product. If an error handler is to be the default one its id has to be set in a product preference file in org.eclipse.ui/ERROR_HANDLER_ID property. The name of the preference file is set in product extension "preferenceCustomization" property.

- class -

  A fully qualified name of a class which extends `org.eclipse.ui.statushandlers.AbstractStatusHandler`.

<!ELEMENT parameter EMPTY>

<!ATTLIST parameter

name CDATA #REQUIRED

value CDATA #REQUIRED

>

This element defines parameters for instances of specified status handler class. Instances of specified status handler class should understand this parameter.

Handling policies can use handler parameters. For example default policy use handlers "prefix" parameter. The default policy looks for the most specific handler for given status checking status pluginId against these prefixes.

- name - The name of a parameter.
- value - The value of a parameter.

<!ELEMENT statusHandlerProductBinding EMPTY>

<!ATTLIST statusHandlerProductBinding

productId CDATA #REQUIRED

handlerId CDATA #REQUIRED

>

Specifies a binding between a product and a status handler. These bindings determine which handler is appropriate for the current product (as defined by `org.eclipse.core.runtime.Platform.getProduct()`).

- productId - The unique id of a product.
- handlerId - The unique id of a status handler.

###### Examples:

The following is an example of the definition for handler with prefix parameter.

    <extension
     point="org.eclipse.ui.statusHandlers">
     <statusHandler
     class="org.eclipse.ui.statushanders.SampleStatusHandler"
     id="sampleStatusHandler">
      <parameter
      name="prefix"
      value="org.eclipse.ui.ide">
      </parameter>
     </statusHandler>
    </extension>

The following is an example of the definition for default (product) handler. The handler defined in the example will be default for product with id "productId".

    <extension
     point="org.eclipse.ui.statusHandlers">
     <statusHandler
     class="org.eclipse.ui.statushandlers.SampleStatusHandler"
     id="sampleStatusHandler">
     </statusHandler>
     <statusHandlerProductBinding
     handlerId="sampleStatusHandler"
     productId="productId">
     </statusHandlerProductBinding>
    </extension>

Of course we can define only the binding (for instance in a product plugin). The handler can be defined in other plugin.

    <extension
     point="org.eclipse.ui.statusHandlers">
     <statusHandlerProductBinding
     handlerId="sampleStatusHandler"
     productId="productId">
     </statusHandlerProductBinding>
    </extension>

###### API Information:

The value of the `class` attribute in `statusHandler` element must be the fully qualified name of a class that extends `org.eclipse.ui.statushandlers.AbstractStatusHandler`.

The `parameter` elements in `statusHandler` element adds parameters which can be used during handling in the status handler defined in `class` attribute.

The value of the `productId` attribute in `statusHandlerProductBinding` is full name of the product to which the handler with id defined in `handlerId` attribute in `statusHandlerProductBinding` will be associated.

###### Supplied Implementation:

The platform supplies basic implementation of `org.eclipse.ui.statushandlers.AbstractStatusHandler`. It is `org.eclipse.ui.statushandlers.WorkbenchErrorHandler` which is the default workbench status handler.

Copyright (c) 2006, 2011 IBM Corporation and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html