Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
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
Eclipse UserFriend
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: Tue Jul 22 18:14:28 EDT 2025

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

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

Back to the top