Promote Children Delete Container. ComponentEditPolicy. Command. [message #157782] |
Tue, 30 October 2007 19:23 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.06155 seconds