[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 database: SQLDatabase? = null
private var index = 0
private val treeView = treeview<SQLElement> { private val treeView = treeview<SQLElement> {
isShowRoot = false isShowRoot = false
@@ -39,7 +41,7 @@ class TablesListView : View() {
button("SQL Script", graphic = FontIcon("fa-code")) { button("SQL Script", graphic = FontIcon("fa-code")) {
action { action {
mainController.openScript( mainController.openScript(
fsNode = InMemoryStringFileNode("Script", "sql", "SELECT * FROM myTable;"), fsNode = InMemoryStringFileNode("Script ${++index}", "sql", ""),
execute = { code -> databaseService.run { executeScript(code, this) } }, execute = { code -> databaseService.run { executeScript(code, this) } },
saveable = false saveable = false
) )

View File

@@ -14,8 +14,8 @@ class InMemoryStringFileNode(name: String, extension: String, val content: Strin
override val nameWithoutExtensionProperty = name.toProperty() override val nameWithoutExtensionProperty = name.toProperty()
override val nameWithoutExtension by nameWithoutExtensionProperty override val nameWithoutExtension by nameWithoutExtensionProperty
override val absolutePathProperty = "".toProperty() override val absolutePathProperty = nameProperty
override val absolutePath by absolutePathProperty override val absolutePath = name
override val type = FileType.FILE override val type = FileType.FILE