Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Annotation Genmodel vs Ecore
Annotation Genmodel vs Ecore [message #421153] Tue, 29 July 2008 08:44 Go to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hello,
I would like to add data about the code generation of my model, but I
don't know the difference between the "EAnnotation" of Ecore and the
"Annotate" of Genmodel.
Someone could help me?

Regards,
David.
Re: Annotation Genmodel vs Ecore [message #421164 is a reply to message #421153] Tue, 29 July 2008 15:41 Go to previous messageGo to next message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Hi David,

The difference is simply "E" vs. "Gen". ;)

EAnnotations can be contained by any Ecore model element (EAnnotation is
modeled as the type of the EModelElement.eAnnotations reference). So,
they can be used to add arbitrary information to anything in Ecore. You
can add an EAnnotation in the sample Ecore editor by right-clicking and
selecting New Child > EAnnotation.

GenAnnotations are similar, but they're defined in GenModel, which
defines the wrappers for Ecore model elements used in code generation
(GenAnnotation is modeled as the type of the GenBase.genAnnotations
reference). So, they can be used to add arbitrary information to any
element in generator model. You can add a GenAnnotation in the EMF
generator by right-clicking and selecting Annotate. GenAnnotations are
used much less frequently than EAnnotations (I believe the only use in
EMF right now is by model exporters to save user selections), so they're
not displayed by default. You'll only see them, and be allowed to create
them, if Generator > Show Annotations is selected from the pull-down menus.

Cheers,
Dave


David wrote:
> Hello,
> I would like to add data about the code generation of my model, but I
> don't know the difference between the "EAnnotation" of Ecore and the
> "Annotate" of Genmodel. Someone could help me?
>
> Regards,
> David.
>
Re: Annotation Genmodel vs Ecore [message #421195 is a reply to message #421164] Wed, 30 July 2008 08:20 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Thanks Dave for your answer.
I think I have to use Annotation in genmodel, in order to add data about
the code generation of my model. Nevertheless, I don't know how to use it,
I don't find exmaple.
Do you know where I can find some example/tutorial.

Regards,
David.
Re: Annotation Genmodel vs Ecore [message #421207 is a reply to message #421195] Wed, 30 July 2008 15:11 Go to previous message
David Steinberg is currently offline David SteinbergFriend
Messages: 489
Registered: July 2009
Senior Member
Hi David,

Do you mean an example of doing it programmatically? If so, I'd take a
look at GenModelUtil, in the org.eclipse.emf.codegen.ecore plug-in.
There are a couple of convenience methods there for easily checking and
adding entries to the details map of GenAnnotations with a source. Those
two methods illustrate how work with annotations, and, if you're only
annotating with textual information, you can use just those methods to
do it.

A more complicated example can be found in ModelExporter, in the
org.eclipse.emf.exporter plug-in.

Cheers,
Dave


David wrote:
> Thanks Dave for your answer.
> I think I have to use Annotation in genmodel, in order to add data about
> the code generation of my model. Nevertheless, I don't know how to use
> it, I don't find exmaple.
> Do you know where I can find some example/tutorial.
>
> Regards,
> David.
>
Previous Topic:HowTo specify that an EReference must be "mapped" on another?
Next Topic:StackOverflowError with package initialization "by loading"
Goto Forum:
  


Current Time: Thu Apr 25 17:42:01 GMT 2024

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

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

Back to the top