I have defined my toolwindow in plugin.xml, and added some contents (tabs) in the createToolWindowContent
function of the corresponding class that implements ToolWindowFactory
.
I have a separate action, for which I would like to activate the toolwindow to a specific tab. For that, I do:
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(tool_window_id);
toolWindow.activate(null); // don't need to execute something when done... or should I?
So right now I cannot select the tab that I want. I found the method
toolWindow.getContentManager().setSelectedContent(content)
but what if I don't have a reference to the created content?
You can use
ContentManager.getContents()
to get the list of all contents displayed in the toolwindow, orfindContent()
orgetContent()
to find a content by index, name or the component shown in it.