Weird bug in #WindowManager.getInstance().getStatusBar

Hi, 

I'm experiencing a weird bug during Plugin development.

My plugin will connect to a server every time a project is opened, and I want to reflect the connection status on the status bar.

So now I have implemented a #StatusBarWidget and I want to use #StatusBar.addWidget to append this widget to the status bar when I'm calling my #init function.

I passed the #init function to #ApplicationUtils.pool within #ProjectManagerListener.projectOpened event.

However, I cannot access the status bar by #WindowManager.getInstance().getStatusBar

The #WindowManagerImpl.myProjectToFrame is a empty HashMap.

I've used a debugger to check #myProjectToFrame before #init was called. It was not empty at that time and then turned to an empty map.

I also tried to invoke #init at a later phase (#EditorOpened event), and the status widget was successfully appended.

I'm very confused about this bug, I wonder if you may have some clue about the cause?

 

0
2 comments

I'm not sure if it is inappropriate to access status bar during "projectOpened".

If that's the case, is there any event being triggered right after "projectOpened"?

Many thanks

Yanze

0

Are you not using com.intellij.openapi.wm.StatusBarWidgetProvider to register your StatusBarWidget?

0

Please sign in to leave a comment.