|
||||||||||
| 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| 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 |
closeFiles(java.util.List<OpenDefinitionsDocument> docs)
This function closes a group of files assuming that the files are contiguous in the enumeration provided by the document navigator. |
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(java.io.File projFile)
Creates a new project with specified project file and default values for other properties. |
java.io.File |
findFileInPaths(java.lang.String fileName,
java.lang.Iterable<java.io.File> paths)
Searches for a file with the given name on the provided paths. |
java.lang.String |
fixPathForNavigator(java.lang.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 |
java.lang.String |
getAuxiliaryBinTitle()
Gives the title of the aux files bin for the navigator |
java.util.List<OpenDefinitionsDocument> |
getAuxiliaryDocuments()
|
RegionManager<MovingDocumentRegion> |
getBookmarkManager()
|
RegionManager<Breakpoint> |
getBreakpointManager()
|
BrowserHistoryManager |
getBrowserHistoryManager()
|
java.io.File |
getBuildDirectory()
|
java.util.List<java.io.File> |
getClassFiles()
|
java.lang.Iterable<java.io.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. |
java.io.File |
getCreateJarFile()
Return the create jar file for the project. |
int |
getCreateJarFlags()
Return the create jar file for the project. |
java.lang.String |
getCustomManifest()
|
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(java.io.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. |
java.lang.String |
getExternalBinTitle()
Gives the title of the external files bin for the navigator |
java.lang.Iterable<AbsRelFile> |
getExtraClassPath()
Returns only the project's extra classpaths. |
java.lang.String |
getHistoryAsString()
Returns the entire history as a String. |
java.lang.String |
getHistoryAsStringWithSemicolons()
Returns the entire history as a String with semicolons as needed. |
java.lang.Iterable<java.io.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. |
java.util.List<OpenDefinitionsDocument> |
getLLOpenDefinitionsDocuments()
Returns a collection of language level documents. |
java.lang.String |
getMainClass()
Return the main file for the project If not in project mode, returns null. |
java.io.File |
getMainClassContainingFile()
Return the File that contains the Main-Class. |
java.io.File |
getMasterWorkingDirectory()
|
java.util.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! |
java.util.List<OpenDefinitionsDocument> |
getOpenDefinitionsDocuments()
Returns a collection of all documents currently open for editing. |
java.util.List<OpenDefinitionsDocument> |
getOutOfSyncDocuments()
|
java.util.List<OpenDefinitionsDocument> |
getOutOfSyncDocuments(java.util.List<OpenDefinitionsDocument> lod)
|
java.awt.print.PageFormat |
getPageFormat()
|
java.util.Map<OptionParser<?>,java.lang.String> |
getPreferencesStoredInProject()
|
java.util.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. |
java.io.File |
getProjectFile()
|
java.io.File[] |
getProjectFiles()
|
java.io.File |
getProjectRoot()
|
java.lang.String |
getSourceBinTitle()
Gives the title of the source bin for the navigator |
java.io.File |
getSourceFile(java.lang.String fileName)
Searches for a file with the given name on the current source roots and the augmented classpath. |
java.lang.Iterable<java.io.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. |
java.io.File |
getWorkingDirectory()
|
boolean |
hasModifiedDocuments()
Checks if any open definitions documents have been modified since last being saved. |
boolean |
hasModifiedDocuments(java.util.List<OpenDefinitionsDocument> lod)
Checks if any of the given documents have been modified since last being saved. |
boolean |
hasOutOfSyncDocuments()
|
boolean |
hasOutOfSyncDocuments(java.util.List<OpenDefinitionsDocument> lod)
|
boolean |
hasUntitledDocuments()
Checks if any open definitions documents are untitled. |
boolean |
inProject(java.io.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 |
newFile(java.lang.String text)
Creates a new document in the definitions pane, containing the specified text, and adds it to the list of open documents. |
OpenDefinitionsDocument |
newTestCase(java.lang.String name,
boolean makeSetUp,
boolean makeTearDown)
Creates a new junit test case. |
void |
openFolder(java.io.File dir,
boolean rec,
java.lang.String ext)
|
void |
openProject(java.io.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(java.lang.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(java.io.File f,
java.util.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(java.io.File wd)
Clears and resets the interactions pane in the specified working directory, provided that the operation has some effect. |
void |
resetInteractions(java.io.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 |
saveConsoleCopy(ConsoleDocument doc,
FileSaveSelector selector)
Save copy of Console or Interactions Pane to text file. |
void |
saveHistory(FileSaveSelector selector)
Saves the unedited version of the current history to a file |
void |
saveHistory(FileSaveSelector selector,
java.lang.String editedVersion)
Saves the edited version of the current history to a file |
void |
saveProject(java.io.File f,
java.util.HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info)
Writes the project file to disk |
void |
setAutoRefreshStatus(boolean b)
Sets autorefresh status of the project |
void |
setBuildDirectory(java.io.File f)
Sets the current build directory. |
void |
setCreateJarFile(java.io.File f)
Sets the create jar file of the project. |
void |
setCreateJarFlags(int f)
Sets the create jar flags of the project. |
void |
setCustomManifest(java.lang.String manifest)
|
void |
setDocumentNavigator(IDocumentNavigator<OpenDefinitionsDocument> newnav)
|
void |
setExtraClassPath(java.lang.Iterable<AbsRelFile> cp)
Sets the set of classpath entries to use as the projects set of classpath entries. |
void |
setMainClass(java.lang.String 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(java.awt.print.PageFormat format)
|
void |
setPreferencesStoredInProject(java.util.Map<OptionParser<?>,java.lang.String> sp)
Set the preferences stored in the project. |
void |
setProjectChanged(boolean changed)
Notifies the project state that the project has been changed. |
void |
setProjectFile(java.io.File f)
Sets project file to specifed value; used in "Save Project As ..." command in MainFrame. |
void |
setProjectRoot(java.io.File f)
Sets the source root for the project. |
void |
setWorkingDirectory(java.io.File f)
Sets the working directory for the Slave JVM (only applies to project mode). |
void |
systemErrPrint(java.lang.String s)
Prints System.err to the DrJava console. |
void |
systemInEcho(java.lang.String s)
Prints the given string to the DrJava console as an echo of System.in. |
void |
systemOutPrint(java.lang.String s)
Prints System.out to the DrJava console. |
| Methods inherited from interface edu.rice.cs.drjava.model.ILoadDocuments |
|---|
openFile, openFiles |
| 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 newFile(java.lang.String text)
text - for the new document
OpenDefinitionsDocument newTestCase(java.lang.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()
boolean closeFiles(java.util.List<OpenDefinitionsDocument> docs)
The corner cases in which the file that is being closed had been externally deleted have been addressed in a few places, namely DefaultGlobalModel.canAbandonFile() and MainFrame.ModelListener.canAbandonFile(). If the DefinitionsDocument for the OpenDefinitionsDocument being closed is not in the cache (see model.cache.DocumentCache) then it is closed without prompting the user to save it. If it is in the cache, then we can successfully notify the user that the file is selected for closing and ask whether to saveAs, close, or cancel.
docs - the list od OpenDefinitionsDocuments to close
void openFolder(java.io.File dir,
boolean rec,
java.lang.String ext)
throws java.io.IOException,
OperationCanceledException,
AlreadyOpenException
java.io.IOException
OperationCanceledException
AlreadyOpenException
void saveAllFiles(FileSaveSelector com)
throws java.io.IOException
java.io.IOExceptionvoid createNewProject(java.io.File projFile)
projFile - the new project file (which does not yet exist in the file system).
void configNewProject()
throws java.io.IOException
java.io.IOException
void saveProject(java.io.File f,
java.util.HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info)
throws java.io.IOException
f - where to save the projectinfo - Extra view-related information that should be included in the project file
java.io.IOException
void reloadProject(java.io.File f,
java.util.HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info)
throws java.io.IOException
f - project file; does not actually get touched
java.io.IOException
java.lang.String fixPathForNavigator(java.lang.String path)
throws java.io.IOException
java.io.IOExceptionjava.lang.String getSourceBinTitle()
java.lang.String getExternalBinTitle()
java.lang.String getAuxiliaryBinTitle()
void addAuxiliaryFile(OpenDefinitionsDocument doc)
void removeAuxiliaryFile(OpenDefinitionsDocument doc)
void openProject(java.io.File file)
throws java.io.IOException,
MalformedProjectFileException
file - The project file to parse
java.io.IOException
MalformedProjectFileExceptionvoid closeProject(boolean qutting)
java.io.File getSourceFile(java.lang.String fileName)
fileName - Name of the source file to look for
java.io.File findFileInPaths(java.lang.String fileName,
java.lang.Iterable<java.io.File> paths)
fileName - Name of the source file to look forpaths - An array of directories to searchjava.lang.Iterable<java.io.File> getSourceRootSet()
DefinitionsEditorKit getEditorKit()
EditorKit implementation for use in the definitions pane.
DocumentIterator getDocumentIterator()
void refreshActiveDocument()
ConsoleDocument getConsoleDocument()
InteractionsDJDocument getSwingConsoleDocument()
void resetConsole()
void systemOutPrint(java.lang.String s)
void systemErrPrint(java.lang.String s)
void systemInEcho(java.lang.String s)
InteractionsDocument getInteractionsDocument()
InteractionsDJDocument getSwingInteractionsDocument()
void resetInteractions(java.io.File wd)
void resetInteractions(java.io.File wd,
boolean forceReset)
void interpretCurrentInteraction()
java.lang.Iterable<java.io.File> getInteractionsClassPath()
void loadHistory(FileOpenSelector selector)
throws java.io.IOException
java.io.IOException
InteractionsScriptModel loadHistoryAsScript(FileOpenSelector selector)
throws java.io.IOException,
OperationCanceledException
java.io.IOException
OperationCanceledExceptionvoid clearHistory()
void saveConsoleCopy(ConsoleDocument doc,
FileSaveSelector selector)
throws java.io.IOException
java.io.IOException
void saveHistory(FileSaveSelector selector)
throws java.io.IOException
selector - File to save to
java.io.IOException
void saveHistory(FileSaveSelector selector,
java.lang.String editedVersion)
throws java.io.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.
java.io.IOExceptionjava.lang.String getHistoryAsStringWithSemicolons()
java.lang.String getHistoryAsString()
void printDebugMessage(java.lang.String s)
int getDebugPort()
throws java.io.IOException
java.io.IOException - if unable to get a valid port number.java.lang.Iterable<java.io.File> getClassPath()
java.awt.print.PageFormat getPageFormat()
void setPageFormat(java.awt.print.PageFormat format)
void quit()
void forceQuit()
int getDocumentCount()
int getNumCompErrors()
void setNumCompErrors(int num)
OpenDefinitionsDocument getODDForDocument(AbstractDocumentInterface doc)
java.util.List<OpenDefinitionsDocument> getNonProjectDocuments()
java.util.List<OpenDefinitionsDocument> getProjectDocuments()
boolean isProjectActive()
java.io.File getProjectFile()
java.io.File[] getProjectFiles()
java.io.File getProjectRoot()
void setProjectFile(java.io.File f)
void setProjectRoot(java.io.File f)
java.io.File getBuildDirectory()
void setBuildDirectory(java.io.File f)
boolean getAutoRefreshStatus()
void setAutoRefreshStatus(boolean b)
java.util.Map<OptionParser<?>,java.lang.String> getPreferencesStoredInProject()
void setPreferencesStoredInProject(java.util.Map<OptionParser<?>,java.lang.String> sp)
java.io.File getMasterWorkingDirectory()
java.io.File getWorkingDirectory()
void setWorkingDirectory(java.io.File f)
void setMainClass(java.lang.String f)
java.lang.String getMainClass()
java.io.File getMainClassContainingFile()
java.lang.Iterable<AbsRelFile> getExtraClassPath()
void setExtraClassPath(java.lang.Iterable<AbsRelFile> cp)
void setCreateJarFile(java.io.File f)
java.io.File getCreateJarFile()
void setCreateJarFlags(int f)
int getCreateJarFlags()
boolean inProject(java.io.File f)
boolean inProjectPath(OpenDefinitionsDocument doc)
void setProjectChanged(boolean changed)
boolean isProjectChanged()
boolean hasOutOfSyncDocuments()
boolean hasOutOfSyncDocuments(java.util.List<OpenDefinitionsDocument> lod)
java.util.List<OpenDefinitionsDocument> getOutOfSyncDocuments()
java.util.List<OpenDefinitionsDocument> getOutOfSyncDocuments(java.util.List<OpenDefinitionsDocument> lod)
void cleanBuildDirectory()
java.util.List<java.io.File> getClassFiles()
java.util.List<OpenDefinitionsDocument> getOpenDefinitionsDocuments()
java.util.List<OpenDefinitionsDocument> getLLOpenDefinitionsDocuments()
java.util.List<OpenDefinitionsDocument> getAuxiliaryDocuments()
boolean hasModifiedDocuments()
boolean hasModifiedDocuments(java.util.List<OpenDefinitionsDocument> lod)
boolean hasUntitledDocuments()
OpenDefinitionsDocument getDocumentForFile(java.io.File file)
throws java.io.IOException
file - File contained by the document to be returned
java.io.IOExceptionGlobalEventNotifier getNotifier()
java.lang.String getCustomManifest()
void setCustomManifest(java.lang.String manifest)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||