Wizard: do not update path & artifactId value for invalid project name
This commit is contained in:
+5
-2
@@ -78,8 +78,11 @@ class ProjectSettingsComponent(ideWizard: IdeWizard) : DynamicComponent(ideWizar
|
||||
super.onValueUpdated(reference)
|
||||
when (reference?.path) {
|
||||
StructurePlugin::name.path -> {
|
||||
tryUpdateLocationByProjectName()
|
||||
tryArtifactIdByProjectName()
|
||||
val isNameValid = read { StructurePlugin::name.reference.validate().isOk }
|
||||
if (isNameValid) {
|
||||
tryUpdateLocationByProjectName()
|
||||
tryArtifactIdByProjectName()
|
||||
}
|
||||
}
|
||||
StructurePlugin::artifactId.path -> {
|
||||
artifactIdWasUpdatedByHand = true
|
||||
|
||||
+3
@@ -192,6 +192,9 @@ class Context private constructor(
|
||||
val <V : Any, T : SettingType<V>> SettingReference<V, T>.setting: Setting<V, T>
|
||||
get() = with(this) { getSetting() }
|
||||
|
||||
fun <V : Any, T : SettingType<V>> SettingReference<V, T>.validate() =
|
||||
setting.validator.validate(this@Reader, settingValue)
|
||||
|
||||
inline operator fun <T> invoke(reader: Reader.() -> T): T = reader()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user