1 19 package org.netbeans.modules.java.j2seproject.classpath; 20 21 import java.io.IOException ; 22 import java.net.URI ; 23 import java.net.URL ; 24 import org.netbeans.spi.java.project.classpath.ProjectClassPathExtender; 25 import org.openide.filesystems.FileObject; 26 import org.openide.filesystems.FileUtil; 27 import org.netbeans.api.project.libraries.Library; 28 import org.netbeans.api.project.ant.AntArtifact; 29 30 @Deprecated 31 public class J2SEProjectClassPathExtender implements ProjectClassPathExtender { 32 33 private static final String CP_CLASS_PATH = "javac.classpath"; 35 private final J2SEProjectClassPathModifier delegate; 36 37 public J2SEProjectClassPathExtender (final J2SEProjectClassPathModifier delegate) { 38 assert delegate != null; 39 this.delegate = delegate; 40 } 41 42 public boolean addLibrary(final Library library) throws IOException { 43 return addLibrary(CP_CLASS_PATH, library); 44 } 45 46 public boolean addLibrary(final String type, final Library library) throws IOException { 47 return this.delegate.handleLibraries (new Library[] {library},type, J2SEProjectClassPathModifier.ADD); 48 } 49 50 public boolean addArchiveFile(final FileObject archiveFile) throws IOException { 51 return addArchiveFile(CP_CLASS_PATH,archiveFile); 52 } 53 54 public boolean addArchiveFile(final String type, FileObject archiveFile) throws IOException { 55 if (FileUtil.isArchiveFile(archiveFile)) { 56 archiveFile = FileUtil.getArchiveRoot (archiveFile); 57 } 58 return this.delegate.handleRoots(new URL [] {archiveFile.getURL()},type,J2SEProjectClassPathModifier.ADD); 59 } 60 61 public boolean addAntArtifact(final AntArtifact artifact, final URI artifactElement) throws IOException { 62 return addAntArtifact(CP_CLASS_PATH,artifact, artifactElement); 63 } 64 65 public boolean addAntArtifact(final String type, final AntArtifact artifact, final URI artifactElement) throws IOException { 66 return this.delegate.handleAntArtifacts(new AntArtifact[] {artifact}, new URI [] {artifactElement},type,J2SEProjectClassPathModifier.ADD); 67 } 68 69 } 70 | Popular Tags |