Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Serializing Model into Resource
Serializing Model into Resource [message #1815170] Thu, 26 September 2019 10:29 Go to next message
Eclipse UserFriend
Hello,

i would like to save a semantic models textual representation in a resource.

I know already that I can serialize a modified semantic model:
val model = resource.allContents.head

// modify model

resource.save(0)


But if the resource is empty, the model will be null.

I know how to create a new model but i dont know how to add that model to the resource.

Please point me at the function that does this

Thanks

Lukas
Re: Serializing Model into Resource [message #1815171 is a reply to message #1815170] Thu, 26 September 2019 10:30 Go to previous messageGo to next message
Eclipse UserFriend
resource.contents+=root
Re: Serializing Model into Resource [message #1815196 is a reply to message #1815171] Fri, 27 September 2019 01:41 Go to previous messageGo to next message
Eclipse UserFriend
You can find an example for that under https://github.com/itemis/itemis-blog/blob/combining-emf-models-with-xtext-dsls/org.eclipse.xtext.example.fowlerdsl.ui/src/org/eclipse/xtext/example/fowlerdsl/ui/handlers/EmfStatemachineSerializationHandler.xtend#L37
Re: Serializing Model into Resource [message #1815320 is a reply to message #1815196] Mon, 30 September 2019 10:07 Go to previous message
Eclipse UserFriend
Thank you Tamas and Christian. That was easy. ;)
Previous Topic:Decouple Xtext project from Eclipse Plugin (UI project)
Next Topic:DSL autocompletion to open custom Dialogs
Goto Forum:
  


Current Time: Wed Mar 19 06:30:35 EDT 2025

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

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

Back to the top