/** * Returns the comparator used to sort strings. * * @return the comparator used to sort strings */ protected Comparator getComparator() { if (comparator == null){ comparator = Policy.getComparator(); } return comparator; }
@Override int getColumnCount() { if (Policy.getErrorSupportProvider() == null) return 2; return 3; }
/** * Return the comparator used by JFace to sort strings. * * @return the comparator used by JFace to sort strings * @since 3.2 */ public static Comparator<Object> getComparator() { if (viewerComparator == null) { viewerComparator = getDefaultComparator(); } return viewerComparator; }
/** * Log the Exception to the logger. * * @param exception * @since 3.4 */ public static void logException(Exception exception) { getLog().log( new Status(IStatus.ERROR, JFACE, exception .getLocalizedMessage(), exception)); }
@Override public void handleException(Throwable e) { errorOccurred = true; Policy.getLog().log(new Status(IStatus.ERROR, Policy.JFACE, 0, e.toString(), e)); clearSelectedNode(); String message = JFaceResources.getString("SafeRunnable.errorMessage"); //$NON-NLS-1$ Policy.getStatusHandler().show( new Status(IStatus.ERROR, Policy.JFACE, message, e), JFaceResources.getString("Error")); //$NON-NLS-1$ } });
public void handleException(Throwable e) { // Workaround to avoid interactive error dialogs during // automated testing if (ignoreErrors) return; if (message == null) message = JFaceResources.getString("SafeRunnable.errorMessage"); //$NON-NLS-1$ Policy.getStatusHandler().show( new Status(IStatus.ERROR, Policy.JFACE, message, e), JFaceResources.getString("SafeRunnable.errorMessage")); //$NON-NLS-1$ }
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));
/** * Returns the filename for the ImageData. * * @return {@link String} or <code>null</code> if the file cannot be found */ private String getFilePath() { if (location == null) return new Path(name).toOSString(); URL resource = location.getResource(name); if (resource == null) return null; try { if (!InternalPolicy.OSGI_AVAILABLE) {// Stand-alone case return new Path(resource.getFile()).toOSString(); } return new Path(FileLocator.toFileURL(resource).getPath()).toOSString(); } catch (IOException e) { Policy.logException(e); return null; } } }
/** * Returns the status handler used by JFace to handle statuses. * * @return the status handler * @since 3.4 */ public static StatusHandler getStatusHandler() { if (statusHandler == null) { statusHandler = getDummyStatusHandler(); } return statusHandler; }
/** * Returns the logger used by JFace to log errors. * <p> * The default logger prints the status to <code>System.err</code>. * </p> * * @return the logger * @since 3.1 */ public static ILogger getLog() { if (log == null) { log = getDummyLog(); } return log; }
/** * Log the Exception to the logger. * * @param exception * @since 3.4 */ public static void logException(Exception exception) { getLog().log( new Status(IStatus.ERROR, JFACE, exception .getLocalizedMessage(), exception)); }
@Override public void handleException(Throwable e) { errorOccurred = true; Policy.getLog().log(new Status(IStatus.ERROR, Policy.JFACE, 0, e.toString(), e)); clearSelectedNode(); String message = JFaceResources.getString("SafeRunnable.errorMessage"); //$NON-NLS-1$ Policy.getStatusHandler().show( new Status(IStatus.ERROR, Policy.JFACE, message, e), JFaceResources.getString("Error")); //$NON-NLS-1$ } });
@Override public void handleException(Throwable e) { // Workaround to avoid interactive error dialogs during // automated testing if (ignoreErrors) return; if (message == null) message = JFaceResources.getString("SafeRunnable.errorMessage"); //$NON-NLS-1$ Policy.getStatusHandler().show( new Status(IStatus.ERROR, Policy.JFACE, message, e), JFaceResources.getString("SafeRunnable.errorMessage")); //$NON-NLS-1$ }
} catch (IOException e) { if (logIOException) { Policy.logException(e); } else if (InternalPolicy.DEBUG_LOG_URL_IMAGE_DESCRIPTOR_MISSING_2x) { if (name.endsWith("@2x.png") || name.endsWith("@1.5x.png")) { //$NON-NLS-1$ //$NON-NLS-2$ String message = "High-resolution image missing: " + location + ' ' + name; //$NON-NLS-1$ Policy.getLog().log(new Status(IStatus.WARNING, Policy.JFACE, message, e));
/** * Return the font record for the key. * @param symbolicName The key for the record. * @return FontRecord */ private FontRecord getFontRecord(String symbolicName) { Assert.isNotNull(symbolicName); Object result = stringToFontRecord.get(symbolicName); if (result != null) { return (FontRecord) result; } result = stringToFontData.get(symbolicName); FontRecord fontRecord; if (result == null) { fontRecord = defaultFontRecord(); } else { fontRecord = createFont(symbolicName, (FontData[]) result); } if (fontRecord == null) { fontRecord = defaultFontRecord(); if (Display.getCurrent() == null) { // log error but don't throw an exception to preserve existing functionality String msg = "Unable to create font \"" + symbolicName + "\" in a non-UI thread. Using default font instead."; //$NON-NLS-1$ //$NON-NLS-2$ Policy.logException(new SWTException(msg)); return fontRecord; // don't add it to the cache; if later asked from UI thread, a proper font will be created } } stringToFontRecord.put(symbolicName, fontRecord); return fontRecord; }
/** * Returns the status handler used by JFace to handle statuses. * * @return the status handler * @since 1.1 */ public static StatusHandler getStatusHandler() { if (statusHandler == null) { statusHandler = getDummyStatusHandler(); } return statusHandler; }
/** * Returns the logger used by JFace to log errors. * <p> * The default logger prints the status to <code>System.err</code>. * </p> * * @return the logger * @since 3.1 */ public static ILogger getLog() { if (log == null) { log = getDummyLog(); } return log; }
/** * Returns the comparator used to sort strings. * * @return the comparator used to sort strings */ protected Comparator<? super String> getComparator() { if (comparator == null){ comparator = Policy.getComparator(); } return comparator; }
/** * Log the Exception to the logger. * * @param exception */ public static void logException(Exception exception) { getLog().log( new Status(IStatus.ERROR, JFACE, exception .getLocalizedMessage(), exception)); }
public void handleException(Throwable e) { errorOccurred = true; Policy.getLog().log(new Status(IStatus.ERROR, Policy.JFACE, 0, e.toString(), e)); clearSelectedNode(); String message = JFaceResources.getString("SafeRunnable.errorMessage"); //$NON-NLS-1$ Policy.getStatusHandler().show( new Status(IStatus.ERROR, Policy.JFACE, message, e), JFaceResources.getString("Error")); //$NON-NLS-1$ } });