fireUndoableEditUpdate(new UndoableEditEvent(this, ev));
  public void setLogicalStyle(int position, Style style)  {    Element el = getParagraphElement(position);    // getParagraphElement doesn't return null but subclasses might so    // we check for null here.    if (el == null)      return;    try    {      writeLock();        if (el instanceof AbstractElement)      {        AbstractElement ael = (AbstractElement) el;        ael.setResolveParent(style);          int start = el.getStartOffset();          int end = el.getEndOffset();          DefaultDocumentEvent ev =             new DefaultDocumentEvent (                                      start,                                       end - start,                                       DocumentEvent.EventType.CHANGE);          // FIXME: Add an UndoableEdit to this event and fire it.          fireChangedUpdate(ev);      }    else        throw new         AssertionError("paragraph elements are expected to be"                       + "instances of AbstractDocument.AbstractElement");    }    finally    {      writeUnlock();    }  }