+1  A: 

Probably your best bet is to embed other SWT widgets in the StyledText. Each widget will perform a certain calculation in a background thread and update its visual representation as the results come in. Note that you can do the calculations in the background but the rendering must happen in the SWT thread. So you can't do many complex things during rendering. If things become too slow, use cache images (create a couple of off-screen images where you can render the results and then simply draw those images).

Extend these widgets from Canvas as this is the widget intended for custom rendering. It will also allow you to react to different events (i.e. display additional information when the user hovers over an enzyme cut).

Be careful with the enzyme cuts, though: They vary in height. I suggest to give this widget a bit more space by default (even when it's not used) so the text doesn't jump a lot while the widget calculates and adds cuts.

Aaron Digulla
Good insights, Aaron. I'll take a look into embedding widgets into StyledText. As for the text jumping around due to the enzymes: I don't deem this very likely since that is fairly slow (lots of enzymes with regular expressions as recognition sequences in a huge file). I think it would actually be a good idea to give them a minimum display delay so that in smaller files it only updates after a second or two. That's really in the details, though; if I can get variable sized widgets into StyledText, I think I'm halfway there.
Paul Lammertsma
Changing the size of a widget should make StyledText re-layout itself.
Aaron Digulla
A: 

I instead chose for a solution using multiple buffers, where each buffer is drawn in a separate thread. The performance is much better than StyledText, and I have complete flexibility to drawing things where I like.

The only drawback is that I have to reimplement the basics of text editing: text selection, navigation -- even to the basics of entering characters. I am nevertheless satisfied with the result.

I'm afraid I cannot provide source code as it is part of a copyrighted project.

Paul Lammertsma