Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XtextEditor with folding disabled by default
XtextEditor with folding disabled by default [message #1014812] Tue, 26 February 2013 14:06 Go to next message
Marco Naddeo is currently offline Marco NaddeoFriend
Messages: 62
Registered: November 2012
Member
Hi Smile

I need to have a XtextEditor which has folding disabled by default.

In other words, I want that folding is disabled by default, in the same way the user can disable it by deselecting "Folding" -> "Enable Folding" from the context menu.

How can I get that?


Thanks in advance
Marco
Re: XtextEditor with folding disabled by default [message #1014908 is a reply to message #1014812] Tue, 26 February 2013 18:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

simply subclassing DefaultFoldingRegionProvider and binding it doesnt work?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XtextEditor with folding disabled by default [message #1015032 is a reply to message #1014908] Wed, 27 February 2013 09:16 Go to previous messageGo to next message
Marco Naddeo is currently offline Marco NaddeoFriend
Messages: 62
Registered: November 2012
Member
Ok, it works by overriding getFoldingRegions method Smile, but if I only want to change the preference value (disabling it by default and not completely), how can I do it?

In addition, is there a way to completely disable the folding from the context menu?

Thanks again,
Marco
Re: XtextEditor with folding disabled by default [message #1015037 is a reply to message #1015032] Wed, 27 February 2013 09:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi by accessing the preference store in the method :) the preference
store is not really Xtext specific

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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: XtextEditor with folding disabled by default [message #1015213 is a reply to message #1015032] Wed, 27 February 2013 18:53 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

regarding the second question, bind your own implementation of XtextEditor and override the rulerContextMenuAboutToShow method. You should be able to remove the foldingMenu again.

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
Re: XtextEditor with folding disabled by default [message #1015215 is a reply to message #1015213] Wed, 27 February 2013 19:08 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Alternatively (if you want to use the default behaviour but only not to use folding at the beginning you may override
org.eclipse.xtext.ui.editor.XtextEditor.installFoldingSupport(ProjectionViewer)
and e.g. calling projectionViewer.doOperation(ProjectionViewer.TOGGLE); once mor
so that folding is disabled again


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Put error mark at right EStructuralFeature
Next Topic:Splitting one DSL into 6
Goto Forum:
  


Current Time: Fri Apr 19 23:03:43 GMT 2024

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

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

Back to the top