|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GlobalModel
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 an unit testing functionality of DrJava, along with many other things. An ongoing refactoring effort will be moving many GlobalModel functions into more specific sub-interfaces for particular behaviors:
DefaultGlobalModel
,
ILoadDocuments
,
CompilerModel
,
JUnitModel
,
JavadocModel
Field Summary | |
---|---|
static Iterable<File> |
RUNTIME_CLASS_PATH
|
Method Summary | |
---|---|
void |
addAuxiliaryFile(OpenDefinitionsDocument doc)
Adds a document to the list of auxiliary files. |
void |
addListener(GlobalModelListener listener)
Add a listener to this global model. |
void |
addToBrowserHistory()
Add the current location to the browser history. |
void |
cleanBuildDirectory()
Cleans the build directory. |
void |
clearHistory()
Clears the interactions 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. |
boolean |
closeFileWithoutPrompt(OpenDefinitionsDocument doc)
Closes an open definitions document, without prompting to save if the document has been changed. |
void |
closeProject(boolean qutting)
Performs any needed operations on the model before closing the project and its files. |
void |
configNewProject()
Configures a new project (created by createNewProject) and saves it to disk. |
RegionManager<MovingDocumentRegion> |
createFindResultsManager()
|
void |
createNewProject(File projFile)
Creates a new project with specified project file and default values for other properties. |
File |
findFileInPaths(String fileName,
Iterable<File> paths)
Searches for a file with the given name on the provided paths. |
String |
fixPathForNavigator(String path)
Formats a string pathname for use in the document navigator. |
void |
forceQuit()
Halts the program immediately. |
boolean |
getAutoRefreshStatus()
Gets autorefresh status of the project |
String |
getAuxiliaryBinTitle()
Gives the title of the aux files bin for the navigator |
List<OpenDefinitionsDocument> |
getAuxiliaryDocuments()
|
RegionManager<MovingDocumentRegion> |
getBookmarkManager()
|
RegionManager<Breakpoint> |
getBreakpointManager()
|
BrowserHistoryManager |
getBrowserHistoryManager()
|
File |
getBuildDirectory()
|
List<File> |
getClassFiles()
|
Iterable<File> |
getClassPath()
Get the class path to be used in all class-related operations. |
CompilerModel |
getCompilerModel()
Gets the CompilerModel, which provides all methods relating to compilers. |
ConsoleDocument |
getConsoleDocument()
Gets the console document. |
File |
getCreateJarFile()
Return the create jar file for the project. |
int |
getCreateJarFlags()
Return the create jar file for the project. |
Debugger |
getDebugger()
Gets the Debugger, which interfaces with the integrated debugger. |
int |
getDebugPort()
Returns an available port number to use for debugging the interactions JVM. |
int |
getDocumentCount()
Returns the document count |
OpenDefinitionsDocument |
getDocumentForFile(File file)
Returns the OpenDefinitionsDocument for the specified File, opening a new copy if one is not already open. |
DocumentIterator |
getDocumentIterator()
Gets a DocumentIterator to allow navigating through open swing Documents. |
IDocumentNavigator<OpenDefinitionsDocument> |
getDocumentNavigator()
Gets the DocumentNavigator, which controls the document view. |
DefinitionsEditorKit |
getEditorKit()
Fetches the EditorKit implementation for use in the definitions pane. |
String |
getExternalBinTitle()
Gives the title of the external files bin for the navigator |
Iterable<File> |
getExtraClassPath()
Returns only the project's extra classpaths. |
String |
getHistoryAsString()
Returns the entire history as a String. |
String |
getHistoryAsStringWithSemicolons()
Returns the entire history as a String with semicolons as needed. |
Iterable<File> |
getInteractionsClassPath()
Returns the current classpath in use by the Interpreter JVM. |
InteractionsDocument |
getInteractionsDocument()
Gets the (toolkit-independent) interactions document. |
DefaultInteractionsModel |
getInteractionsModel()
Returns the interactions model. |
JavadocModel |
getJavadocModel()
Gets the JavadocModel, which provides all methods relating to Javadoc. |
JUnitModel |
getJUnitModel()
Gets the JUnitModel, which provides all methods relating to JUnit testing. |
File |
getMainClass()
Return the main file for the project If not in project mode, returns null. |
File |
getMasterWorkingDirectory()
|
List<OpenDefinitionsDocument> |
getNonProjectDocuments()
Returns a list of OpenDefinitionsDocuments that do not belong to the currently active project. If no project is active, all documents are returned. |
GlobalEventNotifier |
getNotifier()
|
int |
getNumCompErrors()
Returns the number of compiler errors produced by the last compilation. |
OpenDefinitionsDocument |
getODDForDocument(AbstractDocumentInterface doc)
CHECK IF NEEDED! |
List<OpenDefinitionsDocument> |
getOpenDefinitionsDocuments()
Returns a collection of all documents currently open for editing. |
PageFormat |
getPageFormat()
|
List<OpenDefinitionsDocument> |
getProjectDocuments()
Teturns a list of OpenDefinitionsDocuments that do belong to the currently active project. If no project is active, no documents are returned. |
File |
getProjectFile()
|
File[] |
getProjectFiles()
|
File |
getProjectRoot()
|
String |
getSourceBinTitle()
Gives the title of the source bin for the navigator |
File |
getSourceFile(String fileName)
Searches for a file with the given name on the current source roots and the augmented classpath. |
Iterable<File> |
getSourceRootSet()
Gets a list of all sourceRoots for the open definitions documents, without duplicates. |
InteractionsDJDocument |
getSwingConsoleDocument()
TODO: remove this swing dependency. |
InteractionsDJDocument |
getSwingInteractionsDocument()
TODO: remove this swing dependency. |
File |
getWorkingDirectory()
|
boolean |
hasModifiedDocuments()
Checks if any open definitions documents have been modified since last being saved. |
boolean |
hasModifiedDocuments(List<OpenDefinitionsDocument> lod)
Checks if any of the given documents have been modified since last being saved. |
boolean |
hasOutOfSyncDocuments()
|
boolean |
hasOutOfSyncDocuments(List<OpenDefinitionsDocument> lod)
|
boolean |
hasUntitledDocuments()
Checks if any open definitions documents are untitled. |
boolean |
inProject(File f)
Returns true the given file is in the current project file. |
boolean |
inProjectPath(OpenDefinitionsDocument doc)
A file is in the project if the source root is the same as the project root. |
void |
interpretCurrentInteraction()
Interprets the current given text at the prompt in the interactions pane. |
boolean |
isProjectActive()
|
boolean |
isProjectChanged()
Returns true if the project state has been changed |
void |
loadHistory(FileOpenSelector selector)
Interprets file selected in the FileOpenSelector. |
InteractionsScriptModel |
loadHistoryAsScript(FileOpenSelector selector)
Loads the history/histories from the given selector. |
OpenDefinitionsDocument |
newFile()
Creates a new document in the definitions pane and adds it to the list of open documents. |
OpenDefinitionsDocument |
newTestCase(String name,
boolean makeSetUp,
boolean makeTearDown)
Creates a new junit test case. |
void |
openFolder(File dir,
boolean rec)
|
void |
openProject(File file)
Parses out the given project file, sets up the state and other configurations such as the Navigator and the classpath, and returns an array of files to open. |
void |
printDebugMessage(String s)
Called when the debugger wants to print a message. |
void |
quit()
Exits the program. |
void |
refreshActiveDocument()
Re-runs the global listeners on the active document. |
void |
reloadProject(File f,
HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info)
Reloads a project without writing to disk. |
void |
removeAuxiliaryFile(OpenDefinitionsDocument doc)
Removes a document from the list of auxiliary files. |
void |
removeFindResultsManager(RegionManager<MovingDocumentRegion> rm)
Dispose a manager for find result regions. |
void |
removeListener(GlobalModelListener listener)
Remove a listener from this global model. |
void |
resetConsole()
Resets the console. |
void |
resetInteractions(File wd)
Clears and resets the interactions pane in the specified working directory, provided that the operation has some effect. |
void |
resetInteractions(File wd,
boolean forceReset)
Clears and resets the interactions pane in the specified working directory. |
void |
saveAllFiles(FileSaveSelector com)
Saves all open documents, prompting when necessary. |
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 |
saveProject(File f,
HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info)
Writes the project file to disk |
void |
setAutoRefreshStatus(boolean b)
Sets autorefresh status of the project |
void |
setBuildDirectory(File f)
Sets the current build directory. |
void |
setCreateJarFile(File f)
Sets the create jar file of the project. |
void |
setCreateJarFlags(int f)
Sets the create jar flags of the project. |
void |
setDocumentNavigator(IDocumentNavigator<OpenDefinitionsDocument> newnav)
|
void |
setExtraClassPath(Iterable<File> cp)
Sets the set of classpath entries to use as the projects set of classpath entries. |
void |
setMainClass(File f)
Sets the main file of the project. |
void |
setNumCompErrors(int num)
Sets the number of compiler errors produced by the last compilation. |
void |
setPageFormat(PageFormat format)
|
void |
setProjectChanged(boolean changed)
Notifies the project state that the project has been changed. |
void |
setProjectFile(File f)
Sets project file to specifed value; used in "Save Project As ..." command in MainFrame. |
void |
setProjectRoot(File f)
Sets the source root for the project. |
void |
setWorkingDirectory(File f)
Sets the working directory for the Slave JVM (only applies to project mode). |
void |
systemErrPrint(String s)
Prints System.err to the DrJava console. |
void |
systemInEcho(String s)
Prints the given string to the DrJava console as an echo of System.in. |
void |
systemOutPrint(String s)
Prints System.out to the DrJava console. |
void |
waitForInterpreter()
Blocks until the interpreter has registered. |
Methods inherited from interface edu.rice.cs.drjava.model.ILoadDocuments |
---|
openFile, openFiles |
Field Detail |
---|
static final Iterable<File> RUNTIME_CLASS_PATH
Method Detail |
---|
void addListener(GlobalModelListener listener)
listener
- a listener that reacts on events generated by the GlobalModelvoid removeListener(GlobalModelListener listener)
listener
- a listener that reacts on events generated by the GlobalModelDefaultInteractionsModel getInteractionsModel()
CompilerModel getCompilerModel()
JUnitModel getJUnitModel()
JavadocModel getJavadocModel()
Debugger getDebugger()
IDocumentNavigator<OpenDefinitionsDocument> getDocumentNavigator()
void setDocumentNavigator(IDocumentNavigator<OpenDefinitionsDocument> newnav)
RegionManager<Breakpoint> getBreakpointManager()
RegionManager<MovingDocumentRegion> getBookmarkManager()
RegionManager<MovingDocumentRegion> createFindResultsManager()
void removeFindResultsManager(RegionManager<MovingDocumentRegion> rm)
BrowserHistoryManager getBrowserHistoryManager()
void addToBrowserHistory()
OpenDefinitionsDocument newFile()
OpenDefinitionsDocument newTestCase(String name, boolean makeSetUp, boolean makeTearDown)
name
- the name of the new test casemakeSetUp
- true iff an empty setUp() method should be includedmakeTearDown
- true iff an empty tearDown() method should be included
boolean closeFile(OpenDefinitionsDocument doc)
boolean closeFileWithoutPrompt(OpenDefinitionsDocument doc)
boolean closeAllFiles()
void openFolder(File dir, boolean rec) throws IOException, OperationCanceledException, AlreadyOpenException
IOException
OperationCanceledException
AlreadyOpenException
void saveAllFiles(FileSaveSelector com) throws IOException
IOException
void createNewProject(File projFile)
projFile
- the new project file (which does not yet exist in the file system).void configNewProject() throws IOException
IOException
void saveProject(File f, HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info) throws IOException
f
- where to save the projectinfo
- Extra view-related information that should be included in the project file
IOException
void reloadProject(File f, HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info) throws IOException
f
- project file; does not actually get touched
IOException
String fixPathForNavigator(String path) throws IOException
IOException
String getSourceBinTitle()
String getExternalBinTitle()
String getAuxiliaryBinTitle()
void addAuxiliaryFile(OpenDefinitionsDocument doc)
void removeAuxiliaryFile(OpenDefinitionsDocument doc)
void openProject(File file) throws IOException, MalformedProjectFileException
file
- The project file to parse
IOException
MalformedProjectFileException
void closeProject(boolean qutting)
File getSourceFile(String fileName)
fileName
- Name of the source file to look for
File findFileInPaths(String fileName, Iterable<File> paths)
fileName
- Name of the source file to look forpaths
- An array of directories to searchIterable<File> getSourceRootSet()
DefinitionsEditorKit getEditorKit()
EditorKit
implementation for use in the definitions pane.
DocumentIterator getDocumentIterator()
void refreshActiveDocument()
ConsoleDocument getConsoleDocument()
InteractionsDJDocument getSwingConsoleDocument()
void resetConsole()
void systemOutPrint(String s)
void systemErrPrint(String s)
void systemInEcho(String s)
InteractionsDocument getInteractionsDocument()
InteractionsDJDocument getSwingInteractionsDocument()
void resetInteractions(File wd)
void resetInteractions(File wd, boolean forceReset)
void waitForInterpreter()
void interpretCurrentInteraction()
Iterable<File> getInteractionsClassPath()
void loadHistory(FileOpenSelector selector) throws IOException
IOException
InteractionsScriptModel loadHistoryAsScript(FileOpenSelector selector) throws IOException, OperationCanceledException
IOException
OperationCanceledException
void clearHistory()
void saveHistory(FileSaveSelector selector) throws IOException
selector
- File to save to
IOException
void saveHistory(FileSaveSelector selector, String editedVersion) throws IOException
selector
- File to save toeditedVersion
- Edited verison 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
String getHistoryAsStringWithSemicolons()
String getHistoryAsString()
void printDebugMessage(String s)
int getDebugPort() throws IOException
IOException
- if unable to get a valid port number.Iterable<File> getClassPath()
PageFormat getPageFormat()
void setPageFormat(PageFormat format)
void quit()
void forceQuit()
int getDocumentCount()
int getNumCompErrors()
void setNumCompErrors(int num)
OpenDefinitionsDocument getODDForDocument(AbstractDocumentInterface doc)
List<OpenDefinitionsDocument> getNonProjectDocuments()
List<OpenDefinitionsDocument> getProjectDocuments()
boolean isProjectActive()
File getProjectFile()
File[] getProjectFiles()
File getProjectRoot()
void setProjectFile(File f)
void setProjectRoot(File f)
File getBuildDirectory()
void setBuildDirectory(File f)
boolean getAutoRefreshStatus()
void setAutoRefreshStatus(boolean b)
File getMasterWorkingDirectory()
File getWorkingDirectory()
void setWorkingDirectory(File f)
void setMainClass(File f)
File getMainClass()
Iterable<File> getExtraClassPath()
void setExtraClassPath(Iterable<File> cp)
void setCreateJarFile(File f)
File getCreateJarFile()
void setCreateJarFlags(int f)
int getCreateJarFlags()
boolean inProject(File f)
boolean inProjectPath(OpenDefinitionsDocument doc)
void setProjectChanged(boolean changed)
boolean isProjectChanged()
boolean hasOutOfSyncDocuments()
boolean hasOutOfSyncDocuments(List<OpenDefinitionsDocument> lod)
void cleanBuildDirectory()
List<File> getClassFiles()
List<OpenDefinitionsDocument> getOpenDefinitionsDocuments()
List<OpenDefinitionsDocument> getAuxiliaryDocuments()
boolean hasModifiedDocuments()
boolean hasModifiedDocuments(List<OpenDefinitionsDocument> lod)
boolean hasUntitledDocuments()
OpenDefinitionsDocument getDocumentForFile(File file) throws IOException
file
- File contained by the document to be returned
IOException
GlobalEventNotifier getNotifier()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |