How to float tool window programatically?

Hi Team,

I need to float tool window programatically. Following is my scenario;

1) User allows to download result and those result display on a grid in tool window.

2) when user right clicks data in grid pop menu will appear and base on user selection another tool window should appear.

What happens here second tool window will not visible because result tool window still there.

Is there any configuration that second tool window open in floating mode?Appreciate your help.

 

ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(getProjects()[0]);
toolWindowManager.unregisterToolWindow(toolWindowName);
ToolWindow secondToolWindow = toolWindowManager.registerToolWindow(toolWindowName, false, ToolWindowAnchor.BOTTOM);
secondToolWindow .setIcon(ResourceManager.getPluginImage("image.ico");

ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent((JComponent)component, StringUtil.EMPTY, false);
secondToolWindow .getContentManager().removeAllContents(true);
secondToolWindow .getContentManager().addContent(content);
secondToolWindow .activate(null, false);

 

Thanks,

Navin

1 comment
Comment actions Permalink

Try 

secondToolWindow.setType(ToolWindowType.FLOATING, null);
0

Please sign in to leave a comment.