Index: nbproject/project.properties =================================================================== RCS file: /cvs/java/project/nbproject/project.properties,v retrieving revision 1.20 diff -u -r1.20 project.properties --- nbproject/project.properties 17 Apr 2006 15:48:42 -0000 1.20 +++ nbproject/project.properties 25 Apr 2006 12:05:51 -0000 @@ -11,6 +11,7 @@ is.autoload=true +javac.source=1.5 javadoc.title=Java Project API javadoc.overview=${basedir}/overview.html javadoc.arch=${basedir}/arch.xml Index: src/org/netbeans/spi/java/project/classpath/ProjectClassPathChanger.java =================================================================== RCS file: src/org/netbeans/spi/java/project/classpath/ProjectClassPathChanger.java diff -N src/org/netbeans/spi/java/project/classpath/ProjectClassPathChanger.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/netbeans/spi/java/project/classpath/ProjectClassPathChanger.java 25 Apr 2006 12:05:51 -0000 @@ -0,0 +1,127 @@ +/* + * Sun Public License Notice + * + * The contents of this file are subject to the Sun Public License + * Version 1.0 (the "License"). You may not use this file except in + * compliance with the License. A copy of the License is available at + * http://www.sun.com/ + * + * The Original Code is NetBeans. The Initial Developer of the Original + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.spi.java.project.classpath; + +import java.io.IOException; +import java.net.URI; +import org.netbeans.api.project.SourceGroup; +import org.netbeans.api.project.ant.AntArtifact; +import org.netbeans.api.project.libraries.Library; +import org.openide.filesystems.FileObject; + +/** + * Interface for project's classpaths modification. + * A project can provide this interface in its {@link org.netbeans.api.project.Project#getLookup 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.9 + */ +public interface ProjectClassPathChanger { + + /** + * Adds a library into the project's classpath if the + * library is not already included. + * @param library to be added + * @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} + * identifying the compilation unit to change + * @param classPathId the id of the classpath the library should be added to, + * eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} + * @return true in case the classpath was changed + * @exception IOException in case the project metadata cannot be changed + * @exception UnsupportedOperationException is thrown when the project does not support + * adding of a library to the classpath of the given id. + */ + boolean addLibrary (Library library, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; + + + /** + * Removes a library from the project's classpath if the + * library is included on it. + * @param library to be removed + * @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} + * identifying the compilation unit to change + * @param classPathId the id of the classpath the library should be removed from, + * eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} + * @return true in case the classpath was changed + * @exception IOException in case the project metadata cannot be changed + * @exception UnsupportedOperationException is thrown when the project does not support + * removing of a library from the classpath of the given id. + */ + boolean removeLibrary (Library library, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; + + /** + * Adds an archive file or folder into the project's classpath if the + * entry is not already there. + * @param classPathRoot root to be added, either root of an archive or folder + * @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} + * identifying the compilation unit to change + * @param classPathId the id of the classpath the root should be added to, + * eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} + * @return true in case the classpath was changed + * @exception IOException in case the project metadata cannot be changed + * @exception UnsupportedOperationException is thrown when the project does not support + * adding of a root to the classpath of the given id. + */ + boolean addRoot (FileObject classPathRoot, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; + + /** + * Removes an archive file or folder from the project's classpath if the + * entry is included on it. + * @param classPathRoot root to be removed, either root of an archive or folder + * @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} + * identifying the compilation unit to change + * @param classPathId the id of the classpath the root should be removed from, + * eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} + * @return true in case the classpath was changed + * @exception IOException in case the project metadata cannot be changed + * @exception UnsupportedOperationException is thrown when the project does not support + * removing of a root from the classpath of the given id. + */ + boolean removeRoot (FileObject classPathRoot, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; + + /** + * Adds an artifact (e.g. subproject) into project's classpath if the + * artifact is not already on it. + * @param artifact to be added + * @param artifactElement the URI of the build output + * (must be owned by the artifact and be relative to it) + * @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} + * identifying the compilation unit to change + * @param classPathId the id of the classpath the artifact should be added to, + * eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} + * @return true in case the classpath was changed + * @exception IOException in case the project metadata cannot be changed + * @exception UnsupportedOperationException is thrown when the project does not support + * adding of an artifact to the classpath of the given id. + */ + boolean addAntArtifact (AntArtifact artifact, URI artifactElement, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; + + /** + * Removes an artifact (e.g. subproject) from project's classpath if the + * artifact is not already on it. + * @param artifact to be added + * @param artifactElement the URI of the build output + * (must be owned by the artifact and be relative to it) + * @param sourceGroup of type {@link org.netbeans.api.java.project.JavaProjectConstants#SOURCES_TYPE_JAVA} + * identifying the compilation unit to change + * @param classPathId the id of the classpath the artifact should be removed from, + * eg {@link org.netbeans.api.java.classpath.ClassPath.COMPILE} + * @return true in case the classpath was changed + * @exception IOException in case the project metadata cannot be changed + * @exception UnsupportedOperationException is thrown when the project does not support + * removing of an artifact from the classpath of the given id. + */ + boolean removeAntArtifact (AntArtifact artifact, URI artifactElement, SourceGroup sourceGroup, String classPathId) throws IOException, UnsupportedOperationException; + +} Index: src/org/netbeans/spi/java/project/classpath/ProjectClassPathExtender.java =================================================================== RCS file: /cvs/java/project/src/org/netbeans/spi/java/project/classpath/ProjectClassPathExtender.java,v retrieving revision 1.3 diff -u -r1.3 ProjectClassPathExtender.java --- src/org/netbeans/spi/java/project/classpath/ProjectClassPathExtender.java 12 Jul 2005 04:06:10 -0000 1.3 +++ src/org/netbeans/spi/java/project/classpath/ProjectClassPathExtender.java 25 Apr 2006 12:05:51 -0000 @@ -24,9 +24,10 @@ * A project can provide this interface in its {@link org.netbeans.api.project.Project#getLookup lookup} to * allow clients to extend its compilation classpath * by a new classpath element (JAR, folder, dependent project, or library). - * @since org.netbeans.modules.java.project/1 1.3 + * @since org.netbeans.modules.java.project/1 1.3 + * @deprecated Please use the {@link ProjectClassPathChanger} instead. */ -public interface ProjectClassPathExtender { +public @Deprecated interface ProjectClassPathExtender { /** * Adds a library into the project's compile classpath if the @@ -34,6 +35,7 @@ * @param library to be added * @return true in case the classpath was changed * @exception IOException in case the project metadata cannot be changed + * @deprecated Please use {@link ProjectClassPathChanger#addLibrary} instead. */ boolean addLibrary(Library library) throws IOException; @@ -43,6 +45,7 @@ * @param archiveFile ZIP/JAR file to be added * @return true in case the classpath was changed * @exception IOException in case the project metadata cannot be changed + * @deprecated Please use {@link ProjectClassPathChanger#addArchive} instead. */ boolean addArchiveFile(FileObject archiveFile) throws IOException; @@ -54,6 +57,7 @@ * (must be owned by the artifact and be relative to it) * @return true in case the classpath was changed * @exception IOException in case the project metadata cannot be changed + * @deprecated Please use {@link ProjectClassPathChanger#addAntArtifact} instead. */ boolean addAntArtifact(AntArtifact artifact, URI artifactElement) throws IOException;