edu.rice.cs.drjava.model
Class DummyGlobalModel

java.lang.Object
  extended by edu.rice.cs.drjava.model.DummyGlobalModel
All Implemented Interfaces:
GlobalModel, ILoadDocuments
Direct Known Subclasses:
TestDocGetter

public class DummyGlobalModel
extends Object
implements GlobalModel

Concrete implementation of GlobalModel that always throws UnsupportedOperationExceptions.

Version:
$Id: DummyGlobalModel.java 4691 2008-12-02 23:33:27Z dlsmith $

Field Summary
 
Fields inherited from interface edu.rice.cs.drjava.model.GlobalModel
RUNTIME_CLASS_PATH
 
Constructor Summary
DummyGlobalModel()
           
 
Method Summary
 void addAuxiliaryFile(OpenDefinitionsDocument doc)
          Adds a document to the list of auxiliary files.
 void addListener(GlobalModelListener listener)
          Since this is not supposed to be used, we need to throw an exception OTHER than the ones it officially supports.
 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 quitting)
          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 f)
          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.
 String getCompletePath(int index)
           
 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()
           
 List<OpenDefinitionsDocument> getSortedOpenDefinitionsDocuments()
           
 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 isAlreadyOpen(File file)
           
 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 s)
          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.
 OpenDefinitionsDocument openFile(FileOpenSelector com)
          Open a file and read it into the definitions.
 OpenDefinitionsDocument[] openFiles(FileOpenSelector com)
          Opens multiple files and reads them into the definitions.
 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> ht)
          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> ht)
          Writes the project file to disk
 void setAutoRefreshStatus(boolean status)
          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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyGlobalModel

public DummyGlobalModel()
Method Detail

addListener

public void addListener(GlobalModelListener listener)
Since this is not supposed to be used, we need to throw an exception OTHER than the ones it officially supports.

Specified by:
addListener in interface GlobalModel
Parameters:
listener - a listener that reacts on events generated by the GlobalModel
Throws:
UnsupportedOperationException

removeListener

public void removeListener(GlobalModelListener listener)
Description copied from interface: GlobalModel
Remove a listener from this global model.

Specified by:
removeListener in interface GlobalModel
Parameters:
listener - a listener that reacts on events generated by the GlobalModel

getNotifier

public GlobalEventNotifier getNotifier()
Specified by:
getNotifier in interface GlobalModel

getInteractionsModel

public DefaultInteractionsModel getInteractionsModel()
Description copied from interface: GlobalModel
Returns the interactions model.

Specified by:
getInteractionsModel in interface GlobalModel

getCompilerModel

public CompilerModel getCompilerModel()
Description copied from interface: GlobalModel
Gets the CompilerModel, which provides all methods relating to compilers.

Specified by:
getCompilerModel in interface GlobalModel

getJUnitModel

public JUnitModel getJUnitModel()
Description copied from interface: GlobalModel
Gets the JUnitModel, which provides all methods relating to JUnit testing.

Specified by:
getJUnitModel in interface GlobalModel

getJavadocModel

public JavadocModel getJavadocModel()
Description copied from interface: GlobalModel
Gets the JavadocModel, which provides all methods relating to Javadoc.

Specified by:
getJavadocModel in interface GlobalModel

getDebugger

public Debugger getDebugger()
Description copied from interface: GlobalModel
Gets the Debugger, which interfaces with the integrated debugger.

Specified by:
getDebugger in interface GlobalModel

getBreakpointManager

public RegionManager<Breakpoint> getBreakpointManager()
Specified by:
getBreakpointManager in interface GlobalModel
Returns:
manager for breakpoint regions.

getBookmarkManager

public RegionManager<MovingDocumentRegion> getBookmarkManager()
Specified by:
getBookmarkManager in interface GlobalModel
Returns:
manager for bookmark regions.

createFindResultsManager

public RegionManager<MovingDocumentRegion> createFindResultsManager()
Specified by:
createFindResultsManager in interface GlobalModel
Returns:
new manager for find result regions.

removeFindResultsManager

public void removeFindResultsManager(RegionManager<MovingDocumentRegion> rm)
Description copied from interface: GlobalModel
Dispose a manager for find result regions.

Specified by:
removeFindResultsManager in interface GlobalModel

getBrowserHistoryManager

public BrowserHistoryManager getBrowserHistoryManager()
Specified by:
getBrowserHistoryManager in interface GlobalModel
Returns:
manager for browser history regions.

addToBrowserHistory

public void addToBrowserHistory()
Description copied from interface: GlobalModel
Add the current location to the browser history.

Specified by:
addToBrowserHistory in interface GlobalModel

getDocumentNavigator

public IDocumentNavigator<OpenDefinitionsDocument> getDocumentNavigator()
Description copied from interface: GlobalModel
Gets the DocumentNavigator, which controls the document view.

Specified by:
getDocumentNavigator in interface GlobalModel

setDocumentNavigator

public void setDocumentNavigator(IDocumentNavigator<OpenDefinitionsDocument> newnav)
Specified by:
setDocumentNavigator in interface GlobalModel

newFile

public OpenDefinitionsDocument newFile()
Description copied from interface: GlobalModel
Creates a new document in the definitions pane and adds it to the list of open documents.

Specified by:
newFile in interface GlobalModel
Returns:
The new open document

newTestCase

public OpenDefinitionsDocument newTestCase(String name,
                                           boolean makeSetUp,
                                           boolean makeTearDown)
Description copied from interface: GlobalModel
Creates a new junit test case. TODO: Move to JUnitModel?

Specified by:
newTestCase in interface GlobalModel
Parameters:
name - the name of the new test case
makeSetUp - true iff an empty setUp() method should be included
makeTearDown - true iff an empty tearDown() method should be included
Returns:
the new open test case

openFile

public OpenDefinitionsDocument openFile(FileOpenSelector com)
                                 throws IOException,
                                        OperationCanceledException,
                                        AlreadyOpenException
Description copied from interface: ILoadDocuments
Open a file and read it into the definitions. The provided file selector chooses a file, and on a successful open, the fileOpened() event is fired.

Specified by:
openFile in interface ILoadDocuments
Parameters:
com - a command pattern command that selects what file to open
Returns:
The open document, or null if unsuccessful
Throws:
IOException
OperationCanceledException - if the open was canceled
AlreadyOpenException - if the file is already open

openFiles

public OpenDefinitionsDocument[] openFiles(FileOpenSelector com)
                                    throws IOException,
                                           OperationCanceledException,
                                           AlreadyOpenException
Description copied from interface: ILoadDocuments
Opens multiple files and reads them into the definitions. The provided file selector chooses multiple files, and for each successful open, the fileOpened() event is fired. Note that getFile called on the returned OpenDefinitionsDocument is guaranteed to return an absolute path, as this method makes it absolute.

Specified by:
openFiles in interface ILoadDocuments
Parameters:
com - a command pattern command that selects which files to open
Returns:
The last opened document, or null if unsuccessful.
Throws:
IOException - if an underlying I/O operation fails
OperationCanceledException - if the open was canceled
AlreadyOpenException - if the file is already open

closeFile

public boolean closeFile(OpenDefinitionsDocument doc)
Description copied from interface: GlobalModel
Closes an open definitions document, prompting to save if the document has been changed. Returns whether the file was successfully closed.

Specified by:
closeFile in interface GlobalModel
Returns:
true if the document was closed

closeFileWithoutPrompt

public boolean closeFileWithoutPrompt(OpenDefinitionsDocument doc)
Description copied from interface: GlobalModel
Closes an open definitions document, without prompting to save if the document has been changed. Returns whether the file was successfully closed.

Specified by:
closeFileWithoutPrompt in interface GlobalModel
Returns:
true if the document was closed

closeAllFiles

public boolean closeAllFiles()
Description copied from interface: GlobalModel
Attempts to close all open documents.

Specified by:
closeAllFiles in interface GlobalModel
Returns:
true if all documents were closed

openFolder

public void openFolder(File dir,
                       boolean rec)
                throws IOException,
                       OperationCanceledException,
                       AlreadyOpenException
Specified by:
openFolder in interface GlobalModel
Throws:
IOException
OperationCanceledException
AlreadyOpenException

setAutoRefreshStatus

public void setAutoRefreshStatus(boolean status)
Description copied from interface: GlobalModel
Sets autorefresh status of the project

Specified by:
setAutoRefreshStatus in interface GlobalModel

getAutoRefreshStatus

public boolean getAutoRefreshStatus()
Description copied from interface: GlobalModel
Gets autorefresh status of the project

Specified by:
getAutoRefreshStatus in interface GlobalModel

saveAllFiles

public void saveAllFiles(FileSaveSelector com)
                  throws IOException
Description copied from interface: GlobalModel
Saves all open documents, prompting when necessary.

Specified by:
saveAllFiles in interface GlobalModel
Throws:
IOException

createNewProject

public void createNewProject(File f)
Description copied from interface: GlobalModel
Creates a new project with specified project file and default values for other properties.

Specified by:
createNewProject in interface GlobalModel
Parameters:
f - the new project file (which does not yet exist in the file system).

configNewProject

public void configNewProject()
                      throws IOException
Description copied from interface: GlobalModel
Configures a new project (created by createNewProject) and saves it to disk.

Specified by:
configNewProject in interface GlobalModel
Throws:
IOException

saveProject

public void saveProject(File f,
                        HashMap<OpenDefinitionsDocument,DocumentInfoGetter> ht)
                 throws IOException
Description copied from interface: GlobalModel
Writes the project file to disk

Specified by:
saveProject in interface GlobalModel
Parameters:
f - where to save the project
ht - Extra view-related information that should be included in the project file
Throws:
IOException

reloadProject

public void reloadProject(File f,
                          HashMap<OpenDefinitionsDocument,DocumentInfoGetter> ht)
                   throws IOException
Description copied from interface: GlobalModel
Reloads a project without writing to disk.

Specified by:
reloadProject in interface GlobalModel
Parameters:
f - project file; does not actually get touched
Throws:
IOException

fixPathForNavigator

public String fixPathForNavigator(String path)
                           throws IOException
Description copied from interface: GlobalModel
Formats a string pathname for use in the document navigator.

Specified by:
fixPathForNavigator in interface GlobalModel
Throws:
IOException

getSourceBinTitle

public String getSourceBinTitle()
Description copied from interface: GlobalModel
Gives the title of the source bin for the navigator

Specified by:
getSourceBinTitle in interface GlobalModel
Returns:
The text used for the source bin in the tree navigator

getExternalBinTitle

public String getExternalBinTitle()
Description copied from interface: GlobalModel
Gives the title of the external files bin for the navigator

Specified by:
getExternalBinTitle in interface GlobalModel
Returns:
The text used for the external files bin in the tree navigator

getAuxiliaryBinTitle

public String getAuxiliaryBinTitle()
Description copied from interface: GlobalModel
Gives the title of the aux files bin for the navigator

Specified by:
getAuxiliaryBinTitle in interface GlobalModel
Returns:
The text used for the aux files bin in the tree navigator

addAuxiliaryFile

public void addAuxiliaryFile(OpenDefinitionsDocument doc)
Description copied from interface: GlobalModel
Adds a document to the list of auxiliary files.

Specified by:
addAuxiliaryFile in interface GlobalModel

removeAuxiliaryFile

public void removeAuxiliaryFile(OpenDefinitionsDocument doc)
Description copied from interface: GlobalModel
Removes a document from the list of auxiliary files.

Specified by:
removeAuxiliaryFile in interface GlobalModel

openProject

public void openProject(File file)
                 throws IOException,
                        MalformedProjectFileException
Description copied from interface: GlobalModel
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.

Specified by:
openProject in interface GlobalModel
Parameters:
file - The project file to parse
Throws:
IOException
MalformedProjectFileException

closeProject

public void closeProject(boolean quitting)
Description copied from interface: GlobalModel
Performs any needed operations on the model before closing the project and its files. This is not responsible for actually closing the files since that is handled in MainFrame._closeProject()

Specified by:
closeProject in interface GlobalModel

getSourceFile

public File getSourceFile(String fileName)
Description copied from interface: GlobalModel
Searches for a file with the given name on the current source roots and the augmented classpath.

Specified by:
getSourceFile in interface GlobalModel
Parameters:
fileName - Name of the source file to look for
Returns:
the file corresponding to the given name, or null if it cannot be found

findFileInPaths

public File findFileInPaths(String fileName,
                            Iterable<File> paths)
Description copied from interface: GlobalModel
Searches for a file with the given name on the provided paths. Returns null if the file is not found.

Specified by:
findFileInPaths in interface GlobalModel
Parameters:
fileName - Name of the source file to look for
paths - An array of directories to search

getSourceRootSet

public Iterable<File> getSourceRootSet()
Description copied from interface: GlobalModel
Gets a list of all sourceRoots for the open definitions documents, without duplicates.

Specified by:
getSourceRootSet in interface GlobalModel

getCompletePath

public String getCompletePath(int index)

getEditorKit

public DefinitionsEditorKit getEditorKit()
Description copied from interface: GlobalModel
Fetches the EditorKit implementation for use in the definitions pane.

Specified by:
getEditorKit in interface GlobalModel

getDocumentIterator

public DocumentIterator getDocumentIterator()
Description copied from interface: GlobalModel
Gets a DocumentIterator to allow navigating through open swing Documents. TODO: remove ugly swing dependency.

Specified by:
getDocumentIterator in interface GlobalModel

refreshActiveDocument

public void refreshActiveDocument()
Description copied from interface: GlobalModel
Re-runs the global listeners on the active document.

Specified by:
refreshActiveDocument in interface GlobalModel

getConsoleDocument

public ConsoleDocument getConsoleDocument()
Description copied from interface: GlobalModel
Gets the console document.

Specified by:
getConsoleDocument in interface GlobalModel

getSwingConsoleDocument

public InteractionsDJDocument getSwingConsoleDocument()
Description copied from interface: GlobalModel
TODO: remove this swing dependency.

Specified by:
getSwingConsoleDocument in interface GlobalModel
Returns:
InteractionsDJDocument in use by the ConsoleDocument.

resetConsole

public void resetConsole()
Description copied from interface: GlobalModel
Resets the console. Fires consoleReset() event.

Specified by:
resetConsole in interface GlobalModel

systemOutPrint

public void systemOutPrint(String s)
Description copied from interface: GlobalModel
Prints System.out to the DrJava console. This method may be safely called from outside the event thread.

Specified by:
systemOutPrint in interface GlobalModel

systemErrPrint

public void systemErrPrint(String s)
Description copied from interface: GlobalModel
Prints System.err to the DrJava console. This method may be safely called from outside the event thread.

Specified by:
systemErrPrint in interface GlobalModel

systemInEcho

public void systemInEcho(String s)
Description copied from interface: GlobalModel
Prints the given string to the DrJava console as an echo of System.in. This method may be safely called from outside the event thread.

Specified by:
systemInEcho in interface GlobalModel

getInteractionsDocument

public InteractionsDocument getInteractionsDocument()
Description copied from interface: GlobalModel
Gets the (toolkit-independent) interactions document.

Specified by:
getInteractionsDocument in interface GlobalModel

getSwingInteractionsDocument

public InteractionsDJDocument getSwingInteractionsDocument()
Description copied from interface: GlobalModel
TODO: remove this swing dependency.

Specified by:
getSwingInteractionsDocument in interface GlobalModel
Returns:
InteractionsDJDocument in use by the InteractionsDocument.

resetInteractions

public void resetInteractions(File wd)
Description copied from interface: GlobalModel
Clears and resets the interactions pane in the specified working directory, provided that the operation has some effect.

Specified by:
resetInteractions in interface GlobalModel

resetInteractions

public void resetInteractions(File wd,
                              boolean forceReset)
Description copied from interface: GlobalModel
Clears and resets the interactions pane in the specified working directory.

Specified by:
resetInteractions in interface GlobalModel

waitForInterpreter

public void waitForInterpreter()
Description copied from interface: GlobalModel
Blocks until the interpreter has registered.

Specified by:
waitForInterpreter in interface GlobalModel

interpretCurrentInteraction

public void interpretCurrentInteraction()
Description copied from interface: GlobalModel
Interprets the current given text at the prompt in the interactions pane.

Specified by:
interpretCurrentInteraction in interface GlobalModel

getInteractionsClassPath

public Iterable<File> getInteractionsClassPath()
Description copied from interface: GlobalModel
Returns the current classpath in use by the Interpreter JVM. This includes the original jvm classpath, the global drjava extra classpaths, and the project extra classpaths.

Specified by:
getInteractionsClassPath in interface GlobalModel

loadHistory

public void loadHistory(FileOpenSelector selector)
                 throws IOException
Description copied from interface: GlobalModel
Interprets file selected in the FileOpenSelector. Assumes all strings have no trailing whitespace. Interprets the list of interactions as a single transaction so the first error aborts all processing.

Specified by:
loadHistory in interface GlobalModel
Throws:
IOException

loadHistoryAsScript

public InteractionsScriptModel loadHistoryAsScript(FileOpenSelector s)
                                            throws IOException,
                                                   OperationCanceledException
Description copied from interface: GlobalModel
Loads the history/histories from the given selector.

Specified by:
loadHistoryAsScript in interface GlobalModel
Throws:
IOException
OperationCanceledException

clearHistory

public void clearHistory()
Description copied from interface: GlobalModel
Clears the interactions history.

Specified by:
clearHistory in interface GlobalModel

saveHistory

public void saveHistory(FileSaveSelector selector)
                 throws IOException
Description copied from interface: GlobalModel
Saves the unedited version of the current history to a file

Specified by:
saveHistory in interface GlobalModel
Parameters:
selector - File to save to
Throws:
IOException

saveHistory

public void saveHistory(FileSaveSelector selector,
                        String editedVersion)
                 throws IOException
Description copied from interface: GlobalModel
Saves the edited version of the current history to a file

Specified by:
saveHistory in interface GlobalModel
Parameters:
selector - File to save to
editedVersion - 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.
Throws:
IOException

getHistoryAsStringWithSemicolons

public String getHistoryAsStringWithSemicolons()
Description copied from interface: GlobalModel
Returns the entire history as a String with semicolons as needed.

Specified by:
getHistoryAsStringWithSemicolons in interface GlobalModel

getHistoryAsString

public String getHistoryAsString()
Description copied from interface: GlobalModel
Returns the entire history as a String.

Specified by:
getHistoryAsString in interface GlobalModel

printDebugMessage

public void printDebugMessage(String s)
Description copied from interface: GlobalModel
Called when the debugger wants to print a message.

Specified by:
printDebugMessage in interface GlobalModel

getDebugPort

public int getDebugPort()
                 throws IOException
Description copied from interface: GlobalModel
Returns an available port number to use for debugging the interactions JVM.

Specified by:
getDebugPort in interface GlobalModel
Throws:
IOException - if unable to get a valid port number.

getClassPath

public Iterable<File> getClassPath()
Description copied from interface: GlobalModel
Get the class path to be used in all class-related operations. TODO: Insure that this is used wherever appropriate.

Specified by:
getClassPath in interface GlobalModel

getPageFormat

public PageFormat getPageFormat()
Specified by:
getPageFormat in interface GlobalModel

setPageFormat

public void setPageFormat(PageFormat format)
Specified by:
setPageFormat in interface GlobalModel

quit

public void quit()
Description copied from interface: GlobalModel
Exits the program. Only quits if all documents are successfully closed.

Specified by:
quit in interface GlobalModel

forceQuit

public void forceQuit()
Description copied from interface: GlobalModel
Halts the program immediately.

Specified by:
forceQuit in interface GlobalModel

getDocumentCount

public int getDocumentCount()
Description copied from interface: GlobalModel
Returns the document count

Specified by:
getDocumentCount in interface GlobalModel

getNumCompErrors

public int getNumCompErrors()
Description copied from interface: GlobalModel
Returns the number of compiler errors produced by the last compilation.

Specified by:
getNumCompErrors in interface GlobalModel

setNumCompErrors

public void setNumCompErrors(int num)
Description copied from interface: GlobalModel
Sets the number of compiler errors produced by the last compilation.

Specified by:
setNumCompErrors in interface GlobalModel

getODDForDocument

public OpenDefinitionsDocument getODDForDocument(AbstractDocumentInterface doc)
Description copied from interface: GlobalModel
CHECK IF NEEDED!

Specified by:
getODDForDocument in interface GlobalModel

getNonProjectDocuments

public List<OpenDefinitionsDocument> getNonProjectDocuments()
Description copied from interface: GlobalModel
Returns a list of OpenDefinitionsDocuments that do not belong to the currently active project.
If no project is active, all documents are returned.

Specified by:
getNonProjectDocuments in interface GlobalModel

getProjectDocuments

public List<OpenDefinitionsDocument> getProjectDocuments()
Description copied from interface: GlobalModel
Teturns a list of OpenDefinitionsDocuments that do belong to the currently active project.
If no project is active, no documents are returned.

Specified by:
getProjectDocuments in interface GlobalModel

isProjectActive

public boolean isProjectActive()
Specified by:
isProjectActive in interface GlobalModel
Returns:
true if the model has a project open, false otherwise.

getProjectFile

public File getProjectFile()
Specified by:
getProjectFile in interface GlobalModel
Returns:
the file that points to the current project file. Null if not currently in project view

getProjectFiles

public File[] getProjectFiles()
Specified by:
getProjectFiles in interface GlobalModel
Returns:
the directory that the class files should be stored after compilation.

getProjectRoot

public File getProjectRoot()
Specified by:
getProjectRoot in interface GlobalModel
Returns:
the source root for the project.

setProjectFile

public void setProjectFile(File f)
Description copied from interface: GlobalModel
Sets project file to specifed value; used in "Save Project As ..." command in MainFrame.

Specified by:
setProjectFile in interface GlobalModel

setProjectRoot

public void setProjectRoot(File f)
Description copied from interface: GlobalModel
Sets the source root for the project.

Specified by:
setProjectRoot in interface GlobalModel

getBuildDirectory

public File getBuildDirectory()
Specified by:
getBuildDirectory in interface GlobalModel
Returns:
the directory that the class files should be stored after compilation.

setBuildDirectory

public void setBuildDirectory(File f)
Description copied from interface: GlobalModel
Sets the current build directory.

Specified by:
setBuildDirectory in interface GlobalModel

getMasterWorkingDirectory

public File getMasterWorkingDirectory()
Specified by:
getMasterWorkingDirectory in interface GlobalModel
Returns:
the working directory for the Master JVM.

getWorkingDirectory

public File getWorkingDirectory()
Specified by:
getWorkingDirectory in interface GlobalModel
Returns:
the working directory for the Slave JVM (only applied to project mode).

setWorkingDirectory

public void setWorkingDirectory(File f)
Description copied from interface: GlobalModel
Sets the working directory for the Slave JVM (only applies to project mode).

Specified by:
setWorkingDirectory in interface GlobalModel

setMainClass

public void setMainClass(File f)
Description copied from interface: GlobalModel
Sets the main file of the project.

Specified by:
setMainClass in interface GlobalModel

getMainClass

public File getMainClass()
Description copied from interface: GlobalModel
Return the main file for the project If not in project mode, returns null.

Specified by:
getMainClass in interface GlobalModel

getExtraClassPath

public Iterable<File> getExtraClassPath()
Description copied from interface: GlobalModel
Returns only the project's extra classpaths.

Specified by:
getExtraClassPath in interface GlobalModel
Returns:
The classpath entries loaded along with the project

setExtraClassPath

public void setExtraClassPath(Iterable<File> cp)
Description copied from interface: GlobalModel
Sets the set of classpath entries to use as the projects set of classpath entries. This is normally used by the project preferences.

Specified by:
setExtraClassPath in interface GlobalModel

setCreateJarFile

public void setCreateJarFile(File f)
Description copied from interface: GlobalModel
Sets the create jar file of the project.

Specified by:
setCreateJarFile in interface GlobalModel

getCreateJarFile

public File getCreateJarFile()
Description copied from interface: GlobalModel
Return the create jar file for the project. If not in project mode, returns null.

Specified by:
getCreateJarFile in interface GlobalModel

setCreateJarFlags

public void setCreateJarFlags(int f)
Description copied from interface: GlobalModel
Sets the create jar flags of the project.

Specified by:
setCreateJarFlags in interface GlobalModel

getCreateJarFlags

public int getCreateJarFlags()
Description copied from interface: GlobalModel
Return the create jar file for the project. If not in project mode, returns 0.

Specified by:
getCreateJarFlags in interface GlobalModel

inProject

public boolean inProject(File f)
Description copied from interface: GlobalModel
Returns true the given file is in the current project file.

Specified by:
inProject in interface GlobalModel

inProjectPath

public boolean inProjectPath(OpenDefinitionsDocument doc)
Description copied from interface: GlobalModel
A file is in the project if the source root is the same as the project root. This means that project files must be saved in the source root. (we query the model through the model's state)

Specified by:
inProjectPath in interface GlobalModel

setProjectChanged

public void setProjectChanged(boolean changed)
Description copied from interface: GlobalModel
Notifies the project state that the project has been changed.

Specified by:
setProjectChanged in interface GlobalModel

isProjectChanged

public boolean isProjectChanged()
Description copied from interface: GlobalModel
Returns true if the project state has been changed

Specified by:
isProjectChanged in interface GlobalModel

hasOutOfSyncDocuments

public boolean hasOutOfSyncDocuments()
Specified by:
hasOutOfSyncDocuments in interface GlobalModel
Returns:
true iff no open document is out of sync with its primary class file.

hasOutOfSyncDocuments

public boolean hasOutOfSyncDocuments(List<OpenDefinitionsDocument> lod)
Specified by:
hasOutOfSyncDocuments in interface GlobalModel
Returns:
true iff no document in given list is out of sync with its primary class file.

cleanBuildDirectory

public void cleanBuildDirectory()
Description copied from interface: GlobalModel
Cleans the build directory.

Specified by:
cleanBuildDirectory in interface GlobalModel

getClassFiles

public List<File> getClassFiles()
Specified by:
getClassFiles in interface GlobalModel
Returns:
a list of class files.

getDocumentForFile

public OpenDefinitionsDocument getDocumentForFile(File file)
                                           throws IOException
Description copied from interface: GlobalModel
Returns the OpenDefinitionsDocument for the specified File, opening a new copy if one is not already open.

Specified by:
getDocumentForFile in interface GlobalModel
Parameters:
file - File contained by the document to be returned
Returns:
OpenDefinitionsDocument containing file
Throws:
IOException

isAlreadyOpen

public boolean isAlreadyOpen(File file)

getOpenDefinitionsDocuments

public List<OpenDefinitionsDocument> getOpenDefinitionsDocuments()
Description copied from interface: GlobalModel
Returns a collection of all documents currently open for editing. This is equivalent to the results of getDocumentForFile for the set of all files for which isAlreadyOpen returns true. The order of documents is the same as in the display of documents in the view.

Specified by:
getOpenDefinitionsDocuments in interface GlobalModel
Returns:
a List of the open definitions documents.

getAuxiliaryDocuments

public List<OpenDefinitionsDocument> getAuxiliaryDocuments()
Specified by:
getAuxiliaryDocuments in interface GlobalModel

getSortedOpenDefinitionsDocuments

public List<OpenDefinitionsDocument> getSortedOpenDefinitionsDocuments()

hasModifiedDocuments

public boolean hasModifiedDocuments()
Description copied from interface: GlobalModel
Checks if any open definitions documents have been modified since last being saved.

Specified by:
hasModifiedDocuments in interface GlobalModel
Returns:
whether any documents have been modified

hasModifiedDocuments

public boolean hasModifiedDocuments(List<OpenDefinitionsDocument> lod)
Description copied from interface: GlobalModel
Checks if any of the given documents have been modified since last being saved.

Specified by:
hasModifiedDocuments in interface GlobalModel
Returns:
whether any documents have been modified

hasUntitledDocuments

public boolean hasUntitledDocuments()
Description copied from interface: GlobalModel
Checks if any open definitions documents are untitled.

Specified by:
hasUntitledDocuments in interface GlobalModel
Returns:
whether any documents are untitled