void (@NotNull Project project, Editor editor, PsiFile file) { if (!FileModificationService.getInstance().prepareFileForWrite(file)) return; ApplicationManager.getApplication().runWriteAction(() -> { if (!isStillAvailable()) return; PsiClass[] classes = getClassesToImport(true).toArray(PsiClass.EMPTY_ARRAY); if (classes.length == 0) return; AddImportAction action = createAddImportAction(classes, project, editor); action.execute(); }); }