mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-26361 Refer to environment location directory unambiguously in warnings
This commit is contained in:
@@ -106,7 +106,7 @@ class PyAddNewCondaEnvPanel(private val project: Project?,
|
||||
}
|
||||
|
||||
override fun validateAll() =
|
||||
listOfNotNull(validateAnacondaPath(), validateEmptyOrNonExistingDirectoryLocation(pathField))
|
||||
listOfNotNull(validateAnacondaPath(), validateEnvironmentDirectoryLocation(pathField))
|
||||
|
||||
override fun getOrCreateSdk(): Sdk? {
|
||||
val condaPath = condaPathField.text
|
||||
|
||||
@@ -91,7 +91,7 @@ class PyAddNewVirtualEnvPanel(private val project: Project?,
|
||||
}
|
||||
|
||||
override fun validateAll() =
|
||||
listOfNotNull(validateEmptyOrNonExistingDirectoryLocation(pathField),
|
||||
listOfNotNull(validateEnvironmentDirectoryLocation(pathField),
|
||||
validateSdkComboBox(baseSdkField))
|
||||
|
||||
override fun getOrCreateSdk(): Sdk? {
|
||||
|
||||
@@ -44,13 +44,13 @@ abstract class PyAddSdkPanel : JPanel() {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
protected fun validateEmptyOrNonExistingDirectoryLocation(field: TextFieldWithBrowseButton): ValidationInfo? {
|
||||
protected fun validateEnvironmentDirectoryLocation(field: TextFieldWithBrowseButton): ValidationInfo? {
|
||||
val text = field.text
|
||||
val file = File(text)
|
||||
val message = when {
|
||||
StringUtil.isEmptyOrSpaces(text) -> "Location field is empty"
|
||||
file.exists() && !file.isDirectory -> "Location field path is not a directory"
|
||||
file.isNotEmptyDirectory -> "Location directory is not empty"
|
||||
StringUtil.isEmptyOrSpaces(text) -> "Environment location field is empty"
|
||||
file.exists() && !file.isDirectory -> "Environment location field path is not a directory"
|
||||
file.isNotEmptyDirectory -> "Environment location directory is not empty"
|
||||
else -> return null
|
||||
}
|
||||
return ValidationInfo(message, field)
|
||||
|
||||
Reference in New Issue
Block a user