Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » add a listener to a diagram element
add a listener to a diagram element [message #1726631] Tue, 15 March 2016 09:26 Go to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
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]

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 Go to previous messageGo to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
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 #1726790 is a reply to message #1726781] Wed, 16 March 2016 14:00 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi,

Sirius is based on GMF, and GMF based on GEF, then you can API of these
frameworks also.
For your need you can use a precommit, i.e. a ResourceSetListener, to
update some model elements according to some changes. See [1]

[1]
http://www.linuxtopia.org/online_books/eclipse_documentation/eclipse_emf_model_transaction_developer_guide/topic/org.eclipse.emf.transaction.doc/references/overview/eclipse_emf_model_transaction_listeners.html

Best Regards.

Le 16/03/2016 14:24, Alx Hvx a écrit :
> 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 ?



--
Esteban Dugueperoux - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: add a listener to a diagram element [message #1726812 is a reply to message #1726790] Wed, 16 March 2016 16:16 Go to previous messageGo to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
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 #1726813 is a reply to message #1726790] Wed, 16 March 2016 16:17 Go to previous messageGo to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
MULTIPLE POST BUG : TO DELETE

[Updated on: Wed, 16 March 2016 16:27]

Report message to a moderator

Re: add a listener to a diagram element [message #1726814 is a reply to message #1726790] Wed, 16 March 2016 16:18 Go to previous messageGo to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
MULTIPLE POST BUG : TO DELETE

[Updated on: Wed, 16 March 2016 16:28]

Report message to a moderator

Re: add a listener to a diagram element [message #1726815 is a reply to message #1726790] Wed, 16 March 2016 16:18 Go to previous messageGo to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
MULTIPLE POST BUG : TO DELETE

[Updated on: Wed, 16 March 2016 16:28]

Report message to a moderator

Re: add a listener to a diagram element [message #1726816 is a reply to message #1726790] Wed, 16 March 2016 16:18 Go to previous messageGo to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
No Message Body

[Updated on: Wed, 16 March 2016 16:28]

Report message to a moderator

Re: add a listener to a diagram element [message #1726818 is a reply to message #1726790] Wed, 16 March 2016 16:19 Go to previous messageGo to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
No Message Body

[Updated on: Wed, 16 March 2016 16:28]

Report message to a moderator

Re: add a listener to a diagram element [message #1726819 is a reply to message #1726790] Wed, 16 March 2016 16:19 Go to previous messageGo to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
No Message Body

[Updated on: Wed, 16 March 2016 16:28]

Report message to a moderator

Re: add a listener to a diagram element [message #1726820 is a reply to message #1726790] Wed, 16 March 2016 16:19 Go to previous messageGo to next message
Alx Hvx is currently offline Alx HvxFriend
Messages: 40
Registered: March 2016
Member
No Message Body

[Updated on: Wed, 16 March 2016 16:29]

Report message to a moderator

Re: add a listener to a diagram element [message #1727748 is a reply to message #1726790] Sat, 26 March 2016 16:47 Go to previous messageGo to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 210
Registered: February 2014
Senior Member
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]

Report message to a moderator

Re: add a listener to a diagram element [message #1853165 is a reply to message #1727748] Tue, 21 June 2022 13:39 Go to previous message
AMir Taghizadegan is currently offline AMir TaghizadeganFriend
Messages: 32
Registered: May 2022
Member
Hi parsa,
do you have a solution?
Previous Topic:Validation of the odesign file fails
Next Topic:Add a listener to a diagram element on sirius web
Goto Forum:
  


Current Time: Thu Mar 28 12:50:23 GMT 2024

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

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

Back to the top