KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.io.IOException JavaDoc;
38 import java.util.List JavaDoc;
39
40 import edu.rice.cs.util.ClassPathVector;
41
42 /** This state pattern is used by the global model to store any information pertaining to the currently open project.
43  * The state pattern is used because most project information is not needed in list view. (Elspeth Rocks)
44  *
45  * Hint: if you're looking for the instances of this interface, look in DefaultGlobalModel where they are defined
46  * as anonymous inner classes.
47  */

48 public interface FileGroupingState {
49
50   /** @return true if the model is in project mode, false otherwi */
51   public boolean isProjectActive();
52   
53   /** @return true if the document is part of the active project (in the project path), or false
54    * if it is not (or the model is not in project mode)
55    */

56   public boolean inProjectPath(OpenDefinitionsDocument doc);
57   
58   /** @return true if the file is part of the active project (in the project path), or false
59    * if it is not (or the model is not in project mode)
60    */

61   public boolean inProjectPath(File JavaDoc f);
62   
63 // /** junits all files that the state considers "all" (ie, all files in project directory in project mode). */
64
// public void junitAll();
65

66   /** Returns the current project file
67    * @return null if not currently in a project
68    */

69   public File JavaDoc getProjectFile();
70   
71   /** Returns the project source root
72    * @return null if no build directory is specified
73    */

74   public File JavaDoc getProjectRoot();
75   
76   /** Sets project file to specifed value; used in "Save Project As ..." command in MainFrame. */
77   public void setProjectFile(File JavaDoc f);
78   
79   /** Sets the current project root. */
80   public void setProjectRoot(File JavaDoc f);
81   
82   /** Adds file to list of auxiliary files in project */
83   public void addAuxFile(File JavaDoc f);
84  
85   /** Removes file to list of auxiliary files in project. Throws an UnexpectedException if auxFiles does not contain
86    * exactly one instance of f.*/

87   public void remAuxFile(File JavaDoc f);
88   
89   /** Returns the directory in which to put the class files after compilation
90    * @return null if no build directory is specified
91    */

92   public File JavaDoc getBuildDirectory();
93   
94   /** Sets the current build directory. */
95   public void setBuildDirectory(File JavaDoc f);
96   
97   /** Returns the working directory for the slave (interactions pane) JVM. */
98   public File JavaDoc getWorkingDirectory();
99   
100    /** Sets the current working directory for the interactions pane. */
101   public void setWorkingDirectory(File JavaDoc f);
102   
103   /** Returns the source file that has the main method of the project
104    * @return null if no build directory is specified
105    */

106   public File JavaDoc getMainClass();
107   
108   /** Sets the file that has the main method of the project
109    * (Note: should point to the sourcefile of the document, not the class file)
110    */

111   public void setMainClass(File JavaDoc f);
112   
113   /** Sets the create jar file of the project. */
114   public void setCreateJarFile(File JavaDoc f);
115   
116   /** Return the create jar file for the project. If not in project mode, returns 0. */
117   public File JavaDoc getCreateJarFile();
118   
119   /** Sets the create jar flags of the project. */
120   public void setCreateJarFlags(int f);
121   
122   /** Return the create jar flags for the project. If not in project mode, returns null. */
123   public int getCreateJarFlags();
124   
125   /** Return all files saved as source files in the project file. If not in project mode, returns null. */
126   public File JavaDoc[] getProjectFiles();
127   
128   /** Returns true the given file is in the current project file. */
129   public boolean inProject(File JavaDoc f);
130   
131   /** @return true if the file is a project auxiliary file */
132   public boolean isAuxiliaryFile(File JavaDoc f);
133   
134   /** Returns true if in project mode and the current project file has changed. */
135   public boolean isProjectChanged();
136   
137   /** Sets that the project state is no longer a snapshot of the open project. */
138   public void setProjectChanged(boolean changed);
139
140   /** Cleans the build directory. */
141   public void cleanBuildDirectory();
142   
143   /** @return a list of class files. */
144   public List JavaDoc<File JavaDoc> getClassFiles();
145   
146   /** Returns a collection of classpath entries specific to the current project.
147    * @return the project's extra classpath
148    */

149   public ClassPathVector getExtraClassPath();
150   
151   /** Sets the list of project-specific classpath entries. */
152   public void setExtraClassPath(ClassPathVector cp);
153   
154 }
155
Popular Tags