void (@NotNull Project project, @NotNull PsiFile file, @Nullable Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement) { final XmlTag next = editor != null ? PsiTreeUtil.getNextSiblingOfType(startElement, XmlTag.class) : null; final XmlTag prev = editor != null ? PsiTreeUtil.getPrevSiblingOfType(startElement, XmlTag.class) : null; startElement.delete(); if (editor != null) { if (next != null) { editor.getCaretModel().moveToOffset(next.getTextRange().getStartOffset()); } else if (prev != null) { editor.getCaretModel().moveToOffset(prev.getTextRange().getEndOffset()); } } }