in src/main/kotlin/com/github/mkartashev/hserr/toolwindow/HsErrToolWindowFactory.kt [51:73]
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
val hsErrToolWindow = HsErrToolWindow(project, toolWindow)
val selectedEditor = FileEditorManager.getInstance(project).selectedTextEditor
if (selectedEditor != null) {
val document = selectedEditor.document
val file = FileDocumentManager.getInstance().getFile(document)
if (file != null) hsErrToolWindow.maybeUpdateUI(file, selectedEditor)
}
val stats = ContentFactory.getInstance().createContent(hsErrToolWindow.getPanel(), null, false)
stats.putUserData(toolWindowKey, hsErrToolWindow)
toolWindow.contentManager.addContent(stats)
toolWindow.setAdditionalGearActions(HsErrToolWindowActionGroup())
val refreshAction = com.intellij.openapi.actionSystem.ActionManager.getInstance().getAction("HsErrRefreshAction")
val settingsAction = com.intellij.openapi.actionSystem.ActionManager.getInstance().getAction("HsErrSettingsAction")
toolWindow.setTitleActions(listOf(refreshAction, settingsAction))
toolWindow.stripeTitle = "HsErr"
project.messageBus.connect().subscribe(
FileEditorManagerListener.FILE_EDITOR_MANAGER,
hsErrToolWindow
)
}