java - How to get x and y position of user click in Eclipse plugin + RCP -


i developing plugin email client using jface + rcp using eclipse. not developing screens using eclipse, mail client screen plugin.

i want user clicked position in client.

you can use addfilter method of display add listener called mouse down events in swt code:

display display = display.getdefault();  display.addfilter(swt.mousedown, new listener()   {     @override     public void handleevent(event event)      {        system.out.println("event " + event);         if (event.widget instanceof control) {          control control = (control)event.widget;          system.out.println("display " + control.todisplay(event.x, event.y));        }      }  }); 

the event passed handleevent has x , y fields mouse down event - these relative control containing event. control given in widget field. have shown code convert these values absolute display values.

note: works mouse down events in current application , swt code. in past lotus notes used lot of native code not work, don't know if still case.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -