Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Wrong location from BendpointRequest
Wrong location from BendpointRequest [message #218132] Tue, 20 June 2006 03:29 Go to next message
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 #218215 is a reply to message #218132] Tue, 20 June 2006 14:13 Go to previous messageGo to next message
Mohammed Mostafa is currently offline Mohammed Mostafa
Messages: 143
Registered: July 2009
Senior Member
This is a multipart message in MIME format.
--=_alternative 00645CF385257193_=
Content-Type: text/plain; charset="US-ASCII"

Check WireBendpointEditPolicy#getCreateBendpointCommand in
org.eclipse.gef.examples.logicdesigner.edit
I hope this will help
--=_alternative 00645CF385257193_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Check </font><font size=2 face="Courier New">WireBendpointEditPolicy#getCreateBendpointCommand
</font><font size=2 face="sans-serif">in </font><font size=2 face="Courier New">org.eclipse.gef.examples.logicdesigner.edit</font><font size=2 face="sans-serif">
</font>
<br><font size=2 face="sans-serif">I hope this will help</font>
--=_alternative 00645CF385257193_=--
Re: Wrong location from BendpointRequest [message #218310 is a reply to message #218215] Thu, 22 June 2006 08:14 Go to previous message
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
Previous Topic:Selective SanpToGrid Question
Next Topic:How to get the RootEditPart from Editor
Goto Forum:
  


Current Time: Fri Aug 22 06:07:08 EDT 2014

Powered by FUDForum. Page generated in 0.01759 seconds