Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How does one get the current mouse location for a ContexMenuProvider?
How does one get the current mouse location for a ContexMenuProvider? [message #240398] Wed, 02 January 2008 16:19 Go to next message
drew frantz is currently offline drew frantz
Messages: 340
Registered: July 2009
Senior Member
How does one get the current mouse location for a ContexMenuProvider?
Re: How does one get the current mouse location for a ContexMenuProvider? [message #240473 is a reply to message #240398] Mon, 07 January 2008 10:48 Go to previous messageGo to next message
Richard Adams is currently offline Richard Adams
Messages: 77
Registered: July 2009
Location: Edinburgh
Member
Try
Point pos = Display.getCurrent().getCursorLocation();
pos=map.getGraphicalViewer().getControl().toControl(pos) ;

will get a point that you have clicked on in the editor, not sure if this
is what you want.

where 'map' refers to the GEF editor class.
We use this in a PasteAction class that inherits from a GEF
SelectionAction.


Re: How does one get the current mouse location for a ContexMenuProvider? [message #240546 is a reply to message #240473] Wed, 09 January 2008 13:30 Go to previous message
drew frantz is currently offline drew frantz
Messages: 340
Registered: July 2009
Senior Member
Works great thanks,drew
"Richard Adams" <richard.adams@ed.ac.uk> wrote in message
news:5cb4a1f2c6d16ae20d93096b5a2cdf1d$1@www.eclipse.org...
> Try Point pos = Display.getCurrent().getCursorLocation();
> pos=map.getGraphicalViewer().getControl().toControl(pos) ;
>
> will get a point that you have clicked on in the editor, not sure if this
> is what you want.
>
> where 'map' refers to the GEF editor class.
> We use this in a PasteAction class that inherits from a GEF
> SelectionAction.
>
>
>
Previous Topic:Tooltip extra large
Next Topic:Accessibility problems on Figure.
Goto Forum:
  


Current Time: Fri Aug 29 10:14:21 EDT 2014

Powered by FUDForum. Page generated in 0.01919 seconds