void (@NotNull final ProgressIndicator indicator) { final AsynchConsumer<List<CommittedChangeList>> appender = myDlg.getAppender(); final BufferedListConsumer<CommittedChangeList> bufferedListConsumer = new BufferedListConsumer<>(10, appender, -1); final Application application = ApplicationManager.getApplication(); try { myProvider.loadCommittedChanges(mySettings, myLocation, 0, new AsynchConsumer<CommittedChangeList>() { @Override public void consume(CommittedChangeList committedChangeList) { myRevisionsReturned = true; bufferedListConsumer.consumeOne(committedChangeList); if (myCanceled) { indicator.cancel(); } } @Override public void finished() { bufferedListConsumer.flush(); appender.finished(); if (!myRevisionsReturned) { application.invokeLater(() -> myDlg.close(-1), ModalityState.stateForComponent(myDlg.getWindow())); } } }); } catch (VcsException e) { myExceptions.add(e); application.invokeLater(() -> myDlg.close(-1), ModalityState.stateForComponent(myDlg.getWindow())); } }