Eclipse Platform
Release 3.3

org.eclipse.ui.statushandlers
Class StatusAdapter

java.lang.Object
  extended byorg.eclipse.ui.statushandlers.StatusAdapter
All Implemented Interfaces:
IAdaptable

public class StatusAdapter
extends Object
implements 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
static QualifiedName TIMESTAMP_PROPERTY
          This property is used to add timestamp to the adapter.
static QualifiedName TITLE_PROPERTY
          This property is used to add title to the adapter.
 
Constructor Summary
StatusAdapter(IStatus status)
          Creates an instance of this class.
 
Method Summary
 void addAdapter(Class adapter, Object object)
          Associates new object which is an instance of the given class with this adapter. object will be returned when IAdaptable.getAdapter(Class) is called on the receiver with Class adapter as a parameter.
 Object getAdapter(Class adapter)
          Returns an object which is an instance of the given class associated with this object.
 Object getProperty(QualifiedName key)
          Returns the value of the adapter's property identified by the given key, or null if this adapter has no such property.
 IStatus getStatus()
          Returns the wrapped status.
 void setProperty(QualifiedName key, Object value)
          Sets the value of the receiver's property identified by the given key.
 void setStatus(IStatus status)
          Sets a new status for this adapter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TITLE_PROPERTY

public static final QualifiedName TITLE_PROPERTY
This 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

public static final QualifiedName TIMESTAMP_PROPERTY
This property is used to add timestamp to the adapter. If the adapter is shown in the UI, this property can be used for sorting and showing information about the time of status creation.

Constructor Detail

StatusAdapter

public StatusAdapter(IStatus status)
Creates an instance of this class.

Parameters:
status - the status to wrap. May not be null.
Method Detail

addAdapter

public void addAdapter(Class adapter,
                       Object object)
Associates new object which is an instance of the given class with this adapter. object will be returned when IAdaptable.getAdapter(Class) is called on the receiver with Class adapter as a parameter.

Parameters:
adapter - the adapter class
object - the adapter instance

getAdapter

public Object getAdapter(Class adapter)
Description copied from interface: IAdaptable
Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found.

Specified by:
getAdapter in interface IAdaptable
Parameters:
adapter - the adapter class to look up
Returns:
a object castable to the given class, or null if this object does not have an adapter for the given class

getStatus

public IStatus getStatus()
Returns the wrapped status.

Returns:
the wrapped status set in the constructor or in setStatus(IStatus). Will not be null.

setStatus

public void setStatus(IStatus status)
Sets a new status for this adapter.

Parameters:
status - the status to set. May not be null.

getProperty

public Object getProperty(QualifiedName key)
Returns the value of the adapter's property identified by the given key, or null 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

public void setProperty(QualifiedName key,
                        Object value)
Sets the value of the receiver's property identified by the given key.

Parameters:
key - the qualified name of the property
value - the value of the property

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.