public static <S extends CommonProgramRunConfigurationParameters>
  SettingsEditorFragment<S, LabeledComponent<TextFieldWithBrowseButton>> createWorkingDirectory(
    @NotNull Project project,
    @NotNull Computable<? extends Module> moduleProvider
  ) {
    ExtendableTextField textField = new ExtendableTextField(10);
    MacrosDialog.addMacroSupport(textField, MacrosDialog.Filters.DIRECTORY_PATH, () -> moduleProvider.compute() != null);
    TextFieldWithBrowseButton workingDirectoryField = new TextFieldWithBrowseButton(textField);
    workingDirectoryField.addBrowseFolderListener(
      ExecutionBundle.message("select.working.directory.message"),
      null,
      project,
      FileChooserDescriptorFactory.createSingleFolderDescriptor(),
      TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT
    );
    LabeledComponent<TextFieldWithBrowseButton> field = LabeledComponent.create(
      workingDirectoryField,
      ExecutionBundle.message("run.configuration.working.directory.label"),
      BorderLayout.WEST
    );
    SettingsEditorFragment<S, LabeledComponent<TextFieldWithBrowseButton>> workingDirectorySettings =
      new SettingsEditorFragment<>(
        "workingDirectory",
        ExecutionBundle.message("run.configuration.working.directory.name"),
        null,
        field,
        (settings, component) -> component.getComponent().setText(settings.getWorkingDirectory()),
        (settings, component) -> settings.setWorkingDirectory(component.getComponent().getText()),
        Predicates.alwaysTrue()
      );
    workingDirectorySettings.setRemovable(false);
    workingDirectorySettings.setValidation(
      settings -> {
        ThrowableRunnable<RuntimeConfigurationWarning> runnable =
          () -> ProgramParametersUtil.checkWorkingDirectoryExist(settings, project, moduleProvider.compute());
        ValidationInfo validationInfo = RuntimeConfigurationException.validate(textField, runnable);
        return Collections.singletonList(validationInfo);
      });
    return workingDirectorySettings;
  }
public static <S extends CommonProgramRunConfigurationParameters>
  SettingsEditorFragment<S, LabeledComponent<TextFieldWithBrowseButton>> createWorkingDirectory(
    @NotNull Project project,
    @NotNull Computable<? extends Module> moduleProvider
  )