edu.rice.cs.drjava.model
Interface GlobalModelListener

All Superinterfaces:
CompilerListener, InteractionsListener, JavadocListener, JUnitListener
All Known Implementing Classes:
DebugTestCase.InterpretListener, DummyGlobalModelListener, GlobalEventNotifier, GlobalModelJUnitTest.JUnitCompileBeforeTestListener, GlobalModelTestCase.CompileShouldFailListener, GlobalModelTestCase.CompileShouldSucceedListener, GlobalModelTestCase.InteractionListener, GlobalModelTestCase.JUnitNonTestListener, GlobalModelTestCase.JUnitTestListener, GlobalModelTestCase.TestListener, SingleDisplayModelTest.SDTestListener

public interface GlobalModelListener
extends InteractionsListener, JavadocListener, CompilerListener, JUnitListener

An interface for responding to events generated by the GlobalModel. TODO: Refactor to remove component listeners from Global level.

Version:
$Id: GlobalModelListener.java 4636 2008-08-12 18:47:11Z mgricken $

Method Summary
 void activeDocumentChanged(OpenDefinitionsDocument active)
          Called when a new active document is selected
 void activeDocumentRefreshed(OpenDefinitionsDocument active)
          Called when the active document is refreshed
 void browserChanged()
          Called when the a region is added to the browswing history.
 boolean canAbandonFile(OpenDefinitionsDocument doc)
          Called to ask the listener if it is OK to abandon the current document.
 void consoleReset()
          Called when the console window is reset.
 void currentDirectoryChanged(File dir)
          Called when the selection in the navigator changes the current directory without changing the active document.
 void documentNotFound(OpenDefinitionsDocument d, File f)
          Called when the a document, already opened, is brought back into the cache, and it no longer exists on disk or cannot be accessed.
<P,R> void
executeAsyncTask(AsyncTask<P,R> task, P param, boolean showProgress, boolean lockUI)
          Called when an asynchronous task must be run in the model
 void fileClosed(OpenDefinitionsDocument doc)
          Called after a document is closed.
 void fileOpened(OpenDefinitionsDocument doc)
          Called after a file is opened and read into the current document.
 void filePathContainsPound()
          Called when saving a file whose path contains a '#' symbol.
 void fileReverted(OpenDefinitionsDocument doc)
          Called after a document is reverted.
 void fileSaved(OpenDefinitionsDocument doc)
          Called after the current document is saved.
 void filesNotFound(File... f)
          Called when trying to open one or more files that do not exist.
 File[] filesReadOnly(File... f)
          Called when trying to write one or more files that are read-only.
 void focusOnDefinitionsPane()
          Called when the focus must be changed to the active document in the definitions pane
 void focusOnLastFocusOwner()
          Restores the focus in the main frame to the last focus owner.
 void handleAlreadyOpenDocument(OpenDefinitionsDocument doc)
          Performs any UI related steps to handle the case in which a file is being opened that is already open and modified.
 void newFileCreated(OpenDefinitionsDocument doc)
          Called after a new document is created.
 void openProject(File projectFile, FileOpenSelector files)
          Called while the project is being opened.
 void prepareForRun(OpenDefinitionsDocument doc)
          Called when a file's main method is about to be run.
 void projectBuildDirChanged()
          Called when the build directory is modified in the model.
 void projectClosed()
          Called when the project is being closed.
 void projectModified()
          Called if the project's modified state has changed.
 void projectRunnableChanged()
          Called when the project runnability changed (ie, when the main file is set/unset).
 void projectWorkDirChanged()
          Called when the working directory is modified in the model.
 boolean quitFile(OpenDefinitionsDocument doc)
          Called to ask the listener if this document should be saved before quitting.
 boolean shouldRevertFile(OpenDefinitionsDocument doc)
          Called to ask the listener if it is OK to revert the current document to the version saved on disk.
 void undoableEditHappened()
          Called when an undoable edit occurs.
 
Methods inherited from interface edu.rice.cs.drjava.model.repl.InteractionsListener
interactionEnded, interactionErrorOccurred, interactionIncomplete, interactionStarted, interpreterChanged, interpreterExited, interpreterReady, interpreterResetFailed, interpreterResetting, slaveJVMUsed
 
Methods inherited from interface edu.rice.cs.drjava.model.javadoc.JavadocListener
javadocEnded, javadocStarted, saveBeforeJavadoc
 
Methods inherited from interface edu.rice.cs.drjava.model.compiler.CompilerListener
activeCompilerChanged, compileAborted, compileEnded, compileStarted, saveBeforeCompile, saveUntitled
 
Methods inherited from interface edu.rice.cs.drjava.model.junit.JUnitListener
classFileError, compileBeforeJUnit, junitClassesStarted, junitEnded, junitStarted, junitSuiteStarted, junitTestEnded, junitTestStarted, nonTestCase
 

Method Detail

executeAsyncTask

<P,R> void executeAsyncTask(AsyncTask<P,R> task,
                            P param,
                            boolean showProgress,
                            boolean lockUI)
Called when an asynchronous task must be run in the model


handleAlreadyOpenDocument

void handleAlreadyOpenDocument(OpenDefinitionsDocument doc)
Performs any UI related steps to handle the case in which a file is being opened that is already open and modified. The two choices are to revert to the copy on disk, or to keep the current changes.

Parameters:
doc - true if the user wishes to revert the document, false to ignore

filesNotFound

void filesNotFound(File... f)
Called when trying to open one or more files that do not exist.


filesReadOnly

File[] filesReadOnly(File... f)
Called when trying to write one or more files that are read-only.

Parameters:
f - files that are read-only
Returns:
the files that should be attempted to be rewritten

newFileCreated

void newFileCreated(OpenDefinitionsDocument doc)
Called after a new document is created.


fileSaved

void fileSaved(OpenDefinitionsDocument doc)
Called after the current document is saved.


fileOpened

void fileOpened(OpenDefinitionsDocument doc)
Called after a file is opened and read into the current document.


fileClosed

void fileClosed(OpenDefinitionsDocument doc)
Called after a document is closed.


fileReverted

void fileReverted(OpenDefinitionsDocument doc)
Called after a document is reverted.


canAbandonFile

boolean canAbandonFile(OpenDefinitionsDocument doc)
Called to ask the listener if it is OK to abandon the current document.


quitFile

boolean quitFile(OpenDefinitionsDocument doc)
Called to ask the listener if this document should be saved before quitting.

Returns:
true if quitting should continue, false if the user cancelled

shouldRevertFile

boolean shouldRevertFile(OpenDefinitionsDocument doc)
Called to ask the listener if it is OK to revert the current document to the version saved on disk.


prepareForRun

void prepareForRun(OpenDefinitionsDocument doc)
Called when a file's main method is about to be run.


consoleReset

void consoleReset()
Called when the console window is reset.


undoableEditHappened

void undoableEditHappened()
Called when an undoable edit occurs.


filePathContainsPound

void filePathContainsPound()
Called when saving a file whose path contains a '#' symbol.


activeDocumentChanged

void activeDocumentChanged(OpenDefinitionsDocument active)
Called when a new active document is selected


activeDocumentRefreshed

void activeDocumentRefreshed(OpenDefinitionsDocument active)
Called when the active document is refreshed


focusOnDefinitionsPane

void focusOnDefinitionsPane()
Called when the focus must be changed to the active document in the definitions pane


focusOnLastFocusOwner

void focusOnLastFocusOwner()
Restores the focus in the main frame to the last focus owner.


currentDirectoryChanged

void currentDirectoryChanged(File dir)
Called when the selection in the navigator changes the current directory without changing the active document.


projectBuildDirChanged

void projectBuildDirChanged()
Called when the build directory is modified in the model.


projectWorkDirChanged

void projectWorkDirChanged()
Called when the working directory is modified in the model.


openProject

void openProject(File projectFile,
                 FileOpenSelector files)
Called while the project is being opened.

Parameters:
projectFile - the location of the project file
files - The files the gui should open for the model

projectClosed

void projectClosed()
Called when the project is being closed.


projectModified

void projectModified()
Called if the project's modified state has changed.


projectRunnableChanged

void projectRunnableChanged()
Called when the project runnability changed (ie, when the main file is set/unset).


documentNotFound

void documentNotFound(OpenDefinitionsDocument d,
                      File f)
Called when the a document, already opened, is brought back into the cache, and it no longer exists on disk or cannot be accessed.


browserChanged

void browserChanged()
Called when the a region is added to the browswing history.