本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}