Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Text from Ecore
Text from Ecore [message #725926] Fri, 16 September 2011 04:03 Go to next message
ModelGeek Mising name is currently offline ModelGeek Mising name
Messages: 498
Registered: June 2011
Senior Member
Hi,

I would like to generate Emfatic text from my Ecore model created programmatically in a standalone application. So my goal is to generate text from ecore in a standalone application.

For example the text should be like

class Library
{
attribute name : String[?];
property books#_'library' : Book[*] { composes };
property loans : Loan[*] { composes };
property members#_'library' : Member[*] { composes };
documentation 'this is just a documentation text';
documentation(sdfwd = 'this is text 2');
}

Please guide me
Re: Text from Ecore [message #725978 is a reply to message #725926] Fri, 16 September 2011 06:13 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 655
Registered: July 2009
Senior Member
As a "ModelGeek" you should know that you have to write a code generator
to achieve this. You can use any code genertion you want, e.g. Xtend2.
Start reading the docs, there are lots of code generation examples....

Am 16.09.11 10:03, schrieb ModelGeek:
> Hi,
>
> I would like to generate Emfatic text from my Ecore model created
> programmatically in a standalone application. So my goal is to generate
> text from ecore in a standalone application.
>
> For example the text should be like
> class Library
> {
> attribute name : String[?];
> property books#_'library' : Book[*] { composes };
> property loans : Loan[*] { composes };
> property members#_'library' : Member[*] { composes };
> documentation 'this is just a documentation text';
> documentation(sdfwd = 'this is text 2');
> }
>
> Please guide me


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Text from Ecore [message #726008 is a reply to message #725978] Fri, 16 September 2011 07:57 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising name
Messages: 498
Registered: June 2011
Senior Member
Thank you so much for you help, I know i need to write code generator but i mean in Eclipse there is an editor call OCLinEcore which presents Emfatic text for Ecore model. So this means there is already a code generator with template and workflow that can generate Emfatic text from Ecore model.
So i just want to resuse that existing generator in my standalone application. I want to know how to do that... if it is not possible to reuse that then obvioulsy i will consider writing my own.

help will be highly appreciated.

regards

Re: Text from Ecore [message #726084 is a reply to message #726008] Fri, 16 September 2011 10:15 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25907
Registered: July 2009
Senior Member
If OCL already provides for this, they likely have a resource
implementation for producing it. Ed W gave you a detailed answer that
assumed you wanted some kind of editor/viewer, rather than just the
ability to produce text. Make it clear to him you don't need all that
fancy stuff he talked about; you just want to reuse whatever he already
has (his resource implementation) for producing text so you could do
resource.save(System.out, null) and see that text...


On 16/09/2011 4:57 AM, ModelGeek wrote:
> Thank you so much for you help, I know i need to write code generator
> but i mean in Eclipse there is an editor call OCLinEcore which
> presents Emfatic text for Ecore model. So this means there is already
> a code generator with template and workflow that can generate Emfatic
> text from Ecore model.
> So i just want to resuse that existing generator in my standalone
> application. I want to know how to do that... if it is not possible to
> reuse that then obvioulsy i will consider writing my own.
>
> help will be highly appreciated.
>
> regards
>
>
Previous Topic:Node Model - Access Comment after element
Next Topic:[solved] Missing whitespace after XText serialization
Goto Forum:
  


Current Time: Tue Jul 22 07:40:27 EDT 2014

Powered by FUDForum. Page generated in 0.01822 seconds