What is the best way to keep the meta data(or some info) for the diagram ? [message #1727859] |
Mon, 28 March 2016 11:38  |
Eclipse User |
|
|
|
Hi there,
Imagine there is an option for the user to choose the option of showing or hiding a transition label on the diagram. How can I keep that info e.g. showTransitionLabel=on | off.
One way could be creating an ecore metamodel an keep these info in it. but then the user needs to create the emf file for it and it will be tedious. One way could be to create a textfile and keep all the data in it.
So, if you have any experience on this matter, please help me which way is the standard way ?
Thanks,
Parsa
|
|
|
|
|
Re: What is the best way to keep the meta data(or some info) for the diagram ? [message #1728010 is a reply to message #1727950] |
Wed, 30 March 2016 04:55   |
Eclipse User |
|
|
|
On 29-Mar-16 19:00, Parsa Pourali wrote:
> Hi Felix,
>
> Thanks for your reply.
>
> Could you please tell me where should I define DAnnotation ? Is it in my
> ecore metamodel ?
Nope, DAnnotation is an element of sirius metamodel, not your domain
model. If you know Ecore EAnnotations, you know DAnnotations, they work
exactly the same way. You just need to define one yourself and attach it
to the corresponding Diagram or whatever element.
DAnnotation annot = ViewpointFactory.eINSTANCE.createDAnnotation();
annot.setSource("My Very Special Source")
annot.put("ShowAssociationClasses", Boolean.TRUE.toString())
DSemanticDiagram.getDAnnotations().add(myAnnotation)
Then later you check for these attributes in your predicate expressions.
> Also, that filter thing does not work for me, it is not only about
> transitions and labels. Consider a user can choose the option of showing
> an association as just an "Association Edge" or as an "Association Class".
Hmm, maybe a Filter would actually also work in this case. It's kind of
abusing the mechanism but well.. I just mention filters because they
allow you to store some per-diagram on/off state without tinkering with
annotations.
In your association edge example, maybe you could also use separate
layers for each representation.
I just mean to say that before using DAnnotations, try to find a more
"Sirius" way to do something.
Felix
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03622 seconds