Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Execute custom code before Sirius Editor save
Execute custom code before Sirius Editor save [message #1808170] Tue, 18 June 2019 13:26 Go to next message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 157
Registered: February 2016
Senior Member
I would like to execute some custom code in order to additionally modify the EMF model before save. Is it possible with Sirius?

Thanks!
Tamás
Re: Execute custom code before Sirius Editor save [message #1808176 is a reply to message #1808170] Tue, 18 June 2019 14:26 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Tamas,

There are several ways to do this with EMF or Sirius mecanisms.
It mainly depends on what you want to detect and when/how to react.

You might use a precommit listener (org.eclipse.emf.transactionResourceSetListener configured in precommit, aggregate or not) or use a org.eclipse.sirius.business.api.session.ModelChangeTrigger (has a notion of priority and trigger predicate plus a notion of priority which allows them to be called regarding the priority and not the installation order (case of the resource set listener).

Could you give more details about the changes you want to detect and the kind of model modification you want to do ?

You might find samples of both mecanisms in
https://github.com/ObeoNetwork/UML-Designer/blob/master/plugins/org.obeonetwork.dsl.uml2.design/src/org/obeonetwork/dsl/uml2/design/internal/listeners/UmlDesignerSessionManagerListener.java

Regards,

Maxime



Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Execute custom code before Sirius Editor save [message #1808203 is a reply to message #1808176] Wed, 19 June 2019 08:33 Go to previous message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 157
Registered: February 2016
Senior Member
Hi Maxime,

Thanks for your quick reply!

Actually, the custom code should be executed only if the model is changed by the Sirius editor (on save) and should not be executed if the model is changed via an external event (e.g: on a git revert).

The org.eclipse.sirius.business.api.session.ModelChangeTrigger looks promising, I will give it a try.

Regards,
Tamás
Previous Topic:[ANN] Sirius 6.1.3
Next Topic:Open a properties Dialog from a custom widget
Goto Forum:
  


Current Time: Fri Apr 19 07:39:24 GMT 2024

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

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

Back to the top