Skip to main content



      Home
Home » Eclipse Projects » Sirius » Observe creation/deletion of Representations/Descriptors
Observe creation/deletion of Representations/Descriptors [message #1794754] Thu, 06 September 2018 03:18 Go to next message
Eclipse UserFriend
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 04:15 Go to previous messageGo to next message
Eclipse UserFriend
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,

[Updated on: Thu, 06 September 2018 08:22] by Moderator

Re: Observe creation/deletion of Representations/Descriptors [message #1794767 is a reply to message #1794761] Thu, 06 September 2018 04:59 Go to previous message
Eclipse UserFriend
Oh yes, had forgotten about this possibility, that's for sure the easiest :)
Previous Topic:Null Pointer Exception
Next Topic:Undo operation in sirius editor
Goto Forum:
  


Current Time: Sat Apr 26 18:28:57 EDT 2025

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

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

Back to the top