|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.model.EventNotifier<GlobalModelListener>
edu.rice.cs.drjava.model.GlobalEventNotifier
public class GlobalEventNotifier
Keeps track of all listeners to the model, and has the ability to notify them of some event.
This class has a specific role of managing GlobalModelListeners. Other classes with similar names use similar code to perform the same function for other interfaces, e.g. InteractionsEventNotifier and JavadocEventNotifier. These classes implement the appropriate interface definition so that they can be used transparently as composite packaging for a particular listener interface.
Components which might otherwise manage their own list of listeners use EventNotifiers instead to simplify their internal implementation. Notifiers should therefore be considered a private implementation detail of the components, and should not be used directly outside of the "host" component.
TODO: remove direct references to GlobalEventNotifier outside of DefaultGlobalModel TODO: remove public modifier from this class when above has happened All methods in this class must use the synchronization methods provided by ReaderWriterLock. This ensures that multiple notifications (reads) can occur simultaneously, but only one thread can be adding or removing listeners (writing) at a time, and no reads can occur during a write.
No methods on this class should be synchronized using traditional Java synchronization!
| Nested Class Summary | |
|---|---|
static class |
GlobalEventNotifier.Notifier
Deprecated. Use listener methods directly instead. |
static class |
GlobalEventNotifier.Poller
Deprecated. Use listener methods directly instead. |
| Field Summary |
|---|
| Fields inherited from class edu.rice.cs.drjava.model.EventNotifier |
|---|
_listeners, _lock |
| Constructor Summary | |
|---|---|
GlobalEventNotifier()
|
|
| Method Summary | ||
|---|---|---|
void |
activeCompilerChanged()
Called after the active compiler has been changed. |
|
void |
activeDocumentChanged(OpenDefinitionsDocument active)
Called when the selection in the navigator changes the active document. |
|
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 listeners if it is OK to abandon the current document. |
|
void |
classFileError(ClassFileError e)
Called when trying to test an illegal class file. |
|
void |
compileAborted(Exception e)
Called if a compile is aborted. |
|
void |
compileBeforeJUnit(CompilerListener cl)
Called before attempting unit testing if tested class files are out of sync, to give the user a chance to save. |
|
void |
compileEnded(File workDir,
List<? extends File> excludedFiles)
Called when a compile has finished running. |
|
void |
compileStarted()
Called after a compile is started by the GlobalModel. |
|
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. |
|
|
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()
Notifies the view that the current file path contains a #. |
|
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 to shift the focus to the Definitions Pane. |
|
void |
focusOnLastFocusOwner()
Called to shift the focus to the last focus owner among the main frame panes. |
|
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 |
interactionEnded()
Called when an interaction has finished running. |
|
void |
interactionErrorOccurred(int offset,
int length)
Called when the interactions window generates a syntax error. |
|
void |
interactionIncomplete()
Notifies the view that the current interaction is incomplete. |
|
void |
interactionStarted()
Called after an interaction is started by the GlobalModel. |
|
void |
interpreterChanged(boolean inProgress)
Called when the active interpreter is changed. |
|
void |
interpreterExited(int status)
Called when the interactions JVM was closed by System.exit or by being aborted. |
|
void |
interpreterReady(File wd)
Called when the interactions window is reset. |
|
void |
interpreterResetFailed(Throwable t)
Called if the interpreter reset failed. |
|
void |
interpreterResetting()
Called when the interactionsJVM has begun resetting. |
|
void |
javadocEnded(boolean success,
File destDir,
boolean allDocs)
Called after Javadoc is finished. |
|
void |
javadocStarted()
Called after Javadoc is started by the GlobalModel. |
|
void |
junitClassesStarted()
Called when testing specific list of classes. |
|
void |
junitEnded()
Called after JUnit is finished running tests. |
|
void |
junitStarted()
Called after JUnit is started by the GlobalModel. |
|
void |
junitSuiteStarted(int numTests)
Called to indicate that a suite of tests has started running. |
|
void |
junitTestEnded(String name,
boolean wasSuccessful,
boolean causedError)
Called when a particular test has ended. |
|
void |
junitTestStarted(String name)
Called when a particular test is started. |
|
void |
newFileCreated(OpenDefinitionsDocument doc)
Called after a new document is created. |
|
void |
nonTestCase(boolean isTestAll)
Called when trying to test a non-TestCase class. |
|
void |
notifyListeners(GlobalEventNotifier.Notifier n)
Lets the listeners know some event has taken place. |
|
void |
openProject(File pfile,
FileOpenSelector files)
Called while the project is being opened. |
|
boolean |
pollListeners(GlobalEventNotifier.Poller p)
Deprecated. Use listener methods directly instead. |
|
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 listeners save the file before quitting at the user's option. |
|
void |
saveBeforeCompile()
Called to demand that all files be saved before compiling. |
|
void |
saveBeforeJavadoc()
Called before attempting Javadoc, to give the user a chance to save. |
|
void |
saveUntitled()
Called to demand that the active document, which is untitled, is saved before compiling. |
|
boolean |
shouldRevertFile(OpenDefinitionsDocument doc)
Called to ask the listeners if it is OK to revert the current document to the version saved on disk. |
|
void |
slaveJVMUsed()
Called when the slave JVM is used by the interpreter or unit testing. |
|
void |
undoableEditHappened()
Called when an undoable edit occurs. |
|
| Methods inherited from class edu.rice.cs.drjava.model.EventNotifier |
|---|
addListener, removeAllListeners, removeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GlobalEventNotifier()
| Method Detail |
|---|
public <P,R> void executeAsyncTask(AsyncTask<P,R> task,
P param,
boolean showProgress,
boolean lockUI)
GlobalModelListener
executeAsyncTask in interface GlobalModelListenerpublic void filesNotFound(File... f)
GlobalModelListener
filesNotFound in interface GlobalModelListenerpublic File[] filesReadOnly(File... f)
GlobalModelListener
filesReadOnly in interface GlobalModelListenerf - files that are read-only
public void handleAlreadyOpenDocument(OpenDefinitionsDocument doc)
handleAlreadyOpenDocument in interface GlobalModelListenerdoc - true if the user wishes to revert the document, false to ignore
public void openProject(File pfile,
FileOpenSelector files)
GlobalModelListener
openProject in interface GlobalModelListenerpfile - the location of the project filefiles - The files the gui should open for the modelpublic void projectClosed()
GlobalModelListener
projectClosed in interface GlobalModelListenerpublic void projectModified()
GlobalModelListener
projectModified in interface GlobalModelListenerpublic void projectBuildDirChanged()
GlobalModelListener
projectBuildDirChanged in interface GlobalModelListenerpublic void projectWorkDirChanged()
GlobalModelListener
projectWorkDirChanged in interface GlobalModelListenerpublic void projectRunnableChanged()
GlobalModelListener
projectRunnableChanged in interface GlobalModelListenerpublic void notifyListeners(GlobalEventNotifier.Notifier n)
n - tells the listener what happened.@Deprecated public boolean pollListeners(GlobalEventNotifier.Poller p)
p - the question being asked of the listeners
public void prepareForRun(OpenDefinitionsDocument doc)
prepareForRun in interface GlobalModelListenerpublic void newFileCreated(OpenDefinitionsDocument doc)
newFileCreated in interface GlobalModelListenerpublic void consoleReset()
consoleReset in interface GlobalModelListenerpublic void fileSaved(OpenDefinitionsDocument doc)
fileSaved in interface GlobalModelListenerpublic void fileOpened(OpenDefinitionsDocument doc)
fileOpened in interface GlobalModelListenerpublic void fileClosed(OpenDefinitionsDocument doc)
fileClosed in interface GlobalModelListenerpublic void fileReverted(OpenDefinitionsDocument doc)
fileReverted in interface GlobalModelListenerpublic void undoableEditHappened()
undoableEditHappened in interface GlobalModelListenerpublic boolean canAbandonFile(OpenDefinitionsDocument doc)
canAbandonFile in interface GlobalModelListenerpublic boolean quitFile(OpenDefinitionsDocument doc)
quitFile in interface GlobalModelListenerpublic boolean shouldRevertFile(OpenDefinitionsDocument doc)
shouldRevertFile in interface GlobalModelListenerpublic void currentDirectoryChanged(File dir)
currentDirectoryChanged in interface GlobalModelListenerpublic void activeDocumentChanged(OpenDefinitionsDocument active)
activeDocumentChanged in interface GlobalModelListenerpublic void activeDocumentRefreshed(OpenDefinitionsDocument active)
activeDocumentRefreshed in interface GlobalModelListenerpublic void focusOnDefinitionsPane()
focusOnDefinitionsPane in interface GlobalModelListenerpublic void focusOnLastFocusOwner()
focusOnLastFocusOwner in interface GlobalModelListenerpublic void interactionStarted()
interactionStarted in interface InteractionsListenerpublic void interactionEnded()
interactionEnded in interface InteractionsListener
public void interactionErrorOccurred(int offset,
int length)
interactionErrorOccurred in interface InteractionsListeneroffset - the error's offset into the InteractionsDocument.length - the length of the error.public void interpreterResetting()
interpreterResetting in interface InteractionsListenerpublic void interpreterReady(File wd)
interpreterReady in interface InteractionsListenerpublic void interpreterResetFailed(Throwable t)
interpreterResetFailed in interface InteractionsListenert - Throwable explaining why the reset failed.
(Subclasses must maintain listeners.)public void interpreterExited(int status)
interpreterExited in interface InteractionsListenerstatus - the exit codepublic void interpreterChanged(boolean inProgress)
interpreterChanged in interface InteractionsListenerinProgress - Whether the new interpreter is processing an interaction (i.e,. whether an interactionEnded
event will be fired)public void compileStarted()
compileStarted in interface CompilerListener
public void compileEnded(File workDir,
List<? extends File> excludedFiles)
compileEnded in interface CompilerListenerpublic void compileAborted(Exception e)
compileAborted in interface CompilerListenerpublic void saveBeforeCompile()
saveBeforeCompile in interface CompilerListenerpublic void saveUntitled()
saveUntitled in interface CompilerListenerpublic void activeCompilerChanged()
activeCompilerChanged in interface CompilerListenerpublic void nonTestCase(boolean isTestAll)
nonTestCase in interface JUnitListenerisTestAll - whether or not it was a use of the test all buttonpublic void classFileError(ClassFileError e)
classFileError in interface JUnitListenere - the ClassFileError thrown when DrJava attempted to load the offending filepublic void compileBeforeJUnit(CompilerListener cl)
compileBeforeJUnit in interface JUnitListenerpublic void junitStarted()
junitStarted in interface JUnitListenerpublic void junitClassesStarted()
junitClassesStarted in interface JUnitListenerpublic void junitSuiteStarted(int numTests)
junitSuiteStarted in interface JUnitListenernumTests - The number of tests in the suite to be run.public void junitTestStarted(String name)
junitTestStarted in interface JUnitListenername - The name of the test being started.
public void junitTestEnded(String name,
boolean wasSuccessful,
boolean causedError)
junitTestEnded in interface JUnitListenername - the name of the test that has endedwasSuccessful - whether the test passed or notcausedError - if not successful, whether the test caused an error or simply failedpublic void junitEnded()
junitEnded in interface JUnitListenerpublic void javadocStarted()
javadocStarted in interface JavadocListener
public void javadocEnded(boolean success,
File destDir,
boolean allDocs)
javadocEnded in interface JavadocListenersuccess - whether the Javadoc operation generated proper outputdestDir - if (success) the location where the output was generated, otherwise undefined (possibly null)allDocs - Whether Javadoc was run for all open documentspublic void saveBeforeJavadoc()
saveBeforeJavadoc in interface JavadocListenerpublic void interactionIncomplete()
interactionIncomplete in interface InteractionsListenerpublic void slaveJVMUsed()
InteractionsListener
slaveJVMUsed in interface InteractionsListenerpublic void filePathContainsPound()
filePathContainsPound in interface GlobalModelListener
public void documentNotFound(OpenDefinitionsDocument d,
File f)
GlobalModelListener
documentNotFound in interface GlobalModelListenerpublic void browserChanged()
GlobalModelListener
browserChanged in interface GlobalModelListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||