Using ToolWindowGroup

To get a group

Use the following :
ToolWindowGroup group = toolWindowManager.getToolWindowGroup("group_name");

Returns the tool window group to which this manager maps the specified name. If the manager contains no mapping for this name then the manager create a new instance of ToolWindowGroup and associates the group created with the specified name in this manager.

To remove a group

Use the following :
toolWindowManager.removeToolWindowGroup("group_name");

Removes the tool window group for this name from this manager if it is present.

To check if a group exists

Use the following :
boolean contains = toolWindowManager.containsGroup("group_name");

Returns true if this manager contains a group for the specified name.

To add a toolwindow

Use the following :
ToolWindowGroup group = toolWindowManager.getToolWindowGroup("group_name");
ToolWindow debugTool = toolWindowManager.getToolWindow("Debug");
group.addToolWindow(debugTool);

Appends the specified tool window to the end of this group.

To remove a toolwindow

Use the following :
ToolWindowGroup group = toolWindowManager.getToolWindowGroup("group_name");
ToolWindow debugTool = toolWindowManager.getToolWindow("Debug");
group.removeToolWindow(debugTool);

Removes the occurrence in this group of the specified tool window.

To show or hide a group

Use the following :
ToolWindowGroup group = toolWindowManager.getToolWindowGroup("group_name");
group.setVisible(true);

Invokes setVisible(visible) on all toolwindows contained in this group in proper sequence.

To add a ToolWindowGroupListener

Use the following :
ToolWindowGroup group = toolWindowManager.getToolWindowGroup("group_name");
group.addToolWindowGroupListener(listener);

Registers listener so that it will receive events when the groups are made visibile or invisible, when a tool is added or removed. If listener listener is null, no exception is thrown and no action is performed.