Interface ConsoleService


  • public interface ConsoleService
    Generic console interface allowing any plugin to print messages to console window.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addErrorMessage​(java.lang.String originator, java.lang.String message)
      Appends an error message to the console text area.
      void addException​(java.lang.String originator, java.lang.Exception exc)
      Appends an exception to the console text area.
      void addMessage​(java.lang.String originator, java.lang.String message)
      Appends message to the console text area.
      void clearMessages()
      Clears all messages from the console.
      java.io.PrintWriter getStdErr()
      Returns a print writer object to use as standard error.
      java.io.PrintWriter getStdOut()
      Returns a print writer object to use as standard output.
      java.lang.String getText​(int offset, int length)
      Fetches the text contained within the given portion of the console.
      int getTextLength()
      Returns number of characters of currently in the console.
      void print​(java.lang.String msg)
      Prints the message into the console.
      void printError​(java.lang.String errmsg)
      Prints the error message into the console.
      void println​(java.lang.String msg)
      Prints the messages into the console followed by a line feed.
      void printlnError​(java.lang.String errmsg)
      Prints the error message into the console followed by a line feed.
    • Method Detail

      • addMessage

        void addMessage​(java.lang.String originator,
                        java.lang.String message)
        Appends message to the console text area. For example: "originator> message"
        Parameters:
        originator - a descriptive name of the message creator
        message - the message to appear in the console
      • addErrorMessage

        void addErrorMessage​(java.lang.String originator,
                             java.lang.String message)
        Appends an error message to the console text area. The message should be rendered is such a way as to denote that it is an error. For example, display in "red".
        Parameters:
        originator - a descriptive name of the message creator
        message - the message to appear in the console
      • addException

        void addException​(java.lang.String originator,
                          java.lang.Exception exc)
        Appends an exception to the console text area.
        Parameters:
        originator - a descriptive name of the message creator
        exc - the exception
      • clearMessages

        void clearMessages()
        Clears all messages from the console.
      • print

        void print​(java.lang.String msg)
        Prints the message into the console.
        Parameters:
        msg - the messages to print into the console
      • println

        void println​(java.lang.String msg)
        Prints the messages into the console followed by a line feed.
        Parameters:
        msg - the message to print into the console
      • printError

        void printError​(java.lang.String errmsg)
        Prints the error message into the console. It will be displayed in red.
        Parameters:
        errmsg - the error message to print into the console
      • printlnError

        void printlnError​(java.lang.String errmsg)
        Prints the error message into the console followed by a line feed. It will be displayed in red.
        Parameters:
        errmsg - the error message to print into the console
      • getStdOut

        java.io.PrintWriter getStdOut()
        Returns a print writer object to use as standard output.
        Returns:
        a print writer object to use as standard output
      • getStdErr

        java.io.PrintWriter getStdErr()
        Returns a print writer object to use as standard error.
        Returns:
        a print writer object to use as standard error
      • getTextLength

        int getTextLength()
        Returns number of characters of currently in the console. If the console is cleared, this number is reset. Please note: Support for this method is optional based on the underlying console implementation. If this method cannot be supported, please throw UnsupportedOperationException.
        Returns:
        number of characters >= 0
        Throws:
        java.lang.UnsupportedOperationException
      • getText

        java.lang.String getText​(int offset,
                                 int length)
        Fetches the text contained within the given portion of the console. Please note: Support for this method is optional based on the underlying console implementation. If this method cannot be supported, please throw UnsupportedOperationException.
        Parameters:
        offset - the offset into the console representing the desired start of the text >= 0
        length - the length of the desired string >= 0
        Returns:
        the text, in a String of length >= 0
        Throws:
        java.lang.UnsupportedOperationException