@Override
    public int getElementIndex(int i) {
      // For the root element this asks for the index of the offset, which
      // means the line number
      Document document = editor.getDocument();
      return document.getLineNumber(i);
    }
@Override
    public int getElementIndex(int i)