Java Code Examples for org.eclipse.jface.resource.JFaceResources#getFontRegistry()

The following examples show how to use org.eclipse.jface.resource.JFaceResources#getFontRegistry() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ErrorTraceTreeViewer.java    From tlaplus with MIT License 5 votes vote down vote up
private Font getFont(final Object element, final int columnIndex) {
	boolean returnBoldVersion = false;
	
	if (element instanceof TLCVariable) {
		if (((TLCVariable) element).isTraceExplorerVar()) {
			returnBoldVersion = true;
		}
	} else if (element instanceof RecordToSourceCoupler.LoaderTLCState) {
		returnBoldVersion = true;
	}

	final FontRegistry fr = JFaceResources.getFontRegistry();
	return returnBoldVersion ? fr.getBold(TLCErrorView.JFACE_ERROR_TRACE_ID)
							 : fr.get(TLCErrorView.JFACE_ERROR_TRACE_ID);
}
 
Example 2
Source File: Preferences.java    From Rel with Apache License 2.0 5 votes vote down vote up
public static Font getPreferenceFont(Display display, String name) {
	FontRegistry fontRegistry = JFaceResources.getFontRegistry();
	FontData[] fonts = fontRegistry.filterData(getPreferenceFont(name), display);
	if (fonts == null)
		return fontRegistry.defaultFont();
	return new Font(display, fonts);
}
 
Example 3
Source File: WidgetMessageDecorator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Font getMessageFont() {
    final FontRegistry fontRegistry = JFaceResources.getFontRegistry();
    if (fontRegistry.hasValueFor(WidgetMessageDecorator.class.getName())) {
        return fontRegistry.get(WidgetMessageDecorator.class.getName());
    }
    fontRegistry.put(WidgetMessageDecorator.class.getName(),
            new FontData[] { new FontData(WidgetMessageDecorator.class.getName(), 10, SWT.NORMAL) });
    return fontRegistry.get(WidgetMessageDecorator.class.getName());
}
 
Example 4
Source File: BonitaStudioFontRegistry.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param fontID
 * @param style
 * @param size
 * @return
 *         the font with style and size + cache it into font registry
 * 
 */
private static Font getFont(final String fontID, final int size, final int style) {
    if (fontRegistry == null) {
        fontRegistry = JFaceResources.getFontRegistry();
    }
    if (fontRegistry.hasValueFor(fontID)) {
        return fontRegistry.get(fontID);
    } else {
        final FontData fd = new FontData(fontID, size, style);
        fontRegistry.put(fontID, new FontData[] { fd });
        return fontRegistry.get(fontID);
    }
}
 
Example 5
Source File: UiDesk.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public static void updateFont(String cfgName){
	FontRegistry fr = JFaceResources.getFontRegistry();
	FontData[] fd =
		PreferenceConverter.getFontDataArray(new SettingsPreferenceStore(CoreHub.userCfg),
			cfgName);
	fr.put(cfgName, fd);
}
 
Example 6
Source File: UiDesk.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public static Font getFont(String cfgName){
	FontRegistry fr = JFaceResources.getFontRegistry();
	if (!fr.hasValueFor(cfgName)) {
		FontData[] fd =
			PreferenceConverter.getFontDataArray(new SettingsPreferenceStore(CoreHub.userCfg),
				cfgName);
		fr.put(cfgName, fd);
	}
	return fr.get(cfgName);
}
 
Example 7
Source File: UiDesk.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public static Font getFont(String name, int height, int style){
	String key = name + ":" + Integer.toString(height) + ":" + Integer.toString(style); //$NON-NLS-1$ //$NON-NLS-2$
	FontRegistry fr = JFaceResources.getFontRegistry();
	if (!fr.hasValueFor(key)) {
		FontData[] fd = new FontData[] {
			new FontData(name, height, style)
		};
		fr.put(key, fd);
	}
	return fr.get(key);
}
 
Example 8
Source File: ErrorTraceTreeViewer.java    From tlaplus with MIT License 4 votes vote down vote up
void dispose() {
	final FontRegistry fr = JFaceResources.getFontRegistry();
	
       fr.removeListener(errorTraceFontChangeListener);
}
 
Example 9
Source File: ExternalizeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public NLSSubstitutionLabelProvider() {
	fFontRegistry= JFaceResources.getFontRegistry();
}