Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to move an EditPart
How to move an EditPart [message #153667] Mon, 11 October 2004 18:48 Go to next message
Steve Harper is currently offline Steve HarperFriend
Messages: 29
Registered: July 2009
Junior Member
I'm having trouble implementing Move via the Selection Tool.

To install policies on the EditParts I use this:

protected void createEditPolicies()
{
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE,
new ResizableSelection());
}

The ResizableSelection is very simple:

public class ResizableSelection extends ResizableEditPolicy
{
protected Command getResizeCommand(ChangeBoundsRequest p_req)
{
return new ResizeCommand((ComponentPart)p_req.getEditParts().get(0),
p_req);
}

protected Command getMoveCommand(ChangeBoundsRequest p_req)
{
return new MoveCommand(p_req);
}

}

getResizeCommand() is called when I drag a resize handle and the
ResizeCommand() works fine.

However when I move the EditPart, getMoveCommand() is never called.
Visually the part does show the XOR graphics as it's Moved, but when the
mouse button is released nothing happens since my getMoveCommand() never
gets called.
Also as the component is being dragged, the cursor is the universal "no
way" symbol (or whatever a circle with a diagonal line through it is
called.)

Resize was so easy, but I'm stumped about how to move the EditPart. Any
guidance would be greatly appreciated.
Re: How to move an EditPart [message #153738 is a reply to message #153667] Tue, 12 October 2004 12:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: usenet.jevopi.de

I'm using the XYLayoutPolicy for this purpose. That means not the
edited element (EditPart with installed Policies) is responsible for
creating the command but its parent element, usually a XYLaout. I'm
using the XYLayoutPolicy. That's working fine. All examples I've found
are working like that, too.

I tried the selection policy first. I'm a little bit confused: Is it
possible to implement moving and sizing by using XYLayoutPolicy and
ResizablePolicy?

Jens
Re: How to move an EditPart [message #153776 is a reply to message #153738] Tue, 12 October 2004 15:30 Go to previous message
Steve Harper is currently offline Steve HarperFriend
Messages: 29
Registered: July 2009
Junior Member
Jens v. P. wrote:

> I'm using the XYLayoutPolicy for this purpose. That means not the
> edited element (EditPart with installed Policies) is responsible for
> creating the command but its parent element, usually a XYLaout. I'm
> using the XYLayoutPolicy. That's working fine. All examples I've found
> are working like that, too.

> I tried the selection policy first. I'm a little bit confused: Is it
> possible to implement moving and sizing by using XYLayoutPolicy and
> ResizablePolicy?

> Jens

I had tried using an XYLayoutPolicy on the parent as well as Resizable and
NonResizable Policies on the children. That never worked.

Turns out that what I needed to do to get it to work was:
Do NOT install the Resizable/NonResiable policies via
EditPart.createEditPolicies().
Instead, override XYLayoutPolicy.createChildEditPolicy() to install the
appropriate resizable/nonresiable policy on the child.

This then calls the commands associated with the policy correctly.
Previous Topic:sorting an Outline view
Next Topic:GEF outside of Eclipse
Goto Forum:
  


Current Time: Sat Apr 27 03:32:45 GMT 2024

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

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

Back to the top