Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:52 Go to next message
Benoit Ries is currently offline Benoit RiesFriend
Messages: 83
Registered: May 2013
Member
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 10:12 Go to previous messageGo to next message
Yann Mortier is currently offline Yann MortierFriend
Messages: 13
Registered: July 2009
Location: Paris FR
Junior Member
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 15:42 Go to previous message
Benoit Ries is currently offline Benoit RiesFriend
Messages: 83
Registered: May 2013
Member
Thanks a lot Yann, your alternative2 is working exactly as expected !

cheers,
Benoît

[Updated on: Thu, 11 February 2016 15:42]

Report message to a moderator

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


Current Time: Thu Jan 21 11:47:02 GMT 2021

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

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

Back to the top