private void updateFinished() { myDumb = false; if (myProject.isDisposed()) return; if (ApplicationManager.getApplication().isInternal()) LOG.info("updateFinished"); try { myPublisher.exitDumbMode(); FileEditorManagerEx.getInstanceEx(myProject).refreshIcons(); } finally { // It may happen that one of the pending runWhenSmart actions triggers new dumb mode; // in this case we should quit processing pending actions and postpone them until the newly // started dumb mode finishes. while (!myDumb) { final Runnable runnable; synchronized (myRunWhenSmartQueue) { if (myRunWhenSmartQueue.isEmpty()) { break; } runnable = myRunWhenSmartQueue.pullFirst(); } try { runnable.run(); } catch (Throwable e) { LOG.error(e); } } } }
@TestOnly public void setDumb(boolean dumb) { if (dumb) { myDumb = true; myPublisher.enteredDumbMode(); } else { updateFinished(); } }