Java Code Examples for org.eclipse.jface.resource.JFaceResources#TEXT_FONT

The following examples show how to use org.eclipse.jface.resource.JFaceResources#TEXT_FONT . 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: ObligationsView.java    From tlaplus with MIT License 5 votes vote down vote up
public ObligationsView()
{
    items = new HashMap<Integer, ExpandItem>();
    viewers = new HashMap<ExpandItem, SourceViewer>();
    fontListener = new FontPreferenceChangeListener(null, JFaceResources.TEXT_FONT);
    JFaceResources.getFontRegistry().addListener(fontListener);
}
 
Example 2
Source File: ThemeManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void forceFontsUpToDate()
{
	final String[] fontIds = new String[] { IThemeManager.VIEW_FONT_NAME, JFaceResources.TEXT_FONT,
			"org.eclipse.ui.workbench.texteditor.blockSelectionModeFont" }; //$NON-NLS-1$
	UIUtils.getDisplay().asyncExec(new Runnable()
	{

		public void run()
		{
			for (String fontId : fontIds)
			{
				Font fFont = JFaceResources.getFontRegistry().get(fontId);
				// Only set new values if they're different from existing!
				Font existing = JFaceResources.getFont(fontId);
				String existingString = StringUtil.EMPTY;
				if (!existing.isDisposed())
				{
					existingString = PreferenceConverter.getStoredRepresentation(existing.getFontData());
				}
				String fdString = PreferenceConverter.getStoredRepresentation(fFont.getFontData());
				if (!existingString.equals(fdString))
				{
					// put in registry...
					JFaceResources.getFontRegistry().put(fontId, fFont.getFontData());
				}
			}
		}
	});
}
 
Example 3
Source File: ThemePreferencePage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected void performOkFonts()
{
	final String[] fontIds = new String[] { JFaceResources.TEXT_FONT,
			"org.eclipse.ui.workbench.texteditor.blockSelectionModeFont" }; //$NON-NLS-1$

	FontData[] data = fFont.getFontData();
	for (String fontId : fontIds)
	{
		setFont(fontId, data);
	}

	// Shrink by 2 for views!
	data = fFont.getFontData();
	FontData[] smaller = new FontData[data.length];
	int i = 0;
	for (FontData fd : data)
	{
		int height = fd.getHeight();
		if (height >= 12)
		{
			fd.setHeight(height - 2);
		}
		else if (height >= 10)
		{
			fd.setHeight(height - 1);
		}
		smaller[i++] = fd;
	}
	setFont(IThemeManager.VIEW_FONT_NAME, smaller);
}
 
Example 4
Source File: AbstractSimpleLangSourceViewerConfiguration.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public String getFontPropertyPreferenceKey() {
	return JFaceResources.TEXT_FONT;
}
 
Example 5
Source File: AbstractLangBasicSourceViewerConfiguration.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public String getFontPropertyPreferenceKey() {
	return JFaceResources.TEXT_FONT;
}