|
|
|
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 08:55 |
Felix Dorner Messages: 392 Registered: December 2015 |
Senior Member |
|
|
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
|
|
|
|
|
Re: What is the best way to keep the meta data(or some info) for the diagram ? [message #1728269 is a reply to message #1728256] |
Fri, 01 April 2016 13:12 |
|
Hi Parsa,
Le 01/04/2016 13:24, Felix Dorner a écrit :
> On 01-Apr-16 06:12, Parsa Pourali wrote:
>
>> I have tried to :
>> -create a java service which will be run on the first time that the
>> diagram is being created. Am I doing it right?
>
> A Java service is just something you can use in an expression in your
> odesign model... It's not being called on Diagram creation. If you still
> need more help, it would be better if you'd give a concrete problem that
> you're trying to solve. Otherwise it's going to be hard.
>
>> - The thing is that DAnnotation annot =
>> ViewpointFactory.eINSTANCE.createDAnnotation();
>> does not have any createDAnnotation() method ! Am I doing something
>> wrong ?
>
> Sorry, I was too fast. Whenever you need to create some EObject, just
> look up the correct factory by looking at the last segment in the
> package name:
>
> Ctrl+Shift+T : DAnnotation => You can see that it's in
> ...viewpoint.description, this means you use
> DescriptionFactory.eINSTANCE.createDAnnotation().
DAnnotation will allow you to store details in a Map<String, String>.
Maybe you should use the AnnotationEntry concept
(DescriptionFactory.eInstance.createAnnotationEntry()) which also has a
source String attribute to identifie it but have a data containment
EReference in which you can store your additional information if it is a
model. In this case take a look at
DRepresentation.getOwnedAnnotationEntries() (also available on DDiagram
which inherits from DRepresentation) and annotation getters from
DRepresentationQuery.
Regards
--
Maxime - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Powered by
FUDForum. Page generated in 0.01768 seconds