You can first switch to a GUI thread using asyncExec , and then schedule a timer using timerExec . These two methods are similar in that they both perform some action, but asyncExec only switches the thread, timeExec only schedules the action for the GUI thread.
display.asyncExec(() -> display.timerExec(100, () -> doThings()));
It uses lambda expressions that are introduced in Java 8.
With Java 7 or earlier, you must write it with anonymous classes, for example:
display.asyncExec(new Runnable() { public void run() { display.timerExec(100, new Runnable() { public void run() { doThings(); } }); } });
source share