use of org.eclipse.epp.internal.mpc.ui.catalog.ResourceProviderImageDescriptor in project epp.mpc by eclipse.
the class CatalogDescriptor method imageDescriptorForUrl.
private static ImageDescriptor imageDescriptorForUrl(ICatalog catalog, String imageUrl) throws MalformedURLException {
if (imageUrl != null && imageUrl.length() > 0) {
ResourceProvider resourceProvider = MarketplaceClientUiPlugin.getInstance().getResourceProvider();
ResourceFuture resource = resourceProvider.getResource(imageUrl);
if (resource == null) {
String requestSource = NLS.bind(Messages.CatalogDescriptor_requestCatalog, catalog.getName(), catalog.getId());
try {
resource = resourceProvider.retrieveResource(requestSource, imageUrl);
} catch (URISyntaxException e) {
MarketplaceClientUi.log(IStatus.WARNING, Messages.CatalogDescriptor_badUri, catalog.getName(), catalog.getId(), resource, e);
} catch (IOException e) {
MarketplaceClientUi.log(IStatus.WARNING, Messages.CatalogDescriptor_downloadError, catalog.getName(), catalog.getId(), resource, e);
}
}
if (resource != null) {
return new ResourceProviderImageDescriptor(resourceProvider, imageUrl);
}
return ImageDescriptor.createFromURL(URLUtil.toURL(imageUrl));
}
return null;
}
Aggregations