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 09:06 Go to next message
Marco Naddeo is currently offline Marco Naddeo
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 13:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6143
Registered: July 2009
Senior Member
Hi,

simply subclassing DefaultFoldingRegionProvider and binding it doesnt work?
Re: XtextEditor with folding disabled by default [message #1015032 is a reply to message #1014908] Wed, 27 February 2013 04:16 Go to previous messageGo to next message
Marco Naddeo is currently offline Marco Naddeo
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 04:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6143
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
Re: XtextEditor with folding disabled by default [message #1015213 is a reply to message #1015032] Wed, 27 February 2013 13:53 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander Nittka
Messages: 1151
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 14:08 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6143
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
Previous Topic:Put error mark at right EStructuralFeature
Next Topic:Splitting one DSL into 6
Goto Forum:
  


Current Time: Wed Jul 30 19:28:37 EDT 2014

Powered by FUDForum. Page generated in 0.01644 seconds