Set<ImportOptimizer> (@NotNull PsiFile file) { CodeStyleSettings settings = CodeStyle.getSettings(file); if (settings.getExcludedFiles().contains(file)) { return Collections.emptySet(); } Set<ImportOptimizer> optimizers = new HashSet<>(); for (PsiFile psiFile : file.getViewProvider().getAllFiles()) { List<ImportOptimizer> langOptimizers = allForLanguage(psiFile.getLanguage()); for (ImportOptimizer optimizer : langOptimizers) { if (optimizer != null && optimizer.supports(psiFile)) { optimizers.add(optimizer); break; } } } return optimizers; }