Package ghidra.app.services
Interface ConsoleService
public interface ConsoleService
Generic console interface allowing any plugin to print
messages to console window.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addErrorMessage
(String originator, String message) Appends an error message to the console text area.void
addException
(String originator, Exception exc) Appends an exception to the console text area.void
addMessage
(String originator, String message) Appends message to the console text area.void
Clears all messages from the console.Returns a print writer object to use as standard error.Returns a print writer object to use as standard output.getText
(int offset, int length) Fetches the text contained within the given portion of the console.int
Returns number of characters of currently in the console.void
Prints the message into the console.void
printError
(String errmsg) Prints the error message into the console.void
Prints the messages into the console followed by a line feed.void
printlnError
(String errmsg) Prints the error message into the console followed by a line feed.
-
Method Details
-
addMessage
Appends message to the console text area. For example: "originator> message"- Parameters:
originator
- a descriptive name of the message creatormessage
- the message to appear in the console
-
addErrorMessage
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 creatormessage
- the message to appear in the console
-
addException
Appends an exception to the console text area.- Parameters:
originator
- a descriptive name of the message creatorexc
- the exception
-
clearMessages
void clearMessages()Clears all messages from the console. -
print
Prints the message into the console.- Parameters:
msg
- the messages to print into the console
-
println
Prints the messages into the console followed by a line feed.- Parameters:
msg
- the message to print into the console
-
printError
Prints the error message into the console. It will be displayed in red.- Parameters:
errmsg
- the error message to print into the console
-
printlnError
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
PrintWriter getStdOut()Returns a print writer object to use as standard output.- Returns:
- a print writer object to use as standard output
-
getStdErr
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 throwUnsupportedOperationException
.- Returns:
- number of characters >= 0
- Throws:
UnsupportedOperationException
-
getText
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 throwUnsupportedOperationException
.- Parameters:
offset
- the offset into the console representing the desired start of the text >= 0length
- the length of the desired string >= 0- Returns:
- the text, in a String of length >= 0
- Throws:
UnsupportedOperationException
-