public class RefactoringStatus extends Object
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.
RefactoringStatusEntry,
Refactoring.checkAllConditions(IProgressMonitor)| Modifier and Type | Field and Description |
|---|---|
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.
|
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 and Description |
|---|
RefactoringStatus()
Creates a new refactoring status with an empty list of
status entries and a severity of
OK. |
| Modifier and Type | Method and Description |
|---|---|
void |
addEntry(int severity,
String msg,
RefactoringStatusContext context,
String pluginId,
int code)
Adds a new entry filled with the given arguments to this status.
|
void |
addEntry(int severity,
String msg,
RefactoringStatusContext context,
String pluginId,
int code,
Object data)
Adds a new entry filled with the given arguments to this status.
|
void |
addEntry(RefactoringStatusEntry entry)
Adds the given
RefactoringStatusEntry. |
void |
addError(String msg)
Adds an
ERROR entry filled with the given message to this status. |
void |
addError(String msg,
RefactoringStatusContext context)
Adds an
ERROR entry filled with the given message and context to
this status. |
void |
addFatalError(String msg)
Adds a
FATAL entry filled with the given message to this status. |
void |
addFatalError(String msg,
RefactoringStatusContext context)
Adds a
FATAL entry filled with the given message and status to
this status. |
void |
addInfo(String msg)
Adds an
INFO entry filled with the given message to this status. |
void |
addInfo(String msg,
RefactoringStatusContext context)
Adds an
INFO entry filled with the given message and context to
this status. |
void |
addWarning(String msg)
Adds a
WARNING entry filled with the given message to this status. |
void |
addWarning(String msg,
RefactoringStatusContext context)
Adds a
WARNING entry filled with the given message and context to
this status. |
static RefactoringStatus |
create(IStatus status)
Creates a new
RefactoringStatus from the given IStatus. |
static RefactoringStatus |
createErrorStatus(String msg)
Creates a new
RefactoringStatus with one ERROR entry
filled with the given message. |
static RefactoringStatus |
createErrorStatus(String msg,
RefactoringStatusContext context)
Creates a
RefactoringStatus with one ERROR entry
fill with the given message and context. |
static RefactoringStatus |
createFatalErrorStatus(String msg)
Creates a new
RefactoringStatus with one FATAL entry
filled with the given message. |
static RefactoringStatus |
createFatalErrorStatus(String msg,
RefactoringStatusContext context)
Creates a
RefactoringStatus with one FATAL entry
fill with the given message and context. |
static RefactoringStatus |
createInfoStatus(String msg)
Creates a new
RefactoringStatus with one INFO entry
filled with the given message. |
static RefactoringStatus |
createInfoStatus(String msg,
RefactoringStatusContext context)
Creates a new
RefactoringStatus with one INFO entry
filled with the given message and context. |
static RefactoringStatus |
createStatus(int severity,
String msg,
RefactoringStatusContext context,
String pluginId,
int code,
Object data)
Creates a new
RefactoringStatus with one entry filled with the given
arguments. |
static RefactoringStatus |
createWarningStatus(String msg)
Creates a new
RefactoringStatus with one WARNING entry
filled with the given message. |
static RefactoringStatus |
createWarningStatus(String msg,
RefactoringStatusContext context)
Creates a
RefactoringStatus with one WARNING entry
fill with the given message and context. |
RefactoringStatusEntry[] |
getEntries()
Returns the list of refactoring status entries.
|
RefactoringStatusEntry[] |
getEntries(IRefactoringStatusEntryComparator comparator,
RefactoringStatusEntry entry)
Returns a list of refactoring status entries which are considered equal
to the specified status entry.
|
RefactoringStatusEntry |
getEntryAt(int index)
Returns the
RefactoringStatusEntry at the specified index. |
RefactoringStatusEntry |
getEntryMatchingCode(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.
|
RefactoringStatusEntry |
getEntryWithHighestSeverity()
Returns the entry with the highest severity.
|
String |
getMessageMatchingSeverity(int severity)
Returns the first message which severity is equal or greater than the
given severity.
|
int |
getSeverity()
Returns the 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.
|
String |
toString() |
public static final int OK
public static final int INFO
public static final int WARNING
public static final int ERROR
public static final int FATAL
public RefactoringStatus()
OK.public int getSeverity()
public RefactoringStatusEntry[] getEntries()
public RefactoringStatusEntry[] getEntries(IRefactoringStatusEntryComparator comparator, RefactoringStatusEntry entry)
comparator - the comparator to determine whether two status entries
are considered equalentry - the refactoring status entry to compare the entries of this
status withpublic boolean hasEntries()
true if the status as any entries; otherwise
false is returned.public RefactoringStatusEntry getEntryAt(int index)
RefactoringStatusEntry at the specified index.index - the index of the entry to returnIndexOutOfBoundsException - if the index is out of rangepublic RefactoringStatusEntry getEntryMatchingCode(String pluginId, int code)
null if no entry
matches.pluginId - the entry's plug-in identifiercode - the entry's codenull otherwisepublic RefactoringStatusEntry getEntryMatchingSeverity(int severity)
null if no
entry matches.severity - the severity to search for. Must be one of FATAL
, ERROR, WARNING or INFOpublic RefactoringStatusEntry getEntryWithHighestSeverity()
null if no
entries are presentpublic String getMessageMatchingSeverity(int severity)
null if no entry matches.severity - the severity to search for. Must be one of FATAL
, ERROR, WARNING or INFOpublic static RefactoringStatus createStatus(int severity, String msg, RefactoringStatusContext context, String pluginId, int code, Object data)
RefactoringStatus with one entry filled with the given
arguments.severity - the severitymsg - the messagecontext - the context. Can be nullpluginId - the plug-in identifier. Can be null if argument
code equals NO_CODEcode - the problem code. Must be either NO_CODE or a positive integerdata - application specific dataRefactoringStatusEntrypublic static RefactoringStatus createInfoStatus(String msg)
RefactoringStatus with one INFO entry
filled with the given message.msg - the message of the info entryRefactoringStatusEntrypublic static RefactoringStatus createInfoStatus(String msg, RefactoringStatusContext context)
RefactoringStatus with one INFO entry
filled with the given message and context.msg - the message of the info entrycontext - the context of the info entryRefactoringStatusEntrypublic static RefactoringStatus createWarningStatus(String msg)
RefactoringStatus with one WARNING entry
filled with the given message.msg - the message of the warning entryRefactoringStatusEntrypublic static RefactoringStatus createWarningStatus(String msg, RefactoringStatusContext context)
RefactoringStatus with one WARNING entry
fill with the given message and context.msg - the message of the warning entrycontext - the context of the warning entryRefactoringStatusEntrypublic static RefactoringStatus createErrorStatus(String msg)
RefactoringStatus with one ERROR entry
filled with the given message.msg - the message of the error entryRefactoringStatusEntrypublic static RefactoringStatus createErrorStatus(String msg, RefactoringStatusContext context)
RefactoringStatus with one ERROR entry
fill with the given message and context.msg - the message of the error entrycontext - the context of the error entryRefactoringStatusEntrypublic static RefactoringStatus createFatalErrorStatus(String msg)
RefactoringStatus with one FATAL entry
filled with the given message.msg - the message of the fatal entryRefactoringStatusEntrypublic static RefactoringStatus createFatalErrorStatus(String msg, RefactoringStatusContext context)
RefactoringStatus with one FATAL entry
fill with the given message and context.msg - the message of the fatal entrycontext - the context of the fatal entryRefactoringStatusEntrypublic static RefactoringStatus create(IStatus status)
RefactoringStatus 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.status - the status to create a refactoring status fromIStatuspublic void merge(RefactoringStatus other)
null is
allowed - it has no effect.other - the refactoring status to merge withpublic void addInfo(String msg)
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.msg - the message of the info entryRefactoringStatusEntrypublic void addInfo(String msg, RefactoringStatusContext context)
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.msg - the message of the info entrycontext - the context of the info entryRefactoringStatusEntrypublic void addWarning(String msg)
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.msg - the message of the warning entryRefactoringStatusEntrypublic void addWarning(String msg, RefactoringStatusContext context)
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.msg - the message of the warning entrycontext - the context of the warning entryRefactoringStatusEntrypublic void addError(String msg)
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.msg - the message of the error entryRefactoringStatusEntrypublic void addError(String msg, RefactoringStatusContext context)
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.msg - the message of the error entrycontext - the context of the error entryRefactoringStatusEntrypublic void addFatalError(String msg)
FATAL entry filled with the given message to this status.
The severity of this status will changed to FATAL.msg - the message of the fatal entryRefactoringStatusEntrypublic void addFatalError(String msg, RefactoringStatusContext context)
FATAL entry filled with the given message and status to
this status. The severity of this status will changed to FATAL.msg - the message of the fatal entrycontext - the context of the fatal entryRefactoringStatusEntrypublic void addEntry(int severity,
String msg,
RefactoringStatusContext context,
String pluginId,
int code)
fSeverity and
severity.severity - the severity of the entrymsg - the message of the entrycontext - the context of the entry. Can be nullpluginId - the plug-in identifier of the entry. Can be null if
argument code equals NO_CODEcode - the problem code of the entry. Must be either NO_CODE
or a positive integerpublic void addEntry(int severity,
String msg,
RefactoringStatusContext context,
String pluginId,
int code,
Object data)
fSeverity and
severity.severity - the severity of the entrymsg - the message of the entrycontext - the context of the entry. Can be nullpluginId - the plug-in identifier of the entry. Can be null if
argument code equals NO_CODEcode - the problem code of the entry. Must be either NO_CODE
or a positive integerdata - application specific data of the entrypublic void addEntry(RefactoringStatusEntry entry)
RefactoringStatusEntry. The severity of this
status is set to the maximum of fSeverity and the severity of
the entry.entry - the RefactoringStatusEntry to be addedpublic boolean isOK()
OK or not.true if the severity is OK;
otherwise false is returnedpublic boolean hasFatalError()
true if the current severity is
FATAL.true if the current severity is
FATAL; otherwise false is returnedpublic boolean hasError()
true if the current severity is
FATAL or ERROR.true if the current severity is
FATAL or ERROR; otherwise false
is returnedpublic boolean hasWarning()
true if the current severity is
FATAL, ERROR or WARNING.true if the current severity is
FATAL, ERROR or WARNING;
otherwise false is returnedpublic boolean hasInfo()
true if the current severity is
FATAL, ERROR, WARNING or
INFO.true if the current severity is
FATAL, ERROR, WARNING or
INFO; otherwise false is returnedGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.