private boolean showXmlView(
      ImDocument doc, ImAnnotation annot, int xmlWrapperFlags, ImDocumentMarkupPanel idmp) {

    //	collect current display settings, including colors ...
    Set taggedAnnotTypes = new HashSet();
    Set highlightedAnnotTypes = new HashSet();
    Map annotTypeColors = new HashMap();

    //	... for both regions ...
    String[] regTypes = idmp.getLayoutObjectTypes();
    for (int t = 0; t < regTypes.length; t++) {
      String regAnnotType = ImDocumentRoot.getRegionAnnotationType(regTypes[t]);
      if (regAnnotType == null) continue;
      Color typeColor = idmp.getLayoutObjectColor(regTypes[t]);
      if (typeColor != null) annotTypeColors.put(regAnnotType, typeColor);
      if (!idmp.areRegionsPainted(regTypes[t])) continue;
      if (ImWord.WORD_ANNOTATION_TYPE.equals(regTypes[t])) continue;
      if (TableConstants.TABLE_CELL_ANNOTATION_TYPE.equals(regAnnotType))
        highlightedAnnotTypes.add(regAnnotType);
      else taggedAnnotTypes.add(regAnnotType);
    }

    //	... and annotations ...
    String[] annotTypes = idmp.getAnnotationTypes();
    for (int t = 0; t < annotTypes.length; t++) {
      Color typeColor = idmp.getAnnotationColor(annotTypes[t]);
      if (typeColor != null) annotTypeColors.put(annotTypes[t], typeColor);
      if (!idmp.areAnnotationsPainted(annotTypes[t])) continue;
      if (this.isStructureAnnotationType(annotTypes[t])) taggedAnnotTypes.add(annotTypes[t]);
      else highlightedAnnotTypes.add(annotTypes[t]);
    }

    //	..., and add paragraphs, which are implicit in text streams
    taggedAnnotTypes.add(ImRegion.PARAGRAPH_TYPE);

    //	we need to go through this rigmarole because color settings only show up from the second
    // original dialog opened onward
    new ImDocumentEditorDialog(
        this.parent,
        "Color Initializer",
        Gamta.newDocument(Gamta.newTokenSequence("COLOR INITIALIZER", null)),
        xmlWrapperFlags,
        taggedAnnotTypes,
        highlightedAnnotTypes,
        annotTypeColors);

    //	finally ...
    return this.showXmlView(
        doc,
        annot,
        xmlWrapperFlags,
        taggedAnnotTypes,
        highlightedAnnotTypes,
        annotTypeColors,
        idmp);
  }
 //	TODO move this to ImUtils (also from AnnotationActionProvider)
 private String getAnnotationShortValue(ImWord start, ImWord end) {
   if (start == end) return start.getString();
   else if (start.getNextWord() == end)
     return (start.getString()
         + (Gamta.insertSpace(start.getString(), end.getString()) ? " " : "")
         + end.getString());
   else return (start.getString() + " ... " + end.getString());
 }