当前位置: 首页>>代码示例>>Java>>正文


Java TextAttribute.UNDERLINE属性代码示例

本文整理汇总了Java中org.eclipse.jface.text.TextAttribute.UNDERLINE属性的典型用法代码示例。如果您正苦于以下问题:Java TextAttribute.UNDERLINE属性的具体用法?Java TextAttribute.UNDERLINE怎么用?Java TextAttribute.UNDERLINE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jface.text.TextAttribute的用法示例。


在下文中一共展示了TextAttribute.UNDERLINE属性的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);
    }
}
 
开发者ID:anb0s,项目名称:LogViewer,代码行数:28,代码来源:DamageRepairer.java

示例2: tokenAttribute

private TextAttribute tokenAttribute(String colorPrefs, String boldPrefs, String italicPrefs, String underlinePrefs) {
    int style = SWT.NORMAL;

    boolean isBold = store.getBoolean(boldPrefs);
    if (isBold) {
        style = style | SWT.BOLD;
    }

    boolean isItalic = store.getBoolean(italicPrefs);
    if (isItalic) {
        style = style | SWT.ITALIC;
    }

    boolean isUnderline = store.getBoolean(underlinePrefs);
    if (isUnderline) {
        style = style | TextAttribute.UNDERLINE;
    }

    RGB color = PreferenceConverter.getColor(store, colorPrefs);
    TextAttribute attr = new TextAttribute(colorManager.getColor(color), null, style);
    return attr;
}
 
开发者ID:RepreZen,项目名称:KaiZen-OpenAPI-Editor,代码行数:22,代码来源:JsonScanner.java

示例3: 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;
}
 
开发者ID:brocade,项目名称:vTM-eclipse,代码行数:22,代码来源:ColourSetting.java

示例4: 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);
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:9,代码来源:SQLEditorSourceViewerConfiguration.java

示例5: 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();
	}
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:28,代码来源:CSSTokenProvider.java

示例6: 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);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:29,代码来源:DwprofileTokenScanner.java

示例7: 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);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:29,代码来源:HyexpressionTokenScanner.java

示例8: 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);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:29,代码来源:HyvalidityformulaTokenScanner.java

示例9: 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);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:29,代码来源:HydatavalueTokenScanner.java

示例10: 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);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:29,代码来源:HymappingTokenScanner.java

示例11: 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);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:29,代码来源:HyconstraintsTokenScanner.java

示例12: 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);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:29,代码来源:HymanifestTokenScanner.java

示例13: 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;
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:12,代码来源:ParsedSqlTokensScanner.java

示例14: 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

示例15: 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);
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:23,代码来源:AbstractBufferedRuleBasedScanner.java


注:本文中的org.eclipse.jface.text.TextAttribute.UNDERLINE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。