private void updateJdkComponents(@Nullable String targetName) {
    boolean localTarget = targetName == null;
    myTargetJdkCombo.setVisible(!localTarget);
    myJdkCombo.setVisible(localTarget);
    if (!localTarget) {
      List<String> items = IntStream.range(0, myTargetJdkCombo.getItemCount())
        .mapToObj(i -> myTargetJdkCombo.getItemAt(i))
        .toList();

      List<String> targetItems = new ArrayList<>();
      TargetEnvironmentConfiguration targetEnvironmentConfiguration = TargetEnvironmentsManager.getInstance(myProject)
        .getTargets().findByName(targetName);
      if (targetEnvironmentConfiguration != null) {
        for (LanguageRuntimeConfiguration runtimeConfiguration : targetEnvironmentConfiguration.getRuntimes().resolvedConfigs()) {
          if (runtimeConfiguration instanceof JavaLanguageRuntimeConfiguration) {
            String homePath = ((JavaLanguageRuntimeConfiguration)runtimeConfiguration).getHomePath();
            targetItems.add(homePath);
          }
        }
      }

      if (!items.equals(targetItems)) {
        myTargetJdkCombo.removeAllItems();
        targetItems.forEach(myTargetJdkCombo::addItem);
      }
      myJdkLabel.setLabelFor(myTargetJdkCombo);
    } else {
      myJdkLabel.setLabelFor(myJdkCombo);
    }
  }
private void updateJdkComponents(@Nullable String targetName)