Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Eugenia/Xtext] Make the diagram generate formatted code
[Eugenia/Xtext] Make the diagram generate formatted code [message #1406836] Mon, 11 August 2014 08:11 Go to next message
Alex K is currently offline Alex KFriend
Messages: 8
Registered: August 2014
Junior Member
Hi all,

I have been stuck for one week on one wall and I did not find any clear solution to my problem so I hope that someone here can help me.
I have a xtext editor and a diagram generated thanks to Eugenia which work well side by side and I created a formatter for my xtext grammar which works well too.

The problem is that when I change my diagram and save it in order to see the textual editor, all my text is on one row.
After looking for a solution in this forum, I saw that it was maybe because of the serializer of my xtext editor.

If I understand correctly, I have to change the attribute 'formatting' of the SaveOptions class and pass it to 'true' in order to enable the formatting when I save the diagram.
The problem is that I do not know how to do this transformation and I do not know where in my xtext editor I have to do this ?

Thanks for any help,

Alex

Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1406965 is a reply to message #1406836] Mon, 11 August 2014 14:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
HI,

did you implement the formatter? it actually should be called by default.

maybe you should have a look what Eugenia does.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 11 August 2014 14:33]

Report message to a moderator

Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1406968 is a reply to message #1406965] Mon, 11 August 2014 14:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
I just saw it is actuall false by default.
so where is the place the xtextresource.save(options) is called.
maybe you can set a breakpoint there


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1407235 is a reply to message #1406968] Tue, 12 August 2014 06:46 Go to previous messageGo to next message
Alex K is currently offline Alex KFriend
Messages: 8
Registered: August 2014
Junior Member
Hi Christian,

Thank you for you answer.
Indeed, I have to change the 'xtextresource.save(options)' but that is the problem : I did not find this line of code, I looked in the workflow, in every file of my xtext editor and I did not see it. I hope I missed something obvious in one of these files but I cannot find where.

Alex
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1407258 is a reply to message #1407235] Tue, 12 August 2014 07:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
did you set a breakpoint where the save method is called?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1407266 is a reply to message #1407258] Tue, 12 August 2014 08:08 Go to previous messageGo to next message
Alex K is currently offline Alex KFriend
Messages: 8
Registered: August 2014
Junior Member
It is possible to set a breakpoint where the save method is called without knowing where this method is? I am a beginner with Eclipse, I only know how to set a breakpoint on a line that I see.
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1407290 is a reply to message #1407266] Tue, 12 August 2014 09:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
The method is in XtextResource

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1407291 is a reply to message #1407290] Tue, 12 August 2014 09:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
P.S: i actually do not know what you do to pupulate/save/create the xtext model

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1410728 is a reply to message #1407291] Thu, 21 August 2014 13:26 Go to previous messageGo to next message
Alex K is currently offline Alex KFriend
Messages: 8
Registered: August 2014
Junior Member
Hi Christian,

Sorry for the late reply.

I have my xtext grammar with the extension .voc in my case and with this file I generate a diagram with the extension .voc_diagram. Then, when I save the .voc file, the diagram is updated automatically.
The problem is that I would like to do the same on the other way : when I save the diagram, the .voc file is updated with the formatting I created in my formatter but as you said, the formatter option is false by default and I do not manage to find where I can modify this option. I found that this option came from XtextResource but I cannot modify this file, so the question is : where can I modify this option and pass it to true?

I hope that I have explained my problem clearly.

Alex
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1410730 is a reply to message #1410728] Thu, 21 August 2014 13:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
Hi,

i dont know how both resources are connected so i can of course not answer this question.
so what do you do to connect the both resources ?!?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1410742 is a reply to message #1410730] Thu, 21 August 2014 14:05 Go to previous messageGo to next message
Alex K is currently offline Alex KFriend
Messages: 8
Registered: August 2014
Junior Member
The diagram and the xtext file are connected automatically thanks to Eugenia. The xtext grammar and the diagram both come from the same ecore file, that is how they are linked.
I just followed this tutorial : http://www.eclipse.org/epsilon/doc/articles/eugenia-gmf-tutorial/
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1410745 is a reply to message #1410742] Thu, 21 August 2014 14:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
hmm i fear then i cannot help. dont know anything on the internals of eugenia, maybe it is impossible at all.

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Eugenia/Xtext] Make the diagram generate formatted code [message #1410750 is a reply to message #1410745] Thu, 21 August 2014 14:27 Go to previous message
Alex K is currently offline Alex KFriend
Messages: 8
Registered: August 2014
Junior Member
That would explain why I found nothing on the Internet about this subject .. Anyway thank you for your answers !
I have another problem in my project but concerning xtext this time and this tutorial : http://christiandietrich.wordpress.com/2012/08/07/xtext-referencing-elements-of-one-dsl-from-another-dsl/
I think it would be better if I create a new topic to explain this new problem if I do not manage to solve it today.
Previous Topic:Verifying the correctness of Xtext compiler
Next Topic: Highlighting problem
Goto Forum:
  


Current Time: Fri Dec 06 10:06:37 GMT 2019

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

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

Back to the top