1 19 20 package org.netbeans.spi.java.project.classpath; 21 22 import java.io.IOException ; 23 import java.net.URI ; 24 import java.net.URL ; 25 import org.netbeans.api.project.SourceGroup; 26 import org.netbeans.api.project.ant.AntArtifact; 27 import org.netbeans.api.project.libraries.Library; 28 import org.netbeans.modules.java.project.classpath.ProjectClassPathModifierAccessor; 29 import org.openide.filesystems.FileObject; 30 31 38 public abstract class ProjectClassPathModifierImplementation { 39 40 static { 41 ProjectClassPathModifierAccessor.INSTANCE = new Accessor (); 42 } 43 44 protected ProjectClassPathModifierImplementation () { 45 } 46 47 48 53 protected abstract SourceGroup [] getExtensibleSourceGroups (); 54 55 56 61 protected abstract String [] getExtensibleClassPathTypes (SourceGroup sourceGroup); 62 63 77 protected abstract boolean addLibraries (Library[] libraries, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException ; 78 79 80 94 protected abstract boolean removeLibraries (Library[] libraries, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException ; 95 96 110 protected abstract boolean addRoots (URL [] classPathRoots, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException ; 111 112 126 protected abstract boolean removeRoots (URL [] classPathRoots, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException ; 127 128 145 protected abstract boolean addAntArtifacts (AntArtifact[] artifacts, URI [] artifactElements, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException ; 146 147 164 protected abstract boolean removeAntArtifacts (AntArtifact[] artifacts, URI [] artifactElements, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException ; 165 166 167 private static class Accessor extends ProjectClassPathModifierAccessor { 168 169 public SourceGroup[] getExtensibleSourceGroups(final ProjectClassPathModifierImplementation m) { 170 assert m != null; 171 return m.getExtensibleSourceGroups(); 172 } 173 174 public String [] getExtensibleClassPathTypes (final ProjectClassPathModifierImplementation m, SourceGroup sg) { 175 assert m != null; 176 assert sg != null; 177 return m.getExtensibleClassPathTypes(sg); 178 } 179 180 public boolean removeLibraries(Library[] libraries, ProjectClassPathModifierImplementation m, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException { 181 assert m!= null; 182 return m.removeLibraries(libraries, sourceGroup, type); 183 } 184 185 public boolean removeAntArtifacts(AntArtifact[] artifacts, URI [] artifactElements, ProjectClassPathModifierImplementation m, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException { 186 assert m!= null; 187 return m.removeAntArtifacts(artifacts, artifactElements, sourceGroup, type); 188 } 189 190 public boolean addLibraries (Library[] libraries, ProjectClassPathModifierImplementation m, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException { 191 assert m!= null; 192 return m.addLibraries(libraries, sourceGroup, type); 193 } 194 195 public boolean addAntArtifacts (AntArtifact[] artifacts, URI [] artifactElements, ProjectClassPathModifierImplementation m, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException { 196 assert m!= null; 197 return m.addAntArtifacts (artifacts, artifactElements, sourceGroup, type); 198 } 199 200 public boolean removeRoots (URL [] classPathRoots, ProjectClassPathModifierImplementation m, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException { 201 assert m!= null; 202 return m.removeRoots(classPathRoots, sourceGroup, type); 203 } 204 205 public boolean addRoots (URL [] classPathRoots, ProjectClassPathModifierImplementation m, SourceGroup sourceGroup, String type) throws IOException , UnsupportedOperationException { 206 assert m!= null; 207 return m.addRoots (classPathRoots, sourceGroup, type); 208 } 209 210 } 211 } 212 | Popular Tags |