Class RefactoringStatusEntry


  • public class RefactoringStatusEntry
    extends Object
    An immutable object representing an entry in the list in RefactoringStatus. A refactoring status entry consists of a severity, a message, a problem code (represented by a tuple(plug-in identifier and code number)), a context object and a generic data pointer. The context object is used to provide context information for the problem itself. An example context is a tuple consisting of the resource that contains the problem and a corresponding line number.

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

    Since:
    3.0
    Restriction:
    This class is not intended to be subclassed by clients.
    • Field Detail

      • NO_CODE

        public static final int NO_CODE
        A special problem code indicating that no problem code is provided. If NO_CODE is used then the plug-in identifier can be null
        See Also:
        Constant Field Values
    • Constructor Detail

      • RefactoringStatusEntry

        public RefactoringStatusEntry​(int severity,
                                      String msg)
        Creates a new refactoring status entry. The context is set to null the problem code is set to NO_CODE, the plug-in identifier is set to null and the data pointer is set to null as well.
        Parameters:
        severity - the severity
        msg - the message
      • RefactoringStatusEntry

        public RefactoringStatusEntry​(int severity,
                                      String msg,
                                      RefactoringStatusContext context)
        Creates a new refactoring status entry. The problem code is set to NO_CODE, the plug-in identifier is set to null and the data pointer is set to null as well.
        Parameters:
        severity - the severity
        msg - the message
        context - the context. Can be null
      • RefactoringStatusEntry

        public RefactoringStatusEntry​(int severity,
                                      String msg,
                                      RefactoringStatusContext context,
                                      String pluginId,
                                      int code)
        Creates a new refactoring status entry.
        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 equals or greater than zero
      • RefactoringStatusEntry

        public RefactoringStatusEntry​(int severity,
                                      String msg,
                                      RefactoringStatusContext context,
                                      String pluginId,
                                      int code,
                                      Object data)
        Creates a new refactoring status entry.
        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
    • Method Detail

      • getMessage

        public String getMessage()
        Returns the message of the status entry.
        Returns:
        the message
      • getContext

        public RefactoringStatusContext getContext()
        Returns the context which can be used to show more detailed information regarding this status entry in the UI. The method may return null indicating that no context is available.
        Returns:
        the status entry's context
      • getPluginId

        public String getPluginId()
        Returns the plug-in identifier associated with the problem code. Might return null if the problem code equals NO_CODE.
        Returns:
        the plug-in identifier
      • getCode

        public int getCode()
        Returns the problem code.
        Returns:
        the problem code
      • getData

        public Object getData()
        Returns the application defined entry data associated with the receiver, or null if it has not been set.
        Returns:
        the entry data
      • isFatalError

        public boolean isFatalError()
        Returns whether the entry represents a fatal error or not.
        Returns:
        true if (severity ==RefactoringStatus.FATAL)
      • isError

        public boolean isError()
        Returns whether the entry represents an error or not.
        Returns:
        true if (severity ==RefactoringStatus.ERROR).
      • isWarning

        public boolean isWarning()
        Returns whether the entry represents a warning or not.
        Returns:
        true if (severity ==RefactoringStatus.WARNING).
      • isInfo

        public boolean isInfo()
        Returns whether the entry represents an information or not.
        Returns:
        true if (severity ==RefactoringStatus.INFO).
      • toStatus

        public IStatus toStatus()
        Returns this refactoring status entry as an IStatus.

        If this refactoring status entry has a severity of RefactoringStatus.FATAL, the returned status will have a severity of IStatus.ERROR, otherwise a status with severity corresponding to the refactoring status entry is returned. If the plugin id of this refactoring status entry is not defined, the plugin id org.eclipse.ltk.core.refactoring will be used in the returned status.

        Returns:
        the corresponding status
        Since:
        3.2