List<Runnable> (@NotNull PsiFile file) { FormattingService service = FormattingServiceUtil.findImportsOptimizingService(file); List<Runnable> runnables = new ArrayList<>(); List<PsiFile> files = file.getViewProvider().getAllFiles(); for (ImportOptimizer optimizer : service.getImportOptimizers(file)) { for (PsiFile psiFile : files) { if (optimizer.supports(psiFile)) { runnables.add(optimizer.processFile(psiFile)); } } } return runnables; }