Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.ltk.core.refactoring
Class RefactoringStatus  view RefactoringStatus download RefactoringStatus.java

java.lang.Object
  extended byorg.eclipse.ltk.core.refactoring.RefactoringStatus

public class RefactoringStatus
extends java.lang.Object

A RefactoringStatus object represents the outcome of a condition checking operation. It manages a list of RefactoringStatusEntry objects. Each RefactoringStatusEntry object describes one particular problem detected during condition checking.

Additionally a problem severity is managed. Severities are ordered as follows: OK < INFO < WARNING < ERROR < FATAL. The status's problem severity is the maximum of the severities of all entries. If the status doesn't have any entry the status's severity is OK.

Note: this class is not intended to be extended by clients.

Since:
3.0

Field Summary
static int ERROR
          Status severity constant (value 3) indicating this status represents an error.
static int FATAL
          Status severity constant (value 4) indicating this status represents a fatal error.
private  java.util.List fEntries
          List of refactoring status entries.
private  int fSeverity
          The status's severity.
static int INFO
          Status severity constant (value 1) indicating this status is informational only.
static int OK
          Status severity constant (value 0) indicating this status represents the nominal case.
static int WARNING
          Status severity constant (value 2) indicating this status represents a warning.
 
Constructor Summary
RefactoringStatus()
          Creates a new refactoring status with an empty list of status entries and a severity of OK.
 
Method Summary
 void addEntry(int severity, java.lang.String msg, RefactoringStatusContext context, java.lang.String pluginId, int code)
          Adds a new entry filled with the given arguments to this status.
 void addEntry(int severity, java.lang.String msg, RefactoringStatusContext context, java.lang.String pluginId, int code, java.lang.Object data)
          Adds a new entry filled with the given arguments to this status.
 void addEntry(RefactoringStatusEntry entry)
          Adds the given RefactoringStatusEntry.
 void addError(java.lang.String msg)
          Adds an ERROR entry filled with the given message to this status.
 void addError(java.lang.String msg, RefactoringStatusContext context)
          Adds an ERROR entry filled with the given message and context to this status.
 void addFatalError(java.lang.String msg)
          Adds a FATAL entry filled with the given message to this status.
 void addFatalError(java.lang.String msg, RefactoringStatusContext context)
          Adds a FATAL entry filled with the given message and status to this status.
 void addInfo(java.lang.String msg)
          Adds an INFO entry filled with the given message to this status.
 void addInfo(java.lang.String msg, RefactoringStatusContext context)
          Adds an INFO entry filled with the given message and context to this status.
 void addWarning(java.lang.String msg)
          Adds a WARNING entry filled with the given message to this status.
 void addWarning(java.lang.String msg, RefactoringStatusContext context)
          Adds a WARNING entry filled with the given message and context to this status.
static RefactoringStatus create(org.eclipse.core.runtime.IStatus status)
          Creates a new RefactorngStatus from the given IStatus.
static RefactoringStatus createErrorStatus(java.lang.String msg)
          Creates a new RefactorngStatus with one ERROR entry filled with the given message.
static RefactoringStatus createErrorStatus(java.lang.String msg, RefactoringStatusContext context)
          Creates a RefactorngStatus with one ERROR entry fill with the given message and context.
static RefactoringStatus createFatalErrorStatus(java.lang.String msg)
          Creates a new RefactorngStatus with one FATAL entry filled with the given message.
static RefactoringStatus createFatalErrorStatus(java.lang.String msg, RefactoringStatusContext context)
          Creates a RefactorngStatus with one FATAL entry fill with the given message and context.
static RefactoringStatus createInfoStatus(java.lang.String msg)
          Creates a new RefactorngStatus with one INFO entry filled with the given message.
static RefactoringStatus createInfoStatus(java.lang.String msg, RefactoringStatusContext context)
          Creates a new RefactorngStatus with one INFO entry filled with the given message and context.
static RefactoringStatus createStatus(int severity, java.lang.String msg, RefactoringStatusContext context, java.lang.String pluginId, int code, java.lang.Object data)
          Creates a new RefactoringStatus with one entry filled with the given arguments.
static RefactoringStatus createWarningStatus(java.lang.String msg)
          Creates a new RefactorngStatus with one WARNING entry filled with the given message.
static RefactoringStatus createWarningStatus(java.lang.String msg, RefactoringStatusContext context)
          Creates a RefactorngStatus with one WARNING entry fill with the given message and context.
 RefactoringStatusEntry[] getEntries()
          Returns the list of refactoring status entries.
 RefactoringStatusEntry getEntryAt(int index)
          Returns the RefactoringStatusEntry at the specified index.
 RefactoringStatusEntry getEntryMatchingCode(java.lang.String pluginId, int code)
          Returns the first entry managed by this refactoring status that matches the given plug-in identifier and code.
 RefactoringStatusEntry getEntryMatchingSeverity(int severity)
          Returns the first entry which severity is equal or greater than the given severity.
 java.lang.String getMessageMatchingSeverity(int severity)
          Returns the first message which severity is equal or greater than the given severity.
 int getSeverity()
          Returns the severity.
(package private) static java.lang.String getSeverityString(int severity)
           
 boolean hasEntries()
          Returns whether the status has entries or not.
 boolean hasError()
          Returns true if the current severity is FATAL or ERROR.
 boolean hasFatalError()
          Returns true if the current severity is FATAL.
 boolean hasInfo()
          Returns true if the current severity is FATAL, ERROR, WARNING or INFO.
 boolean hasWarning()
          Returns true if the current severity is FATAL, ERROR or WARNING.
 boolean isOK()
          Returns whether the status's severity is OK or not.
 void merge(RefactoringStatus other)
          Merges the receiver and the parameter statuses.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OK

public static final int OK
Status severity constant (value 0) indicating this status represents the nominal case.

See Also:
Constant Field Values

INFO

public static final int INFO
Status severity constant (value 1) indicating this status is informational only.

See Also:
Constant Field Values

WARNING

public static final int WARNING
Status severity constant (value 2) indicating this status represents a warning.

See Also:
Constant Field Values

ERROR

public static final int ERROR
Status severity constant (value 3) indicating this status represents an error.

See Also:
Constant Field Values

FATAL

public static final int FATAL
Status severity constant (value 4) indicating this status represents a fatal error. This is used when the refactoring can't be executed.

See Also:
Constant Field Values

fEntries

private java.util.List fEntries
List of refactoring status entries.


fSeverity

private int fSeverity
The status's severity. The following invariant holds for fSeverity: OK ≤ fSeverity ≤ FATAL.

Constructor Detail

RefactoringStatus

public RefactoringStatus()
Creates a new refactoring status with an empty list of status entries and a severity of OK.

Method Detail

getSeverity

public int getSeverity()
Returns the severity.


getEntries

public RefactoringStatusEntry[] getEntries()
Returns the list of refactoring status entries.


hasEntries

public boolean hasEntries()
Returns whether the status has entries or not.


getEntryAt

public RefactoringStatusEntry getEntryAt(int index)
Returns the RefactoringStatusEntry at the specified index.


getEntryMatchingCode

public RefactoringStatusEntry getEntryMatchingCode(java.lang.String pluginId,
                                                   int code)
Returns the first entry managed by this refactoring status that matches the given plug-in identifier and code. If more than one entry exists that matches the criteria the first one in the list of entries is returned. Returns null if no entry matches.


getEntryMatchingSeverity

public RefactoringStatusEntry getEntryMatchingSeverity(int severity)
Returns the first entry which severity is equal or greater than the given severity. If more than one entry exists that matches the criteria the first one is returned. Returns null if no entry matches.


getMessageMatchingSeverity

public java.lang.String getMessageMatchingSeverity(int severity)
Returns the first message which severity is equal or greater than the given severity. If more than one entry exists that matches the criteria the first one is returned. Returns null if no entry matches.


createStatus

public static RefactoringStatus createStatus(int severity,
                                             java.lang.String msg,
                                             RefactoringStatusContext context,
                                             java.lang.String pluginId,
                                             int code,
                                             java.lang.Object data)
Creates a new RefactoringStatus with one entry filled with the given arguments.


createInfoStatus

public static RefactoringStatus createInfoStatus(java.lang.String msg)
Creates a new RefactorngStatus with one INFO entry filled with the given message.


createInfoStatus

public static RefactoringStatus createInfoStatus(java.lang.String msg,
                                                 RefactoringStatusContext context)
Creates a new RefactorngStatus with one INFO entry filled with the given message and context.


createWarningStatus

public static RefactoringStatus createWarningStatus(java.lang.String msg)
Creates a new RefactorngStatus with one WARNING entry filled with the given message.


createWarningStatus

public static RefactoringStatus createWarningStatus(java.lang.String msg,
                                                    RefactoringStatusContext context)
Creates a RefactorngStatus with one WARNING entry fill with the given message and context.


createErrorStatus

public static RefactoringStatus createErrorStatus(java.lang.String msg)
Creates a new RefactorngStatus with one ERROR entry filled with the given message.


createErrorStatus

public static RefactoringStatus createErrorStatus(java.lang.String msg,
                                                  RefactoringStatusContext context)
Creates a RefactorngStatus with one ERROR entry fill with the given message and context.


createFatalErrorStatus

public static RefactoringStatus createFatalErrorStatus(java.lang.String msg)
Creates a new RefactorngStatus with one FATAL entry filled with the given message.


createFatalErrorStatus

public static RefactoringStatus createFatalErrorStatus(java.lang.String msg,
                                                       RefactoringStatusContext context)
Creates a RefactorngStatus with one FATAL entry fill with the given message and context.


create

public static RefactoringStatus create(org.eclipse.core.runtime.IStatus status)
Creates a new RefactorngStatus from the given IStatus. An OK status is mapped to an OK refactoring status, an information status is mapped to a warning refactoring status, a warning status is mapped to an error refactoring status and an error or cancel status is mapped to a fatal refactoring status. An unknown status is converted into a fatal error status as well. If the status is a MultiStatus then the first level of children of the status will be added as refactoring status entries to the created refactoring status.


merge

public void merge(RefactoringStatus other)
Merges the receiver and the parameter statuses. The resulting list of entries in the receiver will contain entries from both. The resulting severity in the receiver will be the more severe of its current severity and the parameter's severity. Merging with null is allowed - it has no effect.


addInfo

public void addInfo(java.lang.String msg)
Adds an INFO entry filled with the given message to this status. If the current severity is OK it will be changed to INFO . It will remain unchanged otherwise.


addInfo

public void addInfo(java.lang.String msg,
                    RefactoringStatusContext context)
Adds an INFO entry filled with the given message and context to this status. If the current severity is OK it will be changed to INFO. It will remain unchanged otherwise.


addWarning

public void addWarning(java.lang.String msg)
Adds a WARNING entry filled with the given message to this status. If the current severity is OK or INFO it will be changed to WARNING. It will remain unchanged otherwise.


addWarning

public void addWarning(java.lang.String msg,
                       RefactoringStatusContext context)
Adds a WARNING entry filled with the given message and context to this status. If the current severity is OK or INFO it will be changed to WARNING. It will remain unchanged otherwise.


addError

public void addError(java.lang.String msg)
Adds an ERROR entry filled with the given message to this status. If the current severity is OK, INFO or WARNING it will be changed to ERROR. It will remain unchanged otherwise.


addError

public void addError(java.lang.String msg,
                     RefactoringStatusContext context)
Adds an ERROR entry filled with the given message and context to this status. If the current severity is OK, INFO or WARNING it will be changed to ERROR. It will remain unchanged otherwise.


addFatalError

public void addFatalError(java.lang.String msg)
Adds a FATAL entry filled with the given message to this status. The severity of this status will changed to FATAL.


addFatalError

public void addFatalError(java.lang.String msg,
                          RefactoringStatusContext context)
Adds a FATAL entry filled with the given message and status to this status. The severity of this status will changed to FATAL.


addEntry

public void addEntry(int severity,
                     java.lang.String msg,
                     RefactoringStatusContext context,
                     java.lang.String pluginId,
                     int code)
Adds a new entry filled with the given arguments to this status. The severity of this status is set to the maximum of fSeverity and severity.


addEntry

public void addEntry(int severity,
                     java.lang.String msg,
                     RefactoringStatusContext context,
                     java.lang.String pluginId,
                     int code,
                     java.lang.Object data)
Adds a new entry filled with the given arguments to this status. The severity of this status is set to the maximum of fSeverity and severity.


addEntry

public void addEntry(RefactoringStatusEntry entry)
Adds the given RefactoringStatusEntry. The severity of this status is set to the maximum of fSeverity and the severity of the entry.


isOK

public boolean isOK()
Returns whether the status's severity is OK or not.


hasFatalError

public boolean hasFatalError()
Returns true if the current severity is FATAL.


hasError

public boolean hasError()
Returns true if the current severity is FATAL or ERROR.


hasWarning

public boolean hasWarning()
Returns true if the current severity is FATAL, ERROR or WARNING.


hasInfo

public boolean hasInfo()
Returns true if the current severity is FATAL, ERROR, WARNING or INFO.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getSeverityString

static java.lang.String getSeverityString(int severity)