Java Code Examples for org.eclipse.xtext.ui.editor.utils.TextStyle

The following examples show how to use org.eclipse.xtext.ui.editor.utils.TextStyle. These examples are extracted from open source projects. 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
/**
 * Checks if the two given {@link org.eclipse.swt.graphics.TextStyle}s are equal, with respect to colors, font. Underlines and other attributes are ignored.
 *
 * @param textStyleA
 *          the first {@link org.eclipse.swt.graphics.TextStyle}
 * @param textStyleB
 *          the second {@link org.eclipse.swt.graphics.TextStyle}
 * @return {@code true} if the given {@link org.eclipse.swt.graphics.TextStyle}s are equal, {@code false} otherwise
 */
@SuppressWarnings("PMD.CompareObjectsWithEquals")
public static boolean areEqualTextStyles(final org.eclipse.swt.graphics.TextStyle textStyleA, final org.eclipse.swt.graphics.TextStyle textStyleB) {
  if (textStyleA == textStyleB) {
    return true;
  }
  if (textStyleA == null || textStyleB == null) {
    return false;
  }
  if (textStyleA.foreground != null) {
    if (!textStyleA.foreground.equals(textStyleB.foreground)) {
      return false;
    }
  } else if (textStyleB.foreground != null) {
    return false;
  }
  if (textStyleA.font != null) {
    if (!textStyleA.font.equals(textStyleB.font)) {
      return false;
    }
  } else if (textStyleB.font != null) {
    return false;
  }
  return true;
}
 
Example 2
Source Project: ghidra   Source File: SleighHighlightingConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
public void configure(IHighlightingConfigurationAcceptor acceptor) {
	super.configure(acceptor);
	addType(acceptor, CONTEXTFIELD, 50, 50, 0, SWT.ITALIC);
	addType(acceptor, TOKENFIELD, 50, 50, 0, SWT.NORMAL);
	addType(acceptor, SYMBOL, 50, 50, 50, TextStyle.DEFAULT_FONT_STYLE);
	addType(acceptor, VARIABLE, 106, 62, 63, SWT.BOLD);
	addType(acceptor, ATTACHEDSYM, 50, 50, 50, SWT.BOLD);
	addType(acceptor, PRINTPIECE, 0,0,255, SWT.BOLD);
	addType(acceptor, LOCAL, 40,40,40, SWT.ITALIC);
	addType(acceptor, SUBTABLE, 192, 82, 5, SWT.NORMAL);
}
 
Example 3
Source Project: ghidra   Source File: SleighHighlightingConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
public void addType(IHighlightingConfigurationAcceptor acceptor, String s,
		RGB rgb, int style) {
	TextStyle textStyle = new TextStyle();
	textStyle.setBackgroundColor(new RGB(255, 255, 255));
	textStyle.setColor(rgb);
	textStyle.setStyle(style);
	acceptor.acceptDefaultHighlighting(s, s, textStyle);
}
 
Example 4
/**
 * @return a bluish TextStyle for JavaDoc comments
 */
public TextStyle javaDocCommentTextStyle() {
  TextStyle textStyle = defaultTextStyle().copy();
  // CHECKSTYLE:OFF
  textStyle.setColor(new RGB(63, 95, 191));
  // CHECKSTYLE:ON
  return textStyle;
}
 
Example 5
/** Configure numbers to appear in the same color as string literals do. */
@Override
public TextStyle numberTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(42, 0, 255));
	return textStyle;
}
 
Example 6
@Override
public TextStyle keywordTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(14, 48, 131));
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example 7
@Override
public TextStyle commentTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(128, 128, 128));
	textStyle.setStyle(SWT.ITALIC);
	return textStyle;
}
 
Example 8
/**
 * @since 2.6
 */
public TextStyle taskTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(127, 159, 191));
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example 9
protected TextAttribute createTextAttribute(String id, TextStyle defaultTextStyle) {
	TextStyle textStyle = new TextStyle();
	preferencesAccessor.populateTextStyle(id, textStyle, defaultTextStyle);
	int style = textStyle.getStyle();
	Font fontFromFontData = EditorUtils.fontFromFontData(textStyle.getFontData());
	return new TextAttribute(EditorUtils.colorFromRGB(textStyle.getColor()), EditorUtils.colorFromRGB(textStyle
			.getBackgroundColor()), style, fontFromFontData);
}
 
Example 10
Source Project: sarl   Source File: SARLHighlightingConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
/** Style for the capacity method extension.
 *
 * @return the style.
 */
@SuppressWarnings("checkstyle:magicnumber")
public TextStyle capacityMethodInvocation() {
	final TextStyle textStyle = extensionMethodInvocation().copy();
	//textStyle.setColor(new RGB(128, 36, 0));
	textStyle.setStyle(SWT.ITALIC);
	return textStyle;
}
 
Example 11
@Override
public TextStyle keywordTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(127, 0, 85));
	textStyle.setStyle(SWT.NONE);
	return textStyle;
}
 
Example 12
@Override
public TextStyle keywordTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(14, 48, 131));
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example 13
@Override
public TextStyle keywordTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(14, 48, 131));
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example 14
@Override
public TextStyle taskTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	// textStyle.setFontData(GamaFonts.getNavigHeaderFont().getFontData());
	textStyle.setColor(new RGB(150, 132, 106));
	textStyle.setStyle(SWT.ITALIC | SWT.BOLD);
	return textStyle;
}
 
Example 15
Source Project: n4js   Source File: WizardPreviewProvider.java    License: Eclipse Public License 1.0 4 votes vote down vote up
private Color createInactiveColor() {
	TextStyle commentTextStyle = new TextStyle();
	preferenceStoreAccessor.populateTextStyle(HighlightingStyles.COMMENT_ID, commentTextStyle,
			DEFAULT_HIGHLIGHTING_CONFIGURATION.commentTextStyle());
	return new Color(getDisplay(), commentTextStyle.getColor());
}
 
Example 16
Source Project: n4js   Source File: HighlightingConfiguration.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Default style for annotations, colored magenta.
 */
private TextStyle annotationTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(255, 0, 255));
	return textStyle;
}
 
Example 17
Source Project: n4js   Source File: HighlightingConfiguration.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Default style for type references, colored dark grey.
 */
private TextStyle typeRefTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(140, 140, 140));
	return textStyle;
}
 
Example 18
public TextStyle facetTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setStyle(SWT.BOLD);
	textStyle.setColor(new RGB(154, 72, 71));
	return textStyle;
}
 
Example 19
Source Project: n4js   Source File: HighlightingConfiguration.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Default style for number and string literals, colored blue.
 */
public TextStyle literalTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(0, 0, 255));
	return textStyle;
}
 
Example 20
Source Project: n4js   Source File: HighlightingConfiguration.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Default style for number and string literals, colored blue.
 */
public TextStyle jsDocTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(90, 139, 227));
	return textStyle;
}
 
Example 21
Source Project: n4js   Source File: HighlightingConfiguration.java    License: Eclipse Public License 1.0 4 votes vote down vote up
@Override
public TextStyle numberTextStyle() {
	return literalTextStyle();
}
 
Example 22
/** TextStyle for property names of JSON objects */
private TextStyle propertyNameTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(127, 0, 85));
	return textStyle;
}
 
Example 23
private TextStyle localVariableTextStyle() {
	TextStyle textStyle = keywordTextStyle();
	textStyle.setStyle(SWT.NONE);
	return textStyle;
}
 
Example 24
private TextStyle stateVariableTextStyle() {
	TextStyle textStyle = keywordTextStyle();
	textStyle.setColor(new RGB(49, 132, 149));
	textStyle.setStyle(SWT.NONE);
	return textStyle;
}
 
Example 25
public TextStyle counterStyle() {
	TextStyle textStyle = new TextStyle();
	RGB color = JFaceResources.getColorRegistry().getRGB(JFacePreferences.COUNTER_COLOR);
	textStyle.setColor(color);
	return textStyle;
}
 
Example 26
public TextStyle decorationsStyle() {
	TextStyle textStyle = new TextStyle();
	RGB color = JFaceResources.getColorRegistry().getRGB(JFacePreferences.DECORATIONS_COLOR);
	textStyle.setColor(color);
	return textStyle;
}
 
Example 27
public TextStyle activeAnnotationStyle() {
	TextStyle textStyle = extensionMethodInvocation().copy();
	return textStyle;
}
 
Example 28
public TextStyle dataTypeRule() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(0, 0, 192));
	return textStyle;
}
 
Example 29
public TextStyle unusedValue() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(128, 128, 128));
	return textStyle;
}
 
Example 30
public TextStyle variableTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setStyle(SWT.BOLD);
	textStyle.setColor(new RGB(28, 125, 180));
	return textStyle;
}