Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Connection endpoint problem
Connection endpoint problem [message #192218] Tue, 16 August 2005 21:03 Go to next message
Eclipse UserFriend
Originally posted by: prb113.york.ac.uk

Hi I am having a problem creating connections between edit parts. I've
found varios similar problems on the news groups but not the same as the
one I am experiencing.
I have edit parts implementing NodeEditPart and each of the
getSource/TargetConnectionAnchor() methods returns the result of the
method getConnectionAnchor which is basically copied from the shapes
example.
However, when I try to draw a connection, the feedback is all correct but
the final result yields two arrows, one going from the source to a point
at about (100, 100) and another going from a point at about (0,0) to the
target. I'm guessing that I am returning incorrect connection anchors but
I can't see where it goes wrong.

can you help?
Re: Connection endpoint problem [message #192290 is a reply to message #192218] Wed, 17 August 2005 20:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> I have edit parts implementing NodeEditPart and each of the
> getSource/TargetConnectionAnchor() methods returns the result of the
> method getConnectionAnchor which is basically copied from the shapes
> example.

All four methods?? 2 are used during feedback, 2 once an editpart actually
exists.
Re: Connection endpoint problem [message #193819 is a reply to message #192290] Mon, 29 August 2005 11:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: prb113.york.ac.uk

Yes I have implemented all four methods.
They all return the method shown below:
anchor is a field declared in the class.

protected ConnectionAnchor getConnectionAnchor() {
if(anchor==null) {
if(getModel() instanceof Box)
anchor = new ChopboxAnchor(getFigure());
else if(getModel() instanceof AbstractNode)
anchor = new EllipseAnchor(getFigure());
else
throw new IllegalArgumentException("unexpected model");
}
return anchor;
}

Is it correct for the methods to always return the same ancor once it has
been created?
Solved!! [message #194041 is a reply to message #193819] Tue, 30 August 2005 13:45 Go to previous message
Eclipse UserFriend
Originally posted by: prb113.york.ac.uk

Found the problem. I'd simply forgot to set the model in the constructor
of the Connection editpart. It works now.

thanks for your help

Paul
Previous Topic:Disable edit (move,delete) of figure
Next Topic:dragging a connector across a node anchors on the closer node
Goto Forum:
  


Current Time: Tue Jan 14 17:53:49 GMT 2025

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

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

Back to the top