/** * Returns a URL which is the resolved equivalent of the * supplied URL. This method is expected to be used with the * plug-in-relative URLs returned by IPluginDescriptor, Bundle.getEntry() * and Platform.find(). * <p> * If the specified URL is not a plug-in-relative URL, it is returned * as is. If the specified URL is a plug-in-relative URL, this method * attempts to reduce the given URL to one which is native to the Java * class library (eg. file, http, etc). * </p><p> * Note however that users of this API should not assume too much about the * results of this method. While it may consistently return a file: URL in certain * installation configurations, others may result in jar: or http: URLs. * </p> * @param url original plug-in-relative URL. * @return the resolved URL * @exception IOException if unable to resolve URL * @see #asLocalURL(URL) * @see #find(Bundle, IPath) * @see Bundle#getEntry(String) * @deprecated use {@link FileLocator#resolve(URL)} instead */ @Deprecated public static URL resolve(URL url) throws IOException { return FileLocator.resolve(url); }
@Override protected URL resolveBundleResourceURL(URL url) throws IOException { return FileLocator.resolve(url); } }
/** * @param url the location of the class file. */ protected URL resolveBundleResourceURL(URL url) throws IOException { return FileLocator.resolve(url); }
public String resolve(URL platformURL, String relativePath) throws Exception { URL resolvedURL = FileLocator.resolve(platformURL); return resolvedURL.toString() + relativePath; }
public String resolve(URL platformURL, String relativePath) throws Exception { URL resolvedURL = FileLocator.resolve(platformURL); return resolvedURL.toString() + relativePath; }
public InputStream getInputStream(String uri) throws Exception { return FileLocator.resolve( new URL(startLocation + uri) ).openStream(); }
public String resolve(String uri) { try { URL resolvedURL = FileLocator.resolve( new URL(startLocation + uri)); return resolvedURL.toString(); } catch (MalformedURLException e) { } catch (IOException e) { } return null; }
@Override public URL resolve(URL url) throws IOException { URLConnection connection = url.openConnection(); if (!(connection instanceof PlatformURLConnection)) return url; URL result = ((PlatformURLConnection) connection).getResolvedURL(); // if we have a bundle*: URL we should try to convert it if (!result.getProtocol().startsWith(PlatformURLHandler.BUNDLE)) return result; return FileLocator.resolve(result); } }
public URL resolve(URL url) throws IOException { URLConnection connection = url.openConnection(); if (!(connection instanceof PlatformURLConnection)) return url; URL result = ((PlatformURLConnection) connection).getResolvedURL(); // if we have a bundle*: URL we should try to convert it if (!result.getProtocol().startsWith(PlatformURLHandler.BUNDLE)) return result; return FileLocator.resolve(result); } }
@Override public boolean test(@NonNull URL t) { try { return FileLocator.resolve(t) != null; } catch (IOException e) { return false; } }
@Override public URL resolve(URL url) throws IOException { URLConnection connection = url.openConnection(); if (!(connection instanceof PlatformURLConnection)) return url; URL result = ((PlatformURLConnection) connection).getResolvedURL(); // if we have a bundle*: URL we should try to convert it if (!result.getProtocol().startsWith(PlatformURLHandler.BUNDLE)) return result; return FileLocator.resolve(result); } }
@SuppressWarnings("null") @Override public @NonNull URL resolveToLocalURL(URL url) { try { return FileLocator.resolve(url); } catch (IOException e) { throw new RuntimeException(e); } } }
public URL resolve(URL url) throws IOException { URLConnection connection = url.openConnection(); if (!(connection instanceof PlatformURLConnection)) return url; URL result = ((PlatformURLConnection) connection).getResolvedURL(); // if we have a bundle*: URL we should try to convert it if (!result.getProtocol().startsWith(PlatformURLHandler.BUNDLE)) return result; return FileLocator.resolve(result); } }
private ZipFile getZipFileFromPluginDir(String pluginRelativePath, Bundle bundle) throws CoreException { try { URL starterURL = FileLocator.resolve(bundle.getEntry(pluginRelativePath)); return new ZipFile(FileLocator.toFileURL(starterURL).getFile()); } catch (IOException e) { String message = pluginRelativePath + ": " + e.getMessage(); //$NON-NLS-1$ Status status = new Status(IStatus.ERROR, PDEPlugin.getPluginId(), IStatus.ERROR, message, e); throw new CoreException(status); } }
public URL getInstallURL() { try { return FileLocator.resolve(getDefault().getBundle().getEntry("/")); //$NON-NLS-1$ } catch (IOException e) { return null; } }
private ImageDescriptor createImageDescriptor(String relativePath) { Bundle bundle = Platform.getBundle("org.eclipse.ui.forms"); //$NON-NLS-1$ URL url = FileLocator.find(bundle, new Path(relativePath),null); if (url == null) return null; try { url = FileLocator.resolve(url); return ImageDescriptor.createFromURL(url); } catch (IOException e) { return null; } }
private void loadContentUrl(IUrlTip tip) { try { String url = FileLocator.resolve(new URL(tip.getURL())).toString(); fBrowser.setUrl(url); } catch (IOException e) { fTipManager.log(LogUtil.error(getClass(), e)); } }
private ImageDescriptor createImageDescriptor(String relativePath) { Bundle bundle = Platform.getBundle("org.eclipse.ui.forms"); //$NON-NLS-1$ URL url = FileLocator.find(bundle, new Path(relativePath),null); if (url == null) return null; try { url = FileLocator.resolve(url); return ImageDescriptor.createFromURL(url); } catch (IOException e) { return null; } }
private void setCssURL(URL cssURL) { try { if (cssURL != null) fCssURL = FileLocator.resolve(cssURL); } catch (IOException e) { } if (fCssURL == null && fCssPurpose != BUILD) fCssURL = getResourceURL(getProductPlugin(), PLATFORM_CSS); if (fCssURL == null && fCssPurpose != BUILD) fCssURL = getResourceURL(PDECore.PLUGIN_ID, PLATFORM_CSS); }
private ImageDescriptor createImageDescriptor(String relativePath) { Bundle bundle = CheatSheetPlugin.getPlugin().getBundle(); URL url = FileLocator.find(bundle, new Path(relativePath),null); if (url == null) return null; try { url = FileLocator.resolve(url); return ImageDescriptor.createFromURL(url); } catch (IOException e) { return null; } }