Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [XCore] edit instances with XText editor
[XCore] edit instances with XText editor [message #1010925] Mon, 18 February 2013 13:45 Go to next message
David Michonneau is currently offline David Michonneau
Messages: 85
Registered: July 2009
Member
I have an XCore model, and I would like to edit an instance of this model, not in the sample reflective editor, but in a XText based editor (similar to the one I use to author the model itself).

For instance, my model is:

class Library {
contains Book[] books opposite library
}

class Book {
String title
int pages
container Library library opposite books
}

then, I would like to edit an instance of it like this (the syntax is just an example of what it could be), as text, with auto-completion based on the model.

Library {
Book[] {
Book {
title: "Harry Potter and the Deathly Hallows"
pages: 524
},
Book {
title: "The Black Cat"
pages: 63
}
}
}

Is there an easy way to do this?

Thanks,

David
Re: [XCore] edit instances with XText editor [message #1011025 is a reply to message #1010925] Mon, 18 February 2013 17:29 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
David,

This is really and Xtext question. A *.xcore resource logically
contains an EPackage and GenModel in the Resource.getContents so any
tool (such as Xtext) that needs *.ecore/*.genmodel should in principle
be able to work with a *.xcore resource.


On 18/02/2013 2:45 PM, David Michonneau wrote:
> I have an XCore model, and I would like to edit an instance of this
> model, not in the sample reflective editor, but in a XText based
> editor (similar to the one I use to author the model itself).
>
> For instance, my model is:
>
> class Library {
> contains Book[] books opposite library
> }
>
> class Book {
> String title
> int pages
> container Library library opposite books
> }
>
> then, I would like to edit an instance of it like this (the syntax is
> just an example of what it could be), as text, with auto-completion
> based on the model.
>
> Library {
> Book[] {
> Book { title: "Harry Potter and the Deathly Hallows"
> pages: 524
> },
> Book {
> title: "The Black Cat"
> pages: 63
> }
> }
> }
>
> Is there an easy way to do this?
>
> Thanks,
>
> David
Previous Topic:How should I model this relationship.
Next Topic:[XCore] Create dynamic instance with XMI ids
Goto Forum:
  


Current Time: Sat Sep 20 14:15:09 GMT 2014

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

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