public class StatusManager extends Object
StatusManager is the entry point for all statuses to be reported in the user interface.
Handlers shoudn't be used directly but through the StatusManager singleton
which keeps the status handling policy and chooses handlers.
StatusManager.getManager().handle(IStatus)
and
handle(IStatus status, int style)
are the methods are the
primary access points to the StatusManager.
Acceptable styles (can be combined with logical OR)
Dialog
Dialog
Handlers are intended to be accessed via the status manager. The
StatusManager chooses which handler should be used for a particular error.
There are two ways for adding handlers to the handling flow. First using
extension point org.eclipse.ui.statusHandlers
, second by the
workbench advisor and its method
WorkbenchAdvisor.getWorkbenchErrorHandler()
. If a handler is
associated with a product, it is used instead of this defined in advisor.
AbstractStatusHandler
Modifier and Type | Class and Description |
---|---|
static interface |
StatusManager.INotificationListener
This interface allows for listening to status handling framework changes.
|
static interface |
StatusManager.INotificationTypes
This interface declares types of notification.
|
Modifier and Type | Field and Description |
---|---|
static int |
BLOCK
A style indicating that the handling should block the calling thread
until the status has been handled.
|
static int |
LOG
A style indicating that the status should be logged only.
|
static int |
NONE
A style indicating that the status should not be acted on.
|
static int |
SHOW
A style indicating that handlers should show a problem to an user without
blocking the calling method while awaiting user response.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(StatusManager.INotificationListener listener)
Adds a listener to the StatusManager.
|
void |
addLoggedStatus(IStatus status)
This method informs the StatusManager that this IStatus is being handled
by the handler and to ignore it when it shows up in our ILogListener.
|
void |
fireNotification(int type,
StatusAdapter[] adapters)
This method should be called by custom status handlers when an event
occurs.
|
static StatusManager |
getManager()
Returns StatusManager singleton instance.
|
void |
handle(CoreException coreException,
String pluginId)
Handles given CoreException.
|
void |
handle(IStatus status)
Handles the given status.
|
void |
handle(IStatus status,
int style)
Handles the given status due to the style.
|
void |
handle(StatusAdapter statusAdapter)
Handles the given status adapter.
|
void |
handle(StatusAdapter statusAdapter,
int style)
Handles the given status adapter due to the style.
|
void |
removeListener(StatusManager.INotificationListener listener)
Removes a listener from StatusManager.
|
public static final int NONE
public static final int LOG
public static final int SHOW
Dialog
.public static final int BLOCK
A typical usage of this would be to ensure that the user's actions are
blocked until they've dealt with the status in some manner. It is
therefore likely but not required that the StatusHandler
would achieve this through the use of a modal dialog.
Due to the fact
that use of BLOCK
will block any thread, care should be
taken in this use of this flag.
public static StatusManager getManager()
public void handle(StatusAdapter statusAdapter, int style)
public void handle(StatusAdapter statusAdapter)
LOG
style is used when
this method is called.statusAdapter
- the status adapterpublic void handle(IStatus status, int style)
public void handle(IStatus status)
LOG
style is used when this method
is called.status
- the status to handlepublic void handle(CoreException coreException, String pluginId)
StatusManager.getManager().handle(coreException.getStatus());
coreException
- a CoreException to be handled.pluginId
- the unique identifier of the relevant plug-inhandle(IStatus)
public void addLoggedStatus(IStatus status)
status
- already handled and logged statuspublic void fireNotification(int type, StatusAdapter[] adapters)
type
- - type of the event.adapters
- - array of affected StatusAdapter
s.StatusManager.INotificationTypes
,
AbstractStatusHandler.supportsNotification(int)
public void addListener(StatusManager.INotificationListener listener)
listener
- - a listener to be added.public void removeListener(StatusManager.INotificationListener listener)
listener
- - a listener to be removed.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.