Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Anchors not working
Anchors not working [message #160273] Wed, 14 November 2007 13:53 Go to next message
Eclipse UserFriend
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
Eclipse UserFriend
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
Previous Topic:How to create connection between two edit parts
Next Topic:Default Grid View for GMF Editor
Goto Forum:
  


Current Time: Wed Jul 17 01:46:56 GMT 2024

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

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

Back to the top