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: 165
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: 5930
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 W. Damus is currently offline Christian W. DamusFriend
Messages: 1172
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 W. Damus is currently offline Christian W. DamusFriend
Messages: 1172
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: 165
Registered: January 2013
Location: Sweden
Senior Member
Thanks Christian
Previous Topic:Cannot apply SysML stereotype
Next Topic:XMI serialization
Goto Forum:
  


Current Time: Sun Jun 24 22:54:00 GMT 2018

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

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

Back to the top