# HG changeset patch # User Frank Benoit # Date 1211476188 -7200 # Node ID 6787ae179808ee0136c93c41a3fa510f128d1d4b # Parent 5df4896124c70b824868c7954ea5564f8767b0fd Fix FileImageDescriptor to work with compiletime data diff -r 5df4896124c7 -r 6787ae179808 dwtx/jface/resource/FileImageDescriptor.d --- a/dwtx/jface/resource/FileImageDescriptor.d Thu May 22 17:56:17 2008 +0200 +++ b/dwtx/jface/resource/FileImageDescriptor.d Thu May 22 19:09:48 2008 +0200 @@ -176,14 +176,16 @@ * @see dwtx.jface.resource.ImageDescriptor#createImage(bool, * dwt.graphics.Device) */ - public Image createImage(bool returnMissingImageOnError, Device device) { - String path = getFilePath(); - if (path is null) - return createDefaultImage(returnMissingImageOnError, device); - try { - return new Image(device, path); - } catch (DWTException exception) { - //if we fail try the default way using a stream + public override Image createImage(bool returnMissingImageOnError, Device device) { + if( importdata.length is 0 ){ + String path = getFilePath(); + if (path is null ) + return createDefaultImage(returnMissingImageOnError, device); + try { + return new Image(device, path); + } catch (DWTException exception) { + //if we fail try the default way using a stream + } } return super.createImage(returnMissingImageOnError, device); } diff -r 5df4896124c7 -r 6787ae179808 dwtx/jface/resource/ImageDescriptor.d --- a/dwtx/jface/resource/ImageDescriptor.d Thu May 22 17:56:17 2008 +0200 +++ b/dwtx/jface/resource/ImageDescriptor.d Thu May 22 19:09:48 2008 +0200 @@ -311,6 +311,7 @@ } return new Image(device, data); } catch (DWTException exception) { + //ExceptionPrintStackTrace(exception); if (returnMissingImageOnError) { try { return new Image(device, DEFAULT_IMAGE_DATA); diff -r 5df4896124c7 -r 6787ae179808 dwtx/jface/resource/URLImageDescriptor.d --- a/dwtx/jface/resource/URLImageDescriptor.d Thu May 22 17:56:17 2008 +0200 +++ b/dwtx/jface/resource/URLImageDescriptor.d Thu May 22 19:09:48 2008 +0200 @@ -40,13 +40,13 @@ class URLImageDescriptor : ImageDescriptor { /** * Constant for the file protocol for optimized loading - */ + */ private static final String FILE_PROTOCOL = "file"; //$NON-NLS-1$ private Uri url; /** * Creates a new URLImageDescriptor. - * + * * @param url * The URL to load the image from. Must be non-null. */ @@ -89,7 +89,7 @@ /** * 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() { @@ -126,7 +126,7 @@ /** * Returns the filename for the ImageData. - * + * * @return {@link String} or null if the file cannot be found */ private String getFilePath() { @@ -152,11 +152,11 @@ /* * (non-Javadoc) - * + * * @see dwtx.jface.resource.ImageDescriptor#createImage(bool, * dwt.graphics.Device) */ - public Image createImage(bool returnMissingImageOnError, Device device) { + public override Image createImage(bool returnMissingImageOnError, Device device) { // Try to see if we can optimize using SWTs file based image support. String path = getFilePath();