Java Code Examples for org.eclipse.xtext.ui.editor.utils.TextStyle#setStyle()

The following examples show how to use org.eclipse.xtext.ui.editor.utils.TextStyle#setStyle() . 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: 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 2
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 3
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 4
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 5
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle staticField() {
	TextStyle textStyle = field().copy();
	textStyle.setStyle(SWT.ITALIC);
	textStyle.setColor(new RGB(0, 0, 192));
	return textStyle;
}
 
Example 6
Source File: GamlHighlightingConfiguration.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public TextStyle reservedTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setStyle(SWT.ITALIC);
	textStyle.setColor(new RGB(0, 0, 0));
	return textStyle;
}
 
Example 7
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;
}
 
Example 8
Source File: DotHighlightingConfiguration.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
private TextStyle deprecatedQuotedStyle() {
	TextStyle textStyle = quotedStringTextStyle().copy();
	textStyle.setStyle(TextAttribute.STRIKETHROUGH);
	return textStyle;
}
 
Example 9
Source File: DotHighlightingConfiguration.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
private TextStyle deprecatedStyle() {
	TextStyle textStyle = stringTextStyle().copy();
	textStyle.setStyle(TextAttribute.STRIKETHROUGH);
	return textStyle;
}
 
Example 10
Source File: DotHighlightingConfiguration.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
private TextStyle htmlAttributeValueStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(42, 0, 255)); // blue
	textStyle.setStyle(SWT.ITALIC);
	return textStyle;
}
 
Example 11
Source File: DotHighlightingConfiguration.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public TextStyle keywordTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy(); // black
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example 12
Source File: GamlHighlightingConfiguration.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public TextStyle assignTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setStyle(SWT.BOLD);
	textStyle.setColor(new RGB(50, 50, 50));
	return textStyle;
}
 
Example 13
Source File: XbaseHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle staticMethodInvocation() {
	TextStyle textStyle = method().copy();
	textStyle.setStyle(SWT.ITALIC);
	return textStyle;
}
 
Example 14
Source File: PreferenceStoreAccessor.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void populateTextStyle(String id, TextStyle style, TextStyle defaults) {
	IPreferenceStore editorsStore = EditorsUI.getPreferenceStore();
	RGB fontColorDefaultDefault = editorsStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT) 
			? getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB()
			: PreferenceConverter.getColor(editorsStore, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND);
	RGB backgrounColorDefaultDefault = editorsStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) 
			? getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB() 
			: PreferenceConverter.getColor(editorsStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
	FontData[] fontDataDefaultDefault = JFaceResources.getTextFont().getFontData();

	IPreferenceStore preferenceStore = getPreferenceStore();
	String cssID = CSS_PREFIX + id;
	IPreferenceStore cssPrefStore = getPluginCssPreferenceStore();
	
	String colorKey = PREFERENCE_TAG + getTokenColorPreferenceKey(id);
	String cssFontColor = cssPrefStore.getString(getTokenColorPreferenceKey(cssID));
	if(!Strings.isEmpty(cssFontColor)) {
		preferenceStore.setDefault(colorKey, cssFontColor);
	} else if (defaults.getColor() != null) {
		PreferenceConverter.setDefault(preferenceStore, colorKey, defaults.getColor());
	} else {
		PreferenceConverter.setDefault(preferenceStore, colorKey, fontColorDefaultDefault);
	}
	
	String backgroundKey = PREFERENCE_TAG + getTokenBackgroundColorPreferenceKey(id);
	String cssBgColor = cssPrefStore.getString(getTokenBackgroundColorPreferenceKey(cssID));
	if(!Strings.isEmpty(cssBgColor)) {
		preferenceStore.setDefault(backgroundKey, cssBgColor);
	} else if (defaults.getBackgroundColor() != null) {
		PreferenceConverter.setDefault(preferenceStore, backgroundKey, defaults.getBackgroundColor());
	} else {
		PreferenceConverter.setDefault(preferenceStore, backgroundKey, backgrounColorDefaultDefault);
	}
	
	String fontKey = PREFERENCE_TAG + getTokenFontPreferenceKey(id);
	String cssFont = cssPrefStore.getString(getTokenFontPreferenceKey(cssID));
	if(!Strings.isEmpty(cssFont)) {
		preferenceStore.setDefault(fontKey, cssFont);
	} else if (defaults.getFontData() != null)
		PreferenceConverter.setDefault(preferenceStore, fontKey, defaults.getFontData());
	else {
		PreferenceConverter.setDefault(preferenceStore, fontKey, fontDataDefaultDefault);
	}
	
	String styleKey = PREFERENCE_TAG + getTokenStylePreferenceKey(id);
	int cssStyle = cssPrefStore.getInt(getTokenStylePreferenceKey(cssID));
	if(cssStyle != 0) {
		preferenceStore.setDefault(styleKey, cssStyle);
	} else {
		preferenceStore.setDefault(styleKey, defaults.getStyle());
	}
	
	// populate
	RGB color = PreferenceConverter.getColor(preferenceStore, colorKey);
	if (!color.equals(fontColorDefaultDefault))
		style.setColor(color);
	RGB background = PreferenceConverter.getColor(preferenceStore, backgroundKey);
	if (!background.equals(backgrounColorDefaultDefault))
		style.setBackgroundColor(background);
	FontData[] fontDataArray = PreferenceConverter.getFontDataArray(preferenceStore, fontKey);
	if (!Arrays.equals(fontDataArray, fontDataDefaultDefault)) {
		style.setFontData(fontDataArray);
	}
	style.setStyle(preferenceStore.getInt(styleKey));
}
 
Example 15
Source File: DefaultHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle keywordTextStyle() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setColor(new RGB(127, 0, 85));
	textStyle.setStyle(SWT.BOLD);
	return textStyle;
}
 
Example 16
Source File: GamlHighlightingConfiguration.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public TextStyle typeTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setStyle(SWT.BOLD);
	textStyle.setColor(new RGB(0, 79, 116));
	return textStyle;
}
 
Example 17
Source File: SemanticHighlightingConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TextStyle typeReference() {
	TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setStyle(SWT.ITALIC);
	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 pragmaTextStyle() {
	final TextStyle textStyle = defaultTextStyle().copy();
	textStyle.setStyle(SWT.ITALIC);
	textStyle.setColor(new RGB(122, 122, 122));
	return textStyle;
}
 
Example 19
Source File: SolidityHighlightingConfiguration.java    From solidity-ide with Eclipse Public License 1.0 4 votes vote down vote up
private TextStyle stateVariableTextStyle() {
	TextStyle textStyle = keywordTextStyle();
	textStyle.setColor(new RGB(49, 132, 149));
	textStyle.setStyle(SWT.NONE);
	return textStyle;
}
 
Example 20
Source File: SolidityHighlightingConfiguration.java    From solidity-ide with Eclipse Public License 1.0 4 votes vote down vote up
private TextStyle localVariableTextStyle() {
	TextStyle textStyle = keywordTextStyle();
	textStyle.setStyle(SWT.NONE);
	return textStyle;
}