diff --git a/src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/toolWindow/AppleTableToolWindowFactory.kt b/src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/toolWindow/AppleTableToolWindowFactory.kt new file mode 100644 index 0000000..8a7f2a1 --- /dev/null +++ b/src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/toolWindow/AppleTableToolWindowFactory.kt @@ -0,0 +1,14 @@ +package com.github.thinkami.hellojetbrainsplugin.toolWindow + +import com.github.thinkami.hellojetbrainsplugin.ui.AppleTableContent +import com.intellij.openapi.project.Project +import com.intellij.openapi.wm.ToolWindow +import com.intellij.openapi.wm.ToolWindowFactory +import com.intellij.ui.content.ContentFactory + +class AppleTableToolWindowFactory: ToolWindowFactory { + override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) { + val content = ContentFactory.getInstance().createContent(AppleTableContent().contentPanel, null, false) + toolWindow.contentManager.addContent(content) + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/ui/AppleTableContent.kt b/src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/ui/AppleTableContent.kt new file mode 100644 index 0000000..40820c3 --- /dev/null +++ b/src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/ui/AppleTableContent.kt @@ -0,0 +1,24 @@ +package com.github.thinkami.hellojetbrainsplugin.ui + +import com.intellij.openapi.ui.DialogPanel +import com.intellij.ui.dsl.builder.Cell +import com.intellij.ui.dsl.builder.panel +import com.intellij.ui.table.JBTable + +class AppleTableContent { + var contentPanel : DialogPanel + lateinit var myTableModel: Cell + + init { + contentPanel = panel { + row { + + val table = JBTable() + val model = AppleTableModel() + table.model = model + myTableModel = cell(table) + } + } + } + +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/ui/AppleTableModel.kt b/src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/ui/AppleTableModel.kt new file mode 100644 index 0000000..4c3baf7 --- /dev/null +++ b/src/main/kotlin/com/github/thinkami/hellojetbrainsplugin/ui/AppleTableModel.kt @@ -0,0 +1,25 @@ +package com.github.thinkami.hellojetbrainsplugin.ui + +import javax.swing.table.AbstractTableModel + +class AppleTableModel: AbstractTableModel() { + val allData: List> = listOf( + listOf("1", "シナノゴールド", "黄"), + listOf("2", "シナノホッペ", "赤"), + listOf("3", "ジョナゴールド", "赤"), + ) + + val columns: List = listOf("No", "Name", "Color") + + override fun getRowCount(): Int { + return allData.size + } + + override fun getColumnCount(): Int { + return columns.size + } + + override fun getValueAt(rowIndex: Int, columnIndex: Int): Any { + return allData[rowIndex][columnIndex] + } +} \ No newline at end of file diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index f923821..bc9937b 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -9,6 +9,7 @@ messages.MyBundle +