Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ltk.core.refactoring
Class RefactoringStatus


java.lang.Object
  extended by 
org.eclipse.ltk.core.refactoring.RefactoringStatus

public class RefactoringStatus
extends 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
See Also:
RefactoringStatusEntry, Refactoring.checkAllConditions(IProgressMonitor)
Restriction:
This class is not intended to be subclassed by clients.

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.
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, 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 ()
           
 
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.

Use this severity if the refactoring can be performed, but you assume that the user could not be aware of problems or confusions resulting from the execution.

See Also:
Constant Field Values

ERROR

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

Use this severity if the refactoring can be performed, but the refactoring will not be behavior preserving and/or the partial execution will lead to an inconsistent state (e.g. compile errors).

See Also:
Constant Field Values

FATAL

public static final int FATAL
Status severity constant (value 4) indicating this status represents a fatal error.

Use this severity if the refactoring cannot be performed, and execution would lead to major problems. Note that this completely blocks the user from performing this refactoring. It is often preferable to use an ERROR status and allow a partial execution (e.g. if just one reference to a refactored element cannot be updated).

See Also:
Constant Field Values
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.

Returns:
the severity.

getEntries

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

Returns:
the list of refactoring status entries. Returns an empty array if no entries are managed.

getEntries

public 
RefactoringStatusEntry[] getEntries(
IRefactoringStatusEntryComparator comparator,
                                           
RefactoringStatusEntry entry)
Returns a list of refactoring status entries which are considered equal to the specified status entry.

Parameters:
comparator - the comparator to determine whether two status entries are considered equal
entry - the refactoring status entry to compare the entries of this status with
Returns:
the list of refactoring status entries that are considered equal to the specified one, in no particular order. Returns an empty array if no entries are managed or none of them matches.
Since:
3.1

hasEntries

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

Returns:
true if the status as any entries; otherwise false is returned.

getEntryAt

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

Parameters:
index - the index of the entry to return
Returns:
the entry at the specified index
Throws:
IndexOutOfBoundsException - if the index is out of range

getEntryMatchingCode

public 
RefactoringStatusEntry getEntryMatchingCode(
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.

Parameters:
pluginId - the entry's plug-in identifier
code - the entry's code
Returns:
the entry that matches the given plug-in identifier and code; null otherwise

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.

Parameters:
severity - the severity to search for. Must be one of FATAL , ERROR, WARNING or INFO
Returns:
the entry that matches the search criteria

getEntryWithHighestSeverity

public 
RefactoringStatusEntry getEntryWithHighestSeverity()
Returns the entry with the highest severity. If there is more than one entry that matches the first one found in the list of entries is returned.

Returns:
the entry with the highest severity or null if no entries are present
Since:
3.1

getMessageMatchingSeverity

public 
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.

Parameters:
severity - the severity to search for. Must be one of FATAL , ERROR, WARNING or INFO
Returns:
the message of the entry that matches the search criteria

createStatus

public 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.

Parameters:
severity - the severity
msg - the message
context - the context. Can be null
pluginId - the plug-in identifier. Can be null if argument code equals NO_CODE
code - the problem code. Must be either NO_CODE or a positive integer
data - application specific data
Returns:
the newly created refactoring status
See Also:
RefactoringStatusEntry

createInfoStatus

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

Parameters:
msg - the message of the info entry
Returns:
the refactoring status
See Also:
RefactoringStatusEntry

createInfoStatus

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

Parameters:
msg - the message of the info entry
context - the context of the info entry
Returns:
the refactoring status
See Also:
RefactoringStatusEntry

createWarningStatus

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

Parameters:
msg - the message of the warning entry
Returns:
the refactoring status
See Also:
RefactoringStatusEntry

createWarningStatus

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

Parameters:
msg - the message of the warning entry
context - the context of the warning entry
Returns:
the refactoring status
See Also:
RefactoringStatusEntry

createErrorStatus

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

Parameters:
msg - the message of the error entry
Returns:
the refactoring status
See Also:
RefactoringStatusEntry

createErrorStatus

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

Parameters:
msg - the message of the error entry
context - the context of the error entry
Returns:
the refactoring status
See Also:
RefactoringStatusEntry

createFatalErrorStatus

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

Parameters:
msg - the message of the fatal entry
Returns:
the refactoring status
See Also:
RefactoringStatusEntry

createFatalErrorStatus

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

Parameters:
msg - the message of the fatal entry
context - the context of the fatal entry
Returns:
the refactoring status
See Also:
RefactoringStatusEntry

create

public static 
RefactoringStatus create(
IStatus status)
Creates a new 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.

Parameters:
status - the status to create a refactoring status from
Returns:
the refactoring status
Since:
3.2
See Also:
IStatus

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.

Parameters:
other - the refactoring status to merge with

addInfo

public void addInfo(
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.

Parameters:
msg - the message of the info entry
See Also:
RefactoringStatusEntry

addInfo

public void addInfo(
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.

Parameters:
msg - the message of the info entry
context - the context of the info entry
See Also:
RefactoringStatusEntry

addWarning

public void addWarning(
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.

Parameters:
msg - the message of the warning entry
See Also:
RefactoringStatusEntry

addWarning

public void addWarning(
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.

Parameters:
msg - the message of the warning entry
context - the context of the warning entry
See Also:
RefactoringStatusEntry

addError

public void addError(
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.

Parameters:
msg - the message of the error entry
See Also:
RefactoringStatusEntry

addError

public void addError(
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.

Parameters:
msg - the message of the error entry
context - the context of the error entry
See Also:
RefactoringStatusEntry

addFatalError

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

Parameters:
msg - the message of the fatal entry
See Also:
RefactoringStatusEntry

addFatalError

public void addFatalError(
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.

Parameters:
msg - the message of the fatal entry
context - the context of the fatal entry
See Also:
RefactoringStatusEntry

addEntry

public void addEntry(int severity,
                     
String msg,
                     
RefactoringStatusContext context,
                     
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.

Parameters:
severity - the severity of the entry
msg - the message of the entry
context - the context of the entry. Can be null
pluginId - the plug-in identifier of the entry. Can be null if argument code equals NO_CODE
code - the problem code of the entry. Must be either NO_CODE or a positive integer

addEntry

public 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. The severity of this status is set to the maximum of fSeverity and severity.

Parameters:
severity - the severity of the entry
msg - the message of the entry
context - the context of the entry. Can be null
pluginId - the plug-in identifier of the entry. Can be null if argument code equals NO_CODE
code - the problem code of the entry. Must be either NO_CODE or a positive integer
data - application specific data of the entry

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.

Parameters:
entry - the RefactoringStatusEntry to be added

isOK

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

Returns:
true if the severity is OK; otherwise false is returned

hasFatalError

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

Returns:
true if the current severity is FATAL; otherwise false is returned

hasError

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

Returns:
true if the current severity is FATAL or ERROR; otherwise false is returned

hasWarning

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

Returns:
true if the current severity is FATAL, ERROR or WARNING; otherwise false is returned

hasInfo

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

Returns:
true if the current severity is FATAL, ERROR, WARNING or INFO; otherwise false is returned

toString

public 
String toString()
Overrides:
toString in class Object

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire