Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Disable delete specific notes
Disable delete specific notes [message #1772535] Tue, 12 September 2017 07:21 Go to next message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 121
Registered: January 2016
Senior Member
Hi,

How do I disable delete a specific notes inserted from the palette?
I create a note on the diagram programmatically, you do not want to allow the user to delete.

Is it possible?

Thanks.

Martin
Re: Disable delete specific notes [message #1772546 is a reply to message #1772535] Tue, 12 September 2017 09:02 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 522
Registered: July 2009
Senior Member
Hi,

It's not directly possible from Sirius itself, as these notes are actually not really managed by Sirius but purely graphical elements inherited from GMF. It might be possible by using GMF's own extension points to override the normal reaction to "delete" requests. The general idea would be:
* Use the org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders extension point from GMF to provide your own IEditPolicyProvider. It should target org.eclipse.sirius.diagram.ui.internal.edit.parts.SiriusNoteEditPart to only apply to notes on Sirius diagrams.
* In your IEditPolicyProvider, replace the EditPolicyRoles.SEMANTIC_ROLE with your own implementation that "traps" DestroyElementRequest to do nothing. The default behavior for notes is provided by org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.NonSemanticEditPolicy, which ends-up simply destroying the GMF View.

Two "tricky" aspects to be aware of with editpolicyProviders:
* make sure you set up the appropriate priority for your provider (configured in the plugin.xml);
* make sure your IEditPolicyProvider really only applies to your diagrams (using the provides() method), as this is a low-level GMF mechanism which otherwise can impact all GMF-based products (i.e other Sirius-based modelers, or even Papryus).

Regards,
Pierre-Charles


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:[ANN] Sirius 5.0.2
Next Topic:Custom Validation Rules Output
Goto Forum:
  


Current Time: Wed Apr 08 00:03:24 GMT 2020

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

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

Back to the top