add a listener to a diagram element [message #1726631] |
Tue, 15 March 2016 09:26  |
Eclipse User |
|
|
|
Hi everybody,
For my project I have to listen to an element of a diagram an do some actions when the user clic or modify something on it.
For exemple when a field of an element is changed I want to automaticly change the value of another field. Do you know how to do that ?
Another thing I need to do (more complicated I think) is to get the layout position of an element (x and y) on the diagram and store those values on a field of it. For exemple if I drag the element on the diagram from position x=50, y=50 to x=100, y=100 I need that field of this element to automaticly change to x=100 and y=100.
I tried to modify the .aird file but it makes the diagram crash.
Is this something possible to do with Sirius ?
Thank you !
Alex
[Updated on: Wed, 16 March 2016 08:58] by Moderator Report message to a moderator
|
|
|
Re: add a listener to a diagram element [message #1726781 is a reply to message #1726631] |
Wed, 16 March 2016 13:24   |
Eclipse User |
|
|
|
After some research It seems like it is possible to do what I need with the GMF Runtime plugin, the problem is that I have absolutely no idea on how to access that plugin with a Sirius diagram. Maybe I need to create and open the diagrams programmaticly ?
|
|
|
|
Re: add a listener to a diagram element [message #1726812 is a reply to message #1726790] |
Wed, 16 March 2016 16:16   |
Eclipse User |
|
|
|
Thanks for your reply,
I also found this post with approximately the same question as mine : https://www.eclipse.org/forums/index.php/t/1068712/
The answer says that it's possible to use the org.eclipse.sirius.diagram.ui.business.api.view.SiriusGMFHelper.getGMFNode(DDiagramElement) method to do it.
As I am not really familiar with Siruis I don't know witch solution is the best (between the pre-commit and the helper) and I don't kwow how to get the DDiagramElement programmaticly. Do you have an idea ?
Alex.
|
|
|
|
|
|
|
|
|
|
Re: add a listener to a diagram element [message #1727748 is a reply to message #1726790] |
Sat, 26 March 2016 16:47   |
Eclipse User |
|
|
|
Hi Esteban,
Could you please elaborate more on registering the listeners as an extension?
- Should we add the extension in the EMF project plugin or to the Sirius (design) project plug-in ?
- What is the Editing Domain ? is it our EMF project ?
<extension point="org.eclipse.emf.transaction.listeners">
<listener class="org.eclipse.example.MyListener">
<editingDomain id="org.eclipse.example.MyEditingDomain"/>
</listener>
</extension>
Thanks,
Parsa
[Updated on: Sat, 26 March 2016 16:52] by Moderator Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04150 seconds