edu.rice.cs.drjava.model
Class TestDocGetter

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

public class TestDocGetter
extends DummyGlobalModel

Test implementation of the document fetching methods in the GlobalModel interface.


Nested Class Summary
private static class TestDocGetter.TestOpenDoc
          Test implementation of OpenDefinitionsDocument interface.
 
Field Summary
(package private)  java.util.HashMap<java.io.File,OpenDefinitionsDocument> docs
          Storage for documents and File keys.
 
Constructor Summary
TestDocGetter()
          Convenience constructor for no-documents case.
TestDocGetter(java.io.File[] files, java.lang.String[] texts)
          Primary constructor, builds OpenDefDocs from Strings.
 
Method Summary
 OpenDefinitionsDocument getDocumentForFile(java.io.File file)
          Returns the OpenDefinitionsDocument for the specified File, opening a new copy if one is not already open.
 java.util.List<OpenDefinitionsDocument> getOpenDefinitionsDocuments()
          Returns a collection of all documents currently open for editing.
 
Methods inherited from class edu.rice.cs.drjava.model.DummyGlobalModel
addAuxiliaryFile, addListener, addToBrowserHistory, cleanBuildDirectory, clearHistory, closeAllFiles, closeFile, closeFiles, closeFileWithoutPrompt, closeProject, configNewProject, createFindResultsManager, createNewProject, findFileInPaths, fixPathForNavigator, forceQuit, getAutoRefreshStatus, getAuxiliaryBinTitle, getAuxiliaryDocuments, getBookmarkManager, getBreakpointManager, getBrowserHistoryManager, getBuildDirectory, getClassFiles, getClassPath, getCompilerModel, getCompletePath, getConsoleDocument, getCreateJarFile, getCreateJarFlags, getCustomManifest, getDebugger, getDebugPort, getDocumentCount, getDocumentIterator, getDocumentNavigator, getEditorKit, getExternalBinTitle, getExtraClassPath, getHistoryAsString, getHistoryAsStringWithSemicolons, getInteractionsClassPath, getInteractionsDocument, getInteractionsModel, getJavadocModel, getJUnitModel, getLLOpenDefinitionsDocuments, getMainClass, getMainClassContainingFile, getMasterWorkingDirectory, getNonProjectDocuments, getNotifier, getNumCompErrors, getODDForDocument, getOutOfSyncDocuments, getOutOfSyncDocuments, getPageFormat, getPreferencesStoredInProject, getProjectDocuments, getProjectFile, getProjectFiles, getProjectRoot, getSortedOpenDefinitionsDocuments, getSourceBinTitle, getSourceFile, getSourceRootSet, getSwingConsoleDocument, getSwingInteractionsDocument, getWorkingDirectory, hasModifiedDocuments, hasModifiedDocuments, hasOutOfSyncDocuments, hasOutOfSyncDocuments, hasUntitledDocuments, inProject, inProjectPath, interpretCurrentInteraction, isAlreadyOpen, isProjectActive, isProjectChanged, loadHistory, loadHistoryAsScript, newFile, newFile, newTestCase, openFile, openFiles, openFolder, openProject, printDebugMessage, quit, refreshActiveDocument, reloadProject, removeAuxiliaryFile, removeFindResultsManager, removeListener, resetConsole, resetInteractions, resetInteractions, saveAllFiles, saveConsoleCopy, saveHistory, saveHistory, saveProject, setAutoRefreshStatus, setBuildDirectory, setCreateJarFile, setCreateJarFlags, setCustomManifest, setDocumentNavigator, setExtraClassPath, setMainClass, setNumCompErrors, setPageFormat, setPreferencesStoredInProject, setProjectChanged, setProjectFile, setProjectRoot, setWorkingDirectory, systemErrPrint, systemInEcho, systemOutPrint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

docs

java.util.HashMap<java.io.File,OpenDefinitionsDocument> docs
Storage for documents and File keys.

Constructor Detail

TestDocGetter

public TestDocGetter()
Convenience constructor for no-documents case.


TestDocGetter

public TestDocGetter(java.io.File[] files,
                     java.lang.String[] texts)
Primary constructor, builds OpenDefDocs from Strings.

Parameters:
files - the keys to use when getting OpenDefDocs
texts - the text to put in the OpenDefDocs
Method Detail

getDocumentForFile

public OpenDefinitionsDocument getDocumentForFile(java.io.File file)
                                           throws java.io.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
Overrides:
getDocumentForFile in class DummyGlobalModel
Parameters:
file - File contained by the document to be returned
Returns:
OpenDefinitionsDocument containing file
Throws:
java.io.IOException

getOpenDefinitionsDocuments

public java.util.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
Overrides:
getOpenDefinitionsDocuments in class DummyGlobalModel
Returns:
a List of the open definitions documents.