How can I get the current position of the Cursor with SWT?
I need:
Display
)Control
This gets the Cursor position relative to the current Display:
import org.eclipse.swt.widgets.Display;
[...]
Point cursorLocation = Display.getCurrent().getCursorLocation();
To get the position relative to the focused Control you have to translate it:
import org.eclipse.swt.widgets.Display;
[...]
Point cursorLocation = Display.getCurrent().getCursorLocation();
Point relativeCursorLocation = Display.getCurrent().getFocusControl().toControl(cursorLocation);