|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.util.text.ConsoleDocument
edu.rice.cs.drjava.model.repl.InteractionsDocument
public class InteractionsDocument
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
Field Summary | |
---|---|
static String |
CHARACTER_RETURN_STYLE
|
static String |
DEBUGGER_STYLE
Style for debugger messages |
static String |
DEFAULT_PROMPT
Default prompt. |
static String |
ERROR_STYLE
Style for error messages |
static String |
NUMBER_RETURN_STYLE
|
static String |
OBJECT_RETURN_STYLE
|
static String |
STRING_RETURN_STYLE
|
Fields inherited from class edu.rice.cs.util.text.ConsoleDocument |
---|
_beep, _book, _document, _prompt, DEFAULT_CONSOLE_PROMPT, DEFAULT_STYLE, SYSTEM_ERR_STYLE, SYSTEM_IN_STYLE, SYSTEM_OUT_STYLE |
Constructor Summary | |
---|---|
InteractionsDocument(ConsoleDocumentInterface document)
Reset the document on startUp. |
|
InteractionsDocument(ConsoleDocumentInterface document,
History history)
Creates and resets the interactions document on DrJava startUp. |
|
InteractionsDocument(ConsoleDocumentInterface document,
int maxHistorySize)
Reset the document on startUp. |
Method Summary | |
---|---|
void |
addToHistory(String text)
Adds the given text to the history of commands. |
void |
appendExceptionResult(String message,
String styleName)
Inserts the given exception data into the document with the given style. |
void |
appendSyntaxErrorResult(String message,
String interaction,
int startRow,
int startCol,
int endRow,
int endCol,
String styleName)
|
void |
clearCurrentInteraction()
Clears the current input text and then moves to the end of the command history. |
void |
clearHistory()
Clears the history |
void |
forwardHistorySearch(String searchString)
Forward searches the history for the given string. |
void |
forwardSearchInteractionsInHistory()
Forward searches the history for interactions that started with the current interaction. |
String |
getCurrentInteraction()
Returns the string that the user has entered at the current prompt. |
String |
getDefaultStyle()
Gets the String identifying the default style for this document if one exists; null otherwise. |
protected History |
getHistory()
|
String |
getHistoryAsString()
Returns the entire history as a single string. |
String |
getHistoryAsStringWithSemicolons()
Returns the entire history as a single string. |
OptionListener<Integer> |
getHistoryOptionListener()
Accessor method for the history of commands. |
boolean |
hasHistoryNext()
Returns whether there is a next command in the history. |
boolean |
inProgress()
Returns whether an interaction is currently in progress. |
String |
lastEntry()
|
void |
moveHistoryNext(String entry)
Puts the next line from the history on the current line and moves the history forward one line. |
void |
moveHistoryPrevious(String entry)
Puts the previous line from the history on the current line and moves the history back one line. |
void |
preparePrintJob()
This method tells the document to prepare all the DrJavaBook and PagePrinter objects. |
boolean |
recallNextInteractionInHistory()
Gets the next interaction in the history and replaces whatever is on the current interactions input line with this interaction. |
boolean |
recallPreviousInteractionInHistory()
Gets the previous interaction in the history and replaces whatever is on the current interactions input line with this interaction. |
String |
removeLastFromHistory()
Returns the last history item and then removes it, or returns null if the history is empty. |
void |
reset(String banner)
Resets the document to a clean state. |
void |
reverseHistorySearch(String searchString)
Reverse searches the history for the given string. |
void |
reverseSearchInteractionsInHistory()
Reverse searches the history for interactions that started with the current interaction. |
void |
saveHistory(FileSaveSelector selector)
Saves the unedited version of the current history to a file |
void |
saveHistory(FileSaveSelector selector,
String editedVersion)
Saves the edited version of the current history to a file |
void |
setBanner(String banner)
Sets the banner in an empty docuemnt. |
void |
setInProgress(boolean inProgress)
Lets this document know whether an interaction is in progress. |
Methods inherited from class edu.rice.cs.util.text.ConsoleDocument |
---|
_clearCurrentInputText, append, cleanUpPrintJob, clearCurrentInput, disablePrompt, forceInsertText, forceRemoveText, getCurrentInput, getDocText, getEditCondition, getLength, getPageable, getPrompt, getPromptLength, getPromptPos, getText, hasPrompt, insertBeforeLastPrompt, insertNewline, insertPrompt, insertText, print, removeText, setBeep, setEditCondition, setHasPrompt, setPrompt, setPromptPos |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_PROMPT
public static final String ERROR_STYLE
public static final String DEBUGGER_STYLE
public static final String OBJECT_RETURN_STYLE
public static final String STRING_RETURN_STYLE
public static final String CHARACTER_RETURN_STYLE
public static final String NUMBER_RETURN_STYLE
Constructor Detail |
---|
public InteractionsDocument(ConsoleDocumentInterface document)
document
- the edit document to use for the modelpublic InteractionsDocument(ConsoleDocumentInterface document, int maxHistorySize)
document
- EditDocumentInterface to use for the modelmaxHistorySize
- Number of commands to remember in the historypublic InteractionsDocument(ConsoleDocumentInterface document, History history)
document
- EditDocumentInterface to use for the modelhistory
- History of commandsMethod Detail |
---|
public void setInProgress(boolean inProgress)
inProgress
- whether an interaction is in progresspublic boolean inProgress()
public void setBanner(String banner)
public void reset(String banner)
reset
in class ConsoleDocument
public OptionListener<Integer> getHistoryOptionListener()
public void addToHistory(String text)
public String removeLastFromHistory()
public void saveHistory(FileSaveSelector selector) throws IOException
selector
- File to save to
IOException
public void saveHistory(FileSaveSelector selector, String editedVersion) throws IOException
selector
- File to save toeditedVersion
- Edited version of the history which will be
saved to file instead of the lines saved in the history. The saved
file will still include any tags needed to recognize it as a saved
interactions file.
IOException
public String getHistoryAsStringWithSemicolons()
public String getHistoryAsString()
public void clearHistory()
public String lastEntry()
public void moveHistoryPrevious(String entry)
entry
- the current entry (perhaps edited from what is in history)public void moveHistoryNext(String entry)
entry
- the current entry (perhaps edited from what is in history)public boolean hasHistoryNext()
public void reverseHistorySearch(String searchString)
searchString
- the string to search forpublic void forwardHistorySearch(String searchString)
searchString
- the string to search forpublic boolean recallPreviousInteractionInHistory()
public boolean recallNextInteractionInHistory()
public void reverseSearchInteractionsInHistory()
public void forwardSearchInteractionsInHistory()
public void appendExceptionResult(String message, String styleName)
message
- Message contained in the exceptionstyleName
- name of the style for formatting the exceptionpublic void appendSyntaxErrorResult(String message, String interaction, int startRow, int startCol, int endRow, int endCol, String styleName)
public void clearCurrentInteraction()
public String getCurrentInteraction()
public String getDefaultStyle()
EditDocumentInterface
getDefaultStyle
in interface EditDocumentInterface
getDefaultStyle
in class ConsoleDocument
public void preparePrintJob()
preparePrintJob
in class ConsoleDocument
protected History getHistory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |