I had create a simple keywords highlighting editor, it just wrap a StyledText
widget:
public class SQLSegmentEditor extends Composite {
private StyledText st;
public SQLSegmentEditor(Composite parent) {
super(parent, SWT.NONE);
this.setLayout(new FillLayout());
st = new StyledText(this, SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
st.addLineStyleListener(new SQLSegmentLineStyleListener());
}
}
How can I make it can be used in data-binding? I am looking for the proper way, not just one that makes it work.
I want to observer the text content of the inner StyledText
.
For example : I can just add a getStyledText
method to return the wrapped StyledText
widget for using it in databinding. But this will take a risk. In order to keep my editor behavior correctly, I should keep the StyledText
widget not visible to client code.