Mehdi J
04/17/2025, 6:59 PMimport com.intellij.openapi.project.DumbAware
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.ToolWindow
import com.intellij.openapi.wm.ToolWindowFactory
import com.intellij.ui.content.Content
import com.intellij.ui.content.ContentFactory
import org.jetbrains.jewel.bridge.JewelToolWindowComposePanel
import org.jetbrains.jewel.foundation.InternalJewelApi
import org.jetbrains.jewel.ui.component.Text
class ChatToolWindowFactory: ToolWindowFactory, DumbAware {
@OptIn(InternalJewelApi::class)
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
val component = JewelToolWindowComposePanel {
Text("Hello World!")
}
val contentFactory = ContentFactory.getInstance()
val content: Content = contentFactory.createContent(component, "", false)
toolWindow.contentManager.addContent(content)
}
}
Under the hood it uses Swing to Compose bridge API. Will this be deprecated in future?Francisco Noriega
04/17/2025, 7:03 PMimport org.jetbrains.jewel.bridge.addComposeTab
class PanelPlugin : ToolWindowFactory, DumbAware {
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
toolWindow.addComposeTab("") {
MyPanel(project, airChatService)
}
}
Mehdi J
04/17/2025, 7:04 PMMehdi J
04/17/2025, 7:05 PMaddComposeTab
also uses the JewelToolWindowComposePanel
as I used under the hood.Francisco Noriega
04/17/2025, 7:09 PMseb
04/18/2025, 9:14 AM