ToolWindowmanager registerToolWindow depricated

I noticed that one of the registerToolWindow methods has been depricated in the latest version of IDEA. If I am to follow the new version there is no way of passing in the JComponent anymore.
It seems that I am supposed to use a ContentManager and put Content objects into that somehow.

Can anyone please explain what these Content objects are and what I am supposed to do?

3 comments
Comment actions Permalink

I haven't tried it, but I suppose something like this should work:

ToolWindow tw = twm.registerToolWindow(...);
PeerFactory pf = com.intellij.peer.PeerFactory.getInstance();

Content content = pf.getContentFactory().createContent(jcomponent, "Title", false);
tw.getContentManager().addContent(content);

Sascha

0
Comment actions Permalink

Thanks alot, Ill give that a try on monday.

0
Comment actions Permalink

Yup, it works.
Here is a full code sample if anyone else needs to make tool windows.

ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
ToolWindow toolWindow = toolWindowManager.registerToolWindow("BiPad", true, ToolWindowAnchor.BOTTOM);
PeerFactory pf = com.intellij.peer.PeerFactory.getInstance();
Content content = pf.getContentFactory().createContent(biPadForm.getMasterPanel(), "", false); // first arg is a JPanel
toolWindow.getContentManager().addContent(content);
toolWindow.setIcon(IconLoader.getIcon("Bindows-Logo-12.png", BindowsApplicationComponent.class));

0

Please sign in to leave a comment.