[Editor] Enable opening multiple SQL scripts in tabs

This commit is contained in:
2021-03-25 11:15:50 +01:00
parent 80b4621f39
commit fc8dbda165
2 changed files with 5 additions and 3 deletions

View File

@@ -20,6 +20,8 @@ class TablesListView : View() {
private var database: SQLDatabase? = null
private var index = 0
private val treeView = treeview<SQLElement> {
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
)

View File

@@ -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