Jan 18, 2008

How to add a status bar in an RCP app?

If you are writing an RCP application, you may want to add a status message in the status bar. Adding it is very simple.

By all chance, you already have a class extending org.eclipse.ui.application.ActionBarAdvisor in your RCP app (If not, Google around to find out how to add one to your RCP app). Just override the fillStatusLine method.

private StatusLineContributionItem statusItem;

@Override
protected void fillStatusLine(IStatusLineManager statusLine) {

statusItem = new StatusLineContributionItem("LoggedInStatus");
statusItem.setText("Logged in");
statusLine.add(statusItem);
}

Thats it :-)



Note 1: You can add any number of status items
Note 2: In Eclipse 3.3, the class StatusLineContributionItem is in org.eclipse.ui.internal.util package. This has been moved to org.eclipse.jface.action package in Eclipse 3.4

0 comments: