# Trace time spent creating URLImageDescriptor images
org.eclipse.jface/debug/trace/URLImageDescriptor=false
+# Log cases where an "@2x" image could not be found.
+org.eclipse.jface/debug/logURLImageDescriptorMissing2x=false
+
# Switch URLImageDescriptor to load images directly via URL#openStream() (instead of FileLocator#toFileURL(URL))
org.eclipse.jface/debug/loadURLImageDescriptorDirectly=false
# Switch URLImageDescriptor to load images using the "@2x" convention for high-dpi
org.eclipse.jface/debug/loadURLImageDescriptor2x=false
+# Always load the .png image of the "@2x" version, even if the original image was a .gif.
+org.eclipse.jface/debug/loadURLImageDescriptor2xPngForGif=false
+
# Log a message if a dialog is opened without a parent
org.eclipse.jface/debug/dialog/noparent=false
public static boolean DEBUG_TRACE_URL_IMAGE_DESCRIPTOR = false;
/**
+ * (NON-API) Log cases where an "@2x" image could not be found.
+ *
+ * @since 3.11
+ */
+ public static boolean DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x = false;
+
+ /**
* (NON-API) If true, URLImageDescriptor loads images directly via
* URL#openStream(). If false, URLImageDescriptor first tries to use
* FileLocator#toFileURL(URL) and the Image(Device, String) constructor.
public static boolean DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x = false;
/**
+ * (NON-API) Always load the .png image of the "@2x" version, even if the
+ * original image was a .gif.
+ *
+ * @since 3.11
+ */
+ public static boolean DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x_PNG_FOR_GIF = false;
+
+ /**
* (NON-API) A flag to indicate whether the JFace bundle is running inside
* an OSGi container
*
}
return new BufferedInputStream(url.openStream());
} catch (IOException e) {
+ if (InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x) {
+ String path = url.getPath();
+ if (path.endsWith("@2x.png") || path.endsWith("@1.5x.png")) { //$NON-NLS-1$ //$NON-NLS-2$
+ String message = "High-resolution image missing: " + url; //$NON-NLS-1$
+ Policy.getLog().log(new Status(IStatus.WARNING, Policy.JFACE, message, e));
+ }
+ }
return null;
}
}
if (dot != -1 && (zoom == 150 || zoom == 200)) {
String lead = path.substring(0, dot);
String tail = path.substring(dot);
+ if (InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x_PNG_FOR_GIF && ".gif".equalsIgnoreCase(tail)) { //$NON-NLS-1$
+ tail = ".png"; //$NON-NLS-1$
+ }
String x = zoom == 150 ? "@1.5x" : "@2x"; //$NON-NLS-1$ //$NON-NLS-2$
try {
String file = lead + x + tail;
} catch (IOException e) {
if (logIOException) {
Policy.logException(e);
+ } else if (InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x) {
+ String path = url.getPath();
+ if (path.endsWith("@2x.png") || path.endsWith("@1.5x.png")) { //$NON-NLS-1$ //$NON-NLS-2$
+ String message = "High-resolution image missing: " + url; //$NON-NLS-1$
+ Policy.getLog().log(new Status(IStatus.WARNING, Policy.JFACE, message, e));
+ }
}
return null;
}
InternalPolicy.DEBUG_LOG_EQUAL_VIEWER_ELEMENTS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/equalElements")); //$NON-NLS-1$ //$NON-NLS-2$
InternalPolicy.DEBUG_BIDI_UTILS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/bidiUtils")); //$NON-NLS-1$ //$NON-NLS-2$
InternalPolicy.DEBUG_TRACE_URL_IMAGE_DESCRIPTOR = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/trace/URLImageDescriptor")); //$NON-NLS-1$ //$NON-NLS-2$
+ InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/logURLImageDescriptorMissing2x")); //$NON-NLS-1$ //$NON-NLS-2$
InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_DIRECTLY = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/loadURLImageDescriptorDirectly")); //$NON-NLS-1$ //$NON-NLS-2$
InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/loadURLImageDescriptor2x")); //$NON-NLS-1$ //$NON-NLS-2$
+ InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x_PNG_FOR_GIF = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/loadURLImageDescriptor2xPngForGif")); //$NON-NLS-1$ //$NON-NLS-2$
}
}