private static @Nullable AbstractBuildEvent convertAbstractBuildEvent(@NotNull ExternalSystemTaskExecutionEvent event) {
    var progressEvent = event.getProgressEvent();
    var eventId = progressEvent.getEventId();
    var descriptor = progressEvent.getDescriptor();
    var eventTime = descriptor.getEventTime();
    var displayName = descriptor.getDisplayName();
    var parentEventId = ObjectUtils.chooseNotNull(progressEvent.getParentEventId(), event.getId());

    if (progressEvent instanceof ExternalSystemStartEvent) {
      return new StartEventImpl(eventId, parentEventId, eventTime, displayName);
    }
    else if (progressEvent instanceof ExternalSystemFinishEvent<?> finishEvent) {
      var operationResult = finishEvent.getOperationResult();
      var eventResult = convertEventResult(operationResult);
      if (eventResult != null) {
        return new FinishEventImpl(eventId, parentEventId, eventTime, displayName, eventResult);
      }
    }
    else if (progressEvent instanceof ExternalSystemStatusEvent<?> statusEvent) {
      var total = statusEvent.getTotal();
      var progress = statusEvent.getProgress();
      var unit = statusEvent.getUnit();
      return new ProgressBuildEventImpl(eventId, parentEventId, eventTime, displayName, total, progress, unit);
    }
    else if (progressEvent instanceof ExternalSystemMessageEvent<?> messageEvent) {
      var message = ObjectUtils.chooseNotNull(messageEvent.getMessage(), displayName);
      var isStdOut = messageEvent.isStdOut();
      return new OutputBuildEventImpl(eventId, parentEventId, message, isStdOut);
    }
    LOG.warn("Undefined progress event " + event.getClass().getSimpleName() + " " + event);
    return null;
  }
private static @Nullable AbstractBuildEvent convertAbstractBuildEvent(@NotNull ExternalSystemTaskExecutionEvent event)