Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » TriggerListener for changing values of Element properties from Stereotype
TriggerListener for changing values of Element properties from Stereotype [message #473318] Wed, 27 June 2007 09:44 Go to next message
Francis Gavino is currently offline Francis GavinoFriend
Messages: 57
Registered: July 2009
Member
Hi,

I need to create a transaction listener (E.g.
org.eclipse.emf.transaction.TriggerListener) that listens to changes in
the values of Element properties from an applied Stereotype.

For example:
A Behavior (named Foo) and a corresponding CallBehaviorAction (named
FooAction) has an applied Stereotype (named FooStereotype) which has a
Property (named fooStereotypeProperty). When the value of
fooStereotypeProperty of Foo changes, I want to do something and change
also the value of fooStereotypeProperty of FooAction (and vice-versa).

I tried to inspect the Notification but I can't find a way to have access
to the owner of the property (in this case, it's Foo). This is also an EMF
question but I'm not sure where to post it so pardon me if this should be
in the EMF thread.

Thanks,
Francis
Re: TriggerListener for changing values of Element properties from Stereotype [message #473329 is a reply to message #473318] Wed, 27 June 2007 14:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Francis,

This isn't really an EMF question, because you're dealing with the
relationship of stereotype applications to elements, which is a UML thing
:-)

Anyway, the owner of the fooStereotypeProperty that changed and which is the
subject of the Notification is the FooStereotype application (instance).
Get this by casting the result of Notification::getNotifier() as an
EObject.

If you want the element (Foo or FooAction) to which this FooStereotype
instance is applied, use the UMLUtil::getBaseElement(EObject) utility
method.

HTH,

Christian


Francis wrote:

> Hi,
>
> I need to create a transaction listener (E.g.
> org.eclipse.emf.transaction.TriggerListener) that listens to changes in
> the values of Element properties from an applied Stereotype.
>
> For example:
> A Behavior (named Foo) and a corresponding CallBehaviorAction (named
> FooAction) has an applied Stereotype (named FooStereotype) which has a
> Property (named fooStereotypeProperty). When the value of
> fooStereotypeProperty of Foo changes, I want to do something and change
> also the value of fooStereotypeProperty of FooAction (and vice-versa).
>
> I tried to inspect the Notification but I can't find a way to have access
> to the owner of the property (in this case, it's Foo). This is also an EMF
> question but I'm not sure where to post it so pardon me if this should be
> in the EMF thread.
>
> Thanks,
> Francis
Re: TriggerListener for changing values of Element properties from Stereotype [message #473443 is a reply to message #473329] Thu, 28 June 2007 05:20 Go to previous message
Francis Gavino is currently offline Francis GavinoFriend
Messages: 57
Registered: July 2009
Member
Hi Christian,

Thanks for the excellent solution! It works perfectly! :-)

Francis

Christian W. Damus wrote:

> Hi, Francis,

> This isn't really an EMF question, because you're dealing with the
> relationship of stereotype applications to elements, which is a UML thing
> :-)

> Anyway, the owner of the fooStereotypeProperty that changed and which is the
> subject of the Notification is the FooStereotype application (instance).
> Get this by casting the result of Notification::getNotifier() as an
> EObject.

> If you want the element (Foo or FooAction) to which this FooStereotype
> instance is applied, use the UMLUtil::getBaseElement(EObject) utility
> method.

> HTH,

> Christian
Re: TriggerListener for changing values of Element properties from Stereotype [message #622589 is a reply to message #473318] Wed, 27 June 2007 14:17 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Francis,

This isn't really an EMF question, because you're dealing with the
relationship of stereotype applications to elements, which is a UML thing
:-)

Anyway, the owner of the fooStereotypeProperty that changed and which is the
subject of the Notification is the FooStereotype application (instance).
Get this by casting the result of Notification::getNotifier() as an
EObject.

If you want the element (Foo or FooAction) to which this FooStereotype
instance is applied, use the UMLUtil::getBaseElement(EObject) utility
method.

HTH,

Christian


Francis wrote:

> Hi,
>
> I need to create a transaction listener (E.g.
> org.eclipse.emf.transaction.TriggerListener) that listens to changes in
> the values of Element properties from an applied Stereotype.
>
> For example:
> A Behavior (named Foo) and a corresponding CallBehaviorAction (named
> FooAction) has an applied Stereotype (named FooStereotype) which has a
> Property (named fooStereotypeProperty). When the value of
> fooStereotypeProperty of Foo changes, I want to do something and change
> also the value of fooStereotypeProperty of FooAction (and vice-versa).
>
> I tried to inspect the Notification but I can't find a way to have access
> to the owner of the property (in this case, it's Foo). This is also an EMF
> question but I'm not sure where to post it so pardon me if this should be
> in the EMF thread.
>
> Thanks,
> Francis
Re: TriggerListener for changing values of Element properties from Stereotype [message #622656 is a reply to message #473329] Thu, 28 June 2007 05:20 Go to previous message
Francis Gavino is currently offline Francis GavinoFriend
Messages: 57
Registered: July 2009
Member
Hi Christian,

Thanks for the excellent solution! It works perfectly! :-)

Francis

Christian W. Damus wrote:

> Hi, Francis,

> This isn't really an EMF question, because you're dealing with the
> relationship of stereotype applications to elements, which is a UML thing
> :-)

> Anyway, the owner of the fooStereotypeProperty that changed and which is the
> subject of the Notification is the FooStereotype application (instance).
> Get this by casting the result of Notification::getNotifier() as an
> EObject.

> If you want the element (Foo or FooAction) to which this FooStereotype
> instance is applied, use the UMLUtil::getBaseElement(EObject) utility
> method.

> HTH,

> Christian
Previous Topic:How I keep Stereotype tagged value when create ecore from UML model?
Next Topic:org.eclipse.emf.ecore.xmi.IllegalValueException
Goto Forum:
  


Current Time: Tue Sep 26 18:23:41 GMT 2017

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

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