Wizard: fix incorrectly added modules to the tree

This commit is contained in:
Ilya Kirillov
2020-01-18 14:03:02 +03:00
parent 5392ff128f
commit 18090c0e0a
@@ -23,13 +23,13 @@ class TargetsModel(
val userObject = parentToAdd.userObject
when {
userObject is Module && userObject.kind == ModuleKind.singleplatform -> {
val indexOfLastModule = parent.children()
val indexOfLastModule = parentToAdd.children()
.toList()
.indexOfLast {
it.safeAs<DefaultMutableTreeNode>()?.userObject is Module
}
if (indexOfLastModule == -1) parent.insert(this, 0)
else parent.insert(this, indexOfLastModule)
if (indexOfLastModule == -1) parentToAdd.insert(this, 0)
else parentToAdd.insert(this, indexOfLastModule)
}
else -> parentToAdd.add(this)
}