Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » regarding ResourceSetModificationListener
regarding ResourceSetModificationListener [message #224176] Thu, 02 April 2009 18:18 Go to next message
Eclipse UserFriend
Originally posted by: bmoros.um.es

Hi all,

Apart from knowing the resource which has changed when the notification
arrived to XXXDocumentProvider, and the event type, is it possible to know
the element in that resource which has changed? The object returned by the
call notification.getNewValue() does not properly shown the value that I
need.

For example, my DSL diagram editor is opened in a resource (R1) and some
elements are linked to some elements in a UML class diagram opened in
another resource (R2). If the name of a linked class is changed in R2, R1 is
properly updated but I do not know which element in R2 caused the
ResourceSetModification notification. Could I get it some how?

Thanks in advance for your time,

Bego
Re: regarding ResourceSetModificationListener [message #224237 is a reply to message #224176] Fri, 03 April 2009 09:49 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Begoa,

ResourceSetModificationListener is listening only for changes in Resource.RESOURCE__IS_MODIFIED
feature. If you need to listen for any other notification you can either
modify this class or create own suclass of EContentAdapter listening for
an appropriate feature(s).

-----------------
Alex Shatalin
Re: regarding ResourceSetModificationListener [message #224243 is a reply to message #224176] Fri, 03 April 2009 09:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bmoros.um.es

Hi all again,

In order to known the element which has been changed in the UML resource
(R2), I am trying to get the last executed command or the undoCommand (since
the change done in R2 can be undone) in the
XXXDocumentProvider#handleElementChanged method since this is the method
which is executed when the resource change notification arrived. But the
result of info.getEditingDomain().getCommandStack().getMostRecentComma nd()
is null. Could anybody explain me why? is there any other way to get the
element which has changed in other resource?

Some help would be appreciated!!

Best regards,
Bego
Re: regarding ResourceSetModificationListener [message #224431 is a reply to message #224237] Mon, 06 April 2009 11:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bmoros.um.es

Hi Alex,

I have not managed to get the element which has changed from other Resource
in the ResourceSet by listening ResourceSet modifications. Now, I am trying
adding an adapter to the EObject which belong to other resource (for
instance, a UML class diagram) when it is linked to my model (as I explained
in a previous post, in my metamodel de Artifact EClass is linked to a
generic EObject). By adding this adapter I hoped to receive the change
notifications from this EObject. However, the only notification sended is
REMOVING_ADAPTER. I really do not understand what it is happening. Could
you help me?

Thanks in advance!!

Bego
Re: regarding ResourceSetModificationListener [message #224445 is a reply to message #224431] Mon, 06 April 2009 12:10 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Begoa,

Are you sure you've used proper instance of EObject (one wich was modified
later on?)
Try subclassing EContentAdapter as I suggested in prev. post.

-----------------
Alex Shatalin
Re: regarding ResourceSetModificationListener [message #224512 is a reply to message #224445] Mon, 06 April 2009 15:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bmoros.um.es

Hello Alex,

I have tryed it. I have defined a new subclass of EContentAdapter and I have
added it to the list of ResourceSet adapters. I have defined the
NotificationFilter as ANY just to print the information received in the
Notification parameter of the method notifyChanged when something changes in
a Resource. The problem is that I do not receive the information I need, for
instance the SET event of any EObject which belongs to other diagram. The
notifier of the SET event is the Resource which has changed but I need to
know the specific element which has changed in that Resource.

I am sending attached an excerpt from the metamodel to better explain the
problem. As the attached figure shows, the Artifact class in my metamodel is
linked to an EObject from any other metamodel. If something in this EObject
changes (for instance the name of the class in a UML class diagram), the
object of A class has to know it since it is related to the changed
Artefact by means of the Trace relationship.

I hope I explain myself ...

Thank you very much for your time!!

Bego
  • Attachment: metamodel.JPG
    (Size: 11.35KB, Downloaded 129 times)
Re: regarding ResourceSetModificationListener [message #224521 is a reply to message #224512] Mon, 06 April 2009 16:21 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Begoña,

Did you cann super.notifyChanged(notification); in the end of notifyChanged()
method? This is important to assign your adapter onto the whole tree of elements..

-----------------
Alex Shatalin
Re: regarding ResourceSetModificationListener [message #224544 is a reply to message #224521] Mon, 06 April 2009 16:53 Go to previous message
Eclipse UserFriend
Originally posted by: bmoros.um.es

Hello Alex,

Yes, I did. Since this solution did not work for me, this is the reason why
I tryed to add a listener directly to the EObject linked to the Artifact
when it is set. But it does not work either.

I am really stuck!!

Thank you very much for your time.

"Alex Shatalin" <vano@borland.com> escribi
Previous Topic:adding attribute content to Canvas
Next Topic:[Announce] GMF 2.2.0 I200904031729 is available
Goto Forum:
  


Current Time: Thu Apr 25 13:00:13 GMT 2024

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

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

Back to the top