Monday, April 20, 2009

Zooming in GEF Editor and Connections

Recently I was faced with an issue in GEF Editor where when I was making a connection between to figures and scaling was less than 100%, the connetion feeback would be shown relative to figures coordinates at 100%. I like this kind of problems because you are not quite sure where the problem is; do I have to do coordinate translation? Get new coordinates of figures taking scaling in consideation? Who knows? Luckily the solution was pretty easy: override getFeedbackLayer() method in GraphicalNodeEditPolicy:

protected IFigure getFeedbackLayer() {
return getLayer(org.eclipse.gef.LayerConstants.SCALED_FEEDBACK_LAYER);

That is all, pretty easy-peasy, no?

Blogger Syntax Highliter