Jump to: navigation, search

FAQ How do I write a message to the workbench status line?

Revision as of 23:41, 14 June 2006 by Psylence519.gmail.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

When pressing Ctrl+j in a text editor, the editor enters incremental find mode and prints messages in the status bar in the lower left-hand corner.

This can be done from within any view as follows:

   IActionBars bars = getViewSite().getActionBars();
   bars.getStatusLineManager().setMessage("Hello");

Editors can access the status line via IEditorActionBarContributor, which is given a reference to an IActionBars instance in its init method. The contributor is accessed from an editor by using

   IEditorPart.getEditorSite().getActionBarContributor();

Note that the status line is shared by all views and editors. When the active part changes, the status line updates to show the new active part’s message.

Parts can also specify an error message on the status line, using the method setErrorMessage. The error message, if provided, always takes precedence over any non–error message that was previously shown. When the error message is cleared, the non–error message is put back on the status line.


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.