IDEA X : issue with com.intellij.openapi.wm.StatusBar#addCustomIndicationComponent

In my VCS plugin (MKS), the org.intellij.vcs.mks.MKSChangeProvider#getChanges looks like this

final JLabel statusLabel = new JLabel();
try {
WindowManager.getInstance().getStatusBar(myProject).addCustomIndicationComponent(statusLabel);
// do VCS related stuff, while giving feedback using the JLabel
} finally {

 WindowManager.getInstance().getStatusBar(myProject).removeCustomIndicationComponent(statusLabel);

}

This was working fine in IDEA 8 and 9, but I've just tested in IDEA X, and the result is that the labels are never removed from the status bar and keep acumulating.

I can see that com.intellij.openapi.wm.StatusBar#addCustomIndicationComponent is deprecated (but not the associated remove ?). Is there a new way to achieve something similar ?
4 comments
Comment actions Permalink

Hello Thibaut,

As the javadoc says, you should use the StatusBar.addWidget() method instead.

In my VCS plugin (MKS), the
org.intellij.vcs.mks.MKSChangeProvider#getChanges looks like this

final JLabel statusLabel = new JLabel();
try {
WindowManager.getInstance().getStatusBar(myProject).addCustomIndicatio
nComponent(statusLabel);
// do VCS related stuff, while giving feedback using the JLabel
} finally {
WindowManager.getInstance().getStatusBar(myProject).removeCustomIndic
ationComponent(statusLabel);
}
This was working fine in IDEA 8 and 9, but I've just tested in IDEA X,
and the result is that the labels are never removed from the status
bar and keep acumulating.

I can see that
com.intellij.openapi.wm.StatusBar#addCustomIndicationComponent is
deprecated (but not the associated remove ?). Is there a new way to
achieve something similar ?

---
Original message URL:
http://devnet.jetbrains.net/message/5268864#5268864

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

I can understand that, but I'm still surprised that the #remove method doesn't remove the component any more.

I've tried to look at how to create those widgets, is there some factory somewhere or an example in one of the open  ?
I can't find any implementation of this interface in the public part of the API, and do not quite understand what's expected for the com.intellij.openapi.wm.StatusBarWidget#install method for example.

Any pointers ?

0
Comment actions Permalink

Hello Thibaut,

I can understand that, but I'm still surprised that the #remove method
doesn't remove the component any more.


From looking at the code I can't see why this doesn't work - the remove()
method is implemented, and should find the added widget as long as you pass
the same JComponent instance to the add() and remove() methods. A YouTrack
issue is probably needed here. :)

I've tried to look at how to create those widgets, is there some
factory somewhere or an example in one of the open  ? I can't find any
implementation of this interface in the public part of the API, and do
not quite understand what's expected for the
com.intellij.openapi.wm.StatusBarWidget#install method for example.

Any pointers ?


I think all of the currently existing status bar widget implementations are
included in the CE source. As an example which is probably most relevant,
see the HgCurrentBranchStatus class in the hg4idea plugin sources.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.