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?

7 comments
Comment actions Permalink

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.

1
Comment actions Permalink

The ToolwindowFactory must be stateless. You must create and store all toolwindow-specific data in a newly created Toolwindow object of your own class.

1
Comment actions Permalink

It sounds like you mix up Application vs Project somewhere. Can you share your project sources?

0
Comment actions Permalink

and what can i do to avoid that? im beginner in java...

0
Comment actions Permalink

ah ok i understand

0
Comment actions Permalink

The solution is in other words to intantiate the class of itself. That looks like that:

 

    public void createToolWindowContent(Project project, ToolWindow toolWindow) {
// process(project, toolWindow); // instead of process just like that, instantiate the class itself...
MyToolWindowFactory myToolWindowFactory = new MyToolWindowFactory();
myToolWindowFactory.process(project, toolWindow);
}


Thanks for help :-)
0

Please sign in to leave a comment.