@Override public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException { PsiElement container = myFix instanceof AbstractBatchSuppressByNoInspectionCommentFix ? ((AbstractBatchSuppressByNoInspectionCommentFix) myFix).getContainer(element) : null; boolean caretWasBeforeStatement = editor != null && container != null && editor.getCaretModel().getOffset() == container.getTextRange().getStartOffset(); InspectionManager inspectionManager = InspectionManager.getInstance(project); ProblemDescriptor descriptor = inspectionManager.createProblemDescriptor( element, element, "", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false); myFix.applyFix(project, descriptor); if (caretWasBeforeStatement) { editor.getCaretModel().moveToOffset(container.getTextRange().getStartOffset()); } }
@NotNull @Override public String getFamilyName() { return myFix.getFamilyName(); }
@NotNull @Override public String getText() { return myFix.getName(); }
@Override public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { return myFix.isAvailable(project, element); }