本文整理匯總了Java中org.eclipse.jface.text.TextAttribute.STRIKETHROUGH屬性的典型用法代碼示例。如果您正苦於以下問題:Java TextAttribute.STRIKETHROUGH屬性的具體用法?Java TextAttribute.STRIKETHROUGH怎麽用?Java TextAttribute.STRIKETHROUGH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.jface.text.TextAttribute
的用法示例。
在下文中一共展示了TextAttribute.STRIKETHROUGH屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addRange
/**
* Adds style information to the given text presentation.
*
* @param presentation the text presentation to be extended
* @param offset the offset of the range to be styled
* @param length the length of the range to be styled
* @param attr the attribute describing the style of the range to be styled
* @param wholeLine the boolean switch to declare that the whole line should be colored
*/
private void addRange(TextPresentation presentation, int offset, int length, TextAttribute attr, boolean wholeLine) {
if (attr != null) {
int style= attr.getStyle();
int fontStyle= style & (SWT.ITALIC | SWT.BOLD | SWT.NORMAL);
if(wholeLine) {
try {
int line = document.getLineOfOffset(offset);
int start = document.getLineOffset(line);
length = document.getLineLength(line);
offset = start;
} catch (BadLocationException e) {
}
}
StyleRange styleRange = new StyleRange(offset,length,attr.getForeground(),attr.getBackground(),fontStyle);
styleRange.strikeout = (style & TextAttribute.STRIKETHROUGH) != 0;
styleRange.underline = (style & TextAttribute.UNDERLINE) != 0;
presentation.addStyleRange(styleRange);
}
}
示例2: createToken
/**
* Create a token that styles text. Used by code formatting stuff.
* @return A token with this settings style information.
*/
public IToken createToken()
{
int styleInt = getStyleInt();
if( strikethrough ) styleInt |= TextAttribute.STRIKETHROUGH;
if( underline ) styleInt |= TextAttribute.UNDERLINE;
ColourManager colours = ZXTMPlugin.getDefault().getColourManager();
IToken token = new Token(
new TextAttribute(
colours.getLocalColor( colour ),
null,
styleInt
)
);
return token;
}
示例3: getTextAttribute
private TextAttribute getTextAttribute(IPreferenceStore prefs, SQLEditorStatementTypes type) {
SQLEditorSyntaxModel sm = new SQLEditorSyntaxModel(type, prefs).load();
int style = 0 | (sm.isBold() ? SWT.BOLD : 0)
| (sm.isItalic() ? SWT.ITALIC: 0)
| (sm.isUnderline() ? SWT.UNDERLINE_SINGLE: 0)
| (sm.isUnderline() ? TextAttribute.UNDERLINE: 0)
| (sm.isStrikethrough() ? TextAttribute.STRIKETHROUGH: 0);
return new TextAttribute(fSharedColors.getColor(sm.getColor()), null, style);
}
示例4: CSSTokenProvider
public CSSTokenProvider(InputStream in) {
tokenMaps = new HashMap<>();
try {
parser = new CSSParser(in);
for (IStyle style : parser.getStyles()) {
RGB color = style.getColor();
if (color != null) {
int s = SWT.NORMAL;
if (style.isBold()) {
s = s | SWT.BOLD;
}
if (style.isItalic()) {
s = s | SWT.ITALIC;
}
if (style.isUnderline()) {
s = s | TextAttribute.UNDERLINE;
}
if (style.isStrikeThrough()) {
s = s | TextAttribute.STRIKETHROUGH;
}
tokenMaps.put(style,
new Token(new TextAttribute(ColorManager.getInstance().getColor(color), null, s)));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: getTextAttribute
public TextAttribute getTextAttribute(de.darwinspl.preferences.resource.dwprofile.IDwprofileTokenStyle tokeStyle) {
int[] foregroundColorArray = tokeStyle.getColorAsRGB();
Color foregroundColor = null;
if (colorManager != null) {
foregroundColor = colorManager.getColor(new RGB(foregroundColorArray[0], foregroundColorArray[1], foregroundColorArray[2]));
}
int[] backgroundColorArray = tokeStyle.getBackgroundColorAsRGB();
Color backgroundColor = null;
if (backgroundColorArray != null) {
RGB backgroundRGB = new RGB(backgroundColorArray[0], backgroundColorArray[1], backgroundColorArray[2]);
if (colorManager != null) {
backgroundColor = colorManager.getColor(backgroundRGB);
}
}
int style = SWT.NORMAL;
if (tokeStyle.isBold()) {
style = style | SWT.BOLD;
}
if (tokeStyle.isItalic()) {
style = style | SWT.ITALIC;
}
if (tokeStyle.isStrikethrough()) {
style = style | TextAttribute.STRIKETHROUGH;
}
if (tokeStyle.isUnderline()) {
style = style | TextAttribute.UNDERLINE;
}
return new TextAttribute(foregroundColor, backgroundColor, style);
}
示例6: getTextAttribute
public TextAttribute getTextAttribute(eu.hyvar.feature.expression.resource.hyexpression.IHyexpressionTokenStyle tokeStyle) {
int[] foregroundColorArray = tokeStyle.getColorAsRGB();
Color foregroundColor = null;
if (colorManager != null) {
foregroundColor = colorManager.getColor(new RGB(foregroundColorArray[0], foregroundColorArray[1], foregroundColorArray[2]));
}
int[] backgroundColorArray = tokeStyle.getBackgroundColorAsRGB();
Color backgroundColor = null;
if (backgroundColorArray != null) {
RGB backgroundRGB = new RGB(backgroundColorArray[0], backgroundColorArray[1], backgroundColorArray[2]);
if (colorManager != null) {
backgroundColor = colorManager.getColor(backgroundRGB);
}
}
int style = SWT.NORMAL;
if (tokeStyle.isBold()) {
style = style | SWT.BOLD;
}
if (tokeStyle.isItalic()) {
style = style | SWT.ITALIC;
}
if (tokeStyle.isStrikethrough()) {
style = style | TextAttribute.STRIKETHROUGH;
}
if (tokeStyle.isUnderline()) {
style = style | TextAttribute.UNDERLINE;
}
return new TextAttribute(foregroundColor, backgroundColor, style);
}
示例7: getTextAttribute
public TextAttribute getTextAttribute(eu.hyvar.context.contextValidity.resource.hyvalidityformula.IHyvalidityformulaTokenStyle tokeStyle) {
int[] foregroundColorArray = tokeStyle.getColorAsRGB();
Color foregroundColor = null;
if (colorManager != null) {
foregroundColor = colorManager.getColor(new RGB(foregroundColorArray[0], foregroundColorArray[1], foregroundColorArray[2]));
}
int[] backgroundColorArray = tokeStyle.getBackgroundColorAsRGB();
Color backgroundColor = null;
if (backgroundColorArray != null) {
RGB backgroundRGB = new RGB(backgroundColorArray[0], backgroundColorArray[1], backgroundColorArray[2]);
if (colorManager != null) {
backgroundColor = colorManager.getColor(backgroundRGB);
}
}
int style = SWT.NORMAL;
if (tokeStyle.isBold()) {
style = style | SWT.BOLD;
}
if (tokeStyle.isItalic()) {
style = style | SWT.ITALIC;
}
if (tokeStyle.isStrikethrough()) {
style = style | TextAttribute.STRIKETHROUGH;
}
if (tokeStyle.isUnderline()) {
style = style | TextAttribute.UNDERLINE;
}
return new TextAttribute(foregroundColor, backgroundColor, style);
}
示例8: getTextAttribute
public TextAttribute getTextAttribute(eu.hyvar.dataValues.resource.hydatavalue.IHydatavalueTokenStyle tokeStyle) {
int[] foregroundColorArray = tokeStyle.getColorAsRGB();
Color foregroundColor = null;
if (colorManager != null) {
foregroundColor = colorManager.getColor(new RGB(foregroundColorArray[0], foregroundColorArray[1], foregroundColorArray[2]));
}
int[] backgroundColorArray = tokeStyle.getBackgroundColorAsRGB();
Color backgroundColor = null;
if (backgroundColorArray != null) {
RGB backgroundRGB = new RGB(backgroundColorArray[0], backgroundColorArray[1], backgroundColorArray[2]);
if (colorManager != null) {
backgroundColor = colorManager.getColor(backgroundRGB);
}
}
int style = SWT.NORMAL;
if (tokeStyle.isBold()) {
style = style | SWT.BOLD;
}
if (tokeStyle.isItalic()) {
style = style | SWT.ITALIC;
}
if (tokeStyle.isStrikethrough()) {
style = style | TextAttribute.STRIKETHROUGH;
}
if (tokeStyle.isUnderline()) {
style = style | TextAttribute.UNDERLINE;
}
return new TextAttribute(foregroundColor, backgroundColor, style);
}
示例9: getTextAttribute
public TextAttribute getTextAttribute(eu.hyvar.feature.mapping.resource.hymapping.IHymappingTokenStyle tokeStyle) {
int[] foregroundColorArray = tokeStyle.getColorAsRGB();
Color foregroundColor = null;
if (colorManager != null) {
foregroundColor = colorManager.getColor(new RGB(foregroundColorArray[0], foregroundColorArray[1], foregroundColorArray[2]));
}
int[] backgroundColorArray = tokeStyle.getBackgroundColorAsRGB();
Color backgroundColor = null;
if (backgroundColorArray != null) {
RGB backgroundRGB = new RGB(backgroundColorArray[0], backgroundColorArray[1], backgroundColorArray[2]);
if (colorManager != null) {
backgroundColor = colorManager.getColor(backgroundRGB);
}
}
int style = SWT.NORMAL;
if (tokeStyle.isBold()) {
style = style | SWT.BOLD;
}
if (tokeStyle.isItalic()) {
style = style | SWT.ITALIC;
}
if (tokeStyle.isStrikethrough()) {
style = style | TextAttribute.STRIKETHROUGH;
}
if (tokeStyle.isUnderline()) {
style = style | TextAttribute.UNDERLINE;
}
return new TextAttribute(foregroundColor, backgroundColor, style);
}
示例10: getTextAttribute
public TextAttribute getTextAttribute(eu.hyvar.feature.constraint.resource.hyconstraints.IHyconstraintsTokenStyle tokeStyle) {
int[] foregroundColorArray = tokeStyle.getColorAsRGB();
Color foregroundColor = null;
if (colorManager != null) {
foregroundColor = colorManager.getColor(new RGB(foregroundColorArray[0], foregroundColorArray[1], foregroundColorArray[2]));
}
int[] backgroundColorArray = tokeStyle.getBackgroundColorAsRGB();
Color backgroundColor = null;
if (backgroundColorArray != null) {
RGB backgroundRGB = new RGB(backgroundColorArray[0], backgroundColorArray[1], backgroundColorArray[2]);
if (colorManager != null) {
backgroundColor = colorManager.getColor(backgroundRGB);
}
}
int style = SWT.NORMAL;
if (tokeStyle.isBold()) {
style = style | SWT.BOLD;
}
if (tokeStyle.isItalic()) {
style = style | SWT.ITALIC;
}
if (tokeStyle.isStrikethrough()) {
style = style | TextAttribute.STRIKETHROUGH;
}
if (tokeStyle.isUnderline()) {
style = style | TextAttribute.UNDERLINE;
}
return new TextAttribute(foregroundColor, backgroundColor, style);
}
示例11: getTextAttribute
public TextAttribute getTextAttribute(eu.hyvar.mspl.manifest.resource.hymanifest.IHymanifestTokenStyle tokeStyle) {
int[] foregroundColorArray = tokeStyle.getColorAsRGB();
Color foregroundColor = null;
if (colorManager != null) {
foregroundColor = colorManager.getColor(new RGB(foregroundColorArray[0], foregroundColorArray[1], foregroundColorArray[2]));
}
int[] backgroundColorArray = tokeStyle.getBackgroundColorAsRGB();
Color backgroundColor = null;
if (backgroundColorArray != null) {
RGB backgroundRGB = new RGB(backgroundColorArray[0], backgroundColorArray[1], backgroundColorArray[2]);
if (colorManager != null) {
backgroundColor = colorManager.getColor(backgroundRGB);
}
}
int style = SWT.NORMAL;
if (tokeStyle.isBold()) {
style = style | SWT.BOLD;
}
if (tokeStyle.isItalic()) {
style = style | SWT.ITALIC;
}
if (tokeStyle.isStrikethrough()) {
style = style | TextAttribute.STRIKETHROUGH;
}
if (tokeStyle.isUnderline()) {
style = style | TextAttribute.UNDERLINE;
}
return new TextAttribute(foregroundColor, backgroundColor, style);
}
示例12: getStyleBitmap
public static int getStyleBitmap(SyntaxStyle styleDef) {
int style = SWT.NORMAL;
if (styleDef.italic)
style = style + SWT.ITALIC;
if (styleDef.bold)
style = style + SWT.BOLD;
if (styleDef.strikethrough)
style = style + TextAttribute.STRIKETHROUGH;
if (styleDef.underline)
style = style + TextAttribute.UNDERLINE;
return style;
}
示例13: createStyleRange
private StyleRange createStyleRange(TextAttribute attr, Position position) {
StyleRange result = new StyleRange(position.getOffset(), position.getLength(), attr.getForeground(),
attr.getBackground(), attr.getStyle());
if ((attr.getStyle() & TextAttribute.UNDERLINE) != 0) {
result.underline = true;
result.fontStyle &= ~TextAttribute.UNDERLINE;
}
if ((attr.getStyle() & TextAttribute.STRIKETHROUGH) != 0) {
result.strikeout = true;
result.fontStyle &= ~TextAttribute.STRIKETHROUGH;
}
return result;
}
開發者ID:angelozerr,項目名稱:angular-eclipse,代碼行數:13,代碼來源:HTMLAngularEditorSyntaxColoringPreferencePage.java
示例14: createTextAttribute
/**
* Create a text attribute based on the given color, bold, italic, strikethrough and underline
* preference keys.
*
* @param colorKey the color preference key
* @param boldKey the bold preference key
* @param italicKey the italic preference key
* @param strikeKey the strikethrough preference key
* @param underlineKey the italic preference key
* @return the created text attribute
*/
private TextAttribute createTextAttribute(String colorKey, String boldKey, String italicKey, String strikeKey,
String underlineKey) {
Color color = null;
if (colorKey != null) color = colorMgr.getColor(colorKey);
int style = store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
if (store.getBoolean(italicKey)) style |= SWT.ITALIC;
if (store.getBoolean(strikeKey)) style |= TextAttribute.STRIKETHROUGH;
if (store.getBoolean(underlineKey)) style |= TextAttribute.UNDERLINE;
return new TextAttribute(color, null, style);
}
示例15: applyStyles
@Override
public void applyStyles(TextStyle textStyle) {
textStyle.strikeout = (xtextTextStyle.getStyle() & TextAttribute.STRIKETHROUGH) != 0;
textStyle.underline = (xtextTextStyle.getStyle() & TextAttribute.UNDERLINE) != 0;
if (xtextTextStyle.getFontData() == null
&& xtextTextStyle.getStyle() != org.eclipse.xtext.ui.editor.utils.TextStyle.DEFAULT_FONT_STYLE) {
FontData fontData = new FontData();
fontData.setStyle(xtextTextStyle.getStyle());
xtextTextStyle.setFontData(fontData);
}
textStyle.font = fontFromFontData(xtextTextStyle.getFontData());
if (xtextTextStyle.getBackgroundColor() != null)
textStyle.background = colorFromRGB(xtextTextStyle.getBackgroundColor());
textStyle.foreground = colorFromRGB(xtextTextStyle.getColor());
}