@TestOnly public static void dispatchAllInvocationEventsInIdeEventQueue() throws InterruptedException { assert SwingUtilities.isEventDispatchThread() : Thread.currentThread(); final EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue(); while (true) { AWTEvent event = eventQueue.peekEvent(); if (event == null) break; AWTEvent event1 = eventQueue.getNextEvent(); if (event1 instanceof InvocationEvent) { IdeEventQueue.getInstance().dispatchEvent(event1); } } }
private void updateListsInChooser() { Runnable runnable = new Runnable() { public void run() { if (myChangeListChooser != null && myShowingAllChangeLists) { myChangeListChooser.updateLists( ChangeListManager.getInstance(myProject).getChangeListsCopy()); } } }; if (SwingUtilities.isEventDispatchThread()) { runnable.run(); } else { ApplicationManager.getApplication() .invokeLater(runnable, ModalityState.stateForComponent(this)); } }