edu.rice.cs.drjava.model.compiler
Class CompilerEventNotifier

java.lang.Object
  extended by edu.rice.cs.drjava.model.EventNotifier<CompilerListener>
      extended by edu.rice.cs.drjava.model.compiler.CompilerEventNotifier
All Implemented Interfaces:
CompilerListener

 class CompilerEventNotifier
extends EventNotifier<CompilerListener>
implements CompilerListener

Keeps track of all listeners to a CompilerModel, and has the ability to notify them of some event.

This class has a specific role of managing CompilerListeners. Other classes with similar names use similar code to perform the same function for other interfaces, e.g. InteractionsEventNotifier and GlobalEventNotifier. 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.

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!

Version:
$Id: CompilerEventNotifier.java 5236 2010-04-27 01:43:36Z mgricken $

Field Summary
 
Fields inherited from class edu.rice.cs.drjava.model.EventNotifier
_listeners, _lock
 
Constructor Summary
CompilerEventNotifier()
           
 
Method Summary
 void activeCompilerChanged()
          Called after the active compiler has been changed.
 void compileAborted(java.lang.Exception e)
          Called if the compile cannot be performed.
 void compileEnded(java.io.File workDir, java.util.List<? extends java.io.File> excludedFiles)
          Called when a compile has finished running.
 void compileStarted()
          Called after a compile is started by the GlobalModel.
 void saveBeforeCompile()
          Called when files are saved before compiling.
 void saveUntitled()
          Called when files are saved before compiling.
 
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

CompilerEventNotifier

CompilerEventNotifier()
Method Detail

compileStarted

public void compileStarted()
Called after a compile is started by the GlobalModel.

Specified by:
compileStarted in interface CompilerListener

compileEnded

public void compileEnded(java.io.File workDir,
                         java.util.List<? extends java.io.File> excludedFiles)
Called when a compile has finished running.

Specified by:
compileEnded in interface CompilerListener

compileAborted

public void compileAborted(java.lang.Exception e)
Called if the compile cannot be performed. By default, the Exception is an UnexpectedException containing an explanatory message.

Specified by:
compileAborted in interface CompilerListener

saveBeforeCompile

public void saveBeforeCompile()
Called when files are saved before compiling. It is up to the caller of this method to check if the documents have been saved, using IGetDocuments.hasModifiedDocuments().

Specified by:
saveBeforeCompile in interface CompilerListener

saveUntitled

public void saveUntitled()
Called when files are saved before compiling. It is up to the caller of this method to check if the documents have been saved, using IGetDocuments.hasModifiedDocuments().

Specified by:
saveUntitled in interface CompilerListener

activeCompilerChanged

public void activeCompilerChanged()
Called after the active compiler has been changed.

Specified by:
activeCompilerChanged in interface CompilerListener