Java Code Examples for org.eclipse.swt.graphics.FontData#setName()

The following examples show how to use org.eclipse.swt.graphics.FontData#setName() . 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: GridPropertyHandler.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private boolean applyCSSPropertyFamily(final Object element, final Grid grid, final CSSValue value, String target) throws Exception {
	if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
		final FontData fd = CSSEngineHelper.getFontData(grid);
		final boolean modified = !fd.getName().equals(value.getCssText());
		if (modified) {
			fd.setName(value.getCssText());
			applyFont(grid, fd, target);
		}
	}
	return true;
}
 
Example 2
Source File: ResourceHelper.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static Font getFont(Font currentFont, String name, Integer size) {
	FontData[] original = currentFont.getFontData();
	FontData[] fontData = Arrays.copyOf(original, original.length);
	for (FontData data : fontData) {
		if (name != null) {
			data.setName(name);
		}
		if (size != null) {
			data.setHeight(size);
		}
	}

	return getFont(fontData);
}
 
Example 3
Source File: TableComboPropertyHandler.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private boolean applyCSSPropertyFamily(final Object element, final Control widget, final CSSValue value) throws Exception {
	if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
		final FontData fd = CSSEngineHelper.getFontData(widget);
		final boolean modified = !fd.getName().equals(value.getCssText());
		if (modified) {
			fd.setName(value.getCssText());
			applyFont(widget, fd);
		}
	}
	return true;
}
 
Example 4
Source File: CDateTimePropertyHandler.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void applyCSSPropertyFamily(final Control widget, final CSSValue value, final boolean picker) throws Exception {
	if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
		final FontData fd = CSSEngineHelper.getFontData(widget);
		final boolean modified = !fd.getName().equals(value.getCssText());
		if (modified) {
			fd.setName(value.getCssText());
			if (picker) {
				applyFontForPicker((CDateTime) widget, fd);
			} else {
				applyFont(widget, fd);
			}
		}
	}
}
 
Example 5
Source File: Activator.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void start(BundleContext context) throws Exception {
	super.start(context);		
	plugin = this;	
	String fontName = getPreferenceStore().getString(IPreferenceConstants.TMX_EDITOR_FONT_NAME);
	int size = getPreferenceStore().getInt(IPreferenceConstants.TMX_EDITOR_FONT_SIZE);
	FontData fontData = new FontData();
	fontData.setHeight(size);
	fontData.setName(fontName);
	JFaceResources.getFontRegistry().put(Constants.TMX_EDITOR_TEXT_FONT, new FontData[]{fontData});
	System.setProperty("user.name", getPreferenceStore().getString(IPreferenceConstants.SYSTEM_USER));
}