boolean () { myProgressIndicator.setIndeterminate(true); List<VirtualFile> files = new ArrayList<>(); updateIndicatorText(ApplicationBundle.message("bulk.reformat.prepare.progress.text"), ""); boolean success = myCountingIterator.processAll(file -> { files.add(file.getVirtualFile()); return !isDone(); }); if (!success) return false; myTotalFiles = files.size(); myProgressIndicator.setIndeterminate(false); Application application = ApplicationManager.getApplication(); if (!application.isUnitTestMode()) { application.invokeAndWait(() -> { ReadonlyStatusHandler.OperationStatus status = ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(files); if (status.hasReadonlyFiles()) { stop(); } }); if (isDone()) return false; } return myFileTreeIterator.processAll(file -> { next = file; iteration(); return !isDone(); }); }