Create closeable ToolWindow Tab
I am creating a plugin which is a toolwindow extension. I want to have it closeable tabs like in Version Control.
I created a class which implements ToolWindowFactory
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
component = MyComponent()
val content = toolWindow.contentManager.factory.createContent(component, "title", false)
content.isCloseable = true
toolWindow.contentManager.addContent(content)
toolWindow.contentManager.setSelectedContent(content);
}
But this way the tab is not closeable (when I right click on it I cannot select 'Close tab')
Any ideas on how to make this work?
Please sign in to leave a comment.
Probably, you need to add `canCloseContents="true"` parameter to the toolwindow EP.
Ex: https://github.com/JetBrains/intellij-community/blob/master/platform/platform-resources/src/META-INF/VcsExtensions.xml#L68