[python] (PY-84985) fix typo and simplify expression

(cherry picked from commit afffca848993dee842d4f0a50e290d99f9de079d)

IJ-MR-179540

GitOrigin-RevId: 6d1fc8c32c5bc1fcded273cc8dc548b39b422416
This commit is contained in:
Vitaly Legchilkin
2025-10-22 19:32:17 +00:00
committed by intellij-monorepo-bot
parent d6ff6265db
commit 0955865e8f
@@ -101,16 +101,16 @@ private class HatchEnvComboBoxListCellRenderer(val contentFlow: StateFlow<PyResu
private fun <P : PathHolder> Panel.addEnvironmentComboBox(
model: PythonAddInterpreterModel<P>,
validationRequestor: DialogValidationRequestor,
isValidateOnlyNotExisting: Boolean,
isGenerateNewMode: Boolean,
): ComboBox<HatchVirtualEnvironment> {
val environmentAlreadyExists = AtomicBooleanProperty(false)
lateinit var environmentComboBox: ComboBox<HatchVirtualEnvironment>
val hatchEnvironmentProperty = if (isValidateOnlyNotExisting)
model.hatchViewModel.selectedEnvFromExisting
else
val hatchEnvironmentProperty = if (isGenerateNewMode)
model.hatchViewModel.selectedEnvFromAvailable
else
model.hatchViewModel.selectedEnvFromExisting
row(message("sdk.create.custom.hatch.environment")) {
environmentComboBox = comboBox(emptyList(), HatchEnvComboBoxListCellRenderer(model.hatchViewModel.availableEnvironments))
@@ -123,7 +123,7 @@ private fun <P : PathHolder> Panel.addEnvironmentComboBox(
component.item == null -> {
ValidationInfo(message("sdk.create.custom.hatch.error.no.environments.to.select"))
}
isValidateOnlyNotExisting && component.item?.pythonVirtualEnvironment is PythonVirtualEnvironment.Existing -> {
isGenerateNewMode && component.item?.pythonVirtualEnvironment is PythonVirtualEnvironment.Existing -> {
environmentAlreadyExists.set(true)
ValidationInfo(message("sdk.create.custom.hatch.environment.exists"))
}
@@ -220,7 +220,7 @@ internal fun <P : PathHolder> Panel.buildHatchFormFields(
environmentComboBox = addEnvironmentComboBox(
model = model,
validationRequestor = validationRequestor,
isValidateOnlyNotExisting = isGenerateNewMode
isGenerateNewMode = isGenerateNewMode
)
if (isGenerateNewMode) {