diff --git a/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/database/view/list/TablesListView.kt b/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/database/view/list/TablesListView.kt index fea40412..46c70ebd 100644 --- a/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/database/view/list/TablesListView.kt +++ b/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/database/view/list/TablesListView.kt @@ -20,6 +20,8 @@ class TablesListView : View() { private var database: SQLDatabase? = null + private var index = 0 + private val treeView = treeview { isShowRoot = false @@ -39,7 +41,7 @@ class TablesListView : View() { button("SQL Script", graphic = FontIcon("fa-code")) { action { mainController.openScript( - fsNode = InMemoryStringFileNode("Script", "sql", "SELECT * FROM myTable;"), + fsNode = InMemoryStringFileNode("Script ${++index}", "sql", ""), execute = { code -> databaseService.run { executeScript(code, this) } }, saveable = false ) diff --git a/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/file/model/InMemoryStringFileNode.kt b/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/file/model/InMemoryStringFileNode.kt index 63385a11..b2808458 100644 --- a/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/file/model/InMemoryStringFileNode.kt +++ b/editor/src/main/kotlin/com/bartlomiejpluta/base/editor/file/model/InMemoryStringFileNode.kt @@ -14,8 +14,8 @@ class InMemoryStringFileNode(name: String, extension: String, val content: Strin override val nameWithoutExtensionProperty = name.toProperty() override val nameWithoutExtension by nameWithoutExtensionProperty - override val absolutePathProperty = "".toProperty() - override val absolutePath by absolutePathProperty + override val absolutePathProperty = nameProperty + override val absolutePath = name override val type = FileType.FILE