void (final T listener) { Boolean dispatched = myListenersState.get(listener); //if (!LOG.assertTrue(dispatched != null, "dispatchPendingEvents() should not be invoked for listener which was not registered")) return; if (dispatched == null) return; if (!dispatched.booleanValue()) { Application application = ApplicationManager.getApplication(); if (application.isDispatchThread()) { invoke(listener); } else { // We do not dispatch events in non swing thread. A potential deadlock otherwise. return; /* ModalityState state = ProgressManager.getInstance().getProgressIndicator().getModalityState(); application.invokeAndWait(new Runnable() { public void run() { invoke(listener); } }, state); */ } } /* Seems like this assertion is incorrect and there's nothing wrong with just skipping in this situation. else { if (myDispatchingListeners.size() > 0 && listener != myDispatchingListeners.peek() && myDispatchingListeners.contains(listener)){ LOG.error("Cyclic dispatching is prohibited"); } } */ }