Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » What is the best way to keep the meta data(or some info) for the diagram ?
What is the best way to keep the meta data(or some info) for the diagram ? [message #1727859] Mon, 28 March 2016 15:38 Go to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 210
Registered: February 2014
Senior Member
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 #1727902 is a reply to message #1727859] Tue, 29 March 2016 07:42 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
On 28-Mar-16 17:38, Parsa Pourali wrote:
> 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.


What I do in a similar case is to set a DAnnotation on a Diagram to
store filter state from an extension.

IIRC in Capella they use a dummy collapse filter and then access the
filter state in the label expression to show different labels.

Felix
Re: What is the best way to keep the meta data(or some info) for the diagram ? [message #1727950 is a reply to message #1727902] Tue, 29 March 2016 17:00 Go to previous messageGo to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 210
Registered: February 2014
Senior Member
Hi Felix,

Thanks for your reply.

Could you please tell me where should I define DAnnotation ? Is it in my ecore metamodel ?

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".

I also prefer not to embed it in my ecore meta model if there is another way of doing it.

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 08:55 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
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 #1728218 is a reply to message #1728010] Fri, 01 April 2016 04:12 Go to previous messageGo to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 210
Registered: February 2014
Senior Member
Hi Felix,

Thank you for your reply and help.

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?

- The thing is that
DAnnotation annot = ViewpointFactory.eINSTANCE.createDAnnotation();
does not have any createDAnnotation() method ! Am I doing something wrong ?

Thank you,
Bests,
Parsa
Re: What is the best way to keep the meta data(or some info) for the diagram ? [message #1728256 is a reply to message #1728218] Fri, 01 April 2016 11:24 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
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().
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 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
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
Re: What is the best way to keep the meta data(or some info) for the diagram ? [message #1728288 is a reply to message #1728269] Fri, 01 April 2016 16:11 Go to previous message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 210
Registered: February 2014
Senior Member
Thank you both, I can see what you guys are talking about now Smile
Thank you for your help Smile

Bests,
Parsa
Previous Topic:Sirius runtime as standalone applicatio (rcp?)
Next Topic:IllegalArgumentException: The feature 'xxx' is not a valid feature
Goto Forum:
  


Current Time: Fri Apr 19 02:37:14 GMT 2024

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

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

Back to the top