Added
Link Here
|
1 |
/* |
2 |
* Sun Public License Notice |
3 |
* |
4 |
* The contents of this file are subject to the Sun Public License |
5 |
* Version 1.0 (the "License"). You may not use this file except in |
6 |
* compliance with the License. A copy of the License is available at |
7 |
* http://www.sun.com/ |
8 |
* |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun |
11 |
* Microsystems, Inc. All Rights Reserved. |
12 |
*/ |
13 |
|
14 |
package org.netbeans.spi.java.project.classpath; |
15 |
|
16 |
import java.io.IOException; |
17 |
import java.net.URI; |
18 |
import org.netbeans.api.project.SourceGroup; |
19 |
import org.netbeans.api.project.ant.AntArtifact; |
20 |
import org.netbeans.api.project.libraries.Library; |
21 |
import org.openide.filesystems.FileObject; |
22 |
|
23 |
/** |
24 |
* Interface for project's classpaths modification. |
25 |
* A project can provide this interface in its {@link org.netbeans.api.project.Project#getLookup lookup} to |
26 |
* allow clients to add or remove new classpath elements (JAR, folder, dependent project, or library) to its |
27 |
* classpaths. |
28 |
* @since org.netbeans.modules.java.project/1 1.9 |
29 |
*/ |
30 |
public interface ProjectClassPathChanger { |
31 |
|
32 |
/** |
33 |
* Adds a library into the project's classpath if the |
34 |
* library is not already included. |
35 |
* @param library to be added |
36 |
* @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} |
37 |
* identifying the compilation unit to change |
38 |
* @param classPathId the id of the classpath the library should be added to, |
39 |
* eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} |
40 |
* @return true in case the classpath was changed |
41 |
* @exception IOException in case the project metadata cannot be changed |
42 |
* @exception UnsupportedOperationException is thrown when the project does not support |
43 |
* adding of a library to the classpath of the given id. |
44 |
*/ |
45 |
boolean addLibrary (Library library, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; |
46 |
|
47 |
|
48 |
/** |
49 |
* Removes a library from the project's classpath if the |
50 |
* library is included on it. |
51 |
* @param library to be removed |
52 |
* @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} |
53 |
* identifying the compilation unit to change |
54 |
* @param classPathId the id of the classpath the library should be removed from, |
55 |
* eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} |
56 |
* @return true in case the classpath was changed |
57 |
* @exception IOException in case the project metadata cannot be changed |
58 |
* @exception UnsupportedOperationException is thrown when the project does not support |
59 |
* removing of a library from the classpath of the given id. |
60 |
*/ |
61 |
boolean removeLibrary (Library library, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; |
62 |
|
63 |
/** |
64 |
* Adds an archive file or folder into the project's classpath if the |
65 |
* entry is not already there. |
66 |
* @param classPathRoot root to be added, either root of an archive or folder |
67 |
* @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} |
68 |
* identifying the compilation unit to change |
69 |
* @param classPathId the id of the classpath the root should be added to, |
70 |
* eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} |
71 |
* @return true in case the classpath was changed |
72 |
* @exception IOException in case the project metadata cannot be changed |
73 |
* @exception UnsupportedOperationException is thrown when the project does not support |
74 |
* adding of a root to the classpath of the given id. |
75 |
*/ |
76 |
boolean addRoot (FileObject classPathRoot, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; |
77 |
|
78 |
/** |
79 |
* Removes an archive file or folder from the project's classpath if the |
80 |
* entry is included on it. |
81 |
* @param classPathRoot root to be removed, either root of an archive or folder |
82 |
* @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} |
83 |
* identifying the compilation unit to change |
84 |
* @param classPathId the id of the classpath the root should be removed from, |
85 |
* eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} |
86 |
* @return true in case the classpath was changed |
87 |
* @exception IOException in case the project metadata cannot be changed |
88 |
* @exception UnsupportedOperationException is thrown when the project does not support |
89 |
* removing of a root from the classpath of the given id. |
90 |
*/ |
91 |
boolean removeRoot (FileObject classPathRoot, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; |
92 |
|
93 |
/** |
94 |
* Adds an artifact (e.g. subproject) into project's classpath if the |
95 |
* artifact is not already on it. |
96 |
* @param artifact to be added |
97 |
* @param artifactElement the URI of the build output |
98 |
* (must be owned by the artifact and be relative to it) |
99 |
* @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} |
100 |
* identifying the compilation unit to change |
101 |
* @param classPathId the id of the classpath the artifact should be added to, |
102 |
* eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} |
103 |
* @return true in case the classpath was changed |
104 |
* @exception IOException in case the project metadata cannot be changed |
105 |
* @exception UnsupportedOperationException is thrown when the project does not support |
106 |
* adding of an artifact to the classpath of the given id. |
107 |
*/ |
108 |
boolean addAntArtifact (AntArtifact artifact, URI artifactElement, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; |
109 |
|
110 |
/** |
111 |
* Removes an artifact (e.g. subproject) from project's classpath if the |
112 |
* artifact is not already on it. |
113 |
* @param artifact to be added |
114 |
* @param artifactElement the URI of the build output |
115 |
* (must be owned by the artifact and be relative to it) |
116 |
* @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} |
117 |
* identifying the compilation unit to change |
118 |
* @param classPathId the id of the classpath the artifact should be removed from, |
119 |
* eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} |
120 |
* @return true in case the classpath was changed |
121 |
* @exception IOException in case the project metadata cannot be changed |
122 |
* @exception UnsupportedOperationException is thrown when the project does not support |
123 |
* removing of an artifact from the classpath of the given id. |
124 |
*/ |
125 |
boolean removeAntArtifact (AntArtifact artifact, URI artifactElement, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; |
126 |
|
127 |
} |