001: /*BEGIN_COPYRIGHT_BLOCK
002: *
003: * Copyright (c) 2001-2007, JavaPLT group at Rice University (javaplt@rice.edu)
004: * All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions are met:
008: * * Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: * * Redistributions in binary form must reproduce the above copyright
011: * notice, this list of conditions and the following disclaimer in the
012: * documentation and/or other materials provided with the distribution.
013: * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the
014: * names of its contributors may be used to endorse or promote products
015: * derived from this software without specific prior written permission.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
018: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
019: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
020: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
021: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
022: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
023: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
024: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
025: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
026: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028: *
029: * This software is Open Source Initiative approved Open Source Software.
030: * Open Source Initative Approved is a trademark of the Open Source Initiative.
031: *
032: * This file is part of DrJava. Download the current version of this project
033: * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/
034: *
035: * END_COPYRIGHT_BLOCK*/
036:
037: package edu.rice.cs.drjava.model;
038:
039: import java.io.File;
040: import java.util.List;
041: import edu.rice.cs.drjava.model.compiler.CompilerListener;
042: import edu.rice.cs.drjava.model.repl.DummyInteractionsListener;
043: import edu.rice.cs.util.classloader.ClassFileError;
044: import edu.rice.cs.util.swing.AsyncTask;
045: import edu.rice.cs.util.FileOpenSelector;
046:
047: /** A dummy GlobalModelListener that does nothing. Useful for listening to only a small number of events.
048: * Not currently used.
049: * @version $Id: DummyGlobalModelListener.java 4255 2007-08-28 19:17:37Z mgricken $
050: */
051: public class DummyGlobalModelListener extends DummyInteractionsListener
052: implements GlobalModelListener {
053:
054: /** Called when an asynchronous task must be run in the model */
055: public <P, R> void executeAsyncTask(AsyncTask<P, R> task, P param,
056: boolean showProgress, boolean lockUI) {
057: }
058:
059: public void handleAlreadyOpenDocument(OpenDefinitionsDocument doc) {
060: }
061:
062: /** Called when trying to open one or more files that do not exist. */
063: public void filesNotFound(File... f) {
064: }
065:
066: /** Called when the project's build directory has changed. */
067: public void projectBuildDirChanged() {
068: }
069:
070: /** Called when the project's build directory has changed. */
071: public void projectWorkDirChanged() {
072: }
073:
074: /** Called when the project is being opened and the model needs the gui to do some stuff for it. */
075: public void projectOpened(File pfile, FileOpenSelector files) {
076: }
077:
078: /** Called when the project is being closed. */
079: public void projectClosed() {
080: }
081:
082: /** Called when the projects modified state has changed. */
083: public void projectModified() {
084: }
085:
086: /** Called when a project's main class has been set/unset. */
087: public void projectRunnableChanged() {
088: }
089:
090: /** Called after a new document is created. */
091: public void newFileCreated(OpenDefinitionsDocument doc) {
092: }
093:
094: /** Called after the current document is saved. */
095: public void fileSaved(OpenDefinitionsDocument doc) {
096: }
097:
098: /** Called after a file is opened and read into the current document. */
099: public void fileOpened(OpenDefinitionsDocument doc) {
100: }
101:
102: /** Called after a document is closed. */
103: public void fileClosed(OpenDefinitionsDocument doc) {
104: }
105:
106: /** Called after a document is reverted. */
107: public void fileReverted(OpenDefinitionsDocument doc) {
108: }
109:
110: /** Called when an undoable edit occurs. */
111: public void undoableEditHappened() {
112: }
113:
114: /** Called after a compile is started by the GlobalModel. */
115: public void compileStarted() {
116: }
117:
118: /** Called when a compile has finished running. */
119: public void compileEnded(File workDir,
120: List<? extends File> excludedFiles) {
121: }
122:
123: /** Called when a file's main method is about to be run. */
124: public void runStarted(OpenDefinitionsDocument doc) {
125: }
126:
127: /** Called when saving a file whose path contains a '#' symbol. */
128: public void filePathContainsPound() {
129: }
130:
131: /** Called to demand that all class file must be in sync before running unit tests. It is up to the caller of this
132: * method to check if the documents are out of sync, using OpenDefinitionsDocument.checkIfClassFileInSync().
133: */
134: public void compileBeforeJUnit(final CompilerListener l) {
135: }
136:
137: /** Called after JUnit is started by the GlobalModel. */
138: public void junitStarted() {
139: }
140:
141: /** Called when testing all files. */
142: public void junitClassesStarted() {
143: }
144:
145: /** Called to indicate that a suite of tests has started running.
146: * @param numTests The number of tests in the suite to be run.
147: */
148: public void junitSuiteStarted(int numTests) {
149: }
150:
151: /** Called when a particular test is started.
152: * @param name The name of the test being started.
153: */
154: public void junitTestStarted(String name) {
155: }
156:
157: /** Called when a particular test has ended.
158: * @param name The name of the test that has ended.
159: * @param wasSuccessful Whether the test passed or not.
160: * @param causedError If not successful, whether the test caused an error or simply failed.
161: */
162: public void junitTestEnded(String name, boolean wasSuccessful,
163: boolean causedError) {
164: }
165:
166: /** Called after JUnit is finished running tests. */
167: public void junitEnded() {
168: }
169:
170: /** Called when the console window is reset. */
171: public void consoleReset() {
172: }
173:
174: /** Called to demand that all files be saved before compiling. It is up to the caller of this method to check
175: * if the documents have been saved, using IGetDocuments.hasModifiedDocuments().
176: */
177: public void saveBeforeCompile() {
178: }
179:
180: public void saveUntitled() {
181: }
182:
183: /** Called to demand that all files be saved before generating Javadoc. It is up to the caller of this method to
184: * check if the documents have been saved, using IGetDocuments.hasModifiedDocuments().
185: */
186: public void saveBeforeJavadoc() {
187: }
188:
189: /** Called to demand that all files be saved before starting the debugger. It is up to the caller of this method
190: * to check if the documents have been saved, using IGetDocuments.hasModifiedDocuments().
191: *
192: * Not currently used. */
193: // public void saveBeforeDebug() { }
194: /** Called when the navigator selection changes the current directory without changing the active document. */
195: public void currentDirectoryChanged(File dir) {
196: }
197:
198: /** Called when trying to test a non-TestCase class.
199: * @param isTestAll whether or not it was a use of the test all button
200: */
201: public void nonTestCase(boolean isTestAll) {
202: }
203:
204: /** Called when trying to test an illegal class file.
205: * @param e the ClassFileError thrown when DrJava attempted to load the offending class.
206: */
207: public void classFileError(ClassFileError e) {
208: }
209:
210: /** Called to ask the listener if it is OK to abandon the current document. */
211: public boolean canAbandonFile(OpenDefinitionsDocument doc) {
212: return true;
213: }
214:
215: /** Called to ask the listener if the document should be saved before quitting.
216: * @return true if quitting should continue, false if the user cancelled */
217: public boolean quitFile(OpenDefinitionsDocument doc) {
218: return true;
219: }
220:
221: /** Called to ask the listener if it is OK to replace the current document by a newer version on disk. */
222: public boolean shouldRevertFile(OpenDefinitionsDocument doc) {
223: return true;
224: }
225:
226: /** Called after Javadoc is started by the GlobalModel. */
227: public void javadocStarted() {
228: }
229:
230: /** Called after Javadoc is finished.
231: * @param success whether the Javadoc operation generated proper output
232: * @param destDir if (success == true) the location where the output was placed, otherwise undefined
233: * @param allDocs Whether we are running over all open documents
234: */
235: public void javadocEnded(boolean success, File destDir,
236: boolean allDocs) {
237: }
238:
239: public void activeDocumentChanged(OpenDefinitionsDocument active) {
240: }
241:
242: public void activeDocumentRefreshed(OpenDefinitionsDocument active) {
243: }
244:
245: public void focusOnLastFocusOwner() {
246: }
247:
248: public void focusOnDefinitionsPane() {
249: }
250:
251: public void documentNotFound(OpenDefinitionsDocument d, File f) {
252: }
253: }
|