Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Collapsing all comments
Collapsing all comments [message #1065505] Wed, 26 June 2013 08:14 Go to next message
Benoit Ries is currently offline Benoit RiesFriend
Messages: 86
Registered: May 2013
Member
Hi,

I would like to collapse by default all multi-line comments in my xtext editors.

I've looked around and found out that this may be done through the ProjectAnnotationModel but :

1) how do I retrieve the ProjectAnnotationModel, I always get null when using the following instruction:
ProjectionAnnotationModel model = (ProjectionAnnotationModel) xtextEditor.getAdapter(ProjectionAnnotationModel.class);

2) where do I insert the code, i.e. which hook should I use ?


thanks in advance for any hints, pointers on how to achieve this.

Benoît
Re: Collapsing all comments [message #1065875 is a reply to message #1065505] Fri, 28 June 2013 06:40 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

for folding customization you may have a look at this post and the two corresponding projects on github
Terminology and Xturtle.

The overridden XtextEditor contains the code for collapsing regions on startup. Your main problem will be identifying which regions are comments and which regions are not. Currently there is no out of the box support for "typing" them. This issue is addressed in the implementation (proof of concept). For you it may much easier, simply override computeCommentFolding in DefaultFoldingRegionProvider and give the calculated regions a "comment" type.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de

[Updated on: Fri, 28 June 2013 10:25]

Report message to a moderator

Re: Collapsing all comments [message #1065908 is a reply to message #1065875] Fri, 28 June 2013 08:52 Go to previous message
Benoit Ries is currently offline Benoit RiesFriend
Messages: 86
Registered: May 2013
Member
Hi Alex,

XTurtle seems to be doing exactly what I am looking for (and even more).

thanks,
Benoît
Previous Topic:mportedNamespaceAwareLocalScopeProvider
Next Topic:Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar
Goto Forum:
  


Current Time: Fri Apr 19 09:16:29 GMT 2024

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

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

Back to the top