Package org.eclipse.ui.statushandlers
Class StatusAdapter
java.lang.Object
org.eclipse.ui.statushandlers.StatusAdapter
- All Implemented Interfaces:
IAdaptable
The StatusAdapter wraps an instance of IStatus subclass and can hold additional information either by using properties or by adding a new adapter. Used during status handling process.
- Since:
- 3.3
-
Field Summary
Modifier and TypeFieldDescriptionstatic final QualifiedName
Deprecated.static final QualifiedName
Deprecated.useIStatusAdapterConstants.TITLE_PROPERTY
instead -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdapter
(Class adapter, Object object) Associates new object which is an instance of the given class with this adapter. object will be returned whenIAdaptable.getAdapter(Class)
is called on the receiver withClass
adapter as a parameter.<T> T
getAdapter
(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.getProperty
(QualifiedName key) Returns the value of the adapter's property identified by the given key, ornull
if this adapter has no such property.Returns the wrapped status.void
setProperty
(QualifiedName key, Object value) Sets the value of the receiver's property identified by the given key.void
Sets a new status for this adapter.
-
Field Details
-
TITLE_PROPERTY
Deprecated.useIStatusAdapterConstants.TITLE_PROPERTY
insteadThis property is used to add title to the adapter. If the adapter is shown in a dialog, this property is used to create title of the dialog. -
TIMESTAMP_PROPERTY
Deprecated.useIStatusAdapterConstants.TIMESTAMP_PROPERTY
insteadThis property is used to add a timestamp to the adapter. If the adapter is shown in the UI, this property can be used for sorting and showing information about the status creation time.The property must be of type
Long
.
-
-
Constructor Details
-
StatusAdapter
Creates an instance of this class.- Parameters:
status
- the status to wrap. May not benull
.
-
-
Method Details
-
addAdapter
Associates new object which is an instance of the given class with this adapter. object will be returned whenIAdaptable.getAdapter(Class)
is called on the receiver withClass
adapter as a parameter.- Parameters:
adapter
- the adapter classobject
- the adapter instance
-
getAdapter
Description copied from interface:IAdaptable
Returns an object which is an instance of the given class associated with this object. Returnsnull
if no such object can be found.Clients may implement this method but should generally call
Adapters.adapt(Object, Class, boolean)
rather than invoking it directly.- Specified by:
getAdapter
in interfaceIAdaptable
- Type Parameters:
T
- the class type- Parameters:
adapter
- the adapter class to look up- Returns:
- a object of the given class, or
null
if this object does not have an adapter for the given class
-
getStatus
Returns the wrapped status.- Returns:
- the wrapped status set in the constructor or in
setStatus(IStatus)
. Will not benull
.
-
setStatus
Sets a new status for this adapter.- Parameters:
status
- the status to set. May not benull
.
-
getProperty
Returns the value of the adapter's property identified by the given key, ornull
if this adapter has no such property.- Parameters:
key
- the qualified name of the property- Returns:
- the value of the property, or
null
if this adapter has no such property
-
setProperty
Sets the value of the receiver's property identified by the given key.- Parameters:
key
- the qualified name of the propertyvalue
- the value of the property
-
IStatusAdapterConstants.TIMESTAMP_PROPERTY
instead