|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Handles the bulk of DrJava's program logic. The UI components interface with the GlobalModel through its public methods, and GlobalModel responds via the GlobalModelListener interface. This removes the dependency on the UI for the logical flow of the program's features. With the current implementation, we can finally test the compile functionality of DrJava, along with many other things.
Method Summary | |
void |
addListener(GlobalModelListener listener)
Add a listener to this global model. |
boolean |
areAnyModifiedSinceSave()
Checks if any open definitions documents have been modified since last being saved. |
void |
clearCurrentInteraction()
Clears the current interaction text and then moves to the end of the command history. |
boolean |
closeAllFiles()
Attempts to close all open documents. |
boolean |
closeFile(OpenDefinitionsDocument doc)
Closes an open definitions document, prompting to save if the document has been changed. |
CompilerInterface |
getActiveCompiler()
Gets the compiler is the "active" compiler. |
CompilerInterface[] |
getAvailableCompilers()
Returns all registered compilers that are actually available. |
String |
getClasspath()
Returns the current classpath in use by the Interpreter JVM. |
CompilerError[] |
getCompilerErrorsWithoutFiles()
Gets the array of all compile errors without Files. |
StyledDocument |
getConsoleDocument()
Gets the console document. |
DebugManager |
getDebugManager()
Gets the DebugManager, which interfaces with the integrated debugger. |
int |
getDebugPort()
Returns an available port number to use for debugging the interactions JVM. |
ListModel |
getDefinitionsDocuments()
Gets a ListModel of the open definitions documents. |
OpenDefinitionsDocument |
getDocumentForFile(File file)
Returns the OpenDefinitionsDocument for the specified File, opening a new copy if one is not already open. |
DefinitionsEditorKit |
getEditorKit()
Fetches the javax.swing.EditorKit implementation for use
in the definitions pane. |
StyledDocument |
getInteractionsDocument()
Gets the interactions document. |
int |
getInteractionsFrozenPos()
Returns the first location in the document where editing is allowed. |
StyledDocument |
getJUnitDocument()
Gets the junit document. |
int |
getNumErrors()
Gets the total number of current errors. |
File |
getSourceFileFromPaths(String filename,
gj.util.Vector paths)
Searches for a file with the given name on the provided paths. |
File[] |
getSourceRootSet()
Gets an array of all sourceRoots for the open definitions documents, without duplicates. |
void |
interactionsReady()
Called when a new InteractionsJVM has registered as is ready for use. |
void |
interactionsResetting()
Called when the interactionsJVM has begun to be resetted |
void |
interpretCurrentInteraction()
Interprets the current given text at the prompt in the interactions pane. |
OpenDefinitionsDocument |
newFile()
Creates a new document in the definitions pane and adds it to the list of open documents. |
void |
nonTestCase()
Called from the JUnitTestManager if its given className is not a test case. |
OpenDefinitionsDocument |
openFile(FileOpenSelector com)
Open a file and read it into the definitions. |
OpenDefinitionsDocument |
openFiles(FileOpenSelector com)
|
void |
printDebugMessage(String s)
Called when the debugger wants to print a message. |
void |
quit()
Exits the program. |
void |
recallNextInteractionInHistory(Runnable failed)
Forwarding method to remove logical dependency of InteractionsPane on the InteractionsDocument. |
void |
recallPreviousInteractionInHistory(Runnable failed)
Forwarding method to remove logical dependency of InteractionsPane on the InteractionsDocument. |
void |
removeListener(GlobalModelListener listener)
Remove a listener from this global model. |
void |
replCalledSystemExit(int status)
Signifies that the most recent interpretation contained a call to System.exit. |
void |
replReturnedResult(String result)
Signifies that the most recent interpretation completed successfully, returning a value. |
void |
replReturnedVoid()
Signifies that the most recent interpretation completed successfully, returning no value. |
void |
replSystemErrPrint(String s)
Called when the repl prints to System.err. |
void |
replSystemOutPrint(String s)
Called when the repl prints to System.out. |
void |
replThrewException(String exceptionClass,
String message,
String stackTrace)
Signifies that the most recent interpretation was ended due to an exception being thrown. |
void |
resetCompilerErrors()
Resets the compiler error state to have no errors. |
void |
resetConsole()
Resets the console. |
void |
resetInteractions()
Clears and resets the interactions pane. |
void |
saveAllBeforeProceeding(GlobalModelListener.SaveReason reason)
Called to demand that one or more listeners saves all the definitions documents before proceeding. |
void |
saveAllFiles(FileSaveSelector com)
Saves all open documents, prompting when necessary. |
void |
saveAllFiles(FileSaveSelector[] com)
Saves all open documents, used for testing |
void |
setActiveCompiler(CompilerInterface compiler)
Sets which compiler is the "active" compiler. |
void |
systemErrPrint(String s)
Prints System.err to the DrJava console. |
void |
systemOutPrint(String s)
Prints System.out to the DrJava console. |
void |
testFinished(JUnitError[] errors)
Called from the JUnitTestManager after the test finishes |
void |
waitForInterpreter()
Blocks until the interpreter has registered. |
Method Detail |
public void addListener(GlobalModelListener listener)
listener
- a listener that reacts on events generated by the GlobalModelpublic void removeListener(GlobalModelListener listener)
listener
- a listener that reacts on events generated by the GlobalModelpublic DefinitionsEditorKit getEditorKit()
javax.swing.EditorKit
implementation for use
in the definitions pane.public ListModel getDefinitionsDocuments()
public StyledDocument getInteractionsDocument()
public StyledDocument getJUnitDocument()
public StyledDocument getConsoleDocument()
public CompilerError[] getCompilerErrorsWithoutFiles()
public int getNumErrors()
public void resetCompilerErrors()
public OpenDefinitionsDocument newFile()
public OpenDefinitionsDocument openFile(FileOpenSelector com) throws IOException, OperationCanceledException, AlreadyOpenException
com
- a command pattern command that selects what file
to openIOException
- OperationCanceledException
- if the open was canceledAlreadyOpenException
- if the file is already openpublic OpenDefinitionsDocument openFiles(FileOpenSelector com) throws IOException, OperationCanceledException, AlreadyOpenException
public boolean closeFile(OpenDefinitionsDocument doc)
public boolean closeAllFiles()
public void saveAllFiles(FileSaveSelector com) throws IOException
public void saveAllFiles(FileSaveSelector[] com) throws IOException
public void quit()
public OpenDefinitionsDocument getDocumentForFile(File file) throws IOException, OperationCanceledException
file
- File contained by the document to be returnedpublic void resetInteractions()
public void interactionsResetting()
public void interactionsReady()
public void resetConsole()
public void clearCurrentInteraction()
public void recallPreviousInteractionInHistory(Runnable failed)
public void recallNextInteractionInHistory(Runnable failed)
public void interpretCurrentInteraction()
public int getInteractionsFrozenPos()
public void systemOutPrint(String s)
public void systemErrPrint(String s)
public void replSystemOutPrint(String s)
public void replSystemErrPrint(String s)
public void printDebugMessage(String s)
public void waitForInterpreter()
public void replReturnedVoid()
public void replReturnedResult(String result)
result
- The .toString-ed version of the value that was returned
by the interpretation. We must return the String form
because returning the Object directly would require the
data type to be serializable.public void replThrewException(String exceptionClass, String message, String stackTrace)
exceptionClass
- The name of the class of the thrown exceptionmessage
- The exception's messagestackTrace
- The stack trace of the exceptionpublic void replCalledSystemExit(int status)
status
- The exit status that will be returned.public CompilerInterface[] getAvailableCompilers()
CompilerRegistry.getAvailableCompilers()
public void setActiveCompiler(CompilerInterface compiler)
compiler
- Compiler to set active.getActiveCompiler()
,
CompilerRegistry.setActiveCompiler(edu.rice.cs.drjava.model.compiler.CompilerInterface)
public CompilerInterface getActiveCompiler()
setActiveCompiler(edu.rice.cs.drjava.model.compiler.CompilerInterface)
,
CompilerRegistry.getActiveCompiler()
public String getClasspath()
public File[] getSourceRootSet()
InvalidPackageException
- if the package statement in one
of the open documents is invalid.public DebugManager getDebugManager()
public int getDebugPort() throws IOException
IOException
- if unable to get a valid port number.public void saveAllBeforeProceeding(GlobalModelListener.SaveReason reason)
reason
- the reason behind the demand to save the filepublic boolean areAnyModifiedSinceSave()
public File getSourceFileFromPaths(String filename, gj.util.Vector paths)
filename
- Name of the source file to look forpaths
- An array of directories to searchpublic void nonTestCase()
public void testFinished(JUnitError[] errors)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |