Runnable (@NotNull List<? extends PsiFile> files) { ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); String msg = null; double fraction = 0.0D; if (indicator != null) { msg = indicator.getText(); fraction = indicator.getFraction(); indicator.setText(message); } final Runnable[] runnables = new Runnable[files.size()]; for (int i = 0; i < files.size(); i++) { PsiFile pfile = files.get(i); if (pfile == null) { LOG.debug("Unexpected null file at " + i); continue; } if (indicator != null) { if (indicator.isCanceled()) { return null; } indicator.setFraction((double)i / (double)files.size()); } if (pfile.isWritable()) { try { runnables[i] = preprocessFile(pfile, true); } catch (IncorrectOperationException incorrectoperationexception) { LOG.error(incorrectoperationexception); } } files.set(i, null); } if (indicator != null) { indicator.setText(msg); indicator.setFraction(fraction); } return () -> { ProgressIndicator indicator1 = ProgressManager.getInstance().getProgressIndicator(); String msg1 = null; double fraction1 = 0.0D; if (indicator1 != null) { msg1 = indicator1.getText(); fraction1 = indicator1.getFraction(); indicator1.setText(message); } for (int j = 0; j < runnables.length; j++) { if (indicator1 != null) { if (indicator1.isCanceled()) { return; } indicator1.setFraction((double)j / (double)runnables.length); } Runnable runnable = runnables[j]; if (runnable != null) { runnable.run(); } runnables[j] = null; } if (indicator1 != null) { indicator1.setText(msg1); indicator1.setFraction(fraction1); } }; }