SWTNativeInterface.getInstance().getDisplay().readAndDispatch();
} else {
// On Mac OS, under rare circumstances, we have a situation where SWT is waiting synchronously on AWT, while AWT is blocked here.
// We have to use a similar forced dispatching trick.
EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
AWTEvent nextEvent = eventQueue.peekEvent();
if(nextEvent != null) {
nextEvent = eventQueue.getNextEvent();
if(nextEvent != null) {
Method dispatchMethod = EventQueue.class.getDeclaredMethod("dispatchEvent", AWTEvent.class);
dispatchMethod.setAccessible(true);