Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMT (Generative Modeling Technologies) » [xtext] How to use the generated ecore file?
[xtext] How to use the generated ecore file? [message #384433] Sun, 03 August 2008 14:04 Go to next message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1355
Registered: July 2009
Senior Member
the ecore file, generated in the src-gen directory; is there a way to
use it directly (e.g. to generate the emf model and to use the emf model
directly)?

I mean, if I want to access the emf model is there a way to do it
without generating all the stuff from the ecore file?

For instance, I'd like to have all the emf icons (and then change them)
so that I can then customize the icons of the elements in the outline
view; As for this last thing, could anyone provide an example of
customization of label and icon for the outline view?

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Re: [xtext] How to use the generated ecore file? [message #384651 is a reply to message #384433] Fri, 08 August 2008 06:34 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1762
Registered: July 2009
Senior Member
If you want to generate Java from the Ecore file you have to add a
corresponding genmodel file. The generation works as usual.
Note that at runtime (in editor and in standalone mode) the
EPackage.Registry has to be filled before the parser looks up the meta
model the first time. If it's not in the registry the parser will load
the ecore file and use it dynamically.

If you just use Xtend and Xpand to access the meta model you don't need
to generate any java classes since under the hood those languages use
EMF's reflection layer any way.

labels and icons are provided by adding label(MyType) and icon(MyType)
extension to EditorExtensions.ext (in the editor plugin).

example:

label(State this) :
name;

icon(State this) :
"state.gif";

given that there is an image 'state.gif' within the icons/ folder.

Sven


Lorenzo Bettini schrieb:
> the ecore file, generated in the src-gen directory; is there a way to
> use it directly (e.g. to generate the emf model and to use the emf model
> directly)?
>
> I mean, if I want to access the emf model is there a way to do it
> without generating all the stuff from the ecore file?
>
> For instance, I'd like to have all the emf icons (and then change them)
> so that I can then customize the icons of the elements in the outline
> view; As for this last thing, could anyone provide an example of
> customization of label and icon for the outline view?
>
> thanks in advance
> Lorenzo
>


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [xtext] How to use the generated ecore file? [message #384658 is a reply to message #384651] Fri, 08 August 2008 09:22 Go to previous message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1355
Registered: July 2009
Senior Member
Sven Efftinge wrote:
> If you want to generate Java from the Ecore file you have to add a
> corresponding genmodel file. The generation works as usual.

I did that, but I cannot add the genmodel in the src-gen otherwise it
will be erased when running the workflow.

If I create the genmodel on another directory (under src) then the
..ecore file will be copied also in that directory and then I'll have to
take care of copying it again each time I run the workflow and the
generated .ecore is re-generated... am I missing something?

> Note that at runtime (in editor and in standalone mode) the
> EPackage.Registry has to be filled before the parser looks up the meta
> model the first time. If it's not in the registry the parser will load
> the ecore file and use it dynamically.

mh... I don't understand this part sorry...

>
> If you just use Xtend and Xpand to access the meta model you don't need
> to generate any java classes since under the hood those languages use
> EMF's reflection layer any way.
>
> labels and icons are provided by adding label(MyType) and icon(MyType)
> extension to EditorExtensions.ext (in the editor plugin).
>
> example:
>
> label(State this) :
> name;
>
> icon(State this) :
> "state.gif";
>
> given that there is an image 'state.gif' within the icons/ folder.

concerning this part I managed to customize it :-)

thanks
Lorenzo

>
>
> Lorenzo Bettini schrieb:
>> the ecore file, generated in the src-gen directory; is there a way to
>> use it directly (e.g. to generate the emf model and to use the emf
>> model directly)?
>>
>> I mean, if I want to access the emf model is there a way to do it
>> without generating all the stuff from the ecore file?
>>
>> For instance, I'd like to have all the emf icons (and then change
>> them) so that I can then customize the icons of the elements in the
>> outline view; As for this last thing, could anyone provide an example
>> of customization of label and icon for the outline view?
>>
>> thanks in advance
>> Lorenzo
>>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Re: [xtext] How to use the generated ecore file? [message #618903 is a reply to message #384433] Fri, 08 August 2008 06:34 Go to previous message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1762
Registered: July 2009
Senior Member
If you want to generate Java from the Ecore file you have to add a
corresponding genmodel file. The generation works as usual.
Note that at runtime (in editor and in standalone mode) the
EPackage.Registry has to be filled before the parser looks up the meta
model the first time. If it's not in the registry the parser will load
the ecore file and use it dynamically.

If you just use Xtend and Xpand to access the meta model you don't need
to generate any java classes since under the hood those languages use
EMF's reflection layer any way.

labels and icons are provided by adding label(MyType) and icon(MyType)
extension to EditorExtensions.ext (in the editor plugin).

example:

label(State this) :
name;

icon(State this) :
"state.gif";

given that there is an image 'state.gif' within the icons/ folder.

Sven


Lorenzo Bettini schrieb:
> the ecore file, generated in the src-gen directory; is there a way to
> use it directly (e.g. to generate the emf model and to use the emf model
> directly)?
>
> I mean, if I want to access the emf model is there a way to do it
> without generating all the stuff from the ecore file?
>
> For instance, I'd like to have all the emf icons (and then change them)
> so that I can then customize the icons of the elements in the outline
> view; As for this last thing, could anyone provide an example of
> customization of label and icon for the outline view?
>
> thanks in advance
> Lorenzo
>


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [xtext] How to use the generated ecore file? [message #619449 is a reply to message #384651] Fri, 08 August 2008 09:22 Go to previous message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1355
Registered: July 2009
Senior Member
Sven Efftinge wrote:
> If you want to generate Java from the Ecore file you have to add a
> corresponding genmodel file. The generation works as usual.

I did that, but I cannot add the genmodel in the src-gen otherwise it
will be erased when running the workflow.

If I create the genmodel on another directory (under src) then the
..ecore file will be copied also in that directory and then I'll have to
take care of copying it again each time I run the workflow and the
generated .ecore is re-generated... am I missing something?

> Note that at runtime (in editor and in standalone mode) the
> EPackage.Registry has to be filled before the parser looks up the meta
> model the first time. If it's not in the registry the parser will load
> the ecore file and use it dynamically.

mh... I don't understand this part sorry...

>
> If you just use Xtend and Xpand to access the meta model you don't need
> to generate any java classes since under the hood those languages use
> EMF's reflection layer any way.
>
> labels and icons are provided by adding label(MyType) and icon(MyType)
> extension to EditorExtensions.ext (in the editor plugin).
>
> example:
>
> label(State this) :
> name;
>
> icon(State this) :
> "state.gif";
>
> given that there is an image 'state.gif' within the icons/ folder.

concerning this part I managed to customize it :-)

thanks
Lorenzo

>
>
> Lorenzo Bettini schrieb:
>> the ecore file, generated in the src-gen directory; is there a way to
>> use it directly (e.g. to generate the emf model and to use the emf
>> model directly)?
>>
>> I mean, if I want to access the emf model is there a way to do it
>> without generating all the stuff from the ecore file?
>>
>> For instance, I'd like to have all the emf icons (and then change
>> them) so that I can then customize the icons of the elements in the
>> outline view; As for this last thing, could anyone provide an example
>> of customization of label and icon for the outline view?
>>
>> thanks in advance
>> Lorenzo
>>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Previous Topic:[xtext] testing the parser
Next Topic:Re: [xtext] testing the parser
Goto Forum:
  


Current Time: Sat Sep 20 18:18:17 GMT 2014

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

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