Should my plugin use a single ToolWindowFactory to create multiple tool windows?

Hi, I have extended ToolWindowFactory and registered it with my tool window extension in plugin.xml. With that, I am able to open my tool window. Now, I want to add another tool window, and am not sure if the intended design is to create a new ToolWindowFactory, or based on the ID of the tool window, create different content when called into my existing ToolWindowFactory.createToolWindowContent()?

Thanks,
Priya.

0
5 comments
Avatar
Permanently deleted user

Please use different factories for different tool windows.

0

Hello,

 

Since there is one factory per toolwindow, how to retrieve the object of class implementing ToolWindowFactory ?

 

Best regards

 

0

Hi Bernard, not sure I understand your question, but if you want to show a tool window, you can get an instance of the ToolWindow and activate it.

ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow("<id>");
toolWindow.activate(null);
0

Hello,

Thank you for your anwser, but actually the question was how to adress the object instance of AppStructureToolWindowFactory

as soon as I declare something like :

<toolWindow id="AppStructureToolWindowFactory" factoryClass="AppStructureToolWindowFactory"/>

 

The objective of this question was to be able to invoke a method defined in AppStructureToolWindowFactory.

Regards

 

0
Avatar
Permanently deleted user

If you have lines like these in your plugin.xml

<toolWindow id="windowID_1" factoryClass="AppStructureToolWindowFactory1"/>
<toolWindow id="windowID_2" factoryClass="AppStructureToolWindowFactory2"/>

all methods would be called automatically.

0

Please sign in to leave a comment.