Java Code Examples for org.eclipse.swt.SWT#ITALIC

The following examples show how to use org.eclipse.swt.SWT#ITALIC . 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: TableComboPropertyHandler.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private boolean applyCSSPropertyStyle(final Object element, final Control widget, final CSSValue value) throws Exception {
	if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
		final FontData fd = CSSEngineHelper.getFontData(widget);
		boolean modified = false;
		if ("italic".equals(value.getCssText()) || "oblique".equals(value.getCssText())) {
			modified = (fd.getStyle() & SWT.ITALIC) != SWT.ITALIC;
			if (modified) {
				fd.setStyle(fd.getStyle() | SWT.ITALIC);
			}
		} else {
			modified = (fd.getStyle() & SWT.ITALIC) == SWT.ITALIC;
			if (modified) {
				fd.setStyle(fd.getStyle() | ~SWT.ITALIC);
			}
		}
		if (modified) {
			applyFont(widget, fd);
		}

	}
	return true;
}
 
Example 2
Source File: WrappingLabel2EditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 3
Source File: BoundarySignalEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 4
Source File: LanguageNameEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 5
Source File: TextAnnotationText2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 6
Source File: TmxEditorTextPainter.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private Font getFont(int style) {
	Device device = Display.getDefault();
	switch (style) {
	case SWT.BOLD:
		return new Font(device, getFontData(style));
	case SWT.ITALIC:
		return new Font(device, getFontData(style));
	case SWT.BOLD | SWT.ITALIC:
		return new Font(device, getFontData(style));
	default:
		return font;
	}

}
 
Example 7
Source File: SinkNameEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 8
Source File: SubProcessEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 9
Source File: ScriptTaskLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 10
Source File: WrappingLabel4EditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 11
Source File: SourceNameEditPart.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 12
Source File: EndTerminatedEventLabelEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 13
Source File: TextAttributeFactory.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
public static TextAttribute getTextAttribute(LogToolRuleDesc ruleDesc) {		
	if (ruleDesc != null) {
		int style = SWT.NORMAL;
		if (ruleDesc.isItalic())
			style |= SWT.ITALIC;
		if (ruleDesc.isBold())
			style |= SWT.BOLD;
		if (ruleDesc.isStrikethrough())
			style |= TextAttribute.STRIKETHROUGH;
		if (ruleDesc.isUnderline())
			style |= TextAttribute.UNDERLINE;			
		return new TextAttribute(new Color(Display.getDefault(),ruleDesc.getForegroundColor()),new Color(Display.getDefault(),ruleDesc.getBackgroundColor()), style);	
	}
	return null;
}
 
Example 14
Source File: IntermediateErrorCatchEventLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 15
Source File: PWFontChooser.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @return a string that contains data about the choosen font
 */
protected String buildFontInformation() {
	final StringBuilder sb = new StringBuilder();
	if (fontData != null) {
		sb.append(fontData.getName()).append(",").append(fontData.getHeight()).append(" pt");
		if ((fontData.getStyle() & SWT.BOLD) == SWT.BOLD) {
			sb.append(", ").append(ResourceManager.getLabel(ResourceManager.BOLD));
		}
		if ((fontData.getStyle() & SWT.ITALIC) == SWT.ITALIC) {
			sb.append(", ").append(ResourceManager.getLabel(ResourceManager.ITALIC));
		}
	}
	return sb.toString();
}
 
Example 16
Source File: XStyledString.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
private StyleRange mkSRange(String s, Color fgColor, int style) {
    //NOTE: new used attributes in StyleRange must be reconcoled in convertToStyledString()
    StyleRange sr = new StyleRange();
    sr.start = sb.length();
    sr.length = s.length();
    sr.foreground = fgColor;
    sr.fontStyle = (style & (SWT.BOLD | SWT.ITALIC));
    sr.underline = (style & TextAttribute.UNDERLINE) != 0;
    sr.strikeout = (style & TextAttribute.STRIKETHROUGH) != 0;
    usedStyles |= style;
    return sr;
}
 
Example 17
Source File: XORGatewayLabel2EditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void refreshFont() {
	FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
	if (style != null) {
		FontData fontData = new FontData(style.getFontName(), style.getFontHeight(),
				(style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
		setFont(fontData);
	}
}
 
Example 18
Source File: PyDefaultDamagerRepairer.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Adds style information to the given text presentation.
 *
 * @param presentation the text presentation to be extended
 * @param offset the offset of the range to be styled
 * @param length the length of the range to be styled
 * @param attr the attribute describing the style of the range to be styled
 */
protected void addRange(TextPresentation presentation, int offset, int length, TextAttribute attr) {
    if (attr != null) {
        int style = attr.getStyle();
        int fontStyle = style & (SWT.ITALIC | SWT.BOLD | SWT.NORMAL);
        StyleRange styleRange = new StyleRange(offset, length, attr.getForeground(), attr.getBackground(),
                fontStyle);
        styleRange.strikeout = (style & TextAttribute.STRIKETHROUGH) != 0;
        styleRange.underline = (style & TextAttribute.UNDERLINE) != 0;
        styleRange.font = attr.getFont();
        presentation.addStyleRange(styleRange);
    }
}
 
Example 19
Source File: Theme.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * A Java Properties file serialization of this theme.
 * 
 * @return
 */
public Properties toProps()
{
	Properties props = new OrderedProperties();
	props.put(THEME_NAME_PROP_KEY, getName());
	props.put(SELECTION_PROP_KEY, toHex(getSelection()));
	props.put(LINE_HIGHLIGHT_PROP_KEY, toHex(getLineHighlight()));
	props.put(FOREGROUND_PROP_KEY, toHex(getForeground()));
	props.put(BACKGROUND_PROP_KEY, toHex(getBackground()));
	props.put(CARET_PROP_KEY, toHex(caret));
	for (ThemeRule rule : coloringRules)
	{
		if (rule == null)
		{
			continue;
		}
		StringBuilder value = new StringBuilder();
		DelayedTextAttribute attr = rule.getTextAttribute();
		RGBa color = attr.foreground;
		if (color != null)
		{
			value.append(toHex(color)).append(DELIMETER);
		}
		color = attr.background;
		if (color != null)
		{
			value.append(toHex(color)).append(DELIMETER);
		}
		int style = attr.style;
		if ((style & SWT.ITALIC) != 0)
		{
			value.append(ITALIC).append(DELIMETER);
		}
		if ((style & TextAttribute.UNDERLINE) != 0)
		{
			value.append(UNDERLINE).append(DELIMETER);
		}
		if ((style & SWT.BOLD) != 0)
		{
			value.append(BOLD).append(DELIMETER);
		}
		if (value.length() > 0)
		{
			value.deleteCharAt(value.length() - 1);
		}
		// Append the scope selector
		value.append(SELECTOR_DELIMITER);
		value.append(rule.getScopeSelector().toString());
		props.put(rule.getName(), value.toString());
	}
	return props;
}
 
Example 20
Source File: JFaceFontsExample.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Font getFont(Object element) {
	return new Font(Display.getCurrent(), "Helvetica",
			element.toString().startsWith("F") ? 12 : 24,
			element.toString().startsWith("S") ? SWT.BOLD : SWT.ITALIC);
}