Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Source code folding in my own editor
Source code folding in my own editor [message #268188] Mon, 23 August 2004 11:45 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:store a file in the plugin
Next Topic:CVS Question
Goto Forum:
  


Current Time: Thu Dec 26 21:13:13 GMT 2024

Powered by FUDForum. Page generated in 0.03508 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top