|
Re: Disable delete specific notes [message #1772546 is a reply to message #1772535] |
Tue, 12 September 2017 09:02 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.01896 seconds