LogicalPosition (Editor editor, XmlTag tag, String attrName) { final XmlAttributeValue element = tag.getAttribute(attrName).getValueElement(); return editor.offsetToLogicalPosition(element.getTextRange().getStartOffset() + element.getTextRange().getLength() / 2); }