Java Code Examples for org.eclipse.jface.resource.FontRegistry#get()

The following examples show how to use org.eclipse.jface.resource.FontRegistry#get() . 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: TmfEventsTable.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Initialize the fonts.
 */
private void initializeFonts() {
    FontRegistry fontRegistry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
    fFont = fontRegistry.get(FONT_DEFINITION_ID);
    fBoldFont = fontRegistry.getBold(FONT_DEFINITION_ID);
    fTable.setFont(fFont);
    /* Column header font cannot be set. See Bug 63038 */
}
 
Example 3
Source File: DiffAttributeEditor.java    From git-appraise-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Starts a new {@link StyleRange} given a specific line type.
 */
private StyleRange initDiffStyleRangeForLineType(DiffLineType lineType, int startTextOffset) {
  ColorRegistry reg =
      PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
  StyleRange range = new StyleRange();
  range.start = startTextOffset;
  switch (lineType) {
    case ADD:
      range.foreground = reg.get(THEME_DiffAddForegroundColor);
      range.background = reg.get(THEME_DiffAddBackgroundColor);
      break;
    case REMOVE:
      range.foreground = reg.get(THEME_DiffRemoveForegroundColor);
      range.background = reg.get(THEME_DiffRemoveBackgroundColor);
      break;
    case HUNK:
      range.foreground = reg.get(THEME_DiffHunkForegroundColor);
      range.background = reg.get(THEME_DiffHunkBackgroundColor);
      break;
    case HEADLINE:
      range.foreground = reg.get(THEME_DiffHeadlineForegroundColor);
      range.background = reg.get(THEME_DiffHeadlineBackgroundColor);
      FontRegistry fontReg =
          PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
      range.font = fontReg.get(THEME_DiffHeadlineFont);
      break;
    default:
      break;
  }
  return range;
}
 
Example 4
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 5
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 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 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 7
Source File: TmfRawEventViewer.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Initialize the fonts.
 * @since 1.0
 */
protected void initializeFonts() {
    FontRegistry fontRegistry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
    fFixedFont = fontRegistry.get(FONT_DEFINITION_ID);
    fStyledText.setFont(fFixedFont);
}