Class AbstractStatusHandler
- java.lang.Object
-
- org.eclipse.ui.statushandlers.AbstractStatusHandler
-
- Direct Known Subclasses:
WorkbenchErrorHandler
public abstract class AbstractStatusHandler extends Object
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.
All status handlers extends
org.eclipse.ui.statushandlers.AbstractStatusHandler
. Each handler implementshandle(StatusAdapter status, int style)
. This method handles statuses due to handling style. The style indicates how status handler should handle a status.For acceptable styles check
StatusManager
.Handlers shoudn't be used directly but through the
StatusManager
. It chooses which handler should be used for handling. There are two ways for adding handlers to the handling flow. First using extension pointorg.eclipse.ui.statusHandlers
, second by the workbench advisor and its methodWorkbenchAdvisor.getWorkbenchErrorHandler()
. If a handler is associated with a product, it is used instead of this defined in advisor.A status handler has the id and a set of parameters. The handler can use them during handling. If the handler is added as an extension, both are set during initialization of the handler using elements and attributes of
statusHandler
element.- Since:
- 3.3
-
-
Constructor Summary
Constructors Constructor Description AbstractStatusHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
getId()
Returns the id of the handler.Object
getParam(Object key)
Returns the value of the handler's parameter identified by the given key, ornull
if this handler has no such parameter.Map
getParams()
Returns all parameters of the handler.abstract void
handle(StatusAdapter statusAdapter, int style)
HandlesStatusAdapter
objects based on the set style.void
setId(String id)
Sets the id for the handler.void
setParams(Map params)
Sets the parameters for the handler.boolean
supportsNotification(int type)
This methods indicates if particular notification type is supported and ifStatusManager.fireNotification(int, StatusAdapter[])
will be called after the event occurs.
-
-
-
Method Detail
-
handle
public abstract void handle(StatusAdapter statusAdapter, int style)
HandlesStatusAdapter
objects based on the set style.- Parameters:
statusAdapter
- the status adapter. May not benull
.style
- style constant. Acceptable values are defined inStatusManager
and can be combined with logical OR.- See Also:
StatusManager.BLOCK
,StatusManager.NONE
,StatusManager.SHOW
,StatusManager.LOG
-
getParams
public Map getParams()
Returns all parameters of the handler.- Returns:
- the parameters
-
getParam
public Object getParam(Object key)
Returns the value of the handler's parameter identified by the given key, ornull
if this handler has no such parameter.- Parameters:
key
- the name of the property- Returns:
- the value of the parameter, or
null
if this handler has no such parameter
-
setParams
public void setParams(Map params)
Sets the parameters for the handler. If the handler is added via theorg.eclipse.ui.statushandlers extension
, the parameters are set during initialization of the handler usingparameter
elements fromstatusHandler
element.- Parameters:
params
- the parameters to set
-
getId
public String getId()
Returns the id of the handler.- Returns:
- the id
-
setId
public void setId(String id)
Sets the id for the handler. If the handler is added as an extension, the id is set during initialization of the handler usingid
attribute ofstatusHandler
element.- Parameters:
id
- the id to set
-
supportsNotification
public boolean supportsNotification(int type)
This methods indicates if particular notification type is supported and ifStatusManager.fireNotification(int, StatusAdapter[])
will be called after the event occurs. Only known notification types should be accepted, whereas unknown types should be always rejected.- Parameters:
type
- - a notification type that should be checked.- Returns:
- true if particular event notification is supported, false otherwise
- Since:
- 3.5
-
-