1 11 12 package org.eclipse.jdt.apt.core.internal; 13 14 import java.io.File ; 15 16 import org.eclipse.core.resources.IResource; 17 import org.eclipse.core.resources.IWorkspaceRoot; 18 import org.eclipse.core.resources.ResourcesPlugin; 19 import org.eclipse.core.runtime.IPath; 20 import org.eclipse.core.runtime.IStatus; 21 22 26 public class WkspJarFactoryContainer extends JarFactoryContainer { 27 28 private final String _id; 29 private final File _jarFile; 31 38 public WkspJarFactoryContainer(IPath jar) { 39 _id = jar.toString(); 40 IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); 41 IResource res = root.findMember(_id); 42 if (null == res) { 43 _jarFile = root.getLocation().append(jar).toFile(); 46 47 } 48 else if (res.getType() == IResource.FILE) { 49 _jarFile = res.getLocation().toFile(); 50 } 51 else { 52 _jarFile = null; 53 IStatus s = AptPlugin.createWarningStatus( 54 null, "The factorypath entry " + _id + " does not refer to a jar file"); AptPlugin.log(s); 56 } 57 } 58 59 @Override 60 public FactoryType getType() { 61 return FactoryType.WKSPJAR; 62 } 63 64 67 @Override 68 public File getJarFile() { 69 return _jarFile; 70 } 71 72 75 @Override 76 public String getId() { 77 return _id; 78 } 79 } 80 | Popular Tags |