Exemplo n.º 1
0
 public static void postEvent(Control ownerControl, final Event event) {
   final Display display = ownerControl.getDisplay();
   display.asyncExec(
       new Runnable() {
         @Override
         public void run() {
           display.post(event);
         }
       });
 }
Exemplo n.º 2
0
 /**
  * Determine whether this control or any of it's child has focus
  *
  * @param control control to check
  * @return true if it has focus
  */
 public static boolean hasFocus(Control control) {
   Control focusControl = control.getDisplay().getFocusControl();
   if (focusControl == null) {
     return false;
   }
   for (Control fc = focusControl; fc != null; fc = fc.getParent()) {
     if (fc == control) {
       return true;
     }
   }
   return false;
 }