KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > rice > cs > drjava > model > GlobalModelListener


1 /*BEGIN_COPYRIGHT_BLOCK
2  *
3  * This file is part of DrJava. Download the current version of this project from http://www.drjava.org/
4  * or http://sourceforge.net/projects/drjava/
5  *
6  * DrJava Open Source License
7  *
8  * Copyright (C) 2001-2005 JavaPLT group at Rice University (javaplt@rice.edu). All rights reserved.
9  *
10  * Developed by: Java Programming Languages Team, Rice University, http://www.cs.rice.edu/~javaplt/
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13  * documentation files (the "Software"), to deal with the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15  * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16  *
17  * - Redistributions of source code must retain the above copyright notice, this list of conditions and the
18  * following disclaimers.
19  * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
20  * following disclaimers in the documentation and/or other materials provided with the distribution.
21  * - Neither the names of DrJava, the JavaPLT, Rice University, nor the names of its contributors may be used to
22  * endorse or promote products derived from this Software without specific prior written permission.
23  * - Products derived from this software may not be called "DrJava" nor use the term "DrJava" as part of their
24  * names without prior written permission from the JavaPLT group. For permission, write to javaplt@rice.edu.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
27  * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28  * CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
29  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30  * WITH THE SOFTWARE.
31  *
32 END_COPYRIGHT_BLOCK*/

33
34 package edu.rice.cs.drjava.model;
35
36 import java.io.File JavaDoc;
37 import edu.rice.cs.drjava.model.repl.InteractionsListener;
38 import edu.rice.cs.drjava.model.compiler.CompilerListener;
39 import edu.rice.cs.drjava.model.junit.JUnitListener;
40
41 import edu.rice.cs.util.FileOpenSelector;
42 import edu.rice.cs.util.swing.AsyncTask;
43
44 /**
45  * An interface for responding to events generated by the GlobalModel.
46  * TODO: Refactor to remove component listeners from Global level.
47  *
48  * @version $Id: GlobalModelListener.java 4076 2007-01-19 23:01:04Z dlsmith $
49  */

50 public interface GlobalModelListener extends InteractionsListener, JavadocListener, CompilerListener, JUnitListener {
51   
52   /** Called when an asynchronous task must be run in the model */
53   public <P,R> void executeAsyncTask(AsyncTask<P,R> task, P param, boolean showProgress, boolean lockUI);
54   
55  /**
56    * Performs any UI related steps to handle the case in which a file is being opened that
57    * is already open and modified. The two choices are to revert to the copy on disk, or to
58    * keep the current changes.
59    * @param doc {@code true} if the user wishes to revert the document, {@code false} to ignore
60    */

61   public void handleAlreadyOpenDocument(OpenDefinitionsDocument doc);
62   
63   /** Called when trying to open a file that does not exist. */
64   public void fileNotFound(File JavaDoc f);
65   
66   /** Called after a new document is created. */
67   public void newFileCreated(OpenDefinitionsDocument doc);
68
69   /** Called after the current document is saved. */
70   public void fileSaved(OpenDefinitionsDocument doc);
71
72   /** Called after a file is opened and read into the current document. */
73   public void fileOpened(OpenDefinitionsDocument doc);
74
75   /** Called after a document is closed. */
76   public void fileClosed(OpenDefinitionsDocument doc);
77
78   /** Called after a document is reverted. */
79   public void fileReverted(OpenDefinitionsDocument doc);
80
81   /** Called to ask the listener if it is OK to abandon the current document. */
82   public boolean canAbandonFile(OpenDefinitionsDocument doc);
83
84   /** Called to ask the listener if this document should be saved before quitting.
85    * @return true if quitting should continue, false if the user cancelled */

86   public boolean quitFile(OpenDefinitionsDocument doc);
87   
88   /** Called to ask the listener if it is OK to revert the current document to the version saved on disk. */
89   public boolean shouldRevertFile(OpenDefinitionsDocument doc);
90
91   /** Called when a file's main method is about to be run. */
92   public void runStarted(OpenDefinitionsDocument doc);
93
94   /** Called when the console window is reset. */
95   public void consoleReset();
96
97   /** Called when an undoable edit occurs. */
98   public void undoableEditHappened();
99
100   /** Called when saving a file whose path contains a '#' symbol. */
101   public void filePathContainsPound();
102    
103   /** Called when a new active document is selected */
104   public void activeDocumentChanged(OpenDefinitionsDocument active);
105   
106   /** Called when the focus must be changed to the active document in the definitions pane */
107   public void focusOnDefinitionsPane();
108   
109   /** Called when the selection in the navigator changes the current directory without changing the active document. */
110   public void currentDirectoryChanged(File JavaDoc dir);
111     
112   /** Called when the build directory is modified in the model. */
113   public void projectBuildDirChanged();
114   
115   /** Called when the working directory is modified in the model. */
116   public void projectWorkDirChanged();
117   
118   /** Called while the project is being opened.
119    * @param projectFile the location of the project file
120    * @param files The files the gui should open for the model
121    */

122   public void projectOpened(File JavaDoc projectFile, FileOpenSelector files);
123
124   /** Called when the project is being closed. */
125   public void projectClosed();
126
127   /** Called if the project's modified state has changed. */
128   public void projectModified();
129   
130   /** Called when the project runnability changed (ie, when the main file is set/unset). */
131   public void projectRunnableChanged();
132   
133   /** Called when the a document, already opened, is brought back into the cache, and it no longer exists on disk
134    * or cannot be accessed. */

135   public void documentNotFound(OpenDefinitionsDocument d, File JavaDoc f);
136 }
137
138
Popular Tags