@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; }
@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; }