Java Code Examples for org.eclipse.swt.SWT#UNDERLINE_ERROR

The following examples show how to use org.eclipse.swt.SWT#UNDERLINE_ERROR . 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
/**
 * 刷新拼写检查中错误单词的样式
 * @param ranges
 */
public void refreshErrorWordsStyle(List<StyleRange> ranges){
	StyledText styledText = cellEditor.viewer.getTextWidget();
	List<StyleRange> oldRangeList = new ArrayList<StyleRange>();
	for(StyleRange oldRange : styledText.getStyleRanges()){
		if (oldRange.underlineStyle != SWT.UNDERLINE_ERROR) {
			oldRangeList.add(oldRange);
		}
	}
	styledText.setStyleRange(null);

	styledText.setStyleRanges(oldRangeList.toArray(new StyleRange[oldRangeList.size()]));
	if (ranges != null) {
		for (StyleRange range : ranges) {
			styledText.setStyleRange(range);
		}
	}
}
 
Example 2
/**
 * 刷新拼写检查中错误单词的样式
 * @param ranges
 */
public void refreshErrorWordsStyle(List<StyleRange> ranges){
	StyledText styledText = cellEditor.viewer.getTextWidget();
	List<StyleRange> oldRangeList = new ArrayList<StyleRange>();
	for(StyleRange oldRange : styledText.getStyleRanges()){
		if (oldRange.underlineStyle != SWT.UNDERLINE_ERROR) {
			oldRangeList.add(oldRange);
		}
	}
	styledText.setStyleRange(null);

	styledText.setStyleRanges(oldRangeList.toArray(new StyleRange[oldRangeList.size()]));
	if (ranges != null) {
		for (StyleRange range : ranges) {
			styledText.setStyleRange(range);
		}
	}
}
 
Example 3
Source Project: ldparteditor   File: SyntaxFormatter.java    License: MIT License 5 votes vote down vote up
/**
 * Extends the style range of the text with a error-underline-style.
 *
 * @param range
 *            the reference to the style range
 */
private void setErrorStyle(StyleRange range) {
    range.underline = true;
    range.underlineStyle = SWT.UNDERLINE_ERROR;
    range.underlineColor = Colour.line_error_underline[0];
    range.length = range.length - 1;
}
 
Example 4
/**
 * 根据传入的相关参数获取错误单词的样式	robert	2013-01-22
 * @param style
 * @param start
 * @param length
 * @return
 */
private StyleRange getErrorWordRange(TextStyle style, int start, int length){
	StyleRange range = new StyleRange(style);
	range.start = start;
	range.length = length;
	range.underline = true;
	range.underlineStyle = SWT.UNDERLINE_ERROR;
	range.underlineColor = ColorConfigBean.getInstance().getErrorWordColor();
	return range;
}
 
Example 5
/**
 * 根据传入的相关参数获取错误单词的样式	robert	2013-01-22
 * @param style
 * @param start
 * @param length
 * @return
 */
private StyleRange getErrorWordRange(TextStyle style, int start, int length){
	StyleRange range = new StyleRange(style);
	range.start = start;
	range.length = length;
	range.underline = true;
	range.underlineStyle = SWT.UNDERLINE_ERROR;
	range.underlineColor = ColorConfigBean.getInstance().getErrorWordColor();
	return range;
}