void () { if (Toolkit.getDefaultToolkit().getSystemEventQueue() instanceof IdeEventQueue) { return; } if (SwingUtilities.isEventDispatchThread()) { throw new IllegalStateException("must not be called on EDT"); } AWTAutoShutdown.getInstance().notifyThreadBusy(Thread.currentThread()); // in JDK 1.6, `EventQueue#push` causes slow painful death of current EDT, so we have to wait through its agony to termination StartupUiUtil.INSTANCE.pump(); try { //noinspection ResultOfMethodCallIgnored EventQueue.invokeAndWait(IdeEventQueue::getInstance); EventQueue.invokeAndWait(EmptyRunnable.getInstance()); EventQueue.invokeAndWait(EmptyRunnable.getInstance()); } catch (InterruptedException | InvocationTargetException e) { throw new RuntimeException(e); } }