Multiple Instances with my Plugin running parallel
Answered
My Plugin is almost ready to develope. In our Team were working with multiple instances of phpstorm - one for each repository. but unfort. my plugin work only with the last loaded window. it seems as the sources would be shared or something other strange things are happen in background. the first instance shut down my plugin completely. Its a toolwindow. it collapse and if i open it again i got a completely grey background with nothing in it OR it switches(!) to the other instance. bug?
Please sign in to leave a comment.
It sounds like you mix up Application vs Project somewhere. Can you share your project sources?
https://bitbucket.org/comodmw/pra/src/5bd6990233d5fcfb794c810523be022d022b5a76/tool_window/resources/META-INF/plugin.xml?at=master&fileviewer=file-view-default
You cannot store Toolwindow/Project instance variables in MyToolWindowFactory. They will be overwritten upon next call of com.intellij.openapi.wm.ToolWindowFactory#createToolWindowContent which explains perfectly your observation above.
and what can i do to avoid that? im beginner in java...
ah ok i understand
The ToolwindowFactory must be stateless. You must create and store all toolwindow-specific data in a newly created Toolwindow object of your own class.
The solution is in other words to intantiate the class of itself. That looks like that: