Independent Tool Window content when running multiple projects.

I'm developing a plugin that should display different content for different projects basically, based on what file you're in.

However, when I run my plugin and I go to open a new project, the old Tool Window crashes and displays nothing, and the new Tool Window registers changes in the old project as well as the new project. Using a FileEditorWindowListener to run code when selectionChanged() is called right now. Experimenting with creating a "manager" class but it isn't helping right now.

How can I make it so that the tool windows displayed in different projects are independent of each other and work as they do when just one project is open?

1
1 comment
Avatar
Permanently deleted user

Do you use ProjectComponent? Or maybe ApplicationComponent?

Try using the only ProjectComponent like this (it's snippet for plugin.xml):

<project-components>
    <component><implementation-class>your.special.Component</implementation-class></component>
  </project-components>

it would use proper ToolWindowManager instance when register new kind of Tool Window (do it the method projectOpened()) and works well.

0

Please sign in to leave a comment.