1 19 20 package org.netbeans.modules.j2ee.persistence.sourcetestsupport; 21 22 import java.net.URL ; 23 import org.netbeans.api.java.classpath.ClassPath; 24 import org.netbeans.spi.java.classpath.ClassPathProvider; 25 import org.netbeans.spi.java.classpath.support.ClassPathSupport; 26 import org.openide.filesystems.FileObject; 27 import org.openide.filesystems.FileUtil; 28 29 35 public class ClassPathProviderImpl implements ClassPathProvider { 36 37 public ClassPathProviderImpl(){ 38 } 39 40 public ClassPath findClassPath(FileObject file, String type) { 41 if (ClassPath.COMPILE == type){ 42 try { 43 URL toplinkJarUrl = Class.forName("javax.persistence.EntityManager").getProtectionDomain().getCodeSource().getLocation(); 44 return ClassPathSupport.createClassPath(new URL []{FileUtil.getArchiveRoot(toplinkJarUrl)}); 45 } catch (Exception ex) { 46 throw new RuntimeException (ex); 47 } 48 } 49 return null; 50 } 51 } 52 | Popular Tags |