Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Get mouse location
Get mouse location [message #649481] Wed, 19 January 2011 12:32 Go to next message
Marc Mising name is currently offline Marc Mising nameFriend
Messages: 193
Registered: July 2009
Location: Valencia, Spain
Senior Member
Hello,

I want to know the location of the mouse in a certain moment, relative to the FigureCanvas. I know I can get the mouse location relative to the Display, throught Display.getCurrent().getCursorLocation(), but I want to convert this coordinates relative to the Diagram.

Anybody knows how to do it?

Thanks a lot,
Marc
Re: Get mouse location [message #649779 is a reply to message #649481] Thu, 20 January 2011 15:09 Go to previous messageGo to next message
Romain Bioteau is currently offline Romain BioteauFriend
Messages: 65
Registered: August 2009
Location: Grenoble
Member
Hello,
Here is a "hack" :

Tool tool = selectedTargetEditPart.getViewer().getEditDomain().getActiveTool();
AbstractTool aTool = (AbstractTool) tool;
Method m = AbstractTool.class.getDeclaredMethod("getLocation");
m.setAccessible(true);
Point toolLocation = ((org.eclipse.draw2d.geometry.Point) m.invoke(aTool)).getCopy();


HTH
Romain


R&D Engineer at BonitaSoft
Re: Get mouse location [message #649784 is a reply to message #649779] Thu, 20 January 2011 15:26 Go to previous message
Marc Mising name is currently offline Marc Mising nameFriend
Messages: 193
Registered: July 2009
Location: Valencia, Spain
Senior Member
Ooooooohhhhhh thanks a lot Romain!!!!!!! You saved my life Very Happy
It's really what I was looking for...

Thanks a lot!
Marc
Previous Topic:Extending palette
Next Topic:Editing of invisible labels when edit part is added bug or expected behaviour?
Goto Forum:
  


Current Time: Fri Apr 26 08:53:43 GMT 2024

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

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

Back to the top