本文整理匯總了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;
}