private void countingIteration() { if (myCountingIterator.hasNext()) { myCountingIterator.next(); myTotalFiles++; } else { myFilesCountingFinished = true; } }
private List<PsiDirectory> getAllSearchableDirsFromContext() { List<PsiDirectory> dirs = ContainerUtil.newArrayList(); if (myDirectory != null) { dirs.add(myDirectory); } else if (myModule != null) { List<PsiDirectory> allModuleDirs = FileTreeIterator.collectModuleDirectories(myModule); dirs.addAll(allModuleDirs); } else if (myProject != null) { List<PsiDirectory> allProjectDirs = FileTreeIterator.collectProjectDirectories(myProject); dirs.addAll(allProjectDirs); } return dirs; }
@Override public boolean iteration() { if (myStopFormatting) { return true; } if (!myFilesCountingFinished) { updateIndicatorText(ApplicationBundle.message("bulk.reformat.prepare.progress.text"), ""); countingIteration(); return true; } updateIndicatorFraction(myFilesProcessed); if (myFileTreeIterator.hasNext()) { final PsiFile file = myFileTreeIterator.next(); myFilesProcessed++; if (file.isWritable() && canBeFormatted(file) && acceptedByFilters(file)) { updateIndicatorText( ApplicationBundle.message("bulk.reformat.process.progress.text"), getPresentablePath(file)); ApplicationManager.getApplication() .runWriteAction( new Runnable() { @Override public void run() { DumbService.getInstance(myProject) .withAlternativeResolveEnabled( new Runnable() { @Override public void run() { performFileProcessing(file); } }); } }); } } return true; }
@Override public boolean isDone() { return myStopFormatting || !myFileTreeIterator.hasNext(); }