I have a StytedText object which could potentially host a buffer of tens of megabytes of text and hundreds of thousands of StyleRange.
Obviously, this doesn't scale at all. My question is, what's the easiest way to implement an on-demand (sort of) version of StyledText that would generate only the StyleRange objects it needs at time t (to cover that visible area) on the fly?
- Can I do it using SWT by using a custom LineStyleListener, the documentation seems to suggest?
- Does JFace already offer something like that? (that being: a Text view supporting rich styles on character ranges and offering an on-demand way to render the view)
- Should I use another UI library?
Edit: I implemented LineStyleListener and got to something close to what I want. But it got me wondering... why is the default implementation (org.eclipse.swt.custom.DefaultLineStyler) not supporting this on-demand scheme. It is fairly straightforward to just enable the StyleRanges that are in the current view. So, am I missing something essential, here? Is there a major, nasty side-effect to on-demand styling that I overlooked?