Skip to main content



      Home
Home » Modeling » EMF » Modify the element's attribute (Att1) when the element's (Att2) changes
Modify the element's attribute (Att1) when the element's (Att2) changes [message #1793937] Mon, 20 August 2018 16:33 Go to next message
Eclipse UserFriend
Hello,

I am trying to listen to an attribute of an element and change another attribute of that same element accordingly.

for example if the user sets the Att1 to "On Aspect Light", then I set the value of Att2 to "Green", if he set the Att1 to "Two Aspects Light", then I set the Att2 to "Green,Red", and if set the Att1 to "Three Aspects light", then I set the Att2 to "Green, Yellow, Red".

I tried to use a resource change listener, but unfortunately it throws error saying that the read adn write modifications cannot be done at the same context.

Do you know any other ways that I could use?

Thanks,
Parsa
Re: Modify the element's attribute (Att1) when the element's (Att2) changes [message #1793938 is a reply to message #1793937] Mon, 20 August 2018 16:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi, Parsa,

Sounds like you're in a TransactionalEditingDomain. What you are looking to do is one of the use cases of "trigger commands". Instead of a post-commit listener, implement a pre-commit listener that returns a Command (could be a compound) that makes the changes that you need in your objects. See the tutorial documentation in the Help for details.

HTH,

Christian
Re: Modify the element's attribute (Att1) when the element's (Att2) changes [message #1793941 is a reply to message #1793938] Mon, 20 August 2018 17:26 Go to previous message
Eclipse UserFriend
Thanks a lot Christian,

Seems to be working now :)

Cheers,
Parsa
Previous Topic:Resolving package URI from workspace plugin with E4 model editor
Next Topic:Custom icons under Oxygen
Goto Forum:
  


Current Time: Tue Jul 08 01:59:17 EDT 2025

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

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

Back to the top