1 19 20 package org.netbeans.modules.javadoc.search; 21 22 import org.openide.filesystems.FileObject; 23 import org.openide.filesystems.FileUtil; 24 import org.openide.filesystems.URLMapper; 25 import org.netbeans.modules.javadoc.httpfs.HTTPURLMapper; 26 27 import java.net.URL ; 28 import java.net.MalformedURLException ; 29 import java.io.File ; 30 31 40 public final class JavadocURLMapper { 41 42 47 public static URL findURL(FileObject fileObject) { 48 File file = FileUtil.toFile(fileObject); 49 if (file != null) { 50 try { 51 return file.toURI().toURL(); 52 } catch (MalformedURLException ex) { 53 } 55 } 56 57 HTTPURLMapper mapper = new HTTPURLMapper(); 58 URL url = mapper.getURL(fileObject, URLMapper.EXTERNAL); 59 if (url != null) { 60 return url; 61 } 62 63 return URLMapper.findURL(fileObject, URLMapper.EXTERNAL); 64 } 65 } 66 67 | Popular Tags |