insertAtBoundary(editor, doc, offset, insertElement, html, parentTag, addTag);
Element parent = insertElement; Element el;  if (offset > 0 || insertElement == null) { el = doc.getDefaultRootElement(); while (el != null && el.getStartOffset() != offset && ! el.isLeaf()) el = el.getElement(el.getElementIndex(offset)); parent = el != null ? el.getParentElement() : null; } if (parent != null) { int pops = 0; int pushes = 0; if (offset == 0 && insertElement != null) { el = parent; while (el != null && ! el.isLeaf()) { el = el.getElement(el.getElementIndex(offset)); pops++; } } else { el = parent; offset--; while (el != null && ! el.isLeaf()) { el = el.getElement(el.getElementIndex(offset)); pops++; } el = parent; offset++; while (el != null && el != insertElement) { el = el.getElement(el.getElementIndex(offset)); pushes++; } } pops = Math.max(0, pops - 1); insertHTML(editor, doc, offset, html, pops, pushes, addTag); }
      protected void insertAtBoundry(JEditorPane editor,                                     HTMLDocument doc,                                     int offset, Element insertElement,                                     String html, HTML.Tag parentTag,                                     HTML.Tag addTag)      {        insertAtBoundary(editor, doc, offset, insertElement,                         html, parentTag, addTag);      }