|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.drjava.model.AbstractGlobalModel
public class AbstractGlobalModel
In simple terms, a DefaultGlobalModel without an interpreter, compiler, junit testing, debugger or javadoc. Hence, it only has only document handling functionality
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface edu.rice.cs.drjava.config.OptionConstants |
---|
OptionConstants.AccessLevelChoices, OptionConstants.DefaultFont, OptionConstants.HeapSizeChoices, OptionConstants.LookAndFeels, OptionConstants.PlasticThemes, OptionConstants.VersionNotificationChoices |
Field Summary | |
---|---|
protected ConcreteRegionManager<MovingDocumentRegion> |
_bookmarkManager
Manager for bookmark regions. |
protected ConcreteRegionManager<Breakpoint> |
_breakpointManager
Manager for breakpoint regions. |
protected BrowserHistoryManager |
_browserHistoryManager
Manager for browser history regions. |
protected DocumentCache |
_cache
A document cache that manages how many unmodified documents are open at once. |
protected ConsoleDocument |
_consoleDoc
The document used to display System.out and System.err, and to read from System.in. |
protected InteractionsDJDocument |
_consoleDocAdapter
The document adapter used in the console document. |
protected IDocumentNavigator<OpenDefinitionsDocument> |
_documentNavigator
The abstract container which contains views of open documents and allows user to navigate document focus among this collection of open documents |
protected DefinitionsEditorKit |
_editorKit
Factory for new definitions documents and views. |
protected LinkedList<RegionManager<MovingDocumentRegion>> |
_findResultsManagers
Managers for find result regions. |
static Log |
_log
|
GlobalEventNotifier |
_notifier
Keeps track of all listeners to the model, and has the ability to notify them of some event. |
protected PageFormat |
_pageFormat
A PageFormat object for printing to paper. |
protected FileGroupingState |
_state
Specifies the state of the navigator pane. |
static int |
DIFF_THRESHOLD
|
static int |
WRITE_DELAY
Number of milliseconds to wait after each println, to prevent the JVM from being flooded with print calls. |
Fields inherited from interface edu.rice.cs.drjava.model.GlobalModel |
---|
RUNTIME_CLASS_PATH |
Constructor Summary | |
---|---|
AbstractGlobalModel()
Constructs a new GlobalModel. |
Method Summary | ||
---|---|---|
protected edu.rice.cs.drjava.model.AbstractGlobalModel.ConcreteOpenDefDoc |
_createOpenDefinitionsDocument(File f)
Creates a ConcreteOpenDefDoc for an existing file f. |
|
protected edu.rice.cs.drjava.model.AbstractGlobalModel.ConcreteOpenDefDoc |
_createOpenDefinitionsDocument(NullFile f)
Creates a ConcreteOpenDefDoc for a NullFile object f (corresponding to a new empty document) |
|
protected void |
_docAppend(ConsoleDocument doc,
String s,
String style)
Appends a string to the given document using a particular attribute set. |
|
protected OpenDefinitionsDocument |
_getOpenDocument(File file)
Returns the OpenDefinitionsDocument corresponding to the given File, or null if that file is not open. |
|
ProjectProfile |
_makeProjectProfile(File file,
HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info)
Writes the project profile augmented by usage info to specified file. |
|
OpenDefinitionsDocument |
_openFile(File file)
Creates a document from a file. |
|
void |
_toggleBookmark(int pos1,
int pos2)
Raw version of toggleBookmark. |
|
void |
aboutToSaveFromSaveAll(OpenDefinitionsDocument doc)
If the document is untitled, brings it to the top so that the user will know which is being saved. |
|
void |
addAuxiliaryFile(OpenDefinitionsDocument doc)
Adds a document to the list of auxiliary files. |
|
protected void |
addDocToClassPath(OpenDefinitionsDocument doc)
Add a document to the classpath for the slave JVM. |
|
protected void |
addDocToNavigator(OpenDefinitionsDocument doc)
Creates an iNavigatorItem for a document, and adds it to the navigator. |
|
void |
addListener(GlobalModelListener listener)
Add a listener to this global model. |
|
void |
addToBrowserHistory()
Add the current location to the browser history. |
|
void |
autoRefreshProject()
Perform an auto-refresh of the project, adding new source files to the project. |
|
void |
cleanBuildDirectory()
Cleans the build directory. |
|
void |
clearHistory()
throws UnsupportedOperationException |
|
boolean |
closeAllFiles()
Attempts to close all open documents. |
|
boolean |
closeAllFilesOnQuit()
Closes all open documents. |
|
boolean |
closeFile(OpenDefinitionsDocument doc)
Closes an open definitions document, prompting to save if the document has been changed. |
|
protected boolean |
closeFileHelper(OpenDefinitionsDocument doc)
Helper for closeFile. |
|
boolean |
closeFiles(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 suppressReset)
Performs any needed operations on the model after project files have been closed. |
|
void |
configNewProject()
Configures a new project (created by createNewProject) and writes it to disk; only runs in event thread. |
|
RegionManager<MovingDocumentRegion> |
createFindResultsManager()
|
|
void |
createNewProject(File projFile)
Creates a new FileGroupingState for specificed project file and default values for other properties. |
|
void |
dispose()
Prepares this model to be thrown away. |
|
void |
disposeExternalResources()
Disposes of external resources. |
|
void |
exportOldProject(File file,
HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info)
Writes the project profile in the old project format. |
|
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. |
|
OpenDefinitionsDocument |
getActiveDocument()
Returns the currently active document. |
|
boolean |
getAutoRefreshStatus()
Gets autorfresh status of the project |
|
String |
getAuxiliaryBinTitle()
Gives the title of the aux files bin for the navigator. |
|
List<OpenDefinitionsDocument> |
getAuxiliaryDocuments()
Returns the OpenDefinitionsDocuments that are identified as auxiliary project source files. |
|
RegionManager<MovingDocumentRegion> |
getBookmarkManager()
|
|
RegionManager<Breakpoint> |
getBreakpointManager()
|
|
BrowserHistoryManager |
getBrowserHistoryManager()
|
|
File |
getBuildDirectory()
|
|
List<File> |
getClassFiles()
|
|
Iterable<File> |
getClassPath()
throws an UnsupportedOperationException |
|
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 flags for the project. |
|
Debugger |
getDebugger()
throws UnsupportedOperationException |
|
int |
getDebugPort()
throws UnsupportedOperationException |
|
Container |
getDocCollectionWidget()
|
|
DocumentCache |
getDocumentCache()
This method is for use only by test cases. |
|
int |
getDocumentCount()
Returns the document count |
|
OpenDefinitionsDocument |
getDocumentForFile(File file)
Gets the document for the specified file; may involve opening the file. |
|
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. |
|
File[] |
getExclFiles()
Return an array of the files excluded from the current project |
|
String |
getExternalBinTitle()
Gives the title of the external files bin for the navigator |
|
Iterable<File> |
getExtraClassPath()
Returns a project's extra classpaths; empty for FlatFileGroupingState |
|
File[] |
getFilesInFolder(File dir,
boolean rec)
|
|
List<RegionManager<MovingDocumentRegion>> |
getFindResultsManagers()
|
|
String |
getHistoryAsString()
Throws UnsupportedOperationException |
|
String |
getHistoryAsStringWithSemicolons()
Returns the entire history as a String with semicolons as needed. |
|
Iterable<File> |
getInteractionsClassPath()
throws new UnsupportedOperationException |
|
InteractionsDocument |
getInteractionsDocument()
throws UnsupportedOperationException |
|
DefaultInteractionsModel |
getInteractionsModel()
throws UnsupportedOperationException |
|
JavadocModel |
getJavadocModel()
throws UnsupportedOperationException |
|
JUnitModel |
getJUnitModel()
throws UnsupportedOperationException |
|
File |
getMainClass()
Return the main file for the project If not in project mode, returns null. |
|
File |
getMasterWorkingDirectory()
|
|
File[] |
getNewFilesInProject()
gets files in the project source directory that are not accounted for in the project file. |
|
OpenDefinitionsDocument |
getNextDocument(OpenDefinitionsDocument d)
Returns the ODD preceding the given document in the document list. |
|
List<OpenDefinitionsDocument> |
getNonProjectDocuments()
Returns the OpenDefinitionsDocuments that are NOT identified as project source files. |
|
GlobalEventNotifier |
getNotifier()
Notifier list for the global model. |
|
int |
getNumCompErrors()
throws UnsupportedOperationException |
|
OpenDefinitionsDocument |
getODDForDocument(AbstractDocumentInterface doc)
Returns the OpenDefinitionsDocument corresponding to the INavigatorItem/DefinitionsDocument passed in. |
|
List<OpenDefinitionsDocument> |
getOpenDefinitionsDocuments()
Returns a new collection of all documents currently open for editing. |
|
protected static String |
getPackageName(String classname)
Helper method used in subsequent anonymous inner class |
|
PageFormat |
getPageFormat()
|
|
OpenDefinitionsDocument |
getPrevDocument(OpenDefinitionsDocument d)
Returns the ODD preceding the given document in the document list. |
|
List<OpenDefinitionsDocument> |
getProjectDocuments()
Returns the OpenDefinitionsDocuments that are identified as project source files. |
|
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 an array of all sourceRoots for the open definitions documents, without duplicates. |
|
InteractionsDJDocument |
getSwingConsoleDocument()
TODO: remove this swing dependency. |
|
InteractionsDJDocument |
getSwingInteractionsDocument()
throws UnsupportedOperationException |
|
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 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 |
installActiveDocument()
Invokes the activeDocumentChanged method in the global listener on the argument _activeDocument. |
|
void |
interpretCurrentInteraction()
throw new UnsupportedOperationException |
|
boolean |
isAlreadyOpen(File file)
Iterates over OpenDefinitionsDocuments, looking for this file. |
|
boolean |
isClassPathChanged()
|
|
boolean |
isProjectActive()
|
|
boolean |
isProjectChanged()
Returns true if the project state has been changed |
|
static boolean |
isUntitled(File f)
|
|
void |
loadHistory(FileOpenSelector selector)
throws UnsupportedOperationException |
|
InteractionsScriptModel |
loadHistoryAsScript(FileOpenSelector selector)
throws UnsupportedOperationException |
|
protected FileGroupingState |
makeFlatFileGroupingState()
|
|
protected FileGroupingState |
makeProjectFileGroupingState(File pr,
File main,
File bd,
File wd,
File project,
File[] srcFiles,
File[] auxFiles,
File[] excludedFiles,
Iterable<File> cp,
File cjf,
int cjflags,
boolean refresh)
|
|
OpenDefinitionsDocument |
newFile()
Creates a new document, adds it to the list of open documents, and sets it to be active. |
|
OpenDefinitionsDocument |
newFile(File parentDir)
Creates a new open definitions document and adds it to the list. |
|
OpenDefinitionsDocument |
newTestCase(String name,
boolean makeSetUp,
boolean makeTearDown)
Creates a new junit test case. |
|
OpenDefinitionsDocument |
openFile(FileOpenSelector com)
Open a file and add it to the pool of definitions documents. |
|
protected OpenDefinitionsDocument |
openFileHelper(FileOpenSelector com)
|
|
OpenDefinitionsDocument[] |
openFiles(FileOpenSelector com)
Open multiple files and add them to the pool of definitions documents. |
|
protected OpenDefinitionsDocument[] |
openFilesHelper(FileOpenSelector com)
|
|
void |
openFolder(File dir,
boolean rec)
Opens all files in the specified folder dir and places them in the appropriate places in the document navigator. |
|
void |
openNewFilesInProject()
Searches the source folder (recursively) for new files and opens them. |
|
void |
openProject(File projectFile)
Parses the given project file and loads it into the document navigator and resets interactions pane. |
|
protected static
|
pop(ArrayList<T> stack)
This pop method enables an ArrayList to serve as stack. |
|
void |
printDebugMessage(String s)
throws UnsupportedOperationException |
|
void |
quit()
Exits the program. |
|
void |
refreshActiveDocument()
Makes the active document (in this model) the selection in the documentNavigator and invokes the activedocumentRefreshed method in the global listener on this document. |
|
void |
reloadProject(File file,
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)
Remove a manager from the model. |
|
void |
removeListener(GlobalModelListener listener)
Remove a listener from this global model. |
|
void |
resetConsole()
Resets the console. |
|
void |
resetInteractions(File wd)
A degenerate operation since this has no slave JVM and no interactions model. |
|
void |
resetInteractions(File wd,
boolean forceReset)
A degenerate operation since this has no slave JVM and no interactions model. |
|
void |
saveAllFiles(FileSaveSelector com)
Saves all open files, prompting for names if necessary. |
|
protected void |
saveAllFilesHelper(FileSaveSelector com)
Called by saveAllFiles in DefaultGlobalModel |
|
void |
saveHistory(FileSaveSelector selector)
throws UnsupportedOperationException |
|
void |
saveHistory(FileSaveSelector selector,
String editedVersion)
throws UnsupportedOperationException |
|
void |
saveProject(File file,
HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info)
Writes the project profile augmented by usage info to specified file. |
|
void |
setActiveDocument(OpenDefinitionsDocument doc)
Sets the currently active document by updating the selection model. |
|
void |
setActiveFirstDocument()
Selects the first document as the active document. |
|
void |
setActiveNextDocument()
Sets the active document to be the next one in the collection. |
|
void |
setActivePreviousDocument()
Sets the active document to be the previous one in the collection. |
|
void |
setAutoRefreshStatus(boolean status)
Sets autofresh status of the project |
|
void |
setBuildDirectory(File f)
Sets the class with the project's main method. |
|
void |
setClassPathChanged(boolean changed)
Updates the classpath state. |
|
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 |
setExcludedFiles(File[] fs)
Sets the array of files excluded from the current project |
|
void |
setExtraClassPath(Iterable<File> cp)
Sets the set of classpath entries to use as the projects set of classpath entries. |
|
void |
setFileGroupingState(FileGroupingState state)
|
|
void |
setMainClass(File f)
Sets the class with the project's main method. |
|
void |
setNumCompErrors(int num)
throws UnsupportedOperationException |
|
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 class with the project's main method. |
|
void |
setWorkingDirectory(File f)
Sets the working directory for the project; ignored in flat file model. |
|
void |
systemErrPrint(String s)
Prints System.err to the DrJava console. |
|
void |
systemInEcho(String s)
Prints to the DrJava console as an echo of System.in. |
|
void |
systemOutPrint(String s)
Prints System.out to the DrJava console. |
|
void |
toggleBookmark(int pos1,
int pos2)
Toogle the specified bookmark in the active document. |
|
void |
waitForInterpreter()
throw new UnsupportedOperationException |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Log _log
public static final int DIFF_THRESHOLD
protected DocumentCache _cache
public final GlobalEventNotifier _notifier
protected final DefinitionsEditorKit _editorKit
protected final ConsoleDocument _consoleDoc
protected final InteractionsDJDocument _consoleDocAdapter
public static final int WRITE_DELAY
protected volatile PageFormat _pageFormat
protected volatile IDocumentNavigator<OpenDefinitionsDocument> _documentNavigator
protected final ConcreteRegionManager<Breakpoint> _breakpointManager
protected final ConcreteRegionManager<MovingDocumentRegion> _bookmarkManager
protected final LinkedList<RegionManager<MovingDocumentRegion>> _findResultsManagers
protected final BrowserHistoryManager _browserHistoryManager
protected volatile FileGroupingState _state
Constructor Detail |
---|
public AbstractGlobalModel()
Method Detail |
---|
public void addAuxiliaryFile(OpenDefinitionsDocument doc)
addAuxiliaryFile
in interface GlobalModel
public void removeAuxiliaryFile(OpenDefinitionsDocument doc)
removeAuxiliaryFile
in interface GlobalModel
public GlobalEventNotifier getNotifier()
getNotifier
in interface GlobalModel
public RegionManager<Breakpoint> getBreakpointManager()
getBreakpointManager
in interface GlobalModel
public RegionManager<MovingDocumentRegion> getBookmarkManager()
getBookmarkManager
in interface GlobalModel
public List<RegionManager<MovingDocumentRegion>> getFindResultsManagers()
public RegionManager<MovingDocumentRegion> createFindResultsManager()
createFindResultsManager
in interface GlobalModel
public void removeFindResultsManager(RegionManager<MovingDocumentRegion> rm)
removeFindResultsManager
in interface GlobalModel
public BrowserHistoryManager getBrowserHistoryManager()
getBrowserHistoryManager
in interface GlobalModel
public void setFileGroupingState(FileGroupingState state)
state
- the new file grouping state.protected FileGroupingState makeProjectFileGroupingState(File pr, File main, File bd, File wd, File project, File[] srcFiles, File[] auxFiles, File[] excludedFiles, Iterable<File> cp, File cjf, int cjflags, boolean refresh)
public boolean isClassPathChanged()
public void setClassPathChanged(boolean changed)
public void setProjectChanged(boolean changed)
setProjectChanged
in interface GlobalModel
public boolean isProjectChanged()
GlobalModel
isProjectChanged
in interface GlobalModel
public boolean isProjectActive()
isProjectActive
in interface GlobalModel
public File getProjectFile()
getProjectFile
in interface GlobalModel
public File[] getProjectFiles()
getProjectFiles
in interface GlobalModel
public boolean inProject(File f)
GlobalModel
inProject
in interface GlobalModel
public boolean inProjectPath(OpenDefinitionsDocument doc)
inProjectPath
in interface GlobalModel
public void setMainClass(File f)
setMainClass
in interface GlobalModel
public File getMainClass()
GlobalModel
getMainClass
in interface GlobalModel
public void setCreateJarFile(File f)
setCreateJarFile
in interface GlobalModel
public File getCreateJarFile()
getCreateJarFile
in interface GlobalModel
public void setCreateJarFlags(int f)
setCreateJarFlags
in interface GlobalModel
public int getCreateJarFlags()
getCreateJarFlags
in interface GlobalModel
public File getProjectRoot()
getProjectRoot
in interface GlobalModel
public void setProjectRoot(File f)
setProjectRoot
in interface GlobalModel
public void setProjectFile(File f)
setProjectFile
in interface GlobalModel
public File getBuildDirectory()
getBuildDirectory
in interface GlobalModel
public void setBuildDirectory(File f)
setBuildDirectory
in interface GlobalModel
public boolean getAutoRefreshStatus()
getAutoRefreshStatus
in interface GlobalModel
public void setAutoRefreshStatus(boolean status)
setAutoRefreshStatus
in interface GlobalModel
public File getMasterWorkingDirectory()
getMasterWorkingDirectory
in interface GlobalModel
public File getWorkingDirectory()
getWorkingDirectory
in interface GlobalModel
public void setWorkingDirectory(File f)
setWorkingDirectory
in interface GlobalModel
public void cleanBuildDirectory()
GlobalModel
cleanBuildDirectory
in interface GlobalModel
public List<File> getClassFiles()
getClassFiles
in interface GlobalModel
protected static String getPackageName(String classname)
protected FileGroupingState makeFlatFileGroupingState()
public String getSourceBinTitle()
getSourceBinTitle
in interface GlobalModel
public String getExternalBinTitle()
getExternalBinTitle
in interface GlobalModel
public String getAuxiliaryBinTitle()
getAuxiliaryBinTitle
in interface GlobalModel
public void addListener(GlobalModelListener listener)
addListener
in interface GlobalModel
listener
- a listener that reacts on events generated by the GlobalModel.public void removeListener(GlobalModelListener listener)
removeListener
in interface GlobalModel
listener
- a listener that reacts on events generated by the GlobalModel
This method is synchronized using the readers/writers event protocol incorporated in EventNotifierpublic DefinitionsEditorKit getEditorKit()
GlobalModel
EditorKit
implementation for use in the definitions pane.
getEditorKit
in interface GlobalModel
public DefaultInteractionsModel getInteractionsModel()
getInteractionsModel
in interface GlobalModel
public InteractionsDJDocument getSwingInteractionsDocument()
getSwingInteractionsDocument
in interface GlobalModel
public InteractionsDocument getInteractionsDocument()
getInteractionsDocument
in interface GlobalModel
public ConsoleDocument getConsoleDocument()
GlobalModel
getConsoleDocument
in interface GlobalModel
public InteractionsDJDocument getSwingConsoleDocument()
GlobalModel
getSwingConsoleDocument
in interface GlobalModel
public PageFormat getPageFormat()
getPageFormat
in interface GlobalModel
public void setPageFormat(PageFormat format)
setPageFormat
in interface GlobalModel
public CompilerModel getCompilerModel()
GlobalModel
getCompilerModel
in interface GlobalModel
public int getNumCompErrors()
getNumCompErrors
in interface GlobalModel
public void setNumCompErrors(int num)
setNumCompErrors
in interface GlobalModel
public JUnitModel getJUnitModel()
getJUnitModel
in interface GlobalModel
public JavadocModel getJavadocModel()
getJavadocModel
in interface GlobalModel
public IDocumentNavigator<OpenDefinitionsDocument> getDocumentNavigator()
GlobalModel
getDocumentNavigator
in interface GlobalModel
public void setDocumentNavigator(IDocumentNavigator<OpenDefinitionsDocument> newnav)
setDocumentNavigator
in interface GlobalModel
public void toggleBookmark(int pos1, int pos2)
pos1
- first selection positionpos2
- second selection positionpublic void _toggleBookmark(int pos1, int pos2)
pos1
- first selection positionpos2
- second selection positionpublic OpenDefinitionsDocument newFile(File parentDir)
public OpenDefinitionsDocument newFile()
newFile
in interface GlobalModel
public OpenDefinitionsDocument newTestCase(String name, boolean makeSetUp, boolean makeTearDown)
newTestCase
in interface GlobalModel
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
public DocumentCache getDocumentCache()
public OpenDefinitionsDocument openFile(FileOpenSelector com) throws IOException, OperationCanceledException, AlreadyOpenException
openFile
in interface ILoadDocuments
com
- a command pattern command that selects what file to open
IOException
OperationCanceledException
- if the open was canceled
AlreadyOpenException
- if the file is already openprotected OpenDefinitionsDocument openFileHelper(FileOpenSelector com) throws IOException, OperationCanceledException, AlreadyOpenException
IOException
OperationCanceledException
AlreadyOpenException
public OpenDefinitionsDocument[] openFiles(FileOpenSelector com) throws IOException, OperationCanceledException, AlreadyOpenException
openFiles
in interface ILoadDocuments
com
- a command pattern command that selects what file to open
IOException
OperationCanceledException
- if the open was canceled
AlreadyOpenException
- if the file is already openprotected OpenDefinitionsDocument[] openFilesHelper(FileOpenSelector com) throws IOException, OperationCanceledException, AlreadyOpenException
IOException
OperationCanceledException
AlreadyOpenException
public void openFolder(File dir, boolean rec) throws IOException, OperationCanceledException, AlreadyOpenException
openFolder
in interface GlobalModel
IOException
OperationCanceledException
AlreadyOpenException
public File[] getFilesInFolder(File dir, boolean rec) throws IOException, OperationCanceledException, AlreadyOpenException
IOException
OperationCanceledException
AlreadyOpenException
public File[] getNewFilesInProject()
public void openNewFilesInProject()
public void saveAllFiles(FileSaveSelector com) throws IOException
saveAllFiles
in interface GlobalModel
com
- a FileSaveSelector
IOException
protected void saveAllFilesHelper(FileSaveSelector com) throws IOException
IOException
public void createNewProject(File projFile)
createNewProject
in interface GlobalModel
projFile
- the new project file (which does not yet exist in the file system)public void configNewProject() throws IOException
configNewProject
in interface GlobalModel
IOException
public ProjectProfile _makeProjectProfile(File file, HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info) throws IOException
file
- where to save the projectinfo
-
IOException
public void saveProject(File file, HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info) throws IOException
saveProject
in interface GlobalModel
file
- where to save the projectinfo
- Extra view-related information that should be included in the project file
IOException
public void exportOldProject(File file, HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info) throws IOException
file
- where to save the project
IOException
public void reloadProject(File file, HashMap<OpenDefinitionsDocument,DocumentInfoGetter> info) throws IOException
GlobalModel
reloadProject
in interface GlobalModel
file
- project file; does not actually get touched
IOException
public void openProject(File projectFile) throws IOException, MalformedProjectFileException
openProject
in interface GlobalModel
projectFile
- The project file to parse
IOException
MalformedProjectFileException
public void autoRefreshProject()
public void closeProject(boolean suppressReset)
closeProject
in interface GlobalModel
public void aboutToSaveFromSaveAll(OpenDefinitionsDocument doc)
public boolean closeFile(OpenDefinitionsDocument doc)
closeFile
in interface GlobalModel
public boolean closeAllFiles()
closeAllFiles
in interface GlobalModel
public boolean closeFiles(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.
closeFiles
in interface SingleDisplayModel
docs
- the list od OpenDefinitionsDocuments to close
protected boolean closeFileHelper(OpenDefinitionsDocument doc)
public boolean closeFileWithoutPrompt(OpenDefinitionsDocument doc)
closeFileWithoutPrompt
in interface GlobalModel
public boolean closeAllFilesOnQuit()
closeAllFilesOnQuit
in interface SingleDisplayModel
false
if the user cancelledpublic void quit()
quit
in interface GlobalModel
public void forceQuit()
forceQuit
in interface GlobalModel
public void dispose()
dispose
in interface SingleDisplayModel
public void disposeExternalResources()
disposeExternalResources
in interface SingleDisplayModel
public OpenDefinitionsDocument getDocumentForFile(File file) throws IOException
getDocumentForFile
in interface GlobalModel
file
- File contained by the document to be returned
IOException
public boolean isAlreadyOpen(File file)
public OpenDefinitionsDocument getODDForDocument(AbstractDocumentInterface doc)
getODDForDocument
in interface GlobalModel
doc
- the searched for Document
public DocumentIterator getDocumentIterator()
getDocumentIterator
in interface GlobalModel
public OpenDefinitionsDocument getNextDocument(OpenDefinitionsDocument d)
getNextDocument
in interface DocumentIterator
d
- the current Document
public OpenDefinitionsDocument getPrevDocument(OpenDefinitionsDocument d)
getPrevDocument
in interface DocumentIterator
d
- the current Document
public int getDocumentCount()
GlobalModel
getDocumentCount
in interface GlobalModel
getDocumentCount
in interface DocumentIterator
public List<OpenDefinitionsDocument> getOpenDefinitionsDocuments()
getOpenDefinitionsDocuments
in interface GlobalModel
public List<OpenDefinitionsDocument> getSortedOpenDefinitionsDocuments()
public boolean hasOutOfSyncDocuments()
hasOutOfSyncDocuments
in interface GlobalModel
public boolean hasOutOfSyncDocuments(List<OpenDefinitionsDocument> lod)
hasOutOfSyncDocuments
in interface GlobalModel
public void resetInteractions(File wd)
resetInteractions
in interface GlobalModel
public void resetInteractions(File wd, boolean forceReset)
resetInteractions
in interface GlobalModel
public void resetConsole()
resetConsole
in interface GlobalModel
public void interpretCurrentInteraction()
interpretCurrentInteraction
in interface GlobalModel
public void loadHistory(FileOpenSelector selector) throws IOException
loadHistory
in interface GlobalModel
IOException
public InteractionsScriptModel loadHistoryAsScript(FileOpenSelector selector) throws IOException, OperationCanceledException
loadHistoryAsScript
in interface GlobalModel
IOException
OperationCanceledException
public void clearHistory()
clearHistory
in interface GlobalModel
public void saveHistory(FileSaveSelector selector) throws IOException
saveHistory
in interface GlobalModel
selector
- File to save to
IOException
public void saveHistory(FileSaveSelector selector, String editedVersion) throws IOException
saveHistory
in interface GlobalModel
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
public String getHistoryAsStringWithSemicolons()
getHistoryAsStringWithSemicolons
in interface GlobalModel
public String getHistoryAsString()
getHistoryAsString
in interface GlobalModel
protected void _docAppend(ConsoleDocument doc, String s, String style)
doc
- Document to append tos
- String to append to the end of the documentstyle
- the style to print withpublic void systemOutPrint(String s)
systemOutPrint
in interface GlobalModel
public void systemErrPrint(String s)
systemErrPrint
in interface GlobalModel
public void systemInEcho(String s)
systemInEcho
in interface GlobalModel
public void printDebugMessage(String s)
printDebugMessage
in interface GlobalModel
public void waitForInterpreter()
waitForInterpreter
in interface GlobalModel
public Iterable<File> getInteractionsClassPath()
getInteractionsClassPath
in interface GlobalModel
public Iterable<File> getExtraClassPath()
getExtraClassPath
in interface GlobalModel
public void setExtraClassPath(Iterable<File> cp)
setExtraClassPath
in interface GlobalModel
public File[] getExclFiles()
getExclFiles
in interface SingleDisplayModel
public void setExcludedFiles(File[] fs)
setExcludedFiles
in interface SingleDisplayModel
public Iterable<File> getSourceRootSet()
getSourceRootSet
in interface GlobalModel
public Debugger getDebugger()
getDebugger
in interface GlobalModel
public int getDebugPort() throws IOException
getDebugPort
in interface GlobalModel
IOException
- if unable to get a valid port number.public boolean hasModifiedDocuments()
hasModifiedDocuments
in interface GlobalModel
public boolean hasModifiedDocuments(List<OpenDefinitionsDocument> lod)
hasModifiedDocuments
in interface GlobalModel
public boolean hasUntitledDocuments()
hasUntitledDocuments
in interface GlobalModel
public File getSourceFile(String fileName)
getSourceFile
in interface GlobalModel
fileName
- name of the source file to look for
public File findFileInPaths(String fileName, Iterable<File> paths)
findFileInPaths
in interface GlobalModel
fileName
- Name of the source file to look forpaths
- An array of directories to search
public void addToBrowserHistory()
addToBrowserHistory
in interface GlobalModel
public Iterable<File> getClassPath()
getClassPath
in interface GlobalModel
public static boolean isUntitled(File f)
protected edu.rice.cs.drjava.model.AbstractGlobalModel.ConcreteOpenDefDoc _createOpenDefinitionsDocument(NullFile f)
protected edu.rice.cs.drjava.model.AbstractGlobalModel.ConcreteOpenDefDoc _createOpenDefinitionsDocument(File f) throws IOException
FileNotFoundException
- if file f does not exist
IOException
protected OpenDefinitionsDocument _getOpenDocument(File file)
file
- File object to search for
public List<OpenDefinitionsDocument> getNonProjectDocuments()
getNonProjectDocuments
in interface GlobalModel
public List<OpenDefinitionsDocument> getAuxiliaryDocuments()
getAuxiliaryDocuments
in interface GlobalModel
public List<OpenDefinitionsDocument> getProjectDocuments()
getProjectDocuments
in interface GlobalModel
public String fixPathForNavigator(String path) throws IOException
GlobalModel
fixPathForNavigator
in interface GlobalModel
IOException
protected static <T> T pop(ArrayList<T> stack)
protected void addDocToNavigator(OpenDefinitionsDocument doc)
doc
- the document to add to the navigatorprotected void addDocToClassPath(OpenDefinitionsDocument doc)
public OpenDefinitionsDocument _openFile(File file) throws IOException, AlreadyOpenException
file
- File to read document from
IOException
AlreadyOpenException
public OpenDefinitionsDocument getActiveDocument()
getActiveDocument
in interface SingleDisplayModel
public void setActiveDocument(OpenDefinitionsDocument doc)
setActiveDocument
in interface SingleDisplayModel
doc
- Document to set as activepublic Container getDocCollectionWidget()
getDocCollectionWidget
in interface SingleDisplayModel
public void setActiveNextDocument()
setActiveNextDocument
in interface SingleDisplayModel
public void setActivePreviousDocument()
setActivePreviousDocument
in interface SingleDisplayModel
public void setActiveFirstDocument()
setActiveFirstDocument
in interface SingleDisplayModel
public void installActiveDocument()
public void refreshActiveDocument()
refreshActiveDocument
in interface GlobalModel
refreshActiveDocument
in interface SingleDisplayModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |