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

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

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

org.netbeans.spi.java.project.classpath
Class ProjectClassPathModifierImplementation

java.lang.Object
  extended by org.netbeans.spi.java.project.classpath.ProjectClassPathModifierImplementation

public abstract class ProjectClassPathModifierImplementation
extends Object

An SPI for project's classpaths modification. A project can provide subclass of this class in its lookup to allow clients to add or remove new classpath elements (JAR, folder, dependent project, or library) to its classpaths.

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

Constructor Summary
protected ProjectClassPathModifierImplementation()
           
 
Method Summary
protected abstract  boolean addAntArtifacts(AntArtifact[] artifacts, URI[] artifactElements, SourceGroup sourceGroup, String type)
          Adds artifacts (e.g.
protected abstract  boolean addLibraries(Library[] libraries, SourceGroup sourceGroup, String type)
          Adds libraries into the project's classpath if the libraries are not already included.
protected abstract  boolean addRoots(URL[] classPathRoots, SourceGroup sourceGroup, String type)
          Adds archive files or folders into the project's classpath if the entries are not already there.
protected abstract  String[] getExtensibleClassPathTypes(SourceGroup sourceGroup)
          Returns the types of classpaths for given SourceGroup which may be modified.
protected abstract  SourceGroup[] getExtensibleSourceGroups()
          Returns the SourceGroups providing classpath(s) which may be modified.
protected abstract  boolean removeAntArtifacts(AntArtifact[] artifacts, URI[] artifactElements, SourceGroup sourceGroup, String type)
          Removes artifacts (e.g.
protected abstract  boolean removeLibraries(Library[] libraries, SourceGroup sourceGroup, String type)
          Removes libraries from the project's classpath if the libraries are included on it.
protected abstract  boolean removeRoots(URL[] classPathRoots, SourceGroup sourceGroup, String type)
          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
 

Constructor Detail

ProjectClassPathModifierImplementation

protected ProjectClassPathModifierImplementation()
Method Detail

getExtensibleSourceGroups

protected abstract SourceGroup[] getExtensibleSourceGroups()
Returns the SourceGroups providing classpath(s) which may be modified.

Returns:
(possibly empty) array of SourceGroup, never returns null

getExtensibleClassPathTypes

protected abstract String[] getExtensibleClassPathTypes(SourceGroup sourceGroup)
Returns the types of classpaths for given SourceGroup which may be modified.

Parameters:
sourceGroup - for which the classpath types should be returned
Returns:
(possibly empty) array of classpath types, never returns null

addLibraries

protected abstract boolean addLibraries(Library[] libraries,
                                        SourceGroup sourceGroup,
                                        String type)
                                 throws IOException,
                                        UnsupportedOperationException
Adds libraries into the project's classpath if the libraries are not already included.

Parameters:
libraries - to be added
sourceGroup - of type JavaProjectConstants.SOURCES_TYPE_JAVA identifying the compilation unit to change
type - the type of the classpath the library should be added to, eg ClassPath.COMPILE
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

protected abstract boolean removeLibraries(Library[] libraries,
                                           SourceGroup sourceGroup,
                                           String type)
                                    throws IOException,
                                           UnsupportedOperationException
Removes libraries from the project's classpath if the libraries are included on it.

Parameters:
libraries - to be removed
sourceGroup - of type JavaProjectConstants.SOURCES_TYPE_JAVA identifying the compilation unit to change
type - the type of the classpath the library should be removed from, eg ClassPath.COMPILE
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

protected abstract boolean addRoots(URL[] classPathRoots,
                                    SourceGroup sourceGroup,
                                    String type)
                             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
sourceGroup - of type JavaProjectConstants.SOURCES_TYPE_JAVA identifying the compilation unit to change
type - the type of the classpath the root should be added to, eg ClassPath.COMPILE
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

protected abstract boolean removeRoots(URL[] classPathRoots,
                                       SourceGroup sourceGroup,
                                       String type)
                                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
sourceGroup - of type JavaProjectConstants.SOURCES_TYPE_JAVA identifying the compilation unit to change
type - the type of the classpath the root should be removed from, eg ClassPath.COMPILE
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

protected abstract boolean addAntArtifacts(AntArtifact[] artifacts,
                                           URI[] artifactElements,
                                           SourceGroup sourceGroup,
                                           String type)
                                    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)
sourceGroup - of type JavaProjectConstants.SOURCES_TYPE_JAVA identifying the compilation unit to change
type - the type of the classpath the artifact should be added to, eg ClassPath.COMPILE
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

protected abstract boolean removeAntArtifacts(AntArtifact[] artifacts,
                                              URI[] artifactElements,
                                              SourceGroup sourceGroup,
                                              String type)
                                       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)
sourceGroup - of type JavaProjectConstants.SOURCES_TYPE_JAVA identifying the compilation unit to change
type - the type of the classpath the artifact should be removed from, eg ClassPath.COMPILE
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.