void (long timeout, @NotNull TimeUnit timeUnit) { try { EdtTestUtil.runInEdtAndWait(() -> { Application app = ApplicationManager.getApplication(); if (app != null && !app.isDisposed()) { FileBasedIndexImpl index = (FileBasedIndexImpl)app.getServiceIfCreated(FileBasedIndex.class); if (index != null) { index.getChangedFilesCollector().waitForVfsEventsExecuted(timeout, timeUnit); } DocumentCommitThread commitThread = (DocumentCommitThread)app.getServiceIfCreated(DocumentCommitProcessor.class); if (commitThread != null) { commitThread.waitForAllCommits(timeout, timeUnit); } } }); } catch (Exception e) { LOG.warn(e); } }