Eclipse Platform
2.0

org.eclipse.core.runtime
Class Status

java.lang.Object
  |
  +--org.eclipse.core.runtime.Status
All Implemented Interfaces:
IStatus
Direct Known Subclasses:
MultiStatus

public class Status
extends Object
implements IStatus

A concrete status implementation, suitable either for instantiating or subclassing.


Field Summary
 
Fields inherited from interface org.eclipse.core.runtime.IStatus
ERROR, INFO, OK, WARNING
 
Constructor Summary
Status(int severity, String pluginId, int code, String message, Throwable exception)
          Creates a new status object.
 
Method Summary
 IStatus[] getChildren()
          Returns a list of status object immediately contained in this multi-status, or an empty list if this is not a multi-status.
 int getCode()
          Returns the plug-in-specific status code describing the outcome.
 Throwable getException()
          Returns the relevant low-level exception, or null if none.
 String getMessage()
          Returns the message describing the outcome.
 String getPlugin()
          Returns the unique identifier of the plug-in associated with this status (this is the plug-in that defines the meaning of the status code).
 int getSeverity()
          Returns the severity.
 boolean isMultiStatus()
          Returns whether this status is a multi-status.
 boolean isOK()
          Returns whether this status indicates everything is okay (neither info, warning, nor error).
 boolean matches(int severityMask)
          Returns whether the severity of this status matches the given specification.
protected  void setCode(int code)
          Sets the status code.
protected  void setException(Throwable exception)
          Sets the exception.
protected  void setMessage(String message)
          Sets the message.
protected  void setPlugin(String pluginId)
          Sets the plug-in id.
protected  void setSeverity(int severity)
          Sets the severity.
 String toString()
          Returns a string representation of the status, suitable for debugging purposes only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Status

public Status(int severity,
              String pluginId,
              int code,
              String message,
              Throwable exception)
Creates a new status object. The created status has no children.

Parameters:
severity - the severity; one of OK, ERROR, INFO, or WARNING
pluginId - the unique identifier of the relevant plug-in
code - the plug-in-specific status code, or OK
message - a human-readable message, localized to the current locale
exception - a low-level exception, or null if not applicable
Method Detail

getChildren

public IStatus[] getChildren()
Description copied from interface: IStatus
Returns a list of status object immediately contained in this multi-status, or an empty list if this is not a multi-status.

Specified by:
getChildren in interface IStatus
Returns:
an array of status objects
See Also:
IStatus.isMultiStatus()

getCode

public int getCode()
Description copied from interface: IStatus
Returns the plug-in-specific status code describing the outcome.

Specified by:
getCode in interface IStatus
Returns:
plug-in-specific status code

getException

public Throwable getException()
Description copied from interface: IStatus
Returns the relevant low-level exception, or null if none. For example, when an operation fails because of a network communications failure, this might return the java.io.IOException describing the exact nature of that failure.

Specified by:
getException in interface IStatus
Returns:
the relevant low-level exception, or null if none

getMessage

public String getMessage()
Description copied from interface: IStatus
Returns the message describing the outcome. The message is localized to the current locale.

Specified by:
getMessage in interface IStatus
Returns:
a localized message

getPlugin

public String getPlugin()
Description copied from interface: IStatus
Returns the unique identifier of the plug-in associated with this status (this is the plug-in that defines the meaning of the status code).

Specified by:
getPlugin in interface IStatus
Returns:
the unique identifier of the relevant plug-in

getSeverity

public int getSeverity()
Description copied from interface: IStatus
Returns the severity. The severities are as follows (in descending order):

The severity of a multi-status is defined to be the maximum severity of any of its children, or OK if it has no children.

Specified by:
getSeverity in interface IStatus
Returns:
the severity: one of OK, ERROR, INFO, or WARNING
See Also:
IStatus.matches(int)

isMultiStatus

public boolean isMultiStatus()
Description copied from interface: IStatus
Returns whether this status is a multi-status. A multi-status describes the outcome of an operation involving multiple operands.

The severity of a multi-status is derived from the severities of its children; a multi-status with no children is OK by definition. A multi-status carries a plug-in identifier, a status code, a message, and an optional exception. Clients may treat multi-status objects in a multi-status unaware way.

Specified by:
isMultiStatus in interface IStatus
Returns:
true for a multi-status, false otherwise
See Also:
IStatus.getChildren()

isOK

public boolean isOK()
Description copied from interface: IStatus
Returns whether this status indicates everything is okay (neither info, warning, nor error).

Specified by:
isOK in interface IStatus
Returns:
true if this status has severity OK, and false otherwise

matches

public boolean matches(int severityMask)
Description copied from interface: IStatus
Returns whether the severity of this status matches the given specification.

Specified by:
matches in interface IStatus
Parameters:
severityMask - a mask formed by bitwise or'ing severity mask constants (ERROR, WARNING, INFO)
Returns:
true if there is at least one match, false if there are no matches
See Also:
IStatus.getSeverity(), IStatus.ERROR, IStatus.WARNING, IStatus.INFO

setCode

protected void setCode(int code)
Sets the status code.

Parameters:
code - the plug-in-specific status code, or OK

setException

protected void setException(Throwable exception)
Sets the exception.

Parameters:
exception - a low-level exception, or null if not applicable

setMessage

protected void setMessage(String message)
Sets the message.

Parameters:
message - a human-readable message, localized to the current locale

setPlugin

protected void setPlugin(String pluginId)
Sets the plug-in id.

Parameters:
pluginId - the unique identifier of the relevant plug-in

setSeverity

protected void setSeverity(int severity)
Sets the severity.

Parameters:
severity - the severity; one of OK, ERROR, INFO, or WARNING

toString

public String toString()
Returns a string representation of the status, suitable for debugging purposes only.

Overrides:
toString in class Object

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.