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


Java StyledString.setStyle方法代码示例

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


在下文中一共展示了StyledString.setStyle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStyledText

import org.eclipse.jface.viewers.StyledString; //导入方法依赖的package包/类
@Override
public StyledString getStyledText(final Object element) {
	if (element instanceof IEObjectDescription) {
		final String text = getText(element);
		final StyledString string = new StyledString(text);

		final int[] matchingRegion = getMatchingRegions(text);
		if (null != matchingRegion) {
			for (int i = 0; i < matchingRegion.length; i = i + 2) {
				string.setStyle(matchingRegion[i], matchingRegion[i + 1], boldStyler);
			}
		}

		final int indexOf = text.indexOf(NAME_SEPARATOR);
		if (-1 < indexOf) {
			string.setStyle(indexOf, text.length() - indexOf, qualifierStyler);
		}
		return string;
	}
	return new StyledString();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:OpenTypeSelectionDialog.java

示例2: getStyledDisplayString

import org.eclipse.jface.viewers.StyledString; //导入方法依赖的package包/类
@Override
public StyledString getStyledDisplayString(IDocument document, int offset, BoldStylerProvider boldStylerProvider) {
	// Highlight matched prefix
	StyledString styledDisplayString = new StyledString();
	styledDisplayString.append(getStyledDisplayString());

	String pattern = getPatternToEmphasizeMatch(document, offset);
	if (pattern != null && pattern.length() > 0) {
		String displayString = styledDisplayString.getString();
		int[] bestSequence = completionEntry.getMatcher().bestSubsequence(displayString, pattern);
		int highlightAdjustment = 0;
		for (int index : bestSequence) {
			styledDisplayString.setStyle(index + highlightAdjustment, 1, boldStylerProvider.getBoldStyler());
		}
	}
	return styledDisplayString;
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:18,代码来源:EditorConfigCompletionProposal.java

示例3: getStyledText

import org.eclipse.jface.viewers.StyledString; //导入方法依赖的package包/类
public StyledString getStyledText(Object element) {
	final String text = getText(element);
	if (text == null || EMPTY_STRING.equals(text)) {
		return new StyledString();
	}
	
	final StyledString string = new StyledString(text);
	
	if (element instanceof Spec) {
		string.setStyle(0, string.length(), StyledString.QUALIFIER_STYLER);
	} else if (element instanceof Model && text.indexOf(DELIM) != -1) {
		final int index = text.indexOf(DELIM);
		string.setStyle(index, text.length() - index, StyledString.DECORATIONS_STYLER);
	} else if (element instanceof ItemsListSeparator) {
		string.setStyle(0, string.length(), StyledString.QUALIFIER_STYLER);
	}
	return string;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:19,代码来源:TLAFilteredItemsSelectionDialog.java

示例4: getStyledDisplayString

import org.eclipse.jface.viewers.StyledString; //导入方法依赖的package包/类
@Override
public StyledString getStyledDisplayString(IDocument document, int offset, BoldStylerProvider boldStylerProvider) {
	// Highlight matched prefix
	StyledString styledDisplayString = new StyledString();
	styledDisplayString.append(getStyledDisplayString());

	String pattern = getPatternToEmphasizeMatch(document, offset);
	if (pattern != null && pattern.length() > 0) {
		String displayString = styledDisplayString.getString();
		int[] bestSequence = getMatcher().bestSubsequence(displayString, pattern);
		int highlightAdjustment = 0;
		for (int index : bestSequence) {
			styledDisplayString.setStyle(index + highlightAdjustment, 1, boldStylerProvider.getBoldStyler());
		}
	}
	return styledDisplayString;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:18,代码来源:TypeScriptCompletionProposalWithExtension7.java

示例5: getStyledDisplayText

import org.eclipse.jface.viewers.StyledString; //导入方法依赖的package包/类
@Override
public StyledString getStyledDisplayText() {
	String dt = getDisplayText();
	StyledString ss = new StyledString(dt);
	if (!isFirst()) {
		if (getParent() instanceof MFromTableJoin && getParent().getValue() instanceof MQueryTable) {
			int ind = dt.indexOf(" AS ");
			if (ind >= 0)
				ss.setStyle(ind, " AS ".length(), FontUtils.KEYWORDS_STYLER);
			ind = (dt).indexOf(" ON ");
			if (ind >= 0)
				ss.setStyle(ind, " ON ".length(), FontUtils.KEYWORDS_STYLER);
		} else
			ss.setStyle(0, (prevCond + " ").length(), FontUtils.KEYWORDS_STYLER);
	}
	ss.setStyle(dt.lastIndexOf("$X{"), 3, FontUtils.CLASSTYPE_STYLER);
	ss.setStyle(dt.lastIndexOf("}"), 1, FontUtils.CLASSTYPE_STYLER);
	return ss;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:MExpressionX.java

示例6: getStyledDisplayText

import org.eclipse.jface.viewers.StyledString; //导入方法依赖的package包/类
@Override
public StyledString getStyledDisplayText() {
	String dt = getDisplayText();
	StyledString ss = new StyledString(dt);
	if (!isFirst()) {
		if (getParent() instanceof MFromTableJoin && getParent().getValue() instanceof MQueryTable) {
			int ind = dt.indexOf(" AS ");
			if (ind >= 0)
				ss.setStyle(ind, " AS ".length(), FontUtils.KEYWORDS_STYLER);
			ind = (dt).indexOf(" ON ");
			if (ind >= 0)
				ss.setStyle(ind, " ON ".length(), FontUtils.KEYWORDS_STYLER);
		} else
			ss.setStyle(0, (prevCond + " ").length(), FontUtils.KEYWORDS_STYLER);
	}
	ss.setStyle(dt.lastIndexOf("$P!{"), 4, FontUtils.CLASSTYPE_STYLER);
	ss.setStyle(dt.lastIndexOf("}"), 1, FontUtils.CLASSTYPE_STYLER);
	return ss;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:MExpressionPNot.java

示例7: adjustStyleOfDuration

import org.eclipse.jface.viewers.StyledString; //导入方法依赖的package包/类
/**
 * Adjust the style of the duration section of the styled string if it has one
 * @param styledString
 * @param resultString
 */
private void adjustStyleOfDuration(StyledString styledString, String resultString) {
	int durationIndex = resultString.indexOf("double duration");
	if (durationIndex != -1) {
		int indexOfNewLine = resultString.substring(durationIndex).indexOf('\n');
		if (indexOfNewLine == -1) {
			indexOfNewLine = resultString.substring(durationIndex).length() - 1;
		}
	styledString.setStyle(durationIndex + "double".length(), indexOfNewLine - "double".length(), FontStyler.BOLD);
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:16,代码来源:ValidateResultsView.java

示例8: adjustStyleOfAxesToMove

import org.eclipse.jface.viewers.StyledString; //导入方法依赖的package包/类
/**
 * Adjust the style of the AxesToMove section of the styled string if it has one
 * @param styledString
 * @param resultString
 */
private void adjustStyleOfAxesToMove(StyledString styledString, String resultString) {
	int axesToMoveIndex = resultString.indexOf("string[] axesToMove");
	if (axesToMoveIndex != -1) {
		int indexOfNewLine = resultString.substring(axesToMoveIndex).indexOf('\n');
		if (indexOfNewLine == -1) {
			indexOfNewLine = resultString.substring(axesToMoveIndex).length();
		}
	styledString.setStyle(axesToMoveIndex + "string[]".length(), indexOfNewLine - "string[]".length(), FontStyler.BOLD);
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:16,代码来源:ValidateResultsView.java

示例9: getStyledDisplayText

import org.eclipse.jface.viewers.StyledString; //导入方法依赖的package包/类
@Override
public StyledString getStyledDisplayText() {
	StyledString dt = new StyledString(join + " ", FontUtils.KEYWORDS_STYLER);
	String tbltext = super.getDisplayText();
	if (getValue() instanceof MQueryTable)
		return dt.append("(");
	int ind = (join + " " + tbltext).indexOf(" AS ");
	dt.append(tbltext);
	if (ind >= 0)
		dt.setStyle(ind, " AS ".length(), FontUtils.KEYWORDS_STYLER);
	dt.append(" ON ", FontUtils.KEYWORDS_STYLER);
	return dt;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:14,代码来源:MFromTableJoin.java


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