/**
   * Returns the index for this element, using its hierarchical level (for example "2.1.4").
   *
   * @param element a structured element
   * @return the index of this element
   */
  private String getIndex(IntentStructuredElement element) {

    int positionInContainer = 0;
    // If the element is contained in a document
    if (element.eContainer() instanceof IntentDocument) {
      // We get its position in this document
      positionInContainer = element.eContainer().eContents().indexOf(element) + 1;
    } else {
      // If the element is contained in a SubSectionContainer (i.e. Section or Chapter)
      if (element.eContainer() instanceof IntentSubSectionContainer) {
        // we get its position in this container
        positionInContainer =
            ((IntentSubSectionContainer) element.eContainer()).getSubSections().indexOf(element)
                + 1;
      }
    }
    return Integer.toString(positionInContainer) + ".";
  }
 public static String getIndex(IntentStructuredElement structuredElement) {
   String index = structuredElement.getCompleteLevel().replace(".", "_");
   return index;
 }