Eclipse Spot

StatusBar Reference

StatusBar is a small fragment plugin which adds a status line to a pure E4 RCP application. This reference contains information helpful to developers working with StatusBar.

 

StatusBar lines up custom labels which are capable of displaying both text and images (class org.eclipse.swt.custom.CLabel). Each custom label is backed by StatusItem object which allows the application to control label text, image, width, visibility and position in status line. Background color and font attributes can also be set. Items are layed out on the status line from left to right in according to a position value with range starting at zero. The status line is sized to match the width of the client area of the main window.

It is expected that normally the combined widths of the items will be less than the width of the status line, so a strategy is used to expand the width of one item to consume the remaining space. Which item is selected depends on the number of items:

  • 1 - Expand single item
  • 2 - Expand second item
  • 3 or more - Expand second last item (last item right aligned)

The expanded item fits the case when text content is unpredictable and as much space as available is required. You can check this out by experimenting with typing into the StatusBar Example Message field.

In the following example, we see "Team meeting in 5 mins" text content in the third of four items. As the main window is resized to be more narrow, the text begins to be elided eg. "Team...mins".

Status line message