/** * Returns the default font record. */ private FontRecord defaultFontRecord() { FontRecord record = (FontRecord) stringToFontRecord .get(JFaceResources.DEFAULT_FONT); if (record == null) { Font defaultFont = calculateDefaultFont(); record = createFont(JFaceResources.DEFAULT_FONT, defaultFont .getFontData()); defaultFont.dispose(); stringToFontRecord.put(JFaceResources.DEFAULT_FONT, record); } return record; }
/** * Returns the default font record. */ private FontRecord defaultFontRecord() { FontRecord record = stringToFontRecord .get(JFaceResources.DEFAULT_FONT); if (record == null) { Font defaultFont = calculateDefaultFont(); record = createFont(JFaceResources.DEFAULT_FONT, defaultFont .getFontData()); defaultFont.dispose(); stringToFontRecord.put(JFaceResources.DEFAULT_FONT, record); } return record; }
/** * Returns the default font record. */ private FontRecord defaultFontRecord() { FontRecord record = stringToFontRecord .get(JFaceResources.DEFAULT_FONT); if (record == null) { Font defaultFont = calculateDefaultFont(); record = createFont(JFaceResources.DEFAULT_FONT, defaultFont .getFontData()); defaultFont.dispose(); stringToFontRecord.put(JFaceResources.DEFAULT_FONT, record); } return record; }
/** * 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; }
/** * 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; }
/** * 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; }