當前位置: 首頁>>代碼示例>>Java>>正文


Java TextAttribute.getFont方法代碼示例

本文整理匯總了Java中org.eclipse.jface.text.TextAttribute.getFont方法的典型用法代碼示例。如果您正苦於以下問題:Java TextAttribute.getFont方法的具體用法?Java TextAttribute.getFont怎麽用?Java TextAttribute.getFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.text.TextAttribute的用法示例。


在下文中一共展示了TextAttribute.getFont方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: merge

import org.eclipse.jface.text.TextAttribute; //導入方法依賴的package包/類
private TextAttribute merge(TextAttribute first, TextAttribute second) {
	if (first == null)
		return second;
	if (second == null)
		return first;
	int style = first.getStyle() | second.getStyle();
	Color fgColor = second.getForeground();
	if (fgColor == null)
		fgColor = first.getForeground();
	Color bgColor = second.getBackground();
	if (bgColor == null)
		bgColor = first.getBackground();
	Font font = second.getFont();
	if (font == null)
		font = first.getFont();
	return new TextAttribute(fgColor, bgColor, style, font);
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:18,代碼來源:TextAttributeProvider.java

示例2: getRanges

import org.eclipse.jface.text.TextAttribute; //導入方法依賴的package包/類
public List<StyleRange> getRanges(String expression) {
	final List<StyleRange> ranges = Lists.newArrayList();
	DocumentEvent event = new DocumentEvent();
	event.fDocument = new DummyDocument(expression);
	DocumentTokenSource tokenSource = tokenSourceProvider.get();
	tokenSource.updateStructure(event);
	Iterator<ILexerTokenRegion> iterator = tokenSource.getTokenInfos().iterator();
	while (iterator.hasNext()) {
		ILexerTokenRegion next = iterator.next();
		TextAttribute attribute = attributeProvider.getAttribute(tokenTypeMapper.getId(next.getLexerTokenType()));
		StyleRange range = new StyleRange(next.getOffset(), next.getLength(), attribute.getForeground(),
				attribute.getBackground());
		range.font = attribute.getFont();
		range.fontStyle = attribute.getStyle();
		ranges.add(range);
	}
	return ranges;
}
 
開發者ID:Yakindu,項目名稱:statecharts,代碼行數:19,代碼來源:StyleRanges.java

示例3: createStyleRange

import org.eclipse.jface.text.TextAttribute; //導入方法依賴的package包/類
/**
 * @return Returns a corresponding style range.
 */
public StyleRange createStyleRange() {
	int len = getLength();

	TextAttribute textAttribute = attribute;
	int style = textAttribute.getStyle();
	int fontStyle = style & (SWT.ITALIC | SWT.BOLD | SWT.NORMAL);
	StyleRange styleRange = new StyleRange(getOffset(), len, textAttribute.getForeground(),
			textAttribute.getBackground(), fontStyle);
	styleRange.strikeout = (style & TextAttribute.STRIKETHROUGH) != 0;
	styleRange.underline = (style & TextAttribute.UNDERLINE) != 0;
	styleRange.font = textAttribute.getFont();

	return styleRange;
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:18,代碼來源:AttributedPosition.java

示例4: addRange

import org.eclipse.jface.text.TextAttribute; //導入方法依賴的package包/類
/**
 * 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 lastLineStyleRanges
 */
protected void addRange(TextPresentation presentation, int offset, int length, TextAttribute attr) {
	if (attr != null) {
		int style = attr.getStyle();
		int fontStyle = style & (SWT.ITALIC | SWT.BOLD | SWT.NORMAL);
		StyleRange styleRange = new StyleRange(offset, length, attr.getForeground(), attr.getBackground(),
				fontStyle);
		styleRange.strikeout = (style & TextAttribute.STRIKETHROUGH) != 0;
		styleRange.underline = (style & TextAttribute.UNDERLINE) != 0;
		styleRange.font = attr.getFont();
		presentation.addStyleRange(styleRange);
	}
}
 
開發者ID:eclipse,項目名稱:tm4e,代碼行數:26,代碼來源:TMPresentationReconciler.java

示例5: createStyleRange

import org.eclipse.jface.text.TextAttribute; //導入方法依賴的package包/類
/**
 * Creates a {@link StyleRange} from the given parameters.
 *
 * @param offset
 *          the offset
 * @param length
 *          the length of the range
 * @param textAttribute
 *          the {@link TextAttribute}
 * @return a {@link StyleRange} from the given parameters
 */
public static StyleRange createStyleRange(final int offset, final int length, final TextAttribute textAttribute) {
  int style = textAttribute.getStyle();
  int fontStyle = style & (SWT.ITALIC | SWT.BOLD | SWT.NORMAL);
  StyleRange styleRange = new StyleRange(offset, length, textAttribute.getForeground(), textAttribute.getBackground(), fontStyle);
  styleRange.strikeout = (style & TextAttribute.STRIKETHROUGH) != 0;
  styleRange.underline = (style & TextAttribute.UNDERLINE) != 0;
  styleRange.font = textAttribute.getFont();
  return styleRange;
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:21,代碼來源:AbstractSyntaxColoringTest.java


注:本文中的org.eclipse.jface.text.TextAttribute.getFont方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。