@Override public FontData[] getFontData(String symbolicName) { if (super.hasValueFor(symbolicName)) { return super.getFontData(symbolicName); } return parent.getFontData(symbolicName); }
/** * Return whether or not the dialog font is currently the same as the * default font. * * @return boolean if the two are the same */ protected static boolean dialogFontIsDefault() { FontData[] dialogFontData = JFaceResources.getFontRegistry() .getFontData(JFaceResources.DIALOG_FONT); FontData[] defaultFontData = JFaceResources.getFontRegistry() .getFontData(JFaceResources.DEFAULT_FONT); return Arrays.equals(dialogFontData, defaultFontData); }
/** * Return whether or not the dialog font is currently the same as the * default font. * * @return boolean if the two are the same */ protected static boolean dialogFontIsDefault() { FontData[] dialogFontData = JFaceResources.getFontRegistry() .getFontData(JFaceResources.DIALOG_FONT); FontData[] defaultFontData = JFaceResources.getFontRegistry() .getFontData(JFaceResources.DEFAULT_FONT); return Arrays.equals(dialogFontData, defaultFontData); }
/** * Returns the font descriptor for the font with the given symbolic * font name. Returns the default font if there is no special value * associated with that name * * @param symbolicName symbolic font name * @return the font descriptor (never null) * * @since 1.0 */ public FontDescriptor getDescriptor(String symbolicName) { Assert.isNotNull(symbolicName); return FontDescriptor.createFrom(getFontData(symbolicName)); }
/** * Return whether or not the dialog font is currently the same as the * default font. * * @return boolean if the two are the same */ protected static boolean dialogFontIsDefault() { FontData[] dialogFontData = JFaceResources.getFontRegistry() .getFontData(JFaceResources.DIALOG_FONT); FontData[] defaultFontData = JFaceResources.getFontRegistry() .getFontData(JFaceResources.DEFAULT_FONT); return Arrays.equals(dialogFontData, defaultFontData); }
/** * Returns the font descriptor for the font with the given symbolic * font name. Returns the default font if there is no special value * associated with that name * * @param symbolicName symbolic font name * @return the font descriptor (never null) * * @since 3.3 */ public FontDescriptor getDescriptor(String symbolicName) { Assert.isNotNull(symbolicName); return FontDescriptor.createFrom(getFontData(symbolicName)); }
/** * Returns the font descriptor for the font with the given symbolic * font name. Returns the default font if there is no special value * associated with that name * * @param symbolicName symbolic font name * @return the font descriptor (never null) * * @since 3.3 */ public FontDescriptor getDescriptor(String symbolicName) { Assert.isNotNull(symbolicName); return FontDescriptor.createFrom(getFontData(symbolicName)); }
protected FontData[] getFontValue(FontDefinition definition) { String id = definition.getId(); FontData[] updatedFD = fontPreferencesToSet.get(definition); if (updatedFD == null) { updatedFD = (FontData[]) fontValuesToSet.get(id); if (updatedFD == null) updatedFD = currentTheme.getFontRegistry().getFontData(id); } return updatedFD; }
@Override public FontData[] getFont(String symbolicName) { return getCurrentTheme().getFontRegistry().getFontData(symbolicName); }
private static String loadStyleSheet() { Bundle bundle= Platform.getBundle(JavaPlugin.getPluginId()); URL styleSheetURL= bundle.getEntry("/JavadocViewStyleSheet.css"); //$NON-NLS-1$ if (styleSheetURL == null) return null; try { styleSheetURL= FileLocator.toFileURL(styleSheetURL); BufferedReader reader= new BufferedReader(new InputStreamReader(styleSheetURL.openStream())); StringBuffer buffer= new StringBuffer(200); String line= reader.readLine(); while (line != null) { buffer.append(line); buffer.append('\n'); line= reader.readLine(); } FontData fontData= JFaceResources.getFontRegistry().getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0]; return HTMLPrinter.convertTopLevelFont(buffer.toString(), fontData); } catch (IOException ex) { JavaPlugin.log(ex); return null; } }
final FontData fontData = JFaceResources.getFontRegistry().getFontData( PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0]; return HTMLPrinter.convertTopLevelFont(buffer.toString(), fontData);
protected static String getStyleSheet() { if (fgStyleSheet == null) fgStyleSheet= loadStyleSheet(); String css= fgStyleSheet; if (css != null) { FontData fontData= JFaceResources.getFontRegistry().getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0]; css= HTMLPrinter.convertTopLevelFont(css, fontData); } return css; }
public void propertyChange(PropertyChangeEvent event) { if (PreferenceConstants.EDITOR_TEXT_FONT.equals(event.getProperty())) PreferenceConverter.putValue(getPreferenceStore(), JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); } };
protected String getStyleSheet() { if (fgStyleSheet == null) fgStyleSheet = loadStyleSheet(); String css = fgStyleSheet; if (css != null) { FontData fontData = JFaceResources.getFontRegistry().getFontData(fontSymbolicName)[0]; css = HTMLPrinter.convertTopLevelFont(css, fontData); } return css; }
FontData fontData= JFaceResources.getFontRegistry().getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0]; css= HTMLPrinter.convertTopLevelFont(css, fontData);
@Override public void propertyChange(PropertyChangeEvent event) { if (PreferenceConstants.EDITOR_TEXT_FONT.equals(event.getProperty())) PreferenceConverter.putValue(getPreferenceStore(), JFaceResources.TEXT_FONT, JFaceResources.getFontRegistry().getFontData(PreferenceConstants.EDITOR_TEXT_FONT)); } };
/** * Returns the Javadoc hover style sheet with the current Javadoc font from the preferences. * @return the updated style sheet * @since 3.4 */ private static String getStyleSheet() { if (fgStyleSheet == null) { fgStyleSheet= loadStyleSheet("/JavadocHoverStyleSheet.css"); //$NON-NLS-1$ } String css= fgStyleSheet; if (css != null) { FontData fontData= JFaceResources.getFontRegistry().getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0]; css= HTMLPrinter.convertTopLevelFont(css, fontData); } return css; }
/** * Returns the Javadoc hover style sheet with the current Javadoc font from the preferences. * @return the updated style sheet * @since 3.4 */ private static String getStyleSheet() { if (fgStyleSheet == null) { fgStyleSheet= loadStyleSheet("/JavadocHoverStyleSheet.css"); //$NON-NLS-1$ } String css= fgStyleSheet; if (css != null) { FontData fontData= JFaceResources.getFontRegistry().getFontData(PreferenceConstants.APPEARANCE_JAVADOC_FONT)[0]; css= HTMLPrinter.convertTopLevelFont(css, fontData); } return css; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { AbstractTextEditor textEditor= getActiveTextEditor(event); if (textEditor == null) { return null; } FontRegistry fontRegistry= textEditor.getSite().getWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry(); String fontProperty= textEditor.getSymbolicFontName(); if (fontProperty == null) { fontProperty= JFaceResources.TEXT_FONT; } Set<String> fontsToSet= getAffectedFontNames(fontProperty, fontRegistry); FontData[] initialFontData= null; String currentFontName= fontProperty; while (currentFontName != null && (initialFontData= fontRegistry.getFontData(currentFontName)) == null) { currentFontName= fgFontToDefault.get(currentFontName); } FontData[] newFontData= createFontDescriptor(initialFontData).getFontData(); if (newFontData != null) { fontsToSet.stream().forEach(fontName -> fontRegistry.put(fontName, newFontData)); } return Status.OK_STATUS; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { AbstractTextEditor textEditor= getActiveTextEditor(event); if (textEditor == null) { return null; } FontRegistry fontRegistry= textEditor.getSite().getWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry(); String fontProperty= textEditor.getSymbolicFontName(); if (fontProperty == null) { fontProperty= JFaceResources.TEXT_FONT; } Set<String> fontsToSet= getAffectedFontNames(fontProperty, fontRegistry); FontData[] initialFontData= null; String currentFontName= fontProperty; while (currentFontName != null && (initialFontData= fontRegistry.getFontData(currentFontName)) == null) { currentFontName= fgFontToDefault.get(currentFontName); } FontData[] newFontData= createFontDescriptor(initialFontData).getFontData(); if (newFontData != null) { fontsToSet.stream().forEach(fontName -> fontRegistry.put(fontName, newFontData)); } return Status.OK_STATUS; }