Skip to main content



      Home
Home » Eclipse Projects » Sirius » How to delete view programmatically of a given DDiagramElement
How to delete view programmatically of a given DDiagramElement [message #1722931] Wed, 10 February 2016 05:52 Go to next message
Eclipse UserFriend
Hi,

I am looking for an API to delete the view of a given DDiagramElement, doing the same thing that the "Delete View" tools in the ViewpointSpecificationEditor.

How can I do that programmatically ?

many thanks in advance,
Benoît
Re: How to delete view programmatically of a given DDiagramElement [message #1723055 is a reply to message #1722931] Thu, 11 February 2016 05:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi Benoit

Did you try the simplest operation?
final DDiagramElement element = ...
// alternative1: EcoreUtil.remove(element);
// or better, alternative2
SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(element).eRemove(element);

You will need these dependencies in order to access ModelAccessor:

  • org.eclipse.sirius
  • org.eclipse.sirius.ecore.extender


I guess it will work fine if you execute this code in a command (this is ok if the operation is executed into a Java Service called by Sirius or an ExternalJavaAction). Of course, the mapping of the deleted view must be unsynchronized or Sirius will recreate the view during the next refresh.

Cheers,
Yann
Re: How to delete view programmatically of a given DDiagramElement [message #1723101 is a reply to message #1723055] Thu, 11 February 2016 10:42 Go to previous message
Eclipse UserFriend
Thanks a lot Yann, your alternative2 is working exactly as expected !

cheers,
Benoît

[Updated on: Thu, 11 February 2016 10:42] by Moderator

Previous Topic:get "root model" context
Next Topic:Composition Edge Delete
Goto Forum:
  


Current Time: Wed Jul 16 06:39:45 EDT 2025

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

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

Back to the top