Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Hide parts of the textual representation in the editor
Hide parts of the textual representation in the editor [message #1763658] Thu, 18 May 2017 12:01 Go to next message
Tobias W. is currently offline Tobias W.Friend
Messages: 10
Registered: May 2017
Junior Member
Hi everybody,

I'm currently working on a DSL project, in which I have some potentially long datatype paths like this:
method myMethod(in /very/long/path/to/Datatype var1, out /another/long/path/to/Datatype2 var2)

Is there a possibility in Xtext to hide some parts of a string in the editor, but not to loose the information in the node model? My goal is to be able to toggle between the full and a short representation like this:
method myMethod(in Datatype var1, out Datatype2 var2)


It would be really helpful if someone could point me in the right direction.

Many thanks in advance!

Tobias


Re: Hide parts of the textual representation in the editor [message #1763670 is a reply to message #1763658] Thu, 18 May 2017 13:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
have a look at the feature called folding. i dont know if it is applicable at your usecase though

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Hide parts of the textual representation in the editor [message #1763675 is a reply to message #1763670] Thu, 18 May 2017 13:38 Go to previous messageGo to next message
Tobias W. is currently offline Tobias W.Friend
Messages: 10
Registered: May 2017
Junior Member
I managed to divide the paths in two segments, one for the absolute path and one for the actual type.

Is there a possibility to hide/collapse/fold an element on a token basis?

Folding normally works only on full lines.
Re: Hide parts of the textual representation in the editor [message #1763676 is a reply to message #1763675] Thu, 18 May 2017 13:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
nope i think you have to dig into how folding works in eclipse text editors (the general term is projection i think)
and if this is possbile to be applied on a non line base.



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Hide parts of the textual representation in the editor [message #1763680 is a reply to message #1763676] Thu, 18 May 2017 14:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
p.s: and if this is only about readablity you might have a look at the word wrap feature as well https://bugs.eclipse.org/bugs/show_bug.cgi?id=35779

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Hide parts of the textual representation in the editor [message #1763681 is a reply to message #1763676] Thu, 18 May 2017 14:22 Go to previous message
Tobias W. is currently offline Tobias W.Friend
Messages: 10
Registered: May 2017
Junior Member
Thank you, Christian!

I will dig into the ProjectionViewer in order to get the desired result. There is a master/slave document mechanism which could be the solution.

The word wrap feature on the other hand is not exactly what I'm looking for, but thanks for the hint.

I will post a possible solution if I find one.
Previous Topic:default value for Boolean attribute and serialization
Next Topic:non-grammar features in a model object
Goto Forum:
  


Current Time: Fri Mar 29 13:36:02 GMT 2024

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

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

Back to the top