| java.lang.Object edu.rice.cs.util.text.ConsoleDocument edu.rice.cs.drjava.model.repl.InteractionsDocument
InteractionsDocument | public class InteractionsDocument extends ConsoleDocument (Code) | | A GUI toolkit-agnostic document that supports console-like interaction with a Java interpreter.
This class assumes that the embedded document supports readers/writers locking and uses that locking
protocol to ensure the integrity of the data added in this class
version: $Id: InteractionsDocument.java 4264 2007-11-15 01:33:48Z mgricken $ |
Method Summary | |
public void | addToHistory(String text) Adds the given text to the history of commands. | public void | appendExceptionResult(String exceptionClass, String message, String stackTrace, String styleName) Inserts the given exception data into the document with the given style. | public void | appendSyntaxErrorResult(String message, String interaction, int startRow, int startCol, int endRow, int endCol, String styleName) | public void | clearCurrentInteraction() Clears the current input text and then moves to the end of the command history. | public void | clearHistory() | public void | forwardHistorySearch(String searchString) Forward searches the history for the given string. | public void | forwardSearchInteractionsInHistory() Forward searches the history for interactions that started with the current interaction. | public String | getCurrentInteraction() Returns the string that the user has entered at the current prompt. | public String | getDefaultStyle() | protected History | getHistory() | public String | getHistoryAsString() Returns the entire history as a single string. | public String | getHistoryAsStringWithSemicolons() Returns the entire history as a single string. | public OptionListener<Integer> | getHistoryOptionListener() Accessor method for the history of commands. | public boolean | hasHistoryNext() Returns whether there is a next command in the history. | public boolean | inProgress() Returns whether an interaction is currently in progress. | public String | lastEntry() | public void | moveHistoryNext(String entry) Puts the next line from the history on the current line and moves the history forward one line. | public void | moveHistoryPrevious(String entry) Puts the previous line from the history on the current line and moves the history back one line. | public void | preparePrintJob() This method tells the document to prepare all the DrJavaBook and PagePrinter objects. | public boolean | recallNextInteractionInHistory() Gets the next interaction in the history and replaces whatever is on the current interactions input line
with this interaction. | public boolean | recallPreviousInteractionInHistory() Gets the previous interaction in the history and replaces whatever is on the current interactions input
line with this interaction. | public String | removeLastFromHistory() Returns the last history item and then removes it, or returns null if the history is empty. | public void | reset(String banner) Resets the document to a clean state. | public void | reverseHistorySearch(String searchString) Reverse searches the history for the given string. | public void | reverseSearchInteractionsInHistory() Reverse searches the history for interactions that started with the current interaction. | public void | saveHistory(FileSaveSelector selector) | public void | saveHistory(FileSaveSelector selector, String editedVersion) Saves the edited version of the current history to a file
Parameters: selector - File to save to Parameters: editedVersion - Edited verison of the history which will besaved to file instead of the lines saved in the history. | public void | setInProgress(boolean inProgress) Lets this document know whether an interaction is in progress. |
CHARACTER_RETURN_STYLE | final public static String CHARACTER_RETURN_STYLE(Code) | | |
DEBUGGER_STYLE | final public static String DEBUGGER_STYLE(Code) | | Style for debugger messages
|
DEFAULT_PROMPT | final public static String DEFAULT_PROMPT(Code) | | Default prompt.
|
ERROR_STYLE | final public static String ERROR_STYLE(Code) | | Style for error messages
|
NUMBER_RETURN_STYLE | final public static String NUMBER_RETURN_STYLE(Code) | | |
OBJECT_RETURN_STYLE | final public static String OBJECT_RETURN_STYLE(Code) | | |
STRING_RETURN_STYLE | final public static String STRING_RETURN_STYLE(Code) | | |
InteractionsDocument | public InteractionsDocument(ConsoleDocumentInterface document, String banner)(Code) | | Reset the document on startUp. Uses a history with configurable size.
Parameters: document - the edit document to use for the model |
InteractionsDocument | public InteractionsDocument(ConsoleDocumentInterface document, int maxHistorySize, String banner)(Code) | | Reset the document on startUp. Uses a history with the given maximum size. This history will not use the config
framework.
Parameters: document - EditDocumentInterface to use for the model Parameters: maxHistorySize - Number of commands to remember in the history |
InteractionsDocument | public InteractionsDocument(ConsoleDocumentInterface document, History history, String banner)(Code) | | Creates and resets the interactions document on DrJava startUp. Uses the given history.
Parameters: document - EditDocumentInterface to use for the model Parameters: history - History of commands |
addToHistory | public void addToHistory(String text)(Code) | | Adds the given text to the history of commands.
|
appendExceptionResult | public void appendExceptionResult(String exceptionClass, String message, String stackTrace, String styleName)(Code) | | Inserts the given exception data into the document with the given style.
Parameters: exceptionClass - Name of the exception that was thrown Parameters: message - Message contained in the exception Parameters: stackTrace - String representation of the stack trace Parameters: styleName - name of the style for formatting the exception |
appendSyntaxErrorResult | public void appendSyntaxErrorResult(String message, String interaction, int startRow, int startCol, int endRow, int endCol, String styleName)(Code) | | |
clearCurrentInteraction | public void clearCurrentInteraction()(Code) | | Clears the current input text and then moves to the end of the command history.
|
clearHistory | public void clearHistory()(Code) | | Clears the history
|
forwardHistorySearch | public void forwardHistorySearch(String searchString)(Code) | | Forward searches the history for the given string.
Parameters: searchString - the string to search for |
forwardSearchInteractionsInHistory | public void forwardSearchInteractionsInHistory()(Code) | | Forward searches the history for interactions that started with the current interaction.
|
getCurrentInteraction | public String getCurrentInteraction()(Code) | | Returns the string that the user has entered at the current prompt. Forwards to getCurrentInput().
|
getHistoryAsString | public String getHistoryAsString()(Code) | | Returns the entire history as a single string. Commands should be separated by semicolons.
|
getHistoryAsStringWithSemicolons | public String getHistoryAsStringWithSemicolons()(Code) | | Returns the entire history as a single string. Commands should be separated by semicolons. If an entire
command does not end in a semicolon, one is added.
|
hasHistoryNext | public boolean hasHistoryNext()(Code) | | Returns whether there is a next command in the history. Assumes that WriteLock is already held!
|
inProgress | public boolean inProgress()(Code) | | Returns whether an interaction is currently in progress. Should use ReadLock?
|
moveHistoryNext | public void moveHistoryNext(String entry)(Code) | | Puts the next line from the history on the current line and moves the history forward one line.
Parameters: entry - the current entry (perhaps edited from what is in history) |
moveHistoryPrevious | public void moveHistoryPrevious(String entry)(Code) | | Puts the previous line from the history on the current line and moves the history back one line.
Parameters: entry - the current entry (perhaps edited from what is in history) |
preparePrintJob | public void preparePrintJob()(Code) | | This method tells the document to prepare all the DrJavaBook and PagePrinter objects.
|
recallNextInteractionInHistory | public boolean recallNextInteractionInHistory()(Code) | | Gets the next interaction in the history and replaces whatever is on the current interactions input line
with this interaction.
|
recallPreviousInteractionInHistory | public boolean recallPreviousInteractionInHistory()(Code) | | Gets the previous interaction in the history and replaces whatever is on the current interactions input
line with this interaction. Assumes that the WriteLock is already held!
|
removeLastFromHistory | public String removeLastFromHistory()(Code) | | Returns the last history item and then removes it, or returns null if the history is empty.
|
reset | public void reset(String banner)(Code) | | Resets the document to a clean state. Does not reset the history.
|
reverseHistorySearch | public void reverseHistorySearch(String searchString)(Code) | | Reverse searches the history for the given string.
Parameters: searchString - the string to search for |
reverseSearchInteractionsInHistory | public void reverseSearchInteractionsInHistory()(Code) | | Reverse searches the history for interactions that started with the current interaction.
|
saveHistory | public void saveHistory(FileSaveSelector selector) throws IOException(Code) | | Saves the unedited version of the current history to a file
Parameters: selector - File to save to |
saveHistory | public void saveHistory(FileSaveSelector selector, String editedVersion) throws IOException(Code) | | Saves the edited version of the current history to a file
Parameters: selector - File to save to Parameters: editedVersion - Edited verison of the history which will besaved to file instead of the lines saved in the history. The savedfile will still include any tags needed to recognize it as a savedinteractions file. |
setInProgress | public void setInProgress(boolean inProgress)(Code) | | Lets this document know whether an interaction is in progress.
Parameters: inProgress - whether an interaction is in progress |
Methods inherited from edu.rice.cs.util.text.ConsoleDocument | protected void _clearCurrentInputText()(Code)(Java Doc) public void _forceInsertText(int offs, String str, String style) throws EditDocumentException(Code)(Java Doc) public void _insertText(int offs, String str, String style) throws EditDocumentException(Code)(Java Doc) public void _removeText(int offs, int len) throws EditDocumentException(Code)(Java Doc) public void acquireReadLock()(Code)(Java Doc) public void acquireWriteLock()(Code)(Java Doc) public void append(String str, String style) throws EditDocumentException(Code)(Java Doc) public void cleanUpPrintJob()(Code)(Java Doc) public void clearCurrentInput()(Code)(Java Doc) public void disablePrompt()(Code)(Java Doc) public void forceInsertText(int offs, String str, String style) throws EditDocumentException(Code)(Java Doc) public void forceRemoveText(int offs, int len) throws EditDocumentException(Code)(Java Doc) public String getCurrentInput()(Code)(Java Doc) public String getDefaultStyle()(Code)(Java Doc) public String getDocText(int offs, int len) throws EditDocumentException(Code)(Java Doc) public DocumentEditCondition getEditCondition()(Code)(Java Doc) public int getLength()(Code)(Java Doc) public Pageable getPageable() throws IllegalStateException(Code)(Java Doc) public String getPrompt()(Code)(Java Doc) public int getPromptPos()(Code)(Java Doc) public String getText()(Code)(Java Doc) public boolean hasPrompt()(Code)(Java Doc) public void insertBeforeLastPrompt(String text, String style)(Code)(Java Doc) public void insertNewLine(int pos)(Code)(Java Doc) public void insertPrompt()(Code)(Java Doc) public void insertText(int offs, String str, String style) throws EditDocumentException(Code)(Java Doc) public void preparePrintJob()(Code)(Java Doc) public void print() throws PrinterException(Code)(Java Doc) public void releaseReadLock()(Code)(Java Doc) public void releaseWriteLock()(Code)(Java Doc) public void removeText(int offs, int len) throws EditDocumentException(Code)(Java Doc) public void reset(String banner)(Code)(Java Doc) public void setBeep(Runnable beep)(Code)(Java Doc) public void setEditCondition(DocumentEditCondition condition)(Code)(Java Doc) public void setHasPrompt(boolean val)(Code)(Java Doc) public void setPrompt(String prompt)(Code)(Java Doc) public void setPromptPos(int newPos)(Code)(Java Doc)
|
|
|