|
Re: Annotation Genmodel vs Ecore [message #421164 is a reply to message #421153] |
Tue, 29 July 2008 15:41 |
David Steinberg 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 #421207 is a reply to message #421195] |
Wed, 30 July 2008 15:11 |
David Steinberg 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.
>
|
|
|
Powered by
FUDForum. Page generated in 0.03289 seconds