Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Comments in Xtext
Comments in Xtext [message #1771190] Tue, 22 August 2017 17:55 Go to next message
Ruchika Kumar is currently offline Ruchika KumarFriend
Messages: 47
Registered: January 2017
Member
I understand that to use and serialize java-doc comments in Xtext, we need to unhide them using hidden(WS) and assign to a feature. However, It would enable the user to write comments at a specific place in the model i.e. the place of the feature it is assigned to.
What if we want comments to be written anywhere inside the model and also serialize them along with the model?
Re: Comments in Xtext [message #1771329 is a reply to message #1771190] Thu, 24 August 2017 06:46 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 592
Registered: July 2009
Location: Dortmund, Germany
Senior Member

You can use the IEObjectDocumentationProvider to access the documentation and leave them as hidden tokens. No need to assign it to a feature.
Re: Comments in Xtext [message #1771550 is a reply to message #1771329] Sun, 27 August 2017 17:05 Go to previous messageGo to next message
Ruchika Kumar is currently offline Ruchika KumarFriend
Messages: 47
Registered: January 2017
Member
Could you throw more light into this? Also, would this approach help serialize the comments?
Re: Comments in Xtext [message #1771600 is a reply to message #1771550] Mon, 28 August 2017 13:55 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 592
Registered: July 2009
Location: Dortmund, Germany
Senior Member

If you mean with 'serialize' here code generation then you can do this. Just inject it as extension and access the 'documentation' property offered by the extension.
Re: Comments in Xtext [message #1771677 is a reply to message #1771600] Tue, 29 August 2017 13:28 Go to previous messageGo to next message
Ruchika Kumar is currently offline Ruchika KumarFriend
Messages: 47
Registered: January 2017
Member
By 'serializing' I mean, converting the model for specification in XMI form. The comments are not visible in xmi if we don't unhide them using hidden(WS)...
Re: Comments in Xtext [message #1771828 is a reply to message #1771677] Thu, 31 August 2017 07:06 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 757
Registered: July 2009
Location: Hamburg
Senior Member
What representation should the comments have in XMI?

You could e.g. implement the transfer of the documentation from the node model yourself when converting the model to XMI.: After copying it to an XMI resource, do another iteration on the EMF model, use the IEObjectDocumentationProvider and turn the docs into EAnnotations that you attach to the elements.


---
Get professional support from the Xtext committers at www.typefox.io
Re: Comments in Xtext [message #1771844 is a reply to message #1771828] Thu, 31 August 2017 09:33 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5833
Registered: July 2009
Senior Member
Hi

Surely if comments matter to you, you should model them? Thus in UML there is a Comment class. In Ecore there are EAnnotations.

Regards

Ed Willink
Previous Topic:How To Unit Test Content Assist In Web Project
Next Topic:formatting - indentation following newline
Goto Forum:
  


Current Time: Thu Apr 19 12:10:35 GMT 2018

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

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