/** * Creates and returns a new image descriptor from a URL. * * @param url The URL of the image file. * @return a new image descriptor */ public static ImageDescriptor createFromURL(URL url) { if (url == null) { return getMissingImageDescriptor(); } return new URLImageDescriptor(url); }
/** * Returns a stream on the image contents. Returns null if a stream could * not be opened. * * @return the stream for loading the data */ protected InputStream getStream() { return getStream(url); }
@Deprecated @Override public ImageData getImageData() { return getImageData(getURL(url)); }
URL pathURL = getURL(url); if (pathURL != null) { String path = getFilePath(pathURL, true); if (path != null) { try {
@Override public ImageData getImageData() { return getImageData(url); }
String path = getFilePath(url, true); if (path != null) { try {
private static ImageData getImageData(URL url) { ImageData result = null; try (InputStream in = getStream(url)) { if (in != null) { result = new ImageData(in); } } catch (SWTException e) { if (e.code != SWT.ERROR_INVALID_IMAGE) { throw e; // fall through otherwise } } catch (IOException e) { Policy.getLog().log(new Status(IStatus.ERROR, Policy.JFACE, e.getLocalizedMessage(), e)); } return result; }
/** * Creates and returns a new image descriptor from a URL. * * @param url The URL of the image file. * @return a new image descriptor */ public static ImageDescriptor createFromURL(URL url) { if (url == null) { return getMissingImageDescriptor(); } return new URLImageDescriptor(url); }
private static ImageData getImageData(URL url) { ImageData result = null; try (InputStream in = getStream(url)) { if (in != null) { result = new ImageData(in); } } catch (SWTException e) { if (e.code != SWT.ERROR_INVALID_IMAGE) { throw e; // fall through otherwise } } catch (IOException e) { Policy.getLog().log(new Status(IStatus.ERROR, Policy.JFACE, e.getLocalizedMessage(), e)); } return result; }
/** * Creates and returns a new image descriptor from a URL. * * @param url The URL of the image file. * @return a new image descriptor */ public static ImageDescriptor createFromURL(URL url) { if (url == null) { return getMissingImageDescriptor(); } return new URLImageDescriptor(url); }
public ImageData getImageData() { ImageData result = null; InputStream in = getStream(); if (in != null) { try { result = new ImageData(in); } catch (SWTException e) { if (e.code != SWT.ERROR_INVALID_IMAGE) { throw e; // fall through otherwise } } finally { try { in.close(); } catch (IOException e) { Policy.getLog().log( new Status(IStatus.ERROR, Policy.JFACE, e .getLocalizedMessage(), e)); } } } return result; }
InputStream stream = getStream(); if( stream != null ) { try {