Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Promote Children Delete Container. ComponentEditPolicy. Command.
Promote Children Delete Container. ComponentEditPolicy. Command. [message #157782] Tue, 30 October 2007 19:23 Go to next message
Eclipse UserFriend
Originally posted by: arvinder.birdi.ca.com

I'm writing a "Promoting Delete" function on a container:
1) It moves all the child components from a selected container up one
level to its parent.
2) Then it deletes the parent.

I installed my own PromoDelEditPolicy which derives from
ComponentEditPolicy on the container.

I got 1) to work by using code similar to getReparentCommand in
CreationEditPolicy. It uses MoveRequest.

I'm having trouble in #2. When I call super.createDeleteSemanticCommand()
it calls getDestroyElementCommand(DestroyElementRequest req) on the
generated container which then deletes the children.

Possible Solutions:
1) Disassociate the container from its children after doing the
MoveRequest. I have not had much luck with this.
2) Add a flag to the request.
3) Create a new type of Request class. DestroyTopElementRequest.
4) Can I insert a sort of Commit() Command bewteen the Move and Delete?
This way the delete will no longer see children.

thanks in advance,
-Arvinder Birdi
Re: Promote Children Delete Container. ComponentEditPolicy. Command. [message #157808 is a reply to message #157782] Tue, 30 October 2007 21:15 Go to previous message
Eclipse UserFriend
Originally posted by: arvinder.birdi.ca.com

I found a simple solution but would like to know if there is a more
appropriate method of doing this.

I created a DestroyTopElementRequest class in a method called
createDeleteTopSemanticCommand which is similar to
createDeleteSemanticCommand.

In the generated class an isinstanceof is used to check for the Top
version. If it is present then children are not deleted.
Previous Topic:Any plan on multiple page editor?
Next Topic:Adding menu to GMF diagram
Goto Forum:
  


Current Time: Thu Nov 21 12:03:50 GMT 2024

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

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

Back to the top