@NotNull
  private static JComponent textComponentSpanningWholeRow(
    @NotNull SimpleColoredComponent chunks,
    Color rowBackground,
    Color rowSelectionBackground,
    Color rowForeground,
    final int column,
    @NotNull final JTable table
  ) {
    final SimpleColoredComponent component = new SimpleColoredComponent() {
      @Override
      protected void doPaint(Graphics2D g) {
        int leftRightInset = JBUI.CurrentTheme.Popup.Selection.LEFT_RIGHT_INSET.get();
        Insets innerInsets = JBUI.CurrentTheme.Popup.Selection.innerInsets();
        int offset = column > 0 && ExperimentalUI.isNewUI() ? -innerInsets.left - leftRightInset : 0;
        int i = 0;
        final TableColumnModel columnModel = table.getColumnModel();
        while (i < column) {
          offset += columnModel.getColumn(i).getWidth();
          i++;
        }
        g.translate(-offset, 0);

        // should increase the column width so that selection background will be visible even after offset translation
        setSize(getWidth() + offset, getHeight());

        super.doPaint(g);

        g.translate(+offset, 0);
      }

      @NotNull
      @Override
      public Dimension getPreferredSize() {
        //return super.getPreferredSize();
        return column == table.getColumnModel().getColumnCount() - 1 ? super.getPreferredSize() : new Dimension(0, 0);
        // it should span the whole row, so we can't return any specific value here,
        // because otherwise it would be used in the "max width" calculation in com.intellij.find.actions.ShowUsagesAction.calcMaxWidth
      }
    };

    component.setForeground(rowForeground);
    component.setOpaque(false);

    for (SimpleColoredComponent.ColoredIterator iterator = chunks.iterator(); iterator.hasNext(); ) {
      iterator.next();
      String fragment = iterator.getFragment();
      SimpleTextAttributes attributes = iterator.getTextAttributes();
      attributes = attributes.derive(attributes.getStyle(), rowForeground, rowBackground, attributes.getWaveColor());
      component.append(fragment, attributes);
    }

    SelectablePanel result = SelectablePanel.wrap(component);
    applyBackground(result, column, rowBackground, rowSelectionBackground);

    return result;
  }
@NotNull
  private static JComponent textComponentSpanningWholeRow(
    @NotNull SimpleColoredComponent chunks,
    Color rowBackground,
    Color rowSelectionBackground,
    Color rowForeground,
    final int column,
    @NotNull final JTable table
  )