edit.addAddedElement(newEl1); if (current.getEndOffset() != newEndOffset) {   }
offset = newEndOffset;
    private void insertFirstContentTag(ElementSpec[] data)    {            // FIXME: This method is not complete.  It needs to properly recreate the      // leaves when the spec's direction is JoinPreviousDirection.      ElementSpec first = data[0];      BranchElement paragraph = (BranchElement) elementStack.peek();      int index = paragraph.getElementIndex(offset);      Element current = paragraph.getElement(index);      int newEndOffset = offset + first.length;      Edit edit = getEditForParagraphAndIndex(paragraph, index);      switch (first.getDirection())        {        case ElementSpec.JoinPreviousDirection:          if (current.getEndOffset() != newEndOffset)            {              Element newEl1 = createLeafElement(paragraph, current.getAttributes(), current.getStartOffset(), newEndOffset);                            edit.addRemovedElement(current);              edit.addAddedElement(newEl1);              if (current.getEndOffset() != newEndOffset)                {                  // This means all the leaves that were there previously need                  // to be recreated after all the new Elements are inserted.                }            }          break;        case ElementSpec.JoinNextDirection:          if (offset != 0)            {              Element next = paragraph.getElement(index + 1);              Element[] removed = new Element[] { current, next };              Element newEl1 = createLeafElement(paragraph, current.getAttributes(), current.getStartOffset(), offset);              Element[] added = new Element[2];              added[0] = newEl1;              if (data.length == 1)                added[1] = createLeafElement(paragraph, next.getAttributes(), offset, next.getEndOffset());              else                added[1] = createLeafElement(paragraph, next.getAttributes(), offset, newEndOffset);              edit.addRemovedElements(removed);              edit.addAddedElements(added);            }          break;        case ElementSpec.OriginateDirection:          if (current.getStartOffset() != offset)            {              Element newEl1 = createLeafElement(paragraph, current.getAttributes(), current.getStartOffset(), offset);              edit.addAddedElement(newEl1);            }          Element newEl2 = createLeafElement(paragraph, first.getAttributes(), offset, newEndOffset);          edit.addRemovedElement(current);          edit.addAddedElement(newEl2);          if (current.getEndOffset() != endOffset && (data.length == 1))            {              // This means all the leaves that were there previously need              // to be recreated after all the new Elements are inserted.              Element newCurrent = createLeafElement(paragraph, current.getAttributes(), newEndOffset, current.getEndOffset());              edit.addAddedElement(newCurrent);            }                      break;        default:          break;        }      offset = newEndOffset;     }