Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to trigger the serializer on existing EMF model?
How to trigger the serializer on existing EMF model? [message #1001938] Thu, 17 January 2013 10:31 Go to next message
Marco Naddeo is currently offline Marco Naddeo
Messages: 62
Registered: November 2012
Member
Hi Smile

I want to trigger the serializer from a context menu in my language editor on the existing EMF model, i.e. without re-parsing the source code... how can I obtain the Resource (and then the AST) starting from my command handler which extends AbstractHandler?


Thanks in advance. Smile

Marco
Re: How to trigger the serializer on existing EMF model? [message #1001971 is a reply to message #1001938] Thu, 17 January 2013 11:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6213
Registered: July 2009
Senior Member
Hi,

am not quite sure what your problem is?
you may have a look at http://christiandietrich.wordpress.com/2011/10/15/xtext-calling-the-generator-from-a-context-menu/

~Christian
Re: How to trigger the serializer on existing EMF model? [message #1002249 is a reply to message #1001971] Fri, 18 January 2013 03:47 Go to previous messageGo to next message
Marco Naddeo is currently offline Marco Naddeo
Messages: 62
Registered: November 2012
Member
Ok if I want my context menu to be a menuContribution with locationURI "popup:org.eclipse.jdt.ui.PackageExplorer", but what about if I want it to have instead locationURI="popup:#TextEditorContext?after=additions"?

In this case, how can I get the Resource in my handler to trigger the serializer on the EMF model? Is it possible to get it from that context? Confused


Marco
Re: How to trigger the serializer on existing EMF model? [message #1002257 is a reply to message #1002249] Fri, 18 January 2013 03:58 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6213
Registered: July 2009
Senior Member
The blog has an example for right click in the editor too

--
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
Previous Topic:Access model from the editor
Next Topic: JvmTypesBuilder generate final parameters
Goto Forum:
  


Current Time: Fri Aug 22 23:48:04 EDT 2014

Powered by FUDForum. Page generated in 0.03986 seconds