Skip to content

Commit

Permalink
Remove tests and run spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecKazakova committed Apr 21, 2022
1 parent 506c311 commit cb7d557
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ class SqliteConnectionManager : ConnectionManager {
Thread.currentThread().contextClassLoader = previousContextLoader
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package app.cash.sqldelight.dialects.sqlite_3_18

import app.cash.sqldelight.dialect.api.ConnectionManager
import app.cash.sqldelight.dialect.api.SqlDelightDialect
import app.cash.sqldelight.dialect.api.TypeResolver
import app.cash.sqldelight.dialects.sqlite_3_18.grammar.SqliteParserUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ interface ConnectionManager {
val key: String,
val serializedProperties: String
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal class DatabaseFileViewProvider(
try {
val connectionManager = SqlDelightProjectService.getInstance(manager.project)
.dialect.connectionManager() ?: return null
val properties = ConnectionProperties("temp", virtualFile.path)
val properties = ConnectionProperties("temp", virtualFile.path)
val statements = connectionManager.getConnection(properties).use {
it.prepareStatement("SELECT sql FROM sqlite_master WHERE sql IS NOT NULL;").use {
it.executeQuery().use {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ internal class ConnectionOptions(val project: Project) {
selectedOption = properties.key
}

fun unselectOption() {
selectedOption = ""
}

fun getKeys(): Collection<String> {
return adapter.fromJson(options.ifEmpty { return emptyList() })!!.map.keys
}
Expand All @@ -33,4 +37,4 @@ internal class ConnectionOptions(val project: Project) {
private class StoredOptions(
val map: MutableMap<String, String> = linkedMapOf()
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,40 @@ internal class ConnectionListPanel(

init {
layout = GridBagLayout()
add(JBScrollPane(list.apply {
selectionMode = ListSelectionModel.SINGLE_SELECTION
layoutOrientation = JList.VERTICAL
addListSelectionListener {
connectionOptions.selectedOption = list.selectedValue ?: ""
add(
JBScrollPane(
list.apply {
selectionMode = ListSelectionModel.SINGLE_SELECTION
layoutOrientation = JList.VERTICAL
addListSelectionListener {
connectionOptions.selectedOption = list.selectedValue ?: ""
}
}
),
GridBagConstraints().apply {
fill = GridBagConstraints.BOTH
weighty = 1.0
weightx = 1.0
gridx = 0
gridy = 0
}
}), GridBagConstraints().apply {
fill = GridBagConstraints.BOTH
weighty = 1.0
weightx = 1.0
gridx = 0
gridy = 0
})
add(JButton("Add Connection").apply {
addActionListener {
val properties = connectionManager.createNewConnectionProperties(project)
?: return@addActionListener
connectionOptions.addOption(properties)
list.model = JBList.createDefaultListModel(*connectionOptions.getKeys().toTypedArray())
)
add(
JButton("Add Connection").apply {
addActionListener {
val properties = connectionManager.createNewConnectionProperties(project)
?: return@addActionListener
connectionOptions.addOption(properties)
list.model = JBList.createDefaultListModel(*connectionOptions.getKeys().toTypedArray())
}
},
GridBagConstraints().apply {
fill = GridBagConstraints.HORIZONTAL
weighty = 0.0
weightx = 1.0
gridx = 0
gridy = 1
}
}, GridBagConstraints().apply {
fill = GridBagConstraints.HORIZONTAL
weighty = 0.0
weightx = 1.0
gridx = 0
gridy = 1
})
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ internal class SqlDelightToolWindowFactory(
toolWindow: ToolWindow
) {
val runSqlText = JPanel(BorderLayout()).apply {
add(JBTextArea("Create a connection to get started.").apply {
margin = Insets(8, 8, 8, 8)
isEditable = false
}, BorderLayout.CENTER)
add(
JBTextArea("Create a connection to get started.").apply {
margin = Insets(8, 8, 8, 8)
isEditable = false
},
BorderLayout.CENTER
)
}

toolWindow.contentManager.apply {
Expand Down Expand Up @@ -62,4 +65,4 @@ internal fun ContentManager.createWithConnectionSidePanel(
)

return factory.createContent(panel, name, false)
}
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit cb7d557

Please sign in to comment.