當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。