Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 20:33 Go to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 193
Registered: February 2014
Senior Member
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 20:53 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1176
Registered: July 2009
Location: Canada
Senior Member

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 21:26 Go to previous message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 193
Registered: February 2014
Senior Member
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: Sun Sep 23 22:27:36 GMT 2018

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

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

Back to the top