|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.model.compiler.DefaultCompilerModel
public class DefaultCompilerModel
Default implementation of the CompilerModel interface. This implementation is used for normal DrJava execution (as opposed to testing DrJava). TO DO: convert edu.rice.cs.util.Pair to edu.rice.cs.plt.tuple.Pair; requires making the same conversion in javalanglevels.
| Field Summary |
|---|
| Fields inherited from interface edu.rice.cs.drjava.model.compiler.CompilerModel |
|---|
EXTENSIONS |
| Constructor Summary | |
|---|---|
DefaultCompilerModel(GlobalModel m,
Iterable<? extends CompilerInterface> compilers)
Main constructor. |
|
| Method Summary | |
|---|---|
void |
addCompiler(CompilerInterface compiler)
Add a compiler to the active list |
void |
addListener(CompilerListener listener)
Adds a CompilerListener to the model. |
void |
compile(List<OpenDefinitionsDocument> defDocs)
Compiles all of the given files. |
void |
compile(OpenDefinitionsDocument doc)
Compiles the given file. |
void |
compileAll()
Compile all open documents. |
void |
compileProject()
Compiles all documents in the project source tree. |
CompilerInterface |
getActiveCompiler()
Gets the compiler that is the "active" compiler. |
Iterable<CompilerInterface> |
getAvailableCompilers()
Returns all registered compilers that are actually available. |
CompilerErrorModel |
getCompilerErrorModel()
Gets the CompilerErrorModel representing the last compile. |
Object |
getCompilerLock()
Returns the lock used to prevent simultaneous compilation and JUnit testing |
int |
getNumCompErrors()
Gets the total number of current compiler errors. |
int |
getNumErrors()
Gets the total number of errors in this compiler model. |
int |
getNumWarnings()
Gets the total number of current warnings. |
void |
removeAllListeners()
Removes all CompilerListeners from this model. |
void |
removeListener(CompilerListener listener)
Removes a CompilerListener from the model. |
void |
resetCompilerErrors()
Resets the compiler error state to have no errors. |
void |
setActiveCompiler(CompilerInterface compiler)
Sets which compiler is the "active" compiler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultCompilerModel(GlobalModel m,
Iterable<? extends CompilerInterface> compilers)
m - the GlobalModel that is the source of documents for this CompilerModelcompilers - The compilers to use. The first will be made active; all are assumed
to be available. An empty list is acceptable.| Method Detail |
|---|
public Object getCompilerLock()
getCompilerLock in interface CompilerModelpublic void addListener(CompilerListener listener)
addListener in interface CompilerModellistener - A listener that reacts to compiler events.public void removeListener(CompilerListener listener)
removeListener in interface CompilerModellistener - a listener that reacts to compiler events
This operation is synchronized by the readers/writers protocol in EventNotifierpublic void removeAllListeners()
removeAllListeners in interface CompilerModel
public void compileAll()
throws IOException
Before compiling, all unsaved and untitled documents are saved, and compilation ends if the user cancels this step. The compilation classpath and sourcepath includes the build directory (if it exists), the source roots, the project "extra classpath" (if it exists), the global "extra classpath", and the current JVM's classpath (which includes drjava.jar, containing JUnit classes).
This method formerly only compiled documents which were out of sync with their class file, as a performance optimization. However, bug #634386 pointed out that unmodified files could depend on modified files, in which case this command would not recompile a file in some situations when it should. Since we value correctness over performance, we now always compile all open documents.
compileAll in interface CompilerModelIOException - if a filesystem-related problem prevents compilation
public void compileProject()
throws IOException
Before compiling, all unsaved and untitled documents are saved, and compilation ends if the user cancels this step. The compilation classpath and sourcepath includes the build directory (if it exists), the source roots, the project "extra classpath" (if it exists), the global "extra classpath", and the current JVM's classpath (which includes drjava.jar, containing JUnit classes).
This method formerly only compiled documents which were out of sync with their class file, as a performance optimization. However, bug #634386 pointed out that unmodified files could depend on modified files, in which case this command would not recompile a file in some situations when it should. Since we value correctness over performance, we now always compile all open documents.
compileProject in interface CompilerModelIOException - if a filesystem-related problem prevents compilation
public void compile(List<OpenDefinitionsDocument> defDocs)
throws IOException
Before compiling, all unsaved and untitled documents are saved, and compilation ends if the user cancels this step. The compilation classpath and sourcepath includes the build directory (if it exists), the source roots, the project "extra classpath" (if it exists), the global "extra classpath", and the current JVM's classpath (which includes drjava.jar, containing JUnit classes).
This method formerly only compiled documents which were out of sync with their class file, as a performance optimization. However, bug #634386 pointed out that unmodified files could depend on modified files, in which case this command would not recompile a file in some situations when it should. Since we value correctness over performance, we now always compile all open documents. @throws IOException if a filesystem-related problem prevents compilation
compile in interface CompilerModeldefDocs - the documents to be compiled
IOException - if a filesystem-related problem prevents compilation
public void compile(OpenDefinitionsDocument doc)
throws IOException
Before compiling, all unsaved and untitled documents are saved, and compilation ends if the user cancels this step. The compilation classpath and sourcepath includes the build directory (if it exists), the source roots, the project "extra classpath" (if it exists), the global "extra classpath", and the current JVM's classpath (which includes drjava.jar, containing JUnit classes).
This method formerly only compiled documents which were out of sync with their class file, as a performance optimization. However, bug #634386 pointed out that unmodified files could depend on modified files, in which case this command would not recompile a file in some situations when it should. Since we value correctness over performance, we now always compile all open documents.
compile in interface CompilerModeldoc - the document to be compiled
IOException - if a filesystem-related problem prevents compilationpublic CompilerErrorModel getCompilerErrorModel()
getCompilerErrorModel in interface CompilerModelpublic int getNumErrors()
getNumErrors in interface CompilerModelpublic int getNumCompErrors()
public int getNumWarnings()
public void resetCompilerErrors()
resetCompilerErrors in interface CompilerModelpublic Iterable<CompilerInterface> getAvailableCompilers()
NoCompilerAvailable.ONLY.
getAvailableCompilers in interface CompilerModelpublic CompilerInterface getActiveCompiler()
getActiveCompiler in interface CompilerModelsetActiveCompiler(edu.rice.cs.drjava.model.compiler.CompilerInterface)public void setActiveCompiler(CompilerInterface compiler)
setActiveCompiler in interface CompilerModelcompiler - Compiler to set active.
IllegalArgumentException - If the compiler is not in the list of available compilersgetActiveCompiler()public void addCompiler(CompilerInterface compiler)
addCompiler in interface CompilerModel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||