@Override public ClassPath findClassPath(FileObject file, String type) { ClassPath cp = javaClassPathProvider.findClassPath(file, type); if (cp != null) { return cp; } FileType fileType = getType(file); if (type.equals(ClassPath.COMPILE)) { cp = getCompileTimeClasspath(fileType); } else if (type.equals(ClassPath.EXECUTE)) { cp = getRunTimeClasspath(fileType); } else if (type.equals(ClassPath.SOURCE)) { cp = getSourcepath(fileType); } else if (type.equals("js/library")) { // NOI18N cp = getSourcepath(FileType.WEB_SOURCE); } return cp; }
private synchronized ClassPath getCompileTimeClasspath(FileType type) { if (type == FileType.WEB_SOURCE) { if (sourceRoots.getRoots().length > 0) { return javaClassPathProvider.findClassPath(sourceRoots.getRoots()[0], ClassPath.COMPILE); } else { ClassPath cp = cache.get(ClassPathCache.WEB_COMPILATION); if (cp == null) { cp = ClassPathFactory.createClassPath(ProjectClassPathSupport.createPropertyBasedClassPathImplementation( projectDirectory, evaluator, new String[] {"javac.classpath", WebProjectProperties.J2EE_PLATFORM_CLASSPATH })); cache.put(ClassPathCache.WEB_COMPILATION, cp); } return cp; } } return null; }
private synchronized ClassPath getRunTimeClasspath(FileType type) { if (type == FileType.WEB_SOURCE) { if (sourceRoots.getRoots().length > 0) { return javaClassPathProvider.findClassPath(sourceRoots.getRoots()[0], ClassPath.EXECUTE); } else { ClassPath cp = cache.get(ClassPathCache.WEB_RUNTIME); if (cp == null) { cp = ClassPathFactory.createClassPath(ProjectClassPathSupport.createPropertyBasedClassPathImplementation( projectDirectory, evaluator, new String[] {"debug.classpath", WebProjectProperties.J2EE_PLATFORM_CLASSPATH })); cache.put(ClassPathCache.WEB_RUNTIME, cp); } return cp; } } return null; }