private void addToPanel(JPanel panel, GridBagConstraints gc) {
      gc.gridx = 0;
      gc.anchor = GridBagConstraints.LINE_START;
      gc.fill = GridBagConstraints.HORIZONTAL;

      if (topSeparatorEnabled) {
        gc.insets = JBUI.insets(14, 0, 10, 0);
        gc.gridwidth = gridWidth();
        gc.weightx = 1.0;
        panel.add(mySeparatorComponent, gc);
        gc.gridy++;
      }

      gc.weightx = 0.0;
      gc.gridwidth = 1;
      gc.insets = JBUI.insets(topSeparatorEnabled || smallVariant ? 0 : 12, 13, 0, labelAbove ? 13 : 0);
      panel.add(label, gc);

      if (labelAbove) {
        gc.insets = JBUI.insets(4, 13, 4, 0);
        gc.gridy++;
      }
      else {
        gc.insets = JBUI.insets(topSeparatorEnabled || smallVariant ? 2 : 14, 12, 0, 0);
        gc.gridx++;
      }

      gc.weightx = 1.0;
      panel.add(myProgressBar, gc);
      gc.gridx++;

      myProgressBar.putClientProperty(DECORATED_PANEL_PROPERTY, this);

      gc.weightx = 0.0;
      gc.insets = JBUI.insets(labelAbove || topSeparatorEnabled || smallVariant ? 1 : 14,
                              UIUtil.isUnderWin10LookAndFeel() ? 9 : 10,
                              0, 13);

      if (cancelAction != null) {
        if (cancelAsButton) {
          myCancelButtonAsButton = new JButton(cancelText);
          myCancelButtonAsButton.addActionListener((e) -> cancelAction.run());
          panel.add(myCancelButtonAsButton, gc);
        }
        else {
          myCancelButton = new InplaceButton(cancelIcon, a -> {
            myCancelButton.setPainting(false);
            state = State.CANCELLED;
            cancelAction.run();
          }).setFillBg(false);
        }
      }
      if (resumeAction != null && pauseAction != null) {
        mySuspendButton = new InplaceButton(pauseIcon, a -> {
          if (state == State.CANCELLED) {
            return;
          }
          if (state == State.PLAYING) {
            mySuspendButton.setIcons(resumeIcon);
            state = State.PAUSED;
            setCommentText(IdeBundle.message("comment.text.resume"), true);
            pauseAction.run();
          }
          else {
            mySuspendButton.setIcons(pauseIcon);
            state = State.PLAYING;
            setCommentText(IdeBundle.message("comment.text.pause"), true);
            resumeAction.run();
          }
        }).setFillBg(false);
      }

      if (mySuspendButton != null) {
        addButton(panel, gc, mySuspendButton, false);
      }
      if (myCancelButton != null) {
        if (mySuspendButton != null) {
          gc.gridx++;
        }
        addButton(panel, gc, myCancelButton, true);
      }

      if (commentEnabled) {
        addLabel(panel, gc, comment);
      }

      if (text2 != null) {
        addLabel(panel, gc, text2);
        text2.setVisible(false);
      }

      gc.gridy++;
    }
private void addToPanel(JPanel panel, GridBagConstraints gc)