The StyledText widget shows a piece of Java code, and it uses a JavaLineStyler for syntax highlighting. However, I would like to show some tokens as selected using
codeViewer.setStyleRanges(sranges); //sranges is an array of StyleRange
But looks like the second round style change is prevented by the following code snippet in the StyledText widget source.
public void setStyleRanges(StyleRange[] ranges) {
checkWidget();
if (isListening(ST.LineGetStyle)) return;
if (ranges == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
setStyleRanges(0, 0, null, ranges, true);
}
Not sure how to keep the syntax highlighting alive and then show some tokens selected.