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

The following examples show how to use org.eclipse.xtext.ui.editor.utils.TextStyle. 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: AbstractSyntaxColoringTest.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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 File: GamlHighlightingConfiguration.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@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 #3
Source File: SleighHighlightingConfiguration.java    From ghidra with 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 #4
Source File: CheckHighlightingConfiguration.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @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
Source File: JSONHighlightingConfiguration.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/** 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
Source File: SleighHighlightingConfiguration.java    From ghidra with 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 #7
Source File: SolidityHighlightingConfiguration.java    From solidity-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public TextStyle keywordTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(14, 48, 131));
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example #8
Source File: SolidityHighlightingConfiguration.java    From solidity-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public TextStyle commentTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(128, 128, 128));
	textStyle.setStyle(SWT.ITALIC);
	return textStyle;
}
 
Example #9
Source File: DefaultHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.6
 */
public TextStyle taskTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(127, 159, 191));
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example #10
Source File: TextAttributeProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
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 #11
Source File: SARLHighlightingConfiguration.java    From sarl with 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 #12
Source File: GamlHighlightingConfiguration.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public TextStyle keywordTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(127, 0, 85));
	textStyle.setStyle(SWT.NONE);
	return textStyle;
}
 
Example #13
Source File: SGenHighlightingConfiguration.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public TextStyle keywordTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(14, 48, 131));
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example #14
Source File: SCTHighlightingConfiguration.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public TextStyle keywordTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(14, 48, 131));
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example #15
Source File: SemanticHighlightingConfiguration.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Gets a text style for disabled values (e.g. disabled Check).
 * 
 * @return the text style
 */
public TextStyle disabledValue() {
  TextStyle textStyle = defaultTextStyle().copy();
  textStyle.setColor(RGB_DISABLED);
  return textStyle;
}
 
Example #16
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle typeVariable() {
	return typeArgument().copy();
}
 
Example #17
Source File: HighlightingConfiguration.java    From n4js with 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 #18
Source File: GamlHighlightingConfiguration.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public TextStyle varDefTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setStyle(SWT.NONE);
	textStyle.setColor(new RGB(0, 0, 153));
	return textStyle;
}
 
Example #19
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle localFinalVariableDecl() {
	return localFinalVariable().copy();
}
 
Example #20
Source File: XtendHighlightingConfiguration.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle insignificantTemplateTextStyle() {
	TextStyle textStyle = stringTextStyle().copy();
	return textStyle;
}
 
Example #21
Source File: XtendHighlightingConfiguration.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle richTextDelimiterStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	return textStyle;
}
 
Example #22
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle inheritedMethodInvocation() {
	return method().copy();
}
 
Example #23
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle method() {
	return defaultTextStyle().copy();
}
 
Example #24
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle inheritedField() {
	return field().copy();
}
 
Example #25
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle staticFinalField() {
	return staticField().copy();
}
 
Example #26
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle abstractClasses() {
	return classes().copy();
}
 
Example #27
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle classes() {
	return defaultTextStyle().copy();
}
 
Example #28
Source File: HighlightingConfiguration.java    From n4js with 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 #29
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle interfaces() {
	return defaultTextStyle().copy();
}
 
Example #30
Source File: SGenHighlightingConfiguration.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public TextStyle deprecationTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setStyle(SWT.UNDERLINE_SQUIGGLE);
	return textStyle;
}