Fix missing table header
This commit is contained in:
parent
6a30df2a89
commit
b33653ae22
|
|
@ -5,6 +5,7 @@ import com.intellij.openapi.actionSystem.ActionManager
|
|||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
import com.intellij.ui.components.JBScrollPane
|
||||
import com.intellij.ui.table.JBTable
|
||||
import java.awt.BorderLayout
|
||||
import java.awt.FlowLayout
|
||||
|
|
@ -20,14 +21,13 @@ class FilenameTemplateSettingsComponent(val filenameTemplates: ArrayList<Filenam
|
|||
|
||||
filenameTemplateTable = JBTable(filenameTemplateTableModel)
|
||||
filenameTemplateTable.autoCreateRowSorter = false
|
||||
val filenameTemplateTableScrollPane = JBScrollPane(filenameTemplateTable)
|
||||
|
||||
panel.add(filenameTemplateTable, BorderLayout.CENTER)
|
||||
panel.add(filenameTemplateTableScrollPane, BorderLayout.CENTER)
|
||||
panel.add(createToolbar(filenameTemplateTable), BorderLayout.EAST)
|
||||
}
|
||||
|
||||
private fun createToolbar(table: JBTable): JPanel {
|
||||
val panel = JPanel()
|
||||
panel.layout = FlowLayout(FlowLayout.LEFT)
|
||||
val actionGroup = DefaultActionGroup()
|
||||
actionGroup.add(object : AnAction("Add", "Add new filename template", AllIcons.General.Add) {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
|
|
@ -49,7 +49,11 @@ class FilenameTemplateSettingsComponent(val filenameTemplates: ArrayList<Filenam
|
|||
filenameTemplateTableModel.moveRowsDown(table.selectedRows)
|
||||
}
|
||||
})
|
||||
|
||||
val toolbar = ActionManager.getInstance().createActionToolbar("MyToolbar", actionGroup, false)
|
||||
|
||||
val panel = JPanel()
|
||||
panel.layout = FlowLayout(FlowLayout.LEFT)
|
||||
panel.add(toolbar.component)
|
||||
return panel
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user