edu.rice.cs.drjava.model
Class DefaultGlobalModel

java.lang.Object
  extended by edu.rice.cs.drjava.model.AbstractGlobalModel
      extended by edu.rice.cs.drjava.model.DefaultGlobalModel
All Implemented Interfaces:
OptionConstants, GlobalModel, ILoadDocuments, SingleDisplayModel, DocumentIterator
Direct Known Subclasses:
GlobalModelTestCase.TestGlobalModel

public class DefaultGlobalModel
extends AbstractGlobalModel

Handles the bulk of DrJava's program logic. The UI components interface with the GlobalModel through its public methods, and the 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 functionality of DrJava, along with many other things.

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

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  InteractionsDJDocument _interactionsDocument
          The document used in the Interactions model.
protected  InteractionsListener _interactionsListener
          Core listener attached to interactions model
protected  DefaultInteractionsModel _interactionsModel
          Interface between the InteractionsDocument and the JavaInterpreter, which runs in a separate JVM.
protected  JavadocModel _javadocModel
          Manages all Javadoc functionality.
 
Fields inherited from class edu.rice.cs.drjava.model.AbstractGlobalModel
_bookmarkManager, _breakpointManager, _browserHistoryManager, _cache, _consoleDoc, _consoleDocAdapter, _documentNavigator, _editorKit, _findResultsManagers, _log, _notifier, _pageFormat, _state, DIFF_THRESHOLD, WRITE_DELAY
 
Fields inherited from interface edu.rice.cs.drjava.model.GlobalModel
RUNTIME_CLASS_PATH
 
Fields inherited from interface edu.rice.cs.drjava.config.OptionConstants
accessLevelChoices, ALLOW_PRIVATE_ACCESS, ALWAYS_COMPILE_BEFORE_JUNIT, ALWAYS_SAVE_BEFORE_COMPILE, ALWAYS_SAVE_BEFORE_DEBUG, ALWAYS_SAVE_BEFORE_JAVADOC, ALWAYS_SAVE_BEFORE_RUN, apiJavadocChoices, apiJavadocVersionChoices, AUTO_CLOSE_COMMENTS, BACKUP_FILES, BOOKMARK_COLOR, BROWSER_FILE, BROWSER_HISTORY_MAX_SIZE, BROWSER_STRING, choices, CLIPBOARD_HISTORY_SIZE, COMPILER_ERROR_COLOR, DEBUG_BREAKPOINT_COLOR, DEBUG_BREAKPOINT_DISABLED_COLOR, DEBUG_MESSAGE_COLOR, DEBUG_PANEL_HEIGHT, DEBUG_SOURCEPATH, DEBUG_STEP_DRJAVA, DEBUG_STEP_EXCLUDE, DEBUG_STEP_INTERPRETER, DEBUG_STEP_JAVA, DEBUG_THREAD_COLOR, DEFINITIONS_BACKGROUND_COLOR, DEFINITIONS_COMMENT_COLOR, DEFINITIONS_DOUBLE_QUOTED_COLOR, DEFINITIONS_KEYWORD_COLOR, DEFINITIONS_MATCH_COLOR, DEFINITIONS_NORMAL_COLOR, DEFINITIONS_NUMBER_COLOR, DEFINITIONS_SINGLE_QUOTED_COLOR, DEFINITIONS_TYPE_COLOR, DETACH_DEBUGGER, DETACH_TABBEDPANES, DIALOG_AUTOIMPORT_ENABLED, DIALOG_AUTOIMPORT_STATE, DIALOG_AUTOIMPORT_STORE_POSITION, DIALOG_CLIPBOARD_HISTORY_STATE, DIALOG_CLIPBOARD_HISTORY_STORE_POSITION, DIALOG_COMPLETE_JAVAAPI, DIALOG_COMPLETE_SCAN_CLASS_FILES, DIALOG_COMPLETE_WORD_STATE, DIALOG_COMPLETE_WORD_STORE_POSITION, DIALOG_DEBUGFRAME_STATE, DIALOG_DEBUGFRAME_STORE_POSITION, DIALOG_DRJAVA_ERROR_POPUP_ENABLED, DIALOG_DRJAVA_SURVEY_ENABLED, DIALOG_EDITEXTERNALPROCESS_STATE, DIALOG_EDITEXTERNALPROCESS_STORE_POSITION, DIALOG_EXTERNALPROCESS_STATE, DIALOG_EXTERNALPROCESS_STORE_POSITION, DIALOG_GOTOFILE_FULLY_QUALIFIED, DIALOG_GOTOFILE_STATE, DIALOG_GOTOFILE_STORE_POSITION, DIALOG_JAROPTIONS_STATE, DIALOG_JAROPTIONS_STORE_POSITION, DIALOG_LIGHTWEIGHT_PARSING_DELAY, DIALOG_OPENJAVADOC_STATE, DIALOG_OPENJAVADOC_STORE_POSITION, DIALOG_TABBEDPANES_STATE, DIALOG_TABBEDPANES_STORE_POSITION, DOC_LIST_WIDTH, DRJAVA_ERRORS_BUTTON_COLOR, DRJAVA_SURVEY_DAYS, DRJAVA_USE_FORCE_QUIT, EXTERNAL_SAVED_CMDLINES, EXTERNAL_SAVED_COUNT, EXTERNAL_SAVED_ENCLOSING_DJAPP_FILES, EXTERNAL_SAVED_NAMES, EXTERNAL_SAVED_PREFIX, EXTERNAL_SAVED_WORKDIRS, EXTPROCESS_FILE_EXTENSION, EXTPROCESS_FILE_NAME_INSIDE_JAR, EXTRA_CLASSPATH, EXTRA_COMPILERS, FIND_ALL_DOCUMENTS, FIND_MATCH_CASE, FIND_NO_COMMENTS_STRINGS, FIND_NO_TEST_CASES, FIND_REPLACE_FOCUS_IN_DEFPANE, FIND_RESULTS_COLOR1, FIND_RESULTS_COLOR2, FIND_RESULTS_COLOR3, FIND_RESULTS_COLOR4, FIND_RESULTS_COLOR5, FIND_RESULTS_COLOR6, FIND_RESULTS_COLOR7, FIND_RESULTS_COLOR8, FIND_RESULTS_COLORS, FIND_SEARCH_BACKWARDS, FIND_WHOLE_WORD, FOLLOW_FILE_DELAY, FOLLOW_FILE_LINES, FONT_DOCLIST, FONT_LINE_NUMBERS, FONT_MAIN, FONT_TOOLBAR, FORCE_TEST_SUFFIX, heapSizeChoices, HISTORY_MAX_SIZE, INDENT_LEVEL, INTERACTIONS_ERROR_COLOR, INTERACTIONS_EXIT_PROMPT, INTERACTIONS_RESET_PROMPT, JAVAC_LOCATION, JAVADOC_1_3_LINK, JAVADOC_1_3_TEXT, JAVADOC_1_4_LINK, JAVADOC_1_4_TEXT, JAVADOC_1_5_LINK, JAVADOC_1_5_TEXT, JAVADOC_1_6_LINK, JAVADOC_1_6_TEXT, JAVADOC_ACCESS_LEVEL, JAVADOC_API_REF_VERSION, JAVADOC_AUTO_TEXT, JAVADOC_CUSTOM_PARAMS, JAVADOC_DESTINATION, JAVADOC_FROM_ROOTS, JAVADOC_LINK_VERSION, JAVADOC_NONE_TEXT, JAVADOC_PROMPT_FOR_DESTINATION, KEY_ABOUT, KEY_BACKWARD, KEY_BEGIN_DOCUMENT, KEY_BEGIN_LINE, KEY_BOOKMARKS_PANEL, KEY_BOOKMARKS_TOGGLE, KEY_BROWSE_BACK, KEY_BROWSE_FORWARD, KEY_CHECK_NEW_VERSION, KEY_CLEAR_CONSOLE, KEY_CLEAR_HISTORY, KEY_CLEAR_LINE, KEY_CLOSE_ALL_FILES, KEY_CLOSE_FILE, KEY_CLOSE_PROJECT, KEY_CLOSING_BRACE, KEY_COMMENT_LINES, KEY_COMPILE, KEY_COMPILE_ALL, KEY_COMPLETE_FILE, KEY_COPY, KEY_CUT, KEY_CUT_LINE, KEY_DEBUG_BREAKPOINT_PANEL, KEY_DEBUG_BREAKPOINT_TOGGLE, KEY_DEBUG_CLEAR_ALL_BREAKPOINTS, KEY_DEBUG_MODE_TOGGLE, KEY_DEBUG_RESUME, KEY_DEBUG_STEP_INTO, KEY_DEBUG_STEP_OUT, KEY_DEBUG_STEP_OVER, KEY_DELETE_NEXT, KEY_DELETE_PREVIOUS, KEY_DETACH_DEBUGGER, KEY_DETACH_TABBEDPANES, KEY_DOWN, KEY_DRJAVA_ERRORS, KEY_DRJAVA_SURVEY, KEY_END_DOCUMENT, KEY_END_LINE, KEY_EXEC_PROCESS, KEY_EXECUTE_HISTORY, KEY_EXPORT_OLD, KEY_FIND_NEXT, KEY_FIND_PREV, KEY_FIND_REPLACE, KEY_FOLLOW_FILE, KEY_FORCE_QUIT, KEY_FORWARD, KEY_GOTO_FILE, KEY_GOTO_FILE_UNDER_CURSOR, KEY_GOTO_LINE, KEY_HELP, KEY_JAVADOC_ALL, KEY_JAVADOC_CURRENT, KEY_LIFT_CURRENT_INTERACTION, KEY_LOAD_HISTORY_SCRIPT, KEY_NEW_FILE, KEY_NEW_TEST, KEY_NEXT_DOCUMENT, KEY_NEXT_PANE, KEY_NEXT_WORD, KEY_OPEN_FILE, KEY_OPEN_FOLDER, KEY_OPEN_JAVADOC, KEY_OPEN_JAVADOC_UNDER_CURSOR, KEY_OPEN_PROJECT, KEY_OPENING_BRACE, KEY_PAGE_DOWN, KEY_PAGE_SETUP, KEY_PAGE_UP, KEY_PASTE, KEY_PASTE_FROM_HISTORY, KEY_PREFERENCES, KEY_PREVIOUS_DOCUMENT, KEY_PREVIOUS_PANE, KEY_PREVIOUS_WORD, KEY_PRINT, KEY_PRINT_CONSOLE, KEY_PRINT_INTERACTIONS, KEY_PRINT_PREVIEW, KEY_QUICKSTART, KEY_QUIT, KEY_REDO, KEY_RENAME_FILE, KEY_RESET_INTERACTIONS, KEY_REVERT_FILE, KEY_RUN, KEY_RUN_MAIN, KEY_SAVE_ALL_FILES, KEY_SAVE_FILE, KEY_SAVE_FILE_AS, KEY_SAVE_HISTORY, KEY_SELECT_ALL, KEY_SHIFT_DELETE_NEXT, KEY_SHIFT_DELETE_PREVIOUS, KEY_TEST, KEY_TEST_ALL, KEY_UNCOMMENT_LINES, KEY_UNDO, KEY_UP, KEY_VIEW_INTERACTIONS_CLASSPATH, LANGUAGE_LEVEL, LAST_DIRECTORY, LAST_DRJAVA_SURVEY, LAST_DRJAVA_SURVEY_RESULT, LAST_INTERACTIONS_DIRECTORY, LAST_NEW_VERSION_NOTIFICATION, LIGHTWEIGHT_PARSING_ENABLED, LINEENUM_ENABLED, linkVersionChoices, LOOK_AND_FEEL, MASK, MASTER_JVM_ARGS, MASTER_JVM_XMX, NEW_VERSION_NOTIFICATION, NEW_VERSION_NOTIFICATION_CHOICES, NEW_VERSION_NOTIFICATION_DAYS, OLD_PROJECT_FILE_EXTENSION, OPEN_FOLDER_RECURSIVE, PLASTIC_THEMES, PROJECT_FILE_EXTENSION, PROMPT_BEFORE_CLEAN, QUIT_PROMPT, RECENT_FILES, RECENT_FILES_MAX_SIZE, RECENT_PROJECTS, REMOTE_CONTROL_ENABLED, REMOTE_CONTROL_PORT, RESET_CLEAR_CONSOLE, RUN_WITH_ASSERT, SHOW_CODE_PREVIEW_POPUPS, SHOW_DEBUG_CONSOLE, SHOW_DEPRECATION_WARNINGS, SHOW_FALLTHROUGH_WARNINGS, SHOW_FINALLY_WARNINGS, SHOW_PATH_WARNINGS, SHOW_SERIAL_WARNINGS, SHOW_SOURCE_WHEN_SWITCHING, SHOW_UNCHECKED_WARNINGS, SLAVE_JVM_ARGS, SLAVE_JVM_XMX, STICKY_INTERACTIONS_DIRECTORY, SYSTEM_ERR_COLOR, SYSTEM_IN_COLOR, SYSTEM_OUT_COLOR, TABS_HEIGHT, TEXT_ANTIALIAS, TOOLBAR_ENABLED, TOOLBAR_ICONS_ENABLED, TOOLBAR_TEXT_ENABLED, WARN_BREAKPOINT_OUT_OF_SYNC, WARN_CHANGE_LAF, WARN_CHANGE_THEME, WARN_DEBUG_MODIFIED_FILE, WARN_PATH_CONTAINS_POUND, WINDOW_HEIGHT, WINDOW_STATE, WINDOW_STORE_POSITION, WINDOW_WIDTH, WINDOW_X, WINDOW_Y
 
Constructor Summary
DefaultGlobalModel()
          Constructs a new GlobalModel.
 
Method Summary
protected  edu.rice.cs.drjava.model.DefaultGlobalModel.ConcreteOpenDefDoc _createOpenDefinitionsDocument(File f)
          Creates a ConcreteOpenDefDoc for a given file f
protected  edu.rice.cs.drjava.model.DefaultGlobalModel.ConcreteOpenDefDoc _createOpenDefinitionsDocument(NullFile f)
          Creates a ConcreteOpenDefDoc for a new DefinitionsDocument.
protected  void addDocToClassPath(OpenDefinitionsDocument doc)
          Adds the source root for doc to the interactions classpath; this function is a helper to _openFiles.
 void clearHistory()
          Clears the interactions history
 void dispose()
          Prepares this model to be thrown away.
 void disposeExternalResources()
          Disposes of external resources.
 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.
 Debugger getDebugger()
          Gets the Debugger used by DrJava.
 int getDebugPort()
          Returns an available port number to use for debugging the interactions JVM.
 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()
          throws UnsupportedOperationException
 DefaultInteractionsModel getInteractionsModel()
          throws UnsupportedOperationException
 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.
 int getNumCompErrors()
          throws UnsupportedOperationException
 InteractionsDJDocument getSwingInteractionsDocument()
          throws UnsupportedOperationException
 void interpretCurrentInteraction()
          Interprets the current given text at the prompt in the interactions pane.
 void loadHistory(FileOpenSelector selector)
          Interprets file selected in the FileOpenSelector.
 InteractionsScriptModel loadHistoryAsScript(FileOpenSelector selector)
          Loads the history/histories from the given selector.
 void printDebugMessage(String s)
          Called when the debugger wants to print a message.
 void resetInteractions(File wd)
          A degenerate operation since this has no slave JVM and no interactions model.
 void resetInteractions(File wd, boolean forceReset)
          Clears and resets the slave JVM with working directory wd.
 void resetInteractionsClassPath()
          Adds the project root (if a project is open), the source roots for other open documents, the paths in the "extra classpath" config option, as well as any project-specific classpaths to the interpreter's classpath.
 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 setBuildDirectory(File f)
          Sets the build directory for a project.
 void setNumCompErrors(int num)
          throws UnsupportedOperationException
 void waitForInterpreter()
          Blocks until the interpreter has registered.
 
Methods inherited from class edu.rice.cs.drjava.model.AbstractGlobalModel
_docAppend, _getOpenDocument, _makeProjectProfile, _openFile, _toggleBookmark, aboutToSaveFromSaveAll, addAuxiliaryFile, addDocToNavigator, addListener, addToBrowserHistory, autoRefreshProject, cleanBuildDirectory, closeAllFiles, closeAllFilesOnQuit, closeFile, closeFileHelper, closeFiles, closeFileWithoutPrompt, closeProject, configNewProject, createFindResultsManager, createNewProject, exportOldProject, findFileInPaths, fixPathForNavigator, forceQuit, getActiveDocument, getAutoRefreshStatus, getAuxiliaryBinTitle, getAuxiliaryDocuments, getBookmarkManager, getBreakpointManager, getBrowserHistoryManager, getBuildDirectory, getClassFiles, getConsoleDocument, getCreateJarFile, getCreateJarFlags, getDocCollectionWidget, getDocumentCache, getDocumentCount, getDocumentForFile, getDocumentIterator, getDocumentNavigator, getEditorKit, getExclFiles, getExternalBinTitle, getExtraClassPath, getFilesInFolder, getFindResultsManagers, getMainClass, getMasterWorkingDirectory, getNewFilesInProject, getNextDocument, getNonProjectDocuments, getNotifier, getODDForDocument, getOpenDefinitionsDocuments, getPackageName, getPageFormat, getPrevDocument, getProjectDocuments, getProjectFile, getProjectFiles, getProjectRoot, getSortedOpenDefinitionsDocuments, getSourceBinTitle, getSourceFile, getSourceRootSet, getSwingConsoleDocument, getWorkingDirectory, hasModifiedDocuments, hasModifiedDocuments, hasOutOfSyncDocuments, hasOutOfSyncDocuments, hasUntitledDocuments, inProject, inProjectPath, installActiveDocument, isAlreadyOpen, isClassPathChanged, isProjectActive, isProjectChanged, isUntitled, makeFlatFileGroupingState, makeProjectFileGroupingState, newFile, newFile, newTestCase, openFile, openFileHelper, openFiles, openFilesHelper, openFolder, openNewFilesInProject, openProject, pop, quit, refreshActiveDocument, reloadProject, removeAuxiliaryFile, removeFindResultsManager, removeListener, resetConsole, saveAllFiles, saveAllFilesHelper, saveProject, setActiveDocument, setActiveFirstDocument, setActiveNextDocument, setActivePreviousDocument, setAutoRefreshStatus, setClassPathChanged, setCreateJarFile, setCreateJarFlags, setDocumentNavigator, setExcludedFiles, setExtraClassPath, setFileGroupingState, setMainClass, setPageFormat, setProjectChanged, setProjectFile, setProjectRoot, setWorkingDirectory, systemErrPrint, systemInEcho, systemOutPrint, toggleBookmark
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_interactionsDocument

protected final InteractionsDJDocument _interactionsDocument
The document used in the Interactions model.


_interactionsModel

protected final DefaultInteractionsModel _interactionsModel
Interface between the InteractionsDocument and the JavaInterpreter, which runs in a separate JVM.


_interactionsListener

protected InteractionsListener _interactionsListener
Core listener attached to interactions model


_javadocModel

protected volatile JavadocModel _javadocModel
Manages all Javadoc functionality.

Constructor Detail

DefaultGlobalModel

public DefaultGlobalModel()
Constructs a new GlobalModel. Creates a new MainJVM and starts its Interpreter JVM.

Method Detail

setBuildDirectory

public void setBuildDirectory(File f)
Sets the build directory for a project.

Specified by:
setBuildDirectory in interface GlobalModel
Overrides:
setBuildDirectory in class AbstractGlobalModel

getInteractionsModel

public DefaultInteractionsModel getInteractionsModel()
Description copied from class: AbstractGlobalModel
throws UnsupportedOperationException

Specified by:
getInteractionsModel in interface GlobalModel
Overrides:
getInteractionsModel in class AbstractGlobalModel
Returns:
the interactions model.

getSwingInteractionsDocument

public InteractionsDJDocument getSwingInteractionsDocument()
Description copied from class: AbstractGlobalModel
throws UnsupportedOperationException

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

getInteractionsDocument

public InteractionsDocument getInteractionsDocument()
Description copied from class: AbstractGlobalModel
throws UnsupportedOperationException

Specified by:
getInteractionsDocument in interface GlobalModel
Overrides:
getInteractionsDocument in class AbstractGlobalModel

getCompilerModel

public CompilerModel getCompilerModel()
Gets the CompilerModel, which provides all methods relating to compilers.

Specified by:
getCompilerModel in interface GlobalModel
Overrides:
getCompilerModel in class AbstractGlobalModel

getJUnitModel

public JUnitModel getJUnitModel()
Gets the JUnitModel, which provides all methods relating to JUnit testing.

Specified by:
getJUnitModel in interface GlobalModel
Overrides:
getJUnitModel in class AbstractGlobalModel

getJavadocModel

public JavadocModel getJavadocModel()
Gets the JavadocModel, which provides all methods relating to Javadoc.

Specified by:
getJavadocModel in interface GlobalModel
Overrides:
getJavadocModel in class AbstractGlobalModel

getNumCompErrors

public int getNumCompErrors()
Description copied from class: AbstractGlobalModel
throws UnsupportedOperationException

Specified by:
getNumCompErrors in interface GlobalModel
Overrides:
getNumCompErrors in class AbstractGlobalModel

setNumCompErrors

public void setNumCompErrors(int num)
Description copied from class: AbstractGlobalModel
throws UnsupportedOperationException

Specified by:
setNumCompErrors in interface GlobalModel
Overrides:
setNumCompErrors in class AbstractGlobalModel

dispose

public void dispose()
Prepares this model to be thrown away. Never called in practice outside of quit(), except in tests.

Specified by:
dispose in interface SingleDisplayModel
Overrides:
dispose in class AbstractGlobalModel

disposeExternalResources

public void disposeExternalResources()
Disposes of external resources. Kills the slave JVM.

Specified by:
disposeExternalResources in interface SingleDisplayModel
Overrides:
disposeExternalResources in class AbstractGlobalModel

resetInteractions

public void resetInteractions(File wd)
Description copied from class: AbstractGlobalModel
A degenerate operation since this has no slave JVM and no interactions model.

Specified by:
resetInteractions in interface GlobalModel
Overrides:
resetInteractions in class AbstractGlobalModel

resetInteractions

public void resetInteractions(File wd,
                              boolean forceReset)
Clears and resets the slave JVM with working directory wd. Also clears the console if the option is indicated (on by default). The reset operation is suppressed if the existing slave JVM has not been used, wd matches its working directory, and forceReset is false. wd may be null if a valid directory cannot be determined. In that case, the former working directory is used. This method may run outside the event thread.

Specified by:
resetInteractions in interface GlobalModel
Overrides:
resetInteractions in class AbstractGlobalModel

interpretCurrentInteraction

public void interpretCurrentInteraction()
Interprets the current given text at the prompt in the interactions pane.

Specified by:
interpretCurrentInteraction in interface GlobalModel
Overrides:
interpretCurrentInteraction in class AbstractGlobalModel

loadHistory

public void loadHistory(FileOpenSelector selector)
Interprets file selected in the FileOpenSelector. Assumes strings have no trailing whitespace. Interpretation is aborted after the first error.

Specified by:
loadHistory in interface GlobalModel
Overrides:
loadHistory in class AbstractGlobalModel

loadHistoryAsScript

public InteractionsScriptModel loadHistoryAsScript(FileOpenSelector selector)
                                            throws IOException,
                                                   OperationCanceledException
Loads the history/histories from the given selector.

Specified by:
loadHistoryAsScript in interface GlobalModel
Overrides:
loadHistoryAsScript in class AbstractGlobalModel
Throws:
IOException
OperationCanceledException

clearHistory

public void clearHistory()
Clears the interactions history

Specified by:
clearHistory in interface GlobalModel
Overrides:
clearHistory in class AbstractGlobalModel

saveHistory

public void saveHistory(FileSaveSelector selector)
                 throws IOException
Saves the unedited version of the current history to a file

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

saveHistory

public void saveHistory(FileSaveSelector selector,
                        String editedVersion)
                 throws IOException
Saves the edited version of the current history to a file

Specified by:
saveHistory in interface GlobalModel
Overrides:
saveHistory in class AbstractGlobalModel
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 history file.
Throws:
IOException

getHistoryAsStringWithSemicolons

public String getHistoryAsStringWithSemicolons()
Returns the entire history as a String with semicolons as needed.

Specified by:
getHistoryAsStringWithSemicolons in interface GlobalModel
Overrides:
getHistoryAsStringWithSemicolons in class AbstractGlobalModel

getHistoryAsString

public String getHistoryAsString()
Returns the entire history as a String.

Specified by:
getHistoryAsString in interface GlobalModel
Overrides:
getHistoryAsString in class AbstractGlobalModel

printDebugMessage

public void printDebugMessage(String s)
Called when the debugger wants to print a message. Inserts a newline.

Specified by:
printDebugMessage in interface GlobalModel
Overrides:
printDebugMessage in class AbstractGlobalModel

waitForInterpreter

public void waitForInterpreter()
Blocks until the interpreter has registered.

Specified by:
waitForInterpreter in interface GlobalModel
Overrides:
waitForInterpreter in class AbstractGlobalModel

getInteractionsClassPath

public Iterable<File> getInteractionsClassPath()
Returns the current classpath in use by the Interpreter JVM.

Specified by:
getInteractionsClassPath in interface GlobalModel
Overrides:
getInteractionsClassPath in class AbstractGlobalModel

getDebugger

public Debugger getDebugger()
Gets the Debugger used by DrJava.

Specified by:
getDebugger in interface GlobalModel
Overrides:
getDebugger in class AbstractGlobalModel

getDebugPort

public int getDebugPort()
                 throws IOException
Returns an available port number to use for debugging the interactions JVM.

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

_createOpenDefinitionsDocument

protected edu.rice.cs.drjava.model.DefaultGlobalModel.ConcreteOpenDefDoc _createOpenDefinitionsDocument(NullFile f)
Creates a ConcreteOpenDefDoc for a new DefinitionsDocument.

Overrides:
_createOpenDefinitionsDocument in class AbstractGlobalModel
Returns:
OpenDefinitionsDocument object for a new document

_createOpenDefinitionsDocument

protected edu.rice.cs.drjava.model.DefaultGlobalModel.ConcreteOpenDefDoc _createOpenDefinitionsDocument(File f)
                                                                                                 throws IOException
Creates a ConcreteOpenDefDoc for a given file f

Overrides:
_createOpenDefinitionsDocument in class AbstractGlobalModel
Returns:
OpenDefinitionsDocument object for f
Throws:
FileNotFoundException - if file f does not exist
IOException

addDocToClassPath

protected void addDocToClassPath(OpenDefinitionsDocument doc)
Adds the source root for doc to the interactions classpath; this function is a helper to _openFiles.

Overrides:
addDocToClassPath in class AbstractGlobalModel
Parameters:
doc - the document to add to the classpath

getClassPath

public Iterable<File> getClassPath()
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
Overrides:
getClassPath in class AbstractGlobalModel

resetInteractionsClassPath

public void resetInteractionsClassPath()
Adds the project root (if a project is open), the source roots for other open documents, the paths in the "extra classpath" config option, as well as any project-specific classpaths to the interpreter's classpath. This method is called in DefaultInteractionsModel when the interpreter becomes ready. Runs outside the event thread.