Skip to main content



      Home
Home » Modeling » UML2 » Listen for (re)application of a profile
Listen for (re)application of a profile [message #1696313] Mon, 25 May 2015 10:00 Go to next message
Eclipse UserFriend
Is there a way to listen for (re)application of a profile on a model?

I'd like to run some code when a profile is applied or updated.

/Patrik

[Updated on: Mon, 25 May 2015 10:00] by Moderator

Re: Listen for (re)application of a profile [message #1696320 is a reply to message #1696313] Mon, 25 May 2015 11:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi

EMF allows an org.eclipse.emf.common.notify.Adapter to be added to any
EObject and it will receive notifications of all chnages to the EObject,
so just add an Adapter to the Packages in which you are interested.

The EMF book has much more detail.

Regards

Ed Willink


On 25/05/2015 15:00, Patrik Nandorf wrote:
> Is there a way to listen for (re)application of a profile on a model?
>
> I'd like to run some code when a profile is applied or updated.
>
> /Patrik
Re: Listen for (re)application of a profile [message #1696325 is a reply to message #1696313] Mon, 25 May 2015 13:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi, Patrik,

If you're working in Papyrus, have a look at the
org.eclipse.papyrus.uml.tools.listeners.ProfileApplicationListener
class and search references to it for examples of how it's used. This
provides a custom notification, sent by a Package, when profiles are
applied or unapplied. Most significantly, it accounts for "external"
profile applications that actually don't modify the package at all in
real EMF terms when they are created and destroyed.

HTH,

Christian

On 2015-05-25 14:00:24 +0000, Patrik Nandorf said:

> Is there a way to listen for (re)application of a profile on a model?
>
> I'd like to run some code when a profile is applied or updated.
>
> /Patrik
Re: Listen for (re)application of a profile [message #1696326 is a reply to message #1696325] Mon, 25 May 2015 13:11 Go to previous messageGo to next message
Eclipse UserFriend
I should clarify: the Papyrus editor uses this listener internally to
dispatch ProfileApplicationNotifications on Packages. You don't
interact with the ProfileApplicationListener, as such, but just receive
the notifications in the usual way, via Adapter or ResourceSetListener.

cW


On 2015-05-25 17:08:18 +0000, Christian W. Damus said:

> Hi, Patrik,
>
> If you're working in Papyrus, have a look at the
> org.eclipse.papyrus.uml.tools.listeners.ProfileApplicationListener
> class and search references to it for examples of how it's used. This
> provides a custom notification, sent by a Package, when profiles are
> applied or unapplied. Most significantly, it accounts for "external"
> profile applications that actually don't modify the package at all in
> real EMF terms when they are created and destroyed.
>
> HTH,
>
> Christian
>
> On 2015-05-25 14:00:24 +0000, Patrik Nandorf said:
>
>> Is there a way to listen for (re)application of a profile on a model?
>>
>> I'd like to run some code when a profile is applied or updated.
>>
>> /Patrik
Re: Listen for (re)application of a profile [message #1697175 is a reply to message #1696326] Tue, 02 June 2015 03:48 Go to previous message
Eclipse UserFriend
Thanks Christian
Previous Topic:Cannot apply SysML stereotype
Next Topic:XMI serialization
Goto Forum:
  


Current Time: Wed Jul 23 13:43:02 EDT 2025

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

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

Back to the top