public CloudConfigurationComboBox(@NotNull Kind configurationKind) {
    myConfigurationKind = configurationKind;
    myConfigurationProvider = CloudConfigurationProvider.getCloudConfigurationProvider();
    setMinimumSize(new Dimension(100, getMinimumSize().height));

    getComboBox().setRenderer(new TestConfigurationRenderer());
    getComboBox()
        .addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                Object item = getComboBox().getSelectedItem();
                if (item instanceof CloudConfiguration) {
                  CloudConfiguration cloudConfiguration = (CloudConfiguration) item;
                  myLastChosenCloudConfigurationPerKind.put(
                      myConfigurationKind, cloudConfiguration);
                  if (myCurrentAndroidConfiguration != null && myCurrentModule != null) {
                    Map<Pair<Kind, Module>, CloudConfiguration> matrixConfigurationByModuleCache =
                        myMatrixConfigurationByAndroidConfigurationAndModuleCache.get(
                            myCurrentAndroidConfiguration);
                    if (matrixConfigurationByModuleCache == null) {
                      matrixConfigurationByModuleCache = Maps.newHashMapWithExpectedSize(5);
                      myMatrixConfigurationByAndroidConfigurationAndModuleCache.put(
                          myCurrentAndroidConfiguration, matrixConfigurationByModuleCache);
                    }
                    matrixConfigurationByModuleCache.put(
                        Pair.create(myConfigurationKind, myCurrentModule), cloudConfiguration);
                  }
                }
              }
            });

    CloudConfigurationCoordinator.getInstance(myConfigurationKind).addComboBox(this);
  }
  public void setFacet(@NotNull AndroidFacet facet) {
    if (!CloudConfigurationProvider.isEnabled()) {
      return; // Running tests in cloud is not enabled!
    }

    myCurrentFacet = facet;
    myCurrentModule = myCurrentFacet.getModule();
    myTestingConfigurations =
        myConfigurationProvider.getCloudConfigurations(myCurrentFacet, myConfigurationKind);

    // Since setFacet can be called multiple times, make sure to remove any previously registered
    // listeners.
    removeActionListener(myActionListener);

    myActionListener =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            CloudConfiguration selectedConfig =
                myConfigurationProvider.openMatrixConfigurationDialog(
                    myCurrentFacet,
                    (CloudConfiguration) getComboBox().getSelectedItem(),
                    myConfigurationKind);
            // Update the comboboxes' contents even if selectedConfig is null since it might mean
            // that a user deleted
            // all configurations in the Matrix Configuration dialog.
            List<? extends CloudConfiguration> cloudConfigurations =
                myConfigurationProvider.getCloudConfigurations(myCurrentFacet, myConfigurationKind);
            CloudConfigurationCoordinator.getInstance(myConfigurationKind)
                .updateComboBoxesWithNewCloudConfigurations(cloudConfigurations, myCurrentModule);
            if (cloudConfigurations.isEmpty() || selectedConfig != null) {
              getComboBox().setSelectedItem(selectedConfig);
            }
            getComboBox().updateUI();
          }
        };
    addActionListener(myActionListener);

    updateContent();
  }