站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

ProjectClassPathModifier (Java Project Support) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.java.project/1 1.12

org.netbeans.api.java.project.classpath
Class ProjectClassPathModifier

java.lang.Object
  extended by org.netbeans.api.java.project.classpath.ProjectClassPathModifier

public class ProjectClassPathModifier
extends Object

An API for project's classpaths modification. An client can use this interface to add/remove classpath element (folder, archive, library, subproject) to/from the project's classpath. Not all operations on all project's classpath are supported, if the project type does not support a modification of a given classpath the UnsupportedOperationException is thrown.

Since:
org.netbeans.modules.java.project/1 1.10

Method Summary
static boolean addAntArtifacts(AntArtifact[] artifacts, URI[] artifactElements, FileObject projectArtifact, String classPathType)
          Adds artifacts (e.g.
static boolean addLibraries(Library[] libraries, FileObject projectArtifact, String classPathType)
          Adds libraries into the project's classpath if the libraries are not already included.
static boolean addRoots(URL[] classPathRoots, FileObject projectArtifact, String classPathType)
          Adds archive files or folders into the project's classpath if the entries are not already there.
static boolean removeAntArtifacts(AntArtifact[] artifacts, URI[] artifactElements, FileObject projectArtifact, String classPathType)
          Removes artifacts (e.g.
static boolean removeLibraries(Library[] libraries, FileObject projectArtifact, String classPathType)
          Removes libraries from the project's classpath if the libraries are included on it.
static boolean removeRoots(URL[] classPathRoots, FileObject projectArtifact, String classPathType)
          Removes archive files or folders from the project's classpath if the entries are included on it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addLibraries

public static boolean addLibraries(Library[] libraries,
                                   FileObject projectArtifact,
                                   String classPathType)
                            throws IOException,
                                   UnsupportedOperationException
Adds libraries into the project's classpath if the libraries are not already included.

Parameters:
libraries - to be added
projectArtifact - a file whose classpath should be extended
classPathType - the type of classpath to be extended, @see ClassPath
Returns:
true in case the classpath was changed (at least one library was added to the classpath), the value false is returned when all the libraries are already included on the classpath.
Throws:
IOException - in case the project metadata cannot be changed
UnsupportedOperationException - is thrown when the project does not support adding of a library to the classpath of the given type.

removeLibraries

public static boolean removeLibraries(Library[] libraries,
                                      FileObject projectArtifact,
                                      String classPathType)
                               throws IOException,
                                      UnsupportedOperationException
Removes libraries from the project's classpath if the libraries are included on it.

Parameters:
libraries - to be removed
projectArtifact - a file from whose classpath the libraries should be removed
classPathType - the type of classpath, @see ClassPath
Returns:
true in case the classpath was changed, (at least one library was removed from the classpath), the value false is returned when none of the libraries was included on the classpath.
Throws:
IOException - in case the project metadata cannot be changed
UnsupportedOperationException - is thrown when the project does not support removing of a library from the classpath of the given type.

addRoots

public static boolean addRoots(URL[] classPathRoots,
                               FileObject projectArtifact,
                               String classPathType)
                        throws IOException,
                               UnsupportedOperationException
Adds archive files or folders into the project's classpath if the entries are not already there.

Parameters:
classPathRoots - roots to be added, each root has to be either a root of an archive or a folder
projectArtifact - a file whose classpath should be extended
classPathType - the type of classpath to be extended, @see ClassPath
Returns:
true in case the classpath was changed, (at least one classpath root was added to the classpath), the value false is returned when all the classpath roots are already included on the classpath.
Throws:
IOException - in case the project metadata cannot be changed
UnsupportedOperationException - is thrown when the project does not support adding of a root to the classpath of the given type.

removeRoots

public static boolean removeRoots(URL[] classPathRoots,
                                  FileObject projectArtifact,
                                  String classPathType)
                           throws IOException,
                                  UnsupportedOperationException
Removes archive files or folders from the project's classpath if the entries are included on it.

Parameters:
classPathRoots - roots to be removed, each root has to be either a root of an archive or a folder
projectArtifact - a file from whose classpath the roots should be removed
classPathType - the type of classpath, @see ClassPath
Returns:
true in case the classpath was changed, (at least one classpath root was removed from the classpath), the value false is returned when none of the classpath roots was included on the classpath.
Throws:
IOException - in case the project metadata cannot be changed
UnsupportedOperationException - is thrown when the project does not support removing of a root from the classpath of the given type.

addAntArtifacts

public static boolean addAntArtifacts(AntArtifact[] artifacts,
                                      URI[] artifactElements,
                                      FileObject projectArtifact,
                                      String classPathType)
                               throws IOException,
                                      UnsupportedOperationException
Adds artifacts (e.g. subprojects) into project's classpath if the artifacts are not already on it.

Parameters:
artifacts - to be added
artifactElements - the URIs of the build output, the artifactElements has to have the same length as artifacts. (must be owned by the artifact and be relative to it)
projectArtifact - a file whose classpath should be extended
classPathType - the type of classpath to be extended, @see ClassPath
Returns:
true in case the classpath was changed, (at least one artifact was added to the classpath), the value false is returned when all the artifacts are already included on the classpath.
Throws:
IOException - in case the project metadata cannot be changed
UnsupportedOperationException - is thrown when the project does not support adding of an artifact to the classpath of the given type.

removeAntArtifacts

public static boolean removeAntArtifacts(AntArtifact[] artifacts,
                                         URI[] artifactElements,
                                         FileObject projectArtifact,
                                         String classPathType)
                                  throws IOException,
                                         UnsupportedOperationException
Removes artifacts (e.g. subprojects) from project's classpath if the artifacts are included on it.

Parameters:
artifacts - to be added
artifactElements - the URIs of the build output, the artifactElements has to have the same length as artifacts. (must be owned by the artifact and be relative to it)
projectArtifact - a file from whose classpath the dependent projects should be removed
classPathType - the type of classpath, @see ClassPath
Returns:
true in case the classpath was changed, (at least one artifact was removed from the classpath), the value false is returned when none of the artifacts was included on the classpath.
Throws:
IOException - in case the project metadata cannot be changed
UnsupportedOperationException - is thrown when the project does not support removing of an artifact from the classpath of the given type.

org.netbeans.modules.java.project/1 1.12

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.