Search in sources :

Example 26 with TextStyle

use of org.eclipse.swt.graphics.TextStyle in project KaiZen-OpenAPI-Editor by RepreZen.

the class JsonContentAssistProcessor method getTemplateLabel.

protected StyledString getTemplateLabel(Template template) {
    Styler nameStyle = new StyledString.Styler() {

        @Override
        public void applyStyles(TextStyle textStyle) {
            textStyle.foreground = new Color(Display.getCurrent(), new RGB(80, 80, 255));
        }
    };
    Styler descriptionStyle = new StyledString.Styler() {

        @Override
        public void applyStyles(TextStyle textStyle) {
            textStyle.foreground = new Color(Display.getCurrent(), new RGB(120, 120, 120));
        }
    };
    return new StyledString(template.getName(), nameStyle).append(": ", descriptionStyle).append(template.getDescription(), descriptionStyle);
}
Also used : TextStyle(org.eclipse.swt.graphics.TextStyle) Color(org.eclipse.swt.graphics.Color) StyledString(org.eclipse.jface.viewers.StyledString) Styler(org.eclipse.jface.viewers.StyledString.Styler) RGB(org.eclipse.swt.graphics.RGB)

Example 27 with TextStyle

use of org.eclipse.swt.graphics.TextStyle in project eclipse.platform.text by eclipse.

the class BrowserInformationControl method createTextLayout.

/**
 * Creates and initializes the text layout used
 * to compute the size hint.
 *
 * @since 3.2
 */
private void createTextLayout() {
    fTextLayout = new TextLayout(fBrowser.getDisplay());
    // Initialize fonts
    String symbolicFontName = fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
    Font font = JFaceResources.getFont(symbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
    font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
    fBoldStyle = new TextStyle(font, null, null);
    // Compute and set tab width
    // $NON-NLS-1$
    fTextLayout.setText("    ");
    int tabWidth = fTextLayout.getBounds().width;
    fTextLayout.setTabs(new int[] { tabWidth });
    // $NON-NLS-1$
    fTextLayout.setText("");
}
Also used : TextStyle(org.eclipse.swt.graphics.TextStyle) Font(org.eclipse.swt.graphics.Font) Point(org.eclipse.swt.graphics.Point) TextLayout(org.eclipse.swt.graphics.TextLayout)

Example 28 with TextStyle

use of org.eclipse.swt.graphics.TextStyle in project yamcs-studio by yamcs.

the class RCPSSTextLayout method addStyle.

/**
 * {@inheritDoc}
 */
@Override
public void addStyle(Font font, Color color, int x, int y) {
    TextStyle textStyle = new TextStyle(font, color, null);
    textLayout.setStyle(textStyle, x, y);
}
Also used : TextStyle(org.eclipse.swt.graphics.TextStyle)

Example 29 with TextStyle

use of org.eclipse.swt.graphics.TextStyle in project eclipse-integration-commons by spring-projects.

the class Stylers method boldColoured.

public Styler boldColoured(int foregroundColour) {
    final Color foreGround = getSystemColor(foregroundColour);
    return new Styler() {

        public void applyStyles(TextStyle textStyle) {
            textStyle.font = getBoldFont();
            textStyle.foreground = foreGround;
        }
    };
}
Also used : TextStyle(org.eclipse.swt.graphics.TextStyle) Color(org.eclipse.swt.graphics.Color) Styler(org.eclipse.jface.viewers.StyledString.Styler)

Example 30 with TextStyle

use of org.eclipse.swt.graphics.TextStyle in project jbosstools-openshift by jbosstools.

the class OpenShiftExplorerLabelProvider method getStyledText.

private StyledString getStyledText(NewProjectLinkNode node) {
    StyledString value = new StyledString();
    value.append(node.toString(), new StyledString.Styler() {

        @Override
        public void applyStyles(TextStyle textStyle) {
            textStyle.underline = true;
            textStyle.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLUE);
        }
    });
    return value;
}
Also used : TextStyle(org.eclipse.swt.graphics.TextStyle) StyledString(org.eclipse.jface.viewers.StyledString)

Aggregations

TextStyle (org.eclipse.swt.graphics.TextStyle)35 Point (org.eclipse.swt.graphics.Point)14 TextLayout (org.eclipse.swt.graphics.TextLayout)14 Color (org.eclipse.swt.graphics.Color)9 Font (org.eclipse.swt.graphics.Font)9 Rectangle (org.eclipse.swt.graphics.Rectangle)8 Matcher (java.util.regex.Matcher)6 StyleRange (org.eclipse.swt.custom.StyleRange)6 ArrayList (java.util.ArrayList)5 Styler (org.eclipse.jface.viewers.StyledString.Styler)5 IToken (org.eclipse.jface.text.rules.IToken)4 StyledString (org.eclipse.jface.viewers.StyledString)4 RGB (org.eclipse.swt.graphics.RGB)4 InnerTagBean (net.heartsome.cat.common.innertag.InnerTagBean)3 List (java.util.List)2 Point (org.eclipse.draw2d.geometry.Point)2 Document (org.eclipse.jface.text.Document)2 IDocument (org.eclipse.jface.text.IDocument)2 ITokenScanner (org.eclipse.jface.text.rules.ITokenScanner)2 GridItem (org.eclipse.nebula.widgets.grid.GridItem)2