Class StatusAdapter

java.lang.Object
org.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 Details

    • TITLE_PROPERTY

      @Deprecated 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

      @Deprecated public static final QualifiedName TIMESTAMP_PROPERTY
      This 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

      public StatusAdapter(IStatus status)
      Creates an instance of this class.
      Parameters:
      status - the status to wrap. May not be null.
  • Method Details

    • 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 <T> T getAdapter(Class<T> 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.

      Clients may implement this method but should generally call Adapters.adapt(Object, Class, boolean) rather than invoking it directly.

      Specified by:
      getAdapter in interface IAdaptable
      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

      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