org.eclipse.xtext.builder.preferences
Class StatusInfo

java.lang.Object
  extended by org.eclipse.xtext.builder.preferences.StatusInfo
All Implemented Interfaces:
org.eclipse.core.runtime.IStatus

public class StatusInfo
extends java.lang.Object
implements org.eclipse.core.runtime.IStatus

Initially copied from Jdt.

Since:
2.1
Author:
Michael Clay

Field Summary
static org.eclipse.core.runtime.IStatus OK_STATUS
           
 
Fields inherited from interface org.eclipse.core.runtime.IStatus
CANCEL, ERROR, INFO, OK, WARNING
 
Constructor Summary
StatusInfo()
           
StatusInfo(int severity, java.lang.String message)
           
 
Method Summary
 org.eclipse.core.runtime.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.
 java.lang.Throwable getException()
          Returns the relevant low-level exception, or null if none.
 java.lang.String getMessage()
          Returns the message describing the outcome.
 java.lang.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 isError()
           
 boolean isInfo()
           
 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 isWarning()
           
 boolean matches(int severityMask)
          Returns whether the severity of this status matches the given severity mask.
 void setError(java.lang.String errorMessage)
           
 void setInfo(java.lang.String infoMessage)
           
 void setOK()
           
 void setWarning(java.lang.String warningMessage)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OK_STATUS

public static final org.eclipse.core.runtime.IStatus OK_STATUS
Constructor Detail

StatusInfo

public StatusInfo()

StatusInfo

public StatusInfo(int severity,
                  java.lang.String message)
Method Detail

isOK

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

Specified by:
isOK in interface org.eclipse.core.runtime.IStatus
Returns:
true if this status has severity OK, and false otherwise

isWarning

public boolean isWarning()

isInfo

public boolean isInfo()

isError

public boolean isError()

getMessage

public java.lang.String getMessage()
Description copied from interface: org.eclipse.core.runtime.IStatus
Returns the message describing the outcome. The message is localized to the current locale.

Specified by:
getMessage in interface org.eclipse.core.runtime.IStatus
Returns:
a localized message

setError

public void setError(java.lang.String errorMessage)

setWarning

public void setWarning(java.lang.String warningMessage)

setInfo

public void setInfo(java.lang.String infoMessage)

setOK

public void setOK()

matches

public boolean matches(int severityMask)
Description copied from interface: org.eclipse.core.runtime.IStatus
Returns whether the severity of this status matches the given severity mask. Note that a status with severity OK will never match; use isOK instead to detect a status with a severity of OK.

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

isMultiStatus

public boolean isMultiStatus()
Description copied from interface: org.eclipse.core.runtime.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 org.eclipse.core.runtime.IStatus
Returns:
true for a multi-status, false otherwise
See Also:
IStatus.getChildren()

getSeverity

public int getSeverity()
Description copied from interface: org.eclipse.core.runtime.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 org.eclipse.core.runtime.IStatus
Returns:
the severity: one of OK, ERROR, INFO, WARNING, or CANCEL
See Also:
IStatus.matches(int)

getPlugin

public java.lang.String getPlugin()
Description copied from interface: org.eclipse.core.runtime.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 org.eclipse.core.runtime.IStatus
Returns:
the unique identifier of the relevant plug-in

getException

public java.lang.Throwable getException()
Description copied from interface: org.eclipse.core.runtime.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 org.eclipse.core.runtime.IStatus
Returns:
the relevant low-level exception, or null if none

getCode

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

Specified by:
getCode in interface org.eclipse.core.runtime.IStatus
Returns:
plug-in-specific status code

getChildren

public org.eclipse.core.runtime.IStatus[] getChildren()
Description copied from interface: org.eclipse.core.runtime.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 org.eclipse.core.runtime.IStatus
Returns:
an array of status objects
See Also:
IStatus.isMultiStatus()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object