Anchors not working [message #160273] |
Wed, 14 November 2007 13:53 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: martin.tauber.t-online.de
I have the addded the following code to my <whatever>EditPart to create
custom Anchors:
/**
* @generated NOT
*/
public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart
connection) {
return new ProcedureAnchor(getFigure());
}
/**
* @generated NOT
*/
@Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
return new ProcedureAnchor(getFigure());
}
/**
* @generated NOT
*/
public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart
connection) {
return new ProcedureAnchor(getFigure());
}
/**
* @generated NOT
*/
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
return new ProcedureAnchor(getFigure());
}
and
public class ProcedureAnchor extends AbstractConnectionAnchor {
public ProcedureAnchor(IFigure owner) {
super(owner);
}
public Point getLocation(Point arg0) {
Point p = getOwner().getBounds().getLocation();
getOwner().translateToAbsolute(p);
return p;
}
}
Now when I run my application the request for the anchor works as
expected. But when I release the mouse key. The connection uses the
ChopboxAnchor to create the connection (which I thought I had overwritten).
When I enter the code above the get...Anchor(ConnectionEditPart) methods
don't except the @override parameter, since there is nothing to override
in the partent class.
When I debug the code I find that the get...Anchor(ConnectionEditPart)
methods are never called :-( Well, ok no wonder that it doesn't work ...
but this is how it is documented to work on the eclipse web site ... :-(
Any ideas what I am doing wrong?
Regards
Martin
|
|
|
Re: Anchors not working [message #160839 is a reply to message #160273] |
Fri, 16 November 2007 09:12 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: martin.tauber.t-online.de
I guess that there was some nonprintable character hidden somewhere ...
after deletingthe methods from the source and inserting them again it
worked ...
Martin Tauber wrote:
> I have the addded the following code to my <whatever>EditPart to create
> custom Anchors:
>
> /**
> * @generated NOT
> */
> public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart
> connection) {
> return new ProcedureAnchor(getFigure());
> }
>
> /**
> * @generated NOT
> */
> @Override
> public ConnectionAnchor getSourceConnectionAnchor(Request request) {
> return new ProcedureAnchor(getFigure());
> }
> /**
> * @generated NOT
> */
> public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart
> connection) {
> return new ProcedureAnchor(getFigure());
> }
>
> /**
> * @generated NOT
> */
> public ConnectionAnchor getTargetConnectionAnchor(Request request) {
> return new ProcedureAnchor(getFigure());
> }
>
> and
>
>
> public class ProcedureAnchor extends AbstractConnectionAnchor {
> public ProcedureAnchor(IFigure owner) {
> super(owner);
> }
>
> public Point getLocation(Point arg0) {
> Point p = getOwner().getBounds().getLocation();
> getOwner().translateToAbsolute(p);
> return p;
> }
> }
>
> Now when I run my application the request for the anchor works as
> expected. But when I release the mouse key. The connection uses the
> ChopboxAnchor to create the connection (which I thought I had overwritten).
>
> When I enter the code above the get...Anchor(ConnectionEditPart) methods
> don't except the @override parameter, since there is nothing to override
> in the partent class.
>
> When I debug the code I find that the get...Anchor(ConnectionEditPart)
> methods are never called :-( Well, ok no wonder that it doesn't work ...
> but this is how it is documented to work on the eclipse web site ... :-(
>
> Any ideas what I am doing wrong?
> Regards
> Martin
|
|
|
Powered by
FUDForum. Page generated in 0.02758 seconds