Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » DestroyElementCommand is executed two times when "del." key is pressed and one time with t
DestroyElementCommand is executed two times when "del." key is pressed and one time with t [message #188951] Fri, 23 May 2008 09:09 Go to next message
Youmm P. is currently offline Youmm P.Friend
Messages: 140
Registered: July 2009
Senior Member
Hello,

In the XYZSemanticEditPolicy class, there is this code:

protected Command getDestroyElementCommand (DestroyElementRequest req)
{
CompoundCommand cc = getDestroyEdgesCommand ();
addDestroyChildNodesCommand (cc);
addDestroyShortcutsCommand (cc);
View view = (View) getHost ().getModel ();
if (view.getEAnnotation ("Shortcut") != null) { //$NON-NLS-1$
req.setElementToDestroy (view);
}

cc.add (getGEFWrapper (new DestroyElementCommand(req)));

return cc.unwrap ();
}


I replaced the line

cc.add (getGEFWrapper (new DestroyElementCommand(req)));

by my own delete command:

cc.add (getGEFWrapper (new MyOwnDestroyElementCommand(req)));



When I delete the graphical element on the diagram with the context
menu, MyOwnDestroyElementCommand is executed one time BUT when I delete
the graphical element with the "del." key, it is called two times.

How can I have it being executed only one time in both cases?
Re: DestroyElementCommand is executed two times when "del." key is pressed and one time wi [message #189283 is a reply to message #188951] Sat, 24 May 2008 19:36 Go to previous messageGo to next message
Lazar Codrut-Lucian is currently offline Lazar Codrut-LucianFriend
Messages: 91
Registered: July 2009
Member
It has something to do with the edit policies that are installed. If you'll
try a debug session, you'll see that the command that gets executed is a
complex compound command, and that the destroy command is requested twice,
from two different policies. I added some code in a policy to avoid the
recursive code of a policy to request the command if the request is of a
certain type (DestroyRequest, or something like that). I couldn't find the
place where I made the modification. Maybe I forgot to mark the code as
@generated NOT.

Do you have an exception being thrown when the second Destroy command gets
executed?

Lucian
Re: DestroyElementCommand is executed two times when "del." key is pressed and one time wi [message #189306 is a reply to message #189283] Mon, 26 May 2008 08:38 Go to previous message
Youmm P. is currently offline Youmm P.Friend
Messages: 140
Registered: July 2009
Senior Member
> place where I made the modification. Maybe I forgot to mark the code as
> @generated NOT.
Ok. If you find it again, please post the code here.

>
> Do you have an exception being thrown when the second Destroy command gets
> executed?
No.
Previous Topic:custom tab "human readable" not changing
Next Topic:Having only one edge for an EReference with EOpposite
Goto Forum:
  


Current Time: Fri Apr 26 19:06:32 GMT 2024

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

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

Back to the top