How do multiple tool windows communicate with each other?

I have two tool windows. One contains a JTree and the other contains a JTable. I'd like to notify the JTable tool window to display details from the node selected in the tree whenever the selection changes. I'm not sure how (or where) that communication takes place.

I've got a class implementing ToolWindowFactory for each tool window and both are defined in my plugin.xml

  <extensions defaultExtensionNs="com.intellij">     <!-- Add your extensions here -->       <toolWindow           id="CRX Repository Tree"           anchor="left"           secondary="true"           factoryClass="com.meredith.devtools.intellij.crx.toolwindow.CRXTreeToolWindowFactory">       </toolWindow>       <toolWindow           id="CRX Property View"           anchor="bottom"           secondary="true"           factoryClass="com.meredith.devtools.intellij.crx.toolwindow.CrxPropertyToolWindowFactory">       </toolWindow>   </extensions>



I'm also capturing the JTree selection change. How do I get a reference to my tool windows from my listener class, and once I have the ToolWindow reference what do I have to do to get to my JTable.

Thanks!

Todd
0

talanb wrote:

I'm also capturing the JTree selection change. How do I get a reference to my tool windows from my listener class


ToolWindowManager.getInstance(project).getToolWindow(ID) gets the tool window.

talanb wrote:


and once I have the ToolWindow reference what do I have to do to get to my JTable.



Cast it to your toolwindow implementation class and provide a getter for the table in your implementation, or use ToolWindow.getComponent() and go from there..

0

请先登录再写评论。