--- old/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java 2012-10-23 16:29:04.162306200 +0400 +++ new/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java 2012-10-23 16:29:03.959505900 +0400 @@ -150,6 +150,10 @@ }); } + public static LWCToolkit getLWCToolkit() { + return (LWCToolkit)Toolkit.getDefaultToolkit(); + } + @Override protected PlatformWindow createPlatformWindow(PeerType peerType) { if (peerType == PeerType.EMBEDDEDFRAME) { @@ -407,7 +411,6 @@ return BUTTONS; } - @Override public boolean isTraySupported() { return true; @@ -489,6 +492,22 @@ synchronized(ret) { return ret[0]; } } + /** + * Just a wrapper for LWCToolkit.invokeAndWait. Posts an empty event to the + * appropriate event queue and waits for it to finish. + */ + public static void flushPendingEventsOnAppkit(final Component component) { + try { + invokeAndWait(new Runnable() { + @Override + public synchronized void run() { + } + }, component); + } catch (Exception e) { + e.printStackTrace(); + } + } + // Kicks an event over to the appropriate eventqueue and waits for it to finish // To avoid deadlocking, we manually run the NSRunLoop while waiting // Any selector invoked using ThreadUtilities performOnMainThread will be processed in doAWTRunLoop