Basic question for placing a plugin in the status bar

Answered

I'm just starting playing around with the plugin SDK for IntelliJ IDEA. However I already have some trouble with the first steps.

Here's what I'd like to do: As a very basic first step I'd like to place some kind of clickable item in the lower status bar, next to where the Git integration is located. When clicking that item it should just display some text as a popup.

But how can I place such a component there?

 

1
3 comments

You can implement `com.intellij.openapi.wm.StatusBarWidget` and register it using 

StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
if (statusBar != null) statusBar.addWidget(widget, [Anchor], [disposable]);

For example, when project is opened - by registering `com.intellij.openapi.startup.StartupActivity` with 

<postStartupActivity implementation="com.MyInitWidgetActivity"/>

See https://github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/LineSeparatorPanel.java as an example.

2
Avatar
Permanently deleted user

Thanks Aleksey, this is working fine :-)

0

This approach is now obsolete. I've been working on a status bar widget recently. As of Intellij 2020.1, you now need to add your own implementation of ServerStatusBarWidgetFactory and add it in plugin.xml

<statusBarWidgetFactory implementation="com.domain.MyServerStatusBarWidgetFactory" />

Then you create the StatusBarWidget from within the factory class

1

Please sign in to leave a comment.