Listener for ToolWindowManager

 Hi,

 

I'm working on plugin which starting thread with receiving messages. Thread is created during applicationComponent init and then work independently.

As receiver for all this messages I count with my toolWindow implementation but problem is that I'm not able get its instance till is ready. Is any way how to register for notification when toolWindow is available ?

I did tried create projectComponent and get instance when project is opened but toolWindowManager is produce null.

0
1 comment
Avatar
Permanently deleted user

In your projectComponent try this:

  @Override
  public void projectOpened() {
    myToolWindow =
      ToolWindowManager.getInstance(myProject).registerToolWindow(TOOL_WINDOW_ID, ...)

    StartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable() {
      @Override
      public void run() {
        //Try to use your toolwindow
      }
    });
  }

0

Please sign in to leave a comment.