org.eclipse.xtext.ui.label
Class StylerFactory

java.lang.Object
  extended by org.eclipse.xtext.ui.label.StylerFactory

public class StylerFactory
extends java.lang.Object

Helper class for styled strings.

Author:
Jan Koehnlein - Initial contribution and API

Nested Class Summary
protected static class StylerFactory.DefaultFontStyler
           
protected static class StylerFactory.XtextStyleAdapterStyler
           
 
Constructor Summary
StylerFactory()
           
 
Method Summary
 org.eclipse.jface.viewers.StyledString createFromXtextStyle(java.lang.String text, TextStyle xtextStyle)
          Convenience method to create a new StyledString from a given label text and XtextTextStyle
 org.eclipse.jface.viewers.StyledString.Styler createStyler(org.eclipse.jface.resource.FontDescriptor fontDescriptor, java.lang.String foregroundColorName, java.lang.String backgroundColorName)
          Creates a styler that takes the given descriptor of a font, foreground and background colors from the JFace color registry.
 org.eclipse.jface.viewers.StyledString.Styler createStyler(java.lang.String foregroundColorName, java.lang.String backgroundColorName)
           
 org.eclipse.jface.viewers.StyledString.Styler createXtextStyleAdapterStyler(TextStyle xtextStyle)
          Creates an adapter styler for XtextStyles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StylerFactory

public StylerFactory()
Method Detail

createStyler

public org.eclipse.jface.viewers.StyledString.Styler createStyler(java.lang.String foregroundColorName,
                                                                  java.lang.String backgroundColorName)
See Also:
DefaultLabelProvider#createStyler(FontDescriptor, String, String)

createStyler

public org.eclipse.jface.viewers.StyledString.Styler createStyler(org.eclipse.jface.resource.FontDescriptor fontDescriptor,
                                                                  java.lang.String foregroundColorName,
                                                                  java.lang.String backgroundColorName)
Creates a styler that takes the given descriptor of a font, foreground and background colors from the JFace color registry.

Parameters:
fontDescriptor - the descriptor of a font to apply
foregroundColorName - the color name for the foreground color
backgroundColorName - the color name for the background color
Returns:
the created style

createXtextStyleAdapterStyler

public org.eclipse.jface.viewers.StyledString.Styler createXtextStyleAdapterStyler(TextStyle xtextStyle)
Creates an adapter styler for XtextStyles.

Parameters:
xtextStyle - the xtextStyle to apply
Returns:
the created style

createFromXtextStyle

public org.eclipse.jface.viewers.StyledString createFromXtextStyle(java.lang.String text,
                                                                   TextStyle xtextStyle)
Convenience method to create a new StyledString from a given label text and XtextTextStyle

Parameters:
text - the label to display
xtextStyle - the style to apply to the given text
Returns:
the created style