@Override
    public void documentChanged(final @NotNull DocumentEvent event) {
      final Integer pos = event.getOffset();
      if (ApplicationManager.getApplication().isDispatchThread()) {
        firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
        // Fire caret changed event when the document changes because caretPositionChanged might not be called in some cases
        // (e.g., when deleting text or adding/removing tab indentation, see CaretListener#caretPositionChanged).
        firePropertyChange(ACCESSIBLE_CARET_PROPERTY, null, pos);
        if (SystemInfo.isMac) {
          // For MacOSX we also need to fire a JTextComponent event to anyone listening
          // to our Document, since *that* rather than the accessible property
          // change is the only way to trigger a speech update
          fireJTextComponentDocumentChange(event);
        }
      } else {
        ApplicationManager.getApplication().invokeLater(() -> {
          firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
          firePropertyChange(ACCESSIBLE_CARET_PROPERTY, null, pos);
          fireJTextComponentDocumentChange(event);
        });
      }
    }
@Override
    public void documentChanged(final @NotNull DocumentEvent event)