private int getColumnWidthFromData(@NotNull TableColumn column) {
    int index = column.getModelIndex();
    VcsLogColumn<?> logColumn = VcsLogColumnManager.getInstance().getColumn(index);

    VcsLogCellRenderer cellRenderer = getVcsLogCellRenderer(column);
    if (cellRenderer == null) {
      return column.getPreferredWidth();
    }
    VcsLogCellRenderer.PreferredWidth preferredWidth = cellRenderer.getPreferredWidth();
    if (preferredWidth instanceof VcsLogCellRenderer.PreferredWidth.Fixed fixedWidth) {
      int width = fixedWidth.getFunction().invoke(this);
      if (width >= 0) {
        return width;
      }
      else {
        // negative values are returned because of the migration
        // from com.intellij.vcs.log.ui.table.VcsLogCellRenderer.getPreferredWidth(javax.swing.JTable)
        return column.getPreferredWidth();
      }
    }
    if (getModel().getRowCount() <= 0 || myInitializedColumns.contains(logColumn) || preferredWidth == null) {
      return column.getPreferredWidth();
    }

    VcsLogCellRenderer.PreferredWidth.FromData widthFromData = (VcsLogCellRenderer.PreferredWidth.FromData)preferredWidth;

    int maxRowsToCheck = Math.min(MAX_ROWS_TO_CALC_WIDTH, getRowCount());
    int maxValueWidth = 0;
    int unloaded = 0;
    for (int row = 0; row < maxRowsToCheck; row++) {
      Object value = getModel().getValueAt(row, logColumn);
      Integer width = widthFromData.getFunction().invoke(this, value, row, getColumnViewIndex(logColumn));
      if (width == null) {
        unloaded++;
        continue;
      }
      maxValueWidth = Math.max(width, maxValueWidth);
    }

    int width = Math.min(maxValueWidth, JBUIScale.scale(MAX_DEFAULT_DYNAMIC_COLUMN_WIDTH));
    if (unloaded * 2 <= maxRowsToCheck) myInitializedColumns.add(logColumn);
    return width;
  }
private int getColumnWidthFromData(@NotNull TableColumn column)