Java Code Examples for org.eclipse.swt.widgets.Display#wake()

The following examples show how to use org.eclipse.swt.widgets.Display#wake() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: http4e   File: JobRunner.java    License: Apache License 2.0 5 votes vote down vote up
public void run(){
   // main swt thread
   final Display display = Display.getDefault();

   // start separate thread
   Thread separateThread = new Thread(new Runnable() {
      public void run(){

         if (display.isDisposed()) return;
         final Object execObj = listener.execute();

         if (display.isDisposed()) return;
         display.syncExec(new Runnable() {
            public void run(){
               // sync back to main swt thread
               if (listener.isDisposed())
                  return;
               listener.update(execObj);
            }
         });
         done = true;

         if (display.isDisposed()) return;
         display.wake();
      }
   });
   separateThread.start();

   while (!done && !composite.isDisposed()) {
      if (!display.readAndDispatch())
         display.sleep();
   }
}