Wrong location from BendpointRequest [message #218132] |
Tue, 20 June 2006 07:29 |
Eclipse User |
|
|
|
Originally posted by: m.exp1206.artemis.in-ulm.de
Hello everyone.
I started to develop a plug-in which uses GEF and had no problems so
far. Now i think i may found a bug but I'm not 100% sure.
public class MyBendpointEditPolicy extends BendpointEditPolicy {
....
protected Command
getMoveBendpointCommand(BendpointRequest request) {
return new MyMoveBendpointCommand(
(SimpleConnection)request.getSource().getModel(),
request.getIndex(), request.getLocation());
}
....
}
The coordinates which i get from the BendpointRequest are absolute which
is okay. The problem is that the coordinates are absolute to the
current visible part instead of the root panel itself. That cause the
moved bendpoint to jump to the wrong location if you aren't in the top
left part of the panel.
Further details:
Sun JDK 1.5.0_06 for Win32
Eclipse SDK 3.1.2 for Win32
GEF SDK 3.1.1
I debugged the problem and followed the wrong data to the method
updateHoverRequest() in the class SelectionTool. It's the only place
where the location is specified. I didn't dig any further because it
gets too complicated from me. But it seems that other requests also
get the location in this method and they work without problems.
I also tried different versions of Eclipse and GEF but no changes. I
even tried an older version of the JDK 1.4.2_12 with the same result.
I would appreciate if somebody could verify this problem or give me a
hint where i am wrong.
CU Martin Keller
|
|
|
|
Re: Wrong location from BendpointRequest [message #218310 is a reply to message #218215] |
Thu, 22 June 2006 12:14 |
Eclipse User |
|
|
|
Originally posted by: m.exp1206.artemis.in-ulm.de
After some investigation of the other policies and commands I found these
translate calls inside the method getContrainsFor. I tried to understand
their work and copied some lines to my code. After some modifications i
finally reduced it to one call of translateToRelative.
protected Command getMoveBendpointCommand(BendpointRequest request) {
Point p = request.getLocation();
getConnection().translateToRelative(p);
return new MyMoveBendpointCommand(
(SimpleConnection)request.getSource().getModel(),
request.getIndex(), p);
}
After reading the chapter about coordinate systems in the Draw2D guide
twice i understand the problem. SWT and Draw2D use different coordinate
systems and the translate calls delivers the correct coordinates.
mmostafa@ca.ibm.com wrote:
> [-- text/plain, encoding 7bit, charset: US-ASCII, 3 lines --]
>
> Check WireBendpointEditPolicy#getCreateBendpointCommand in
> org.eclipse.gef.examples.logicdesigner.edit
> I hope this will help
Not really. I thought if i use absolute bendpoints the translation is not
necessary.
Anyway, thank you.
CU Martin Keller
|
|
|
Powered by
FUDForum. Page generated in 0.02668 seconds