I'm developing a custom text editor for a programming language in Eclipse. Is it possible to put a widget (a button, for instance开发者_如何学C) inside a custom text editor?
For all SWT related questions, always have a look at the official Snippet page first. Often it is really helpful. This is one of these cases: Snippet217 shows how to embed arbitrary controls in a StyledText
, which seems to be what you aim for.
It doesn't directly awnser your question but I would recommend using http://www.eclipse.org/Xtext/ (Xtext). By defining a grammar for your programming language, Xtext generates a whole IDE for your language including an editor with syntax highlighting and auto-completion, an outline and hooks for builders etc.
It really is amazing, the first time I used it my jaw just dropped.
精彩评论