ModCommand (@NotNull ActionContext context) { PsiElement element = Objects.requireNonNull(context.findLeaf()); InspectionManager inspectionManager = InspectionManager.getInstance(context.project()); PsiElement container = getContainer(element); boolean caretWasBeforeStatement = container != null && context.offset() == container.getTextRange().getStartOffset(); ProblemDescriptor descriptor = inspectionManager.createProblemDescriptor( element, element, "", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false); ModCommand command = mcFix.perform(context.project(), descriptor); if (caretWasBeforeStatement) { command = ModCommand.moveCaretAfter(command, container.getContainingFile(), context.offset(), true); } return command; }