Source code: javax/ide/model/Project.java
1 package javax.ide.model;
2
3 import java.net.URI;
4 import java.util.Collection;
5
6 import java.util.prefs.Preferences;
7 import javax.ide.model.java.JavaModel;
8 import javax.ide.model.spi.ProjectImpl;
9 import javax.ide.net.URIPath;
10
11 /**
12 * Project interface. Projects are documents encapsulating the user work.
13 * A project specifies the source path where the java source files are
14 * rooted, the class path used when compiling and running the project,
15 * the ouput path where compiled classes are saved.
16 */
17 public final class Project extends Document implements Folder
18 {
19 private ProjectImpl getProjectImpl()
20 {
21 return (ProjectImpl)getElementImpl();
22 }
23
24 /**
25 * Constant identifying the project document type.
26 */
27 public static final String PROJECT_ID = "javax.ide.model.PROJECT_ID";
28
29 /**
30 * Identifies the bound property 'sourcePath'.
31 */
32 public static final String PROP_SOURCE_PATH = "sourcePath";
33
34 /**
35 * Identifies the bound property 'classPath'.
36 */
37 public static final String PROP_CLASS_PATH = "classPath";
38
39 /**
40 * Identifies the bound property 'outputPath'.
41 */
42 public static final String PROP_OUTPUT_PATH = "outputPath";
43
44 /**
45 * Get the source path. The source path where the contents of this
46 * project can be found.
47 *
48 * @return A {@link URIPath} pointing to where the contents of this project
49 * can be located.
50 */
51 public URIPath getSourcePath()
52 {
53 return getProjectImpl().getSourcePath();
54 }
55
56 /**
57 * Get the class path. The class path points to where the compiled classes
58 * used by this project can be found.
59 *
60 * @return A {@link URIPath} pointing to where compiled classes used by this
61 * project are located.
62 */
63 public URIPath getClassPath()
64 {
65 return getProjectImpl().getClassPath();
66 }
67
68 public void setOutputDirectory(URI outputDirectory)
69 {
70 getProjectImpl().setOutputDirectory( outputDirectory );
71 }
72
73 public Preferences getPreferences()
74 {
75 return getProjectImpl().getPreferences();
76 }
77
78 /**
79 * Get the {@link JavaModel} associated with this project.
80 *
81 * @return The {@link JavaModel} associated with this project.
82 */
83 public JavaModel getJavaModel()
84 {
85 return getProjectImpl().getJavaModel();
86 }
87
88 public boolean canAdd(Element element)
89 {
90 return getProjectImpl().canAdd( element );
91 }
92
93 public boolean add(Element child)
94 {
95 return getProjectImpl().add( child );
96 }
97
98 public boolean add(Collection children)
99 {
100 return getProjectImpl().add( children );
101 }
102
103 public boolean canRemove(Element element)
104 {
105 return getProjectImpl().canRemove( element );
106 }
107
108 public boolean remove(Element child)
109 {
110 return getProjectImpl().remove( child );
111 }
112
113 public boolean remove(Collection children)
114 {
115 return getProjectImpl().remove( children );
116 }
117
118 public boolean containsChild(Element child)
119 {
120 return getProjectImpl().containsChild( child );
121 }
122
123 public int size()
124 {
125 return getProjectImpl().size();
126 }
127
128 public void removeAll()
129 {
130 getProjectImpl().removeAll();
131 }
132
133
134 public void addClassPath( URIPath path )
135 {
136 getProjectImpl().addClassPath( path );
137 }
138
139 /**
140 * Get the {@link URI} where the output from compiling project sources is
141 * located.
142 *
143 * @return The {@link URI} where the project class files are located.
144 */
145 public URI getOutputDirectory()
146 {
147 return getProjectImpl().getOutputDirectory();
148 }
149 }