Home » Eclipse Projects » Sirius » How to find if a diagram is already created for an element ?
|
Re: How to find if a diagram is already created for an element ? [message #1716534 is a reply to message #1716179] |
Fri, 04 December 2015 16:01 |
|
Hi Parsa,
You can use the API
DialectManager.INSTANCE.getRepresentations(semanticElement,
currentSiriusSession) to find every representation created on
"semanticElement" and then investigate if a State Machine Diagram exists
among them.
Regards,
Steve
Le 02/12/2015 01:41, Parsa Pourali a écrit :
> Hi,
>
> I have a Feature F, I need to create an State Machine Diagram (Canvas)
> for F. I can do it now. I can also open the corresponding diagram by
> double clicking on the feature F. But here is the question:
>
> When I want to create the diagram for feature F, I need to check that a
> diagram has already been created for the feature F or not! If, it has
> already been created, don't create it again! How to do this ?
>
> Thanks,
> Regards,
> Parsa
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: How to find if a diagram is already created for an element ? [message #1716538 is a reply to message #1716534] |
Fri, 04 December 2015 16:24 |
|
Hello,
I replied a bit too fast and overlooked that you want it for a double
click tool. In your tool, you can add a precondition expression without
using a java service. The expression would look like this:
aql:not(self.eInverse()->filter(diagram::DDiagram).description.name->includes('yourDiagramID'))
where yourDiagramID is the name you sent in the VSM for your State
Machine Diagram.
Regards,
Steve
Le 04/12/2015 17:01, Steve Monnier a écrit :
> Hi Parsa,
>
> You can use the API
> DialectManager.INSTANCE.getRepresentations(semanticElement,
> currentSiriusSession) to find every representation created on
> "semanticElement" and then investigate if a State Machine Diagram exists
> among them.
>
> Regards,
> Steve
>
> Le 02/12/2015 01:41, Parsa Pourali a écrit :
>> Hi,
>>
>> I have a Feature F, I need to create an State Machine Diagram (Canvas)
>> for F. I can do it now. I can also open the corresponding diagram by
>> double clicking on the feature F. But here is the question:
>>
>> When I want to create the diagram for feature F, I need to check that a
>> diagram has already been created for the feature F or not! If, it has
>> already been created, don't create it again! How to do this ?
>>
>> Thanks,
>> Regards,
>> Parsa
>
>
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Re: How to find if a diagram is already created for an element ? [message #1716679 is a reply to message #1716544] |
Mon, 07 December 2015 13:30 |
|
Le 04/12/2015 17:56, Parsa Pourali a écrit :
> Hi Steve,
>
> Thanks a lot for your help. I have three Questions now:
>
> 1- If I'm gonna use DialectManager (someday), should I write a Java
> Service and use it in that service?
Not necessarily. DialectManager can be used to drive Sirius from code
which is not invoked from inside a VSM. For example from a normal
Eclipse action/handler, or a wizard, etc.
> 2- What should I refer to as a session ? With Java service I have access
> to the EObject that triggering the java service, should I just use
> SessionManager.INSTANCE.getSession(theSemanticElement to get the active
> session ?
Yes, if you have a semantic/busniess model element which comes from a
Sirius session that is the recommended API to obtain the corresponding
session.
> 3- I'm using the aql expr you kindly posted, I could manage to use
> eInverse() and it return several elements. However, when I use eInverse
> (diagram::DDiagram), it returns null. And I am sure that there is a
> representation for it. so it shuld not be empty. So, I used eInverse
> (diagram::DDiagramElement) and it returned two elements which I can see
> are diagram elements. The problem with using DDiagramElement is that
> there is no description attribute for it :( Do you have any idea why
> diagram::DDiagram returns empty ?
No, from the look of the expression Steve provided, I would say it
should work. Provided there is really a diagram "rooted" on that element
(not just where the element appears on the diagram) inside the same
Sirius session.
Regards,
Pierre-Charles
--
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Goto Forum:
Current Time: Wed Apr 17 21:47:00 GMT 2024
Powered by FUDForum. Page generated in 0.01822 seconds
|