Source code folding in my own editor [message #268188] |
Mon, 23 August 2004 11:45 |
Eclipse User |
|
|
|
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl
I'm building my own TextEditor (an Eclipse 3.0 plugin) for editing a
self-defined language. I'd like to add support for folding my source
code, just like in the Java text editor since Eclipse 3.0. Is there a
standard way to do this? An extension, or something in the
SourceViewerConfiguration perhaps?
Thank you in advance,
Martijn van Steenbergen.
|
|
|
Re: Source code folding in my own editor [message #268194 is a reply to message #268188] |
Mon, 23 August 2004 12:43 |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.gmx.net
Martijn van Steenbergen wrote:
> I'm building my own TextEditor (an Eclipse 3.0 plugin) for editing a
> self-defined language. I'd like to add support for folding my source
> code, just like in the Java text editor since Eclipse 3.0. Is there a
> standard way to do this? An extension, or something in the
> SourceViewerConfiguration perhaps?
>
> Thank you in advance,
>
> Martijn van Steenbergen.
Here's how to configure it:
- in your editor override createSourceViewer(...) by returning a
ProjectionViewer instance
- in your editor extend createPartControl(...) to configure the
projection support
- in your editor extend getAdapter(...) to provide access to the
projection support
- ensure that whenever folding is affected you create/delete/update the
projection annotations
As an example on how to implement above stuff take a look at JavaEditor
and DefaultJavaFoldingStructureProvider. The Java editor the projection
annotations are updated whenever the Java model for the given
compilation unit changes.
HTH
Dani
|
|
|
Re: Source code folding in my own editor [message #268198 is a reply to message #268194] |
Mon, 23 August 2004 12:56 |
Eclipse User |
|
|
|
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl
Thank you very much! This will keep me busy for quite a while. Slowly
getting there. ^_^
Thanks again,
Martijn.
Daniel Megert wrote:
> Here's how to configure it:
>
> - in your editor override createSourceViewer(...) by returning a
> ProjectionViewer instance
> - in your editor extend createPartControl(...) to configure the
> projection support
> - in your editor extend getAdapter(...) to provide access to the
> projection support
> - ensure that whenever folding is affected you create/delete/update the
> projection annotations
>
> As an example on how to implement above stuff take a look at JavaEditor
> and DefaultJavaFoldingStructureProvider. The Java editor the projection
> annotations are updated whenever the Java model for the given
> compilation unit changes.
>
> HTH
> Dani
|
|
|
Powered by
FUDForum. Page generated in 0.03508 seconds