Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Listen for (re)application of a profile
Listen for (re)application of a profile [message #1696313] Mon, 25 May 2015 14:00 Go to next message
Patrik Nandorf is currently offline Patrik NandorfFriend
Messages: 195
Registered: January 2013
Location: Sweden
Senior Member
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 14:00]

Report message to a moderator

Re: Listen for (re)application of a profile [message #1696320 is a reply to message #1696313] Mon, 25 May 2015 15:10 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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 17:08 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

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 17:11 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

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 07:48 Go to previous message
Patrik Nandorf is currently offline Patrik NandorfFriend
Messages: 195
Registered: January 2013
Location: Sweden
Senior Member
Thanks Christian
Previous Topic:Cannot apply SysML stereotype
Next Topic:XMI serialization
Goto Forum:
  


Current Time: Tue Apr 16 13:42:06 GMT 2024

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

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

Back to the top