KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > j2seproject > classpath > J2SEProjectClassPathExtender


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.java.j2seproject.classpath;
20
21 import java.io.IOException JavaDoc;
22 import java.net.URI JavaDoc;
23 import java.net.URL JavaDoc;
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 JavaDoc
31 public class J2SEProjectClassPathExtender implements ProjectClassPathExtender {
32     
33     private static final String JavaDoc CP_CLASS_PATH = "javac.classpath"; //NOI18N
34

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 JavaDoc {
43         return addLibrary(CP_CLASS_PATH, library);
44     }
45
46     public boolean addLibrary(final String JavaDoc type, final Library library) throws IOException JavaDoc {
47         return this.delegate.handleLibraries (new Library[] {library},type, J2SEProjectClassPathModifier.ADD);
48     }
49
50     public boolean addArchiveFile(final FileObject archiveFile) throws IOException JavaDoc {
51         return addArchiveFile(CP_CLASS_PATH,archiveFile);
52     }
53
54     public boolean addArchiveFile(final String JavaDoc type, FileObject archiveFile) throws IOException JavaDoc {
55         if (FileUtil.isArchiveFile(archiveFile)) {
56             archiveFile = FileUtil.getArchiveRoot (archiveFile);
57         }
58         return this.delegate.handleRoots(new URL JavaDoc[] {archiveFile.getURL()},type,J2SEProjectClassPathModifier.ADD);
59     }
60
61     public boolean addAntArtifact(final AntArtifact artifact, final URI JavaDoc artifactElement) throws IOException JavaDoc {
62         return addAntArtifact(CP_CLASS_PATH,artifact, artifactElement);
63     }
64
65     public boolean addAntArtifact(final String JavaDoc type, final AntArtifact artifact, final URI JavaDoc artifactElement) throws IOException JavaDoc {
66         return this.delegate.handleAntArtifacts(new AntArtifact[] {artifact}, new URI JavaDoc[] {artifactElement},type,J2SEProjectClassPathModifier.ADD);
67     }
68
69 }
70
Popular Tags