Dragging a parent via a child [message #190809] |
Fri, 05 August 2005 20:09  |
Eclipse User |
|
|
|
Originally posted by: mbernst.stanford.edu
As in the Logic Example, I have a container EditPart which holds several
child EditParts. Unlike the logic example, however, these children are
"anchored" inside the container and cannot be orphaned and moved around when
the user attempts to drag them. Instead, I would like to somehow pass the
drag (REQ_MOVE) request up to the parent, so that when the user drags the
child, the parent is the one that moves (and pulls the child along with it).
I've been fiddling around with EditPolicies, getTargetEditPart() and
getCommand() all morning and afternoon, but I can't seem to figure this out.
Is there a straightforward way to drag the parent instead of the child?
Thanks,
Michael
|
|
|
|
|
Re: Dragging a parent via a child [message #191108 is a reply to message #190809] |
Mon, 08 August 2005 15:44   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
In your drag tracker, When the drag starts (handleDragStarted) change the
source of the drag from being the child to the parent.
"mbernst" <mbernst@stanford.edu> wrote in message
news:dd0v34$f1i$1@news.eclipse.org...
> As in the Logic Example, I have a container EditPart which holds several
> child EditParts. Unlike the logic example, however, these children are
> "anchored" inside the container and cannot be orphaned and moved around
> when the user attempts to drag them. Instead, I would like to somehow
> pass the drag (REQ_MOVE) request up to the parent, so that when the user
> drags the child, the parent is the one that moves (and pulls the child
> along with it).
>
> I've been fiddling around with EditPolicies, getTargetEditPart() and
> getCommand() all morning and afternoon, but I can't seem to figure this
> out. Is there a straightforward way to drag the parent instead of the
> child?
>
> Thanks,
> Michael
>
|
|
|
Re: Dragging a parent via a child [message #191360 is a reply to message #191108] |
Tue, 09 August 2005 19:04   |
Eclipse User |
|
|
|
Originally posted by: mbernst.stanford.edu
Thanks a bunch, Randy. Your tactic worked wonderfully, but only after I
also transferred the selection to the parent. Otherwise, I had problems
with getOperationSet() etc:
/**
* @see org.eclipse.gef.tools.AbstractTool#handleDragStarted()
*/
protected boolean handleDragStarted() {
EditPartViewer viewer = getCurrentViewer();
viewer.select(getSourceEditPart().getParent());
this.setSourceEditPart(getSourceEditPart().getParent());
return super.handleDragStarted();
}
Thanks again!
- Michael
Randy Hudson wrote:
> In your drag tracker, When the drag starts (handleDragStarted) change the
> source of the drag from being the child to the parent.
>
> "mbernst" <mbernst@stanford.edu> wrote in message
> news:dd0v34$f1i$1@news.eclipse.org...
>
>>As in the Logic Example, I have a container EditPart which holds several
>>child EditParts. Unlike the logic example, however, these children are
>>"anchored" inside the container and cannot be orphaned and moved around
>>when the user attempts to drag them. Instead, I would like to somehow
>>pass the drag (REQ_MOVE) request up to the parent, so that when the user
>>drags the child, the parent is the one that moves (and pulls the child
>>along with it).
>>
>>I've been fiddling around with EditPolicies, getTargetEditPart() and
>>getCommand() all morning and afternoon, but I can't seem to figure this
>>out. Is there a straightforward way to drag the parent instead of the
>>child?
>>
>>Thanks,
>>Michael
>>
>
>
>
|
|
|
|
|
Re: Dragging a parent via a child [message #191431 is a reply to message #191423] |
Wed, 10 August 2005 09:46  |
Eclipse User |
|
|
|
Originally posted by: cse.nospam.de
Hello,
I have been able to solve this by additionally overriding the method
createOperationSet() in my DragTracker, and return a list containing only
the enclosing part.
What sometimes bothers me with these experiences is that I still dont
understand conceptionally why this has to be, and the only way to get
there was through heavy debugging..
thanks,
chris
|
|
|
Powered by
FUDForum. Page generated in 0.25253 seconds