int (final DomElement parent, final DomCollectionChildDescription childDescription, final Editor editor) { int offset = editor.getCaretModel().getOffset(); for (int i = 0; i < childDescription.getValues(parent).size(); i++) { DomElement element = childDescription.getValues(parent).get(i); XmlElement xmlElement = element.getXmlElement(); if (xmlElement != null && xmlElement.getTextRange().getStartOffset() >= offset) { return i; } } return -1; }