void (TextEditor textEditor, DomElement element) { if (element != null && element.isValid()) { XmlTag tag = element.getXmlTag(); if (tag == null) return; PsiFile file = tag.getContainingFile(); if (file == null) return; Document document = getDocumentManager().getDocument(file); if (document == null || !document.equals(textEditor.getEditor().getDocument())) return; textEditor.getEditor().getCaretModel().moveToOffset(tag.getTextOffset()); textEditor.getEditor().getScrollingModel().scrollToCaret(ScrollType.CENTER); } }