void (@NotNull Editor editor, @NotNull Caret caret, DataContext dataContext) { Project project = editor.getProject(); if (project != null && !caret.hasSelection()) { PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (file != null) { TextRange toDuplicate = EditorUtil.calcCaretLineTextRange(caret); PsiElement name = findNameIdentifier(editor, file, toDuplicate); if (name != null && !name.getTextRange().containsOffset(editor.getCaretModel().getOffset())) { editor.getCaretModel().moveToOffset(name.getTextOffset()); } } } myOriginal.execute(editor, caret, dataContext); }