Java 类org.eclipse.jface.text.contentassist.BoldStylerProvider 实例源码

项目:ec4e    文件:EditorConfigCompletionProposal.java   
@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;
}
项目:typescript.java    文件:TypeScriptCompletionProposalWithExtension7.java   
@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;
}