Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » delete confirmation dialog(delete confirmation dialog)
delete confirmation dialog [message #900025] Fri, 03 August 2012 13:42 Go to next message
Surya Kathayat is currently offline Surya Kathayat
Messages: 44
Registered: July 2012
Member
Hi,

I have implemented a Custom Node Collapse Feature. When a particular node is collapsed, it will delete set of nodes and links from a diagram. As you can see in the diagram below, if a node "A" is collapsed, split node (upper circle in the diagram), node "B", and join node (lower circle in the diagram) shall be deleted.

index.php/fa/11009/0/
index.php/fa/11010/0/

There is no problem in deleting. But I get delete confirm dialog as many times as the total number of Nodes and Links that I am deleting!!!

The following is my code in the Custom feature. Is there any (better) way for showing this "delete confirmation dialog" only once while deleting all these nodes and links??


// delete links
for (int i = 0; i < linkss.size(); i++) {
 Link link = (Link) linkss.get(i);		
 PictogramElement pe = TaskUtils.getLinkPECompareByGuid(plinks, link); //getPEforLink(plinks, link);
 if(pe != null){
   DeleteContext delContext = new DeleteContext(pe); //TaskUtils.getPEforLink(plinks, link));		
   IDeleteFeature delFeature = featureProvider.getDeleteFeature(delContext);		
   if(delFeature.canDelete(delContext)){								
   delFeature.delete(delContext);						
   }						
}
					
// delete tasks
for (int i = 0; i < tasks.size(); i++) {				
  DeleteContext delContext = new DeleteContext(TaskUtils.getTaskPECompareByGuid(plinks, (Task)tasks.get(i))); 
  IDeleteFeature delFeature = featureProvider.getDeleteFeature(delContext);
  if(delFeature.canDelete(delContext)){
  delFeature.delete(delContext);		
}
					



Best regards
Surya

[Updated on: Fri, 03 August 2012 13:43]

Report message to a moderator

Re: delete confirmation dialog [message #900244 is a reply to message #900025] Mon, 06 August 2012 07:08 Go to previous messageGo to next message
Surya Kathayat is currently offline Surya Kathayat
Messages: 44
Registered: July 2012
Member
I managed to solve this by overwriting "delete" method in my Custom Delete Feature.

BR
Surya
Re: delete confirmation dialog [message #900708 is a reply to message #900244] Wed, 08 August 2012 08:58 Go to previous messageGo to next message
Matthias Gorning is currently offline Matthias Gorning
Messages: 81
Registered: April 2010
Location: Germany
Member
Sorry for this late answer.

But probably the better way is to set a MultiDeleteInfo on your delete context.

BR,
Matthias
Re: delete confirmation dialog [message #1456516 is a reply to message #900708] Thu, 30 October 2014 12:46 Go to previous message
Simone Di Cola is currently offline Simone Di Cola
Messages: 51
Registered: February 2014
Member
As in the previous reply, this piece of code does what you asked:

@Override
	public void delete(IDeleteContext context) {
		Validate.notNull(context);
		Validate.isInstanceOf(IDeleteContext.class, context);
		
    ((DeleteContext) context).setMultiDeleteInfo(new MultiDeleteInfo(false, false, 0));		


[...]



Simone
Previous Topic:Get XMI file for a given diagram
Goto Forum:
  


Current Time: Thu Oct 30 14:03:02 GMT 2014

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

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