Using xText with existing model and Resource [message #994066] |
Wed, 26 December 2012 04:48  |
Eclipse User |
|
|
|
Hi,
I want to use xText in following scenario:
I have existing EMF models which are persisted to a local file (using Resource) (as xml)
sfs (semantic file system) takes that content to a backend using REST and handled on backend using ResourceHandlers.
I am targeting to create a DSL for the EMF Model but finally wants to push content into xml only.
This also means that i can read existing xml in DSL format.
How should i approach this ?
I went through xText documentation but still don't know how to read xmi into DSL format and save DSL format to xmi.
I also referred to http://blog.efftinge.de/2009/11/xtext-using-existing-ecore-models.html but wasn't able to make it work.
I try to load an existing xmi file using the DSL editor, it shows xmi itself with keywords in my grammer highlighted and i try to save the DSL content and open using some Sample Ecore Editor, i get errors.
Regards,
Ashwani Kr Sharma
[Updated on: Wed, 26 December 2012 04:59] by Moderator
|
|
|
|
|
|
Re: Using xText with existing model and Resource [message #995916 is a reply to message #995610] |
Mon, 31 December 2012 09:03  |
Eclipse User |
|
|
|
On 2012-30-12 18:03, Ashwani Kr Sharma wrote:
> Hi,
>
> I currently found a way that i will load the xmi of existing model
> (using XMIResource) and take the EOBject and move it to another
> XTextResource. If i save XTextResource it persists it as DSL format. Now
> on each save of XTextResource i have to sync its content to the xmi file.
>
> I have no option to create another file for DSL format and keep its
> content in sync with xmi format.
>
> What do you guys feel about this approach ?
> Regards,
> Ashwani Kr Sharma
That approach works.
You can use the builder framework and "build" the XMI version from the
DSL version. What you want to do depends on how you want to handle
conflicts - both files edited etc. Or if you want to make the DSL the
master if one exists and always overwrite the XMI.
With the builder framework you do not have to keep track of resources as
they change (there are many ways resources can change besides saving it
in an editor).
Hope that helps.
Regards
- henrik
|
|
|
Powered by
FUDForum. Page generated in 0.04632 seconds