Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Selection decoration with XYLayoutEditPolicy in parent
Selection decoration with XYLayoutEditPolicy in parent [message #239422] Fri, 26 October 2007 19:32 Go to next message
Eclipse UserFriend
Originally posted by: lance.walton.casualmiracles.com.removethispart

Hi.

I'm a newbie for GEF and am trying to get something very simple working (it is
for a real project though). I'd appreciate some help.

My 'root' edit part has an XYLayoutEditPolicy installed under the
EditPolicy.LAYOUT_ROLE key. I've also disabled
EditPolicy.SELECTION_FEEDBACK_ROLE by installing null for that key.

I have a child edit part which the figure is just a line. When I select the
line, I want handles to appear on each end so that I can drag them around and
I don't want the usual bounding rectangle to appear. I have used Polyline as
the figure for this, and in the edit part (a subclass of
AbstractGraphicalEditPart), I have the following:

protected void createEditPolicies() {
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
LineSelectionEditPolicy());
installEditPolicy(EditPolicy.COMPONENT_ROLE, new ItemEditPolicy());
}

LineSelectionEditPolicy looks like this:

public class LineSelectionEditPolicy extends SelectionHandlesEditPolicy {
protected List<IFigure> createSelectionHandles() {
GraphicalEditPart editPart = (GraphicalEditPart) getHost();
List<IFigure> handles = new ArrayList<IFigure>();
handles.add(new MoveHandle(editPart, new
RelativeLocator(editPart.getFigure(), 0, 0)));
handles.add(new MoveHandle(editPart, new
RelativeLocator(editPart.getFigure(), 1, 1)));
return handles;
}
}

(I realise that the RelativeLocator creation parameters are not quite right -
don't worry about that for now unless it's relevant :-).

Now, after I have placed a line and then select it, I still get the usual
bounding rectangle. If I debug, I can see that my
LineSelectionEditPolicy.createSelectionHandles() method is being used.

Debugging some more, placing a breakpoint in the
AbstractEditPart.installEditPolicy(), I see my policies being installed.
However, at some point I can see other policies being installed, such as
ResizableEditPolicy under the key "PrimaryDrag Policy", and this appears to be
happening as a result of the parent edit parts
XYLayoutEditPolicy.activateEditPolicies() being invoked. IS this what's
causing the rectangle to appear?

What do I need to do to stop the bounding rectangle appearing?

Regards,

Lance
--
Lance Walton
http://www.casualmiracles.com/
Re: Selection decoration with XYLayoutEditPolicy in parent [message #239525 is a reply to message #239422] Thu, 01 November 2007 22:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lance.walton.casualmiracles.com.removethispart

Can no-one help?

Lance Walton wrote:
> Hi.
>
> ...
--
Lance Walton
http://www.casualmiracles.com/
Re: Selection decoration with XYLayoutEditPolicy in parent [message #239728 is a reply to message #239422] Sat, 10 November 2007 20:18 Go to previous message
Eclipse UserFriend
Originally posted by: lance.walton.casualmiracles.com.removethispart

If I've asked the question the wrong way, please let me know. I can't believe
that no-one knows how to do this...

Regards,

Lance

Lance Walton wrote:
> Hi.
>
> I'm a newbie for GEF and am trying to get something very simple working
> ...

--
Lance Walton
http://www.casualmiracles.com/
Previous Topic:Graphics setAlpha() and connectors
Next Topic:ClassNotFoundException in using EMF model in GEF
Goto Forum:
  


Current Time: Fri Apr 26 23:51:04 GMT 2024

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

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

Back to the top