LocalQuickFix (boolean isOnTheFly) { final boolean requiresEditor = requiresEditor(); if (requiresEditor && !isOnTheFly) return null; return new LocalQuickFix() { @Override @NotNull public String getName() { return AbstractFix.this.getText(); } @Override @NotNull public String getFamilyName() { return AbstractFix.this.getFamilyName(); } @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { Editor editor; if (requiresEditor) { final DataContext dataContext = DataManager.getInstance().getDataContext(); editor = CommonDataKeys.EDITOR.getData(dataContext); if (editor == null) { if ((editor = FileEditorManager.getInstance(project).getSelectedTextEditor()) == null) { return; } } } else { editor = null; } final PsiFile psiFile = descriptor.getPsiElement().getContainingFile(); if (!isAvailable(project, editor, psiFile)) { return; } invoke(project, editor, psiFile); } }; }