Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Observe creation/deletion of Representations/Descriptors
Observe creation/deletion of Representations/Descriptors [message #1794754] Thu, 06 September 2018 07:18 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 275
Registered: December 2015
Senior Member
Hi,

I have to observe all representations in a session. When the session opens I can get all existing representations via DialectManager.getAllRepresentationDescriptors(), but getting hold of newly added representations (and their descriptors) requirese some boilerplate adapter code. Maybe we could add some support for this in Sirius? I have seen that all installed Dialects DO get notified about newly created representations via org.eclipse.sirius.business.api.dialect.RepresentationNotification, but I haven't seen any dialect actually use this feature.. Maybe we could extend sirius to allow registration of listeners to this interface? (And while at it, maybe we could update/extend the interface to use representation descriptors instead). Otherwise, I could try to write the adapter code and submit it as a patch so others can use it too.





Re: Observe creation/deletion of Representations/Descriptors [message #1794761 is a reply to message #1794754] Thu, 06 September 2018 08:15 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 161
Registered: June 2017
Senior Member
Hi,

We surely could. You can open a ticket.

Though the easiest way to keep track without it is to use a resource set listener. To do that, create a SessionManagerListener and register it with SessionManager.INSTANCE.addSessionsListener(sessionManagerListener) in one of your plugin activator.

In your SessionManagerListener, in method org.eclipse.sirius.business.api.session.SessionManagerListener.notifyAddSession(Session)
Add your resource set listener to the Sirius session resource set:

ResourceSetListenerChangeListener resourceSetListenerChangeListener = new ResourceSetListenerChangeListener();
        session.getTransactionalEditingDomain().addResourceSetListener(resourceSetListenerChangeListener);


In your resource set listener that should be a post commit one,
You just have to react to RepresentationDescriptor add/remove notifications to do whatever you need.

Regards,


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius

[Updated on: Thu, 06 September 2018 12:22]

Report message to a moderator

Re: Observe creation/deletion of Representations/Descriptors [message #1794767 is a reply to message #1794761] Thu, 06 September 2018 08:59 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 275
Registered: December 2015
Senior Member
Oh yes, had forgotten about this possibility, that's for sure the easiest :)
Previous Topic:Null Pointer Exception
Next Topic:Sirius on the Web
Goto Forum:
  


Current Time: Tue Sep 25 23:21:01 GMT 2018

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

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

Back to the top