Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Faster way of removing graphiti elements(Remove Graphiti elements)
Faster way of removing graphiti elements [message #1121225] Mon, 30 September 2013 11:53 Go to next message
PALANI SANKAR is currently offline PALANI SANKAR
Messages: 35
Registered: April 2013
Member
Hi All

I am working on a use case where i have a tree inside graphiti editor and on selection of each tree node , different graphiti elements needs to appear , as it is a single editor what i am doing is i am removing the elements and redrawing. currently i am facing a performance issue that on doing removal if there are more elements it is taking much time to remove the elements. can anyone tell me how can i remove elements
without affecting the performance.is there any other way other than remove feature.

It would be helpful if some suggest a way to improve the performance on the above scenario.


Thanks
Palani



Thanks
Palani
Re: Faster way of removing graphiti elements [message #1122104 is a reply to message #1121225] Tue, 01 October 2013 08:28 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas Graf
Messages: 154
Registered: July 2009
Senior Member
Hi Palani,

regarding the deletion, I suspect that there might be room for improvement in Graphiti, however I have not done an in-depth analysis.

DefaultRemoveFeature.remove calls Graphiti.getPeService().deletePictogramElement(pe);

which seems to be doing a depth-first traversal of the tree, invoking EcoreUtil.delete
on the elements.

EcoreUtil.delete tries to find all cross references to the object to be removed (and, possibly, its children). This is called quite often.

I am not sure that this might not lead to performance impact for larger diagrams and domain models (note that EcoreUtil.delete will try to find references from your domain model to your diagram as well - the entire ResourceSet is checked).

Maybe the Graphiti experts could elaborate on this approach and the reason for not just calling EcoreUtil.delete on the object to be removed and letting EcoreUtil do all the recursion?

[Updated on: Tue, 01 October 2013 08:44]

Report message to a moderator

Re: Faster way of removing graphiti elements [message #1122153 is a reply to message #1122104] Tue, 01 October 2013 09:24 Go to previous messageGo to next message
PALANI SANKAR is currently offline PALANI SANKAR
Messages: 35
Registered: April 2013
Member
Hi Andreas

Thanks for your reply

ECoreutil.delete is expecting an eobject as parameter, the thing is am just removing the elements. It should not be allowed to touch the model and it just need to remove the pictogram element. Is there any other way to remove the elements in a faster way.

Thanks
Palani


Thanks
Palani
Re: Faster way of removing graphiti elements [message #1122174 is a reply to message #1122153] Tue, 01 October 2013 09:43 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas Graf
Messages: 154
Registered: July 2009
Senior Member
All elements in the diagram are EObjects. Diagrams are just EMF models.
Re: Faster way of removing graphiti elements [message #1122210 is a reply to message #1122174] Tue, 01 October 2013 10:32 Go to previous messageGo to next message
PALANI SANKAR is currently offline PALANI SANKAR
Messages: 35
Registered: April 2013
Member
Hi Andreas

Thanks for your reply. i will try the same.

Thanks
Palani Sankar.B


Thanks
Palani
Re: Faster way of removing graphiti elements [message #1122501 is a reply to message #1122210] Tue, 01 October 2013 16:44 Go to previous message
Robert Brodt is currently offline Robert Brodt
Messages: 613
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

You probably already knew this, but if you provide your own Delete Feature and then just override protected void deleteBusinessObjects(Object[]) you can ensure your domain model objects don't get deleted.
Previous Topic:Maintaining shape properties after closing the diagram
Next Topic:hide PaletteCompartmentEntry object
Goto Forum:
  


Current Time: Fri Oct 31 12:16:36 GMT 2014

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

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