Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to move child editparts correctly?
How to move child editparts correctly? [message #192866] Tue, 23 August 2005 10:15 Go to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Hi,

I have a question for moving elements.
I have an Editpart A with possible children B and C.
I want that child B can be moved to different editparts A (uses the createAddCommand of the layoutPolicy of target A).
What I want is to prevent the move of C to an different editpart A.
I could realize this by testing on instances of the moved child and return null. But with bigger models this could be very complex.

My question:
How is the deletion of the child in the source editpart correctly handled (perhaps with invocation of getDeleteDependantCommand(Request)?)

Currently I delete the child before adding it to the target editpart. But I think the layoutPolicy of the source should handle this.

Thanks in advance

Andreas
Re: How to move child editparts correctly? [message #192922 is a reply to message #192866] Tue, 23 August 2005 18:36 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Since the EditPolicy needs to be on A, I would think that you need to test
on the invidual instances of B and C.

"Andreas Holtz" <A.Holtz@gmx.net> wrote in message
news:deesvq$llc$1@news.eclipse.org...
> Hi,
>
> I have a question for moving elements.
> I have an Editpart A with possible children B and C.
> I want that child B can be moved to different editparts A (uses the
> createAddCommand of the layoutPolicy of target A).
> What I want is to prevent the move of C to an different editpart A.
> I could realize this by testing on instances of the moved child and return
> null. But with bigger models this could be very complex.
>
> My question:
> How is the deletion of the child in the source editpart correctly handled
> (perhaps with invocation of getDeleteDependantCommand(Request)?)
>
> Currently I delete the child before adding it to the target editpart. But
> I think the layoutPolicy of the source should handle this.
>
> Thanks in advance
>
> Andreas
Re: How to move child editparts correctly? [message #193013 is a reply to message #192866] Wed, 24 August 2005 04:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

The parent's ContainerEditPolicy or LayoutEditPolicy should handle this in
getOrphanChildrenCommand().

"Andreas Holtz" <A.Holtz@gmx.net> wrote in message
news:deesvq$llc$1@news.eclipse.org...
> Hi,
>
> I have a question for moving elements.
> I have an Editpart A with possible children B and C.
> I want that child B can be moved to different editparts A (uses the
createAddCommand of the layoutPolicy of target A).
> What I want is to prevent the move of C to an different editpart A.
> I could realize this by testing on instances of the moved child and return
null. But with bigger models this could be very complex.
>
> My question:
> How is the deletion of the child in the source editpart correctly handled
(perhaps with invocation of getDeleteDependantCommand(Request)?)
>
> Currently I delete the child before adding it to the target editpart. But
I think the layoutPolicy of the source should handle this.
>
> Thanks in advance
>
> Andreas
Re: How to move child editparts correctly? [message #193194 is a reply to message #193013] Wed, 24 August 2005 17:12 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Thank you! :-)
That's what I needed...

Andreas

Pratik Shah schrieb am 24.08.2005 06:01:
> The parent's ContainerEditPolicy or LayoutEditPolicy should handle this in
> getOrphanChildrenCommand().
>
Re: How to move child editparts correctly? [message #193332 is a reply to message #193194] Thu, 25 August 2005 10:49 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Andreas Holtz schrieb am 24.08.2005 19:12:
> Thank you! :-)
> That's what I needed...
>
> Andreas
>
> Pratik Shah schrieb am 24.08.2005 06:01:
>
>> The parent's ContainerEditPolicy or LayoutEditPolicy should handle
>> this in
>> getOrphanChildrenCommand().
>>

Sorry, that's not, what I need.
With the getOrphanChildrenCommand() I can delete the child correctly, but I can not prevent the movement of the child.
But that's what I need...
Re: How to move child editparts correctly? [message #193382 is a reply to message #193332] Thu, 25 August 2005 22:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

> With the getOrphanChildrenCommand() I can delete the child correctly, but
I can not prevent the movement of the child.

The target editpart's getAddCommand() should handle that. Essentially, when
reparenting a part, you're first asking the old parent if that child can be
removed from it and then asking the new one if that child can be added to
it. If either one returns null or unexecutable command, that child will not
be moved.
Re: How to move child editparts correctly? [message #193491 is a reply to message #193382] Fri, 26 August 2005 11:53 Go to previous messageGo to next message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Pratik Shah schrieb am 26.08.2005 00:23:
>>With the getOrphanChildrenCommand() I can delete the child correctly, but
>
> I can not prevent the movement of the child.
>
> The target editpart's getAddCommand() should handle that. Essentially, when
> reparenting a part, you're first asking the old parent if that child can be
> removed from it and then asking the new one if that child can be added to
> it. If either one returns null or unexecutable command, that child will not
> be moved.
>
>

And that's the problem:
How do I ask the old parent if that child can be deleted?
Asking the new one ist the result of createAddCommand, I think.

Thanx

Andreas
Re: How to move child editparts correctly? [message #193536 is a reply to message #193382] Fri, 26 August 2005 13:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> The target editpart's getAddCommand() should handle that. Essentially,
> when
> reparenting a part, you're first asking the old parent if that child can
> be
> removed from it and then asking the new one if that child can be added to
> it. If either one returns null or unexecutable command, that child will
> not
> be moved.

null indicates a no-op, meaning the orphan might be free when the add is
executed. I think it is necessary to return an unexecutable command.
Re: How to move child editparts correctly? [message #193553 is a reply to message #193491] Fri, 26 August 2005 14:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

"Andreas Holtz" <A.Holtz@gmx.net> wrote in message
news:demvsd$s04$1@news.eclipse.org...
> Pratik Shah schrieb am 26.08.2005 00:23:
> >>With the getOrphanChildrenCommand() I can delete the child correctly,
but
> >
> > I can not prevent the movement of the child.
> >
> > The target editpart's getAddCommand() should handle that. Essentially,
when
> > reparenting a part, you're first asking the old parent if that child can
be
> > removed from it and then asking the new one if that child can be added
to
> > it. If either one returns null or unexecutable command, that child will
not
> > be moved.
> >
> >
>
> And that's the problem:
> How do I ask the old parent if that child can be deleted?
> Asking the new one ist the result of createAddCommand, I think.

Okay, now we're going in circles...getOrphanChildrenCommand() should return
an unexecutable command if the child can't be removed from the old parent.

Maybe you should shed some light on the problem you're running into.

>
> Thanx
>
> Andreas
Re: How to move child editparts correctly? [message #193601 is a reply to message #193553] Fri, 26 August 2005 17:36 Go to previous message
Andreas Holtz is currently offline Andreas HoltzFriend
Messages: 53
Registered: July 2009
Member
Pratik Shah schrieb am 26.08.2005 16:20:

> Okay, now we're going in circles...getOrphanChildrenCommand() should return
> an unexecutable command if the child can't be removed from the old parent.

Randy Hudson schrieb am 26.08.2005 15:46:
> null indicates a no-op, meaning the orphan might be free when the add is
> executed. I think it is necessary to return an unexecutable command.

With the UnexecutableCommand it does work. I always thought, that the return off 'null' does mean, that the Command can not be executed.

So thank you both for answering that clearly. :-)

Andreas
Previous Topic:Flow Control plug-ins project
Next Topic:glue figures to one another
Goto Forum:
  


Current Time: Wed Feb 05 12:59:59 GMT 2025

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

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

Back to the top