private void addDelegationComponents(PaintAwarePanel content, int indentLevel) {
    myDelegatePanel = addComponentsGroup(GradleBundle.message("gradle.settings.text.build.run.title"), content, indentLevel, panel -> {
      if (dropDelegateBuildCombobox && dropTestRunnerCombobox) return;

      JBLabel label = new JBLabel(
        XmlStringUtil.wrapInHtml(GradleBundle.message("gradle.settings.text.build.run.hint", getIDEName())),
        UIUtil.ComponentStyle.SMALL);
      label.setForeground(UIUtil.getLabelFontColor(UIUtil.FontColor.BRIGHTER));

      GridBag constraints = ExternalSystemUiUtil.getFillLineConstraints(indentLevel + 1);
      constraints.insets.bottom = UIUtil.LARGE_VGAP;
      panel.add(label, constraints);

      if (!dropDelegateBuildCombobox) {
        BuildRunItem[] states = new BuildRunItem[]{new BuildRunItem(Boolean.TRUE), new BuildRunItem(Boolean.FALSE)};
        myDelegateBuildCombobox = new ComboBox<>(states);
        myDelegateBuildCombobox.setRenderer(new MyItemCellRenderer<>());
        myDelegateBuildCombobox.setSelectedItem(new BuildRunItem(myInitialSettings.getDelegatedBuild()));

        myDelegateBuildLabel = new JBLabel(GradleBundle.message("gradle.settings.text.build.run"));
        panel.add(myDelegateBuildLabel, getLabelConstraints(indentLevel + 1));
        panel.add(myDelegateBuildCombobox, getLabelConstraints(0));
        panel.add(Box.createGlue(), ExternalSystemUiUtil.getFillLineConstraints(indentLevel + 1));

        myDelegateBuildLabel.setLabelFor(myDelegateBuildCombobox);
      }
      if (!dropTestRunnerCombobox) {
        TestRunnerItem[] testRunners = StreamEx.of(TestRunner.values()).map(TestRunnerItem::new).toArray(TestRunnerItem[]::new);
        myTestRunnerCombobox = new ComboBox<>(testRunners);
        myTestRunnerCombobox.setRenderer(new MyItemCellRenderer<>());
        myTestRunnerCombobox.setSelectedItem(new TestRunnerItem(myInitialSettings.getTestRunner()));

        // make sure that the two adjacent comboboxes have same size
        myTestRunnerCombobox.setPrototypeDisplayValue(new TestRunnerItem(TestRunner.CHOOSE_PER_TEST));
        if (myDelegateBuildCombobox != null) {
          myDelegateBuildCombobox.setPreferredSize(myTestRunnerCombobox.getPreferredSize());
        }

        myTestRunnerLabel = new JBLabel(GradleBundle.message("gradle.settings.text.run.tests"));
        panel.add(myTestRunnerLabel, getLabelConstraints(indentLevel + 1));
        panel.add(myTestRunnerCombobox, getLabelConstraints(0));
        panel.add(Box.createGlue(), ExternalSystemUiUtil.getFillLineConstraints(indentLevel + 1));

        myTestRunnerLabel.setLabelFor(myTestRunnerCombobox);
      }
    });
  }
private void addDelegationComponents(PaintAwarePanel content, int indentLevel)