[XCore] edit instances with XText editor [message #1010925] |
Mon, 18 February 2013 08:45  |
Eclipse User |
|
|
|
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 12:29  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.04347 seconds