Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "FAQ How do I write a message to the workbench status line?"

 
m
 
Line 1: Line 1:
When pressing Ctrl+j in a text editor, the editor enters
+
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.  
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:
 
This can be done from within any view as follows:
Line 9: Line 7:
 
</pre>
 
</pre>
  
 
+
Editors can access the status line via <tt>IEditorActionBarContributor</tt>, which is given a reference to an <tt>IActionBars</tt> instance in its <tt>init</tt> method.  The contributor is accessed from an editor by using
Editors can access the status line via <tt>IEditorActionBarContributor</tt>,
+
which is given a reference to an <tt>IActionBars</tt> instance in its
+
<tt>init</tt> method.  The contributor is accessed from an editor by using
+
 
<pre>
 
<pre>
 
   IEditorPart.getEditorSite().getActionBarContributor();
 
   IEditorPart.getEditorSite().getActionBarContributor();
 
</pre>
 
</pre>
  
 +
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&#146;s message.
  
Note that the status line is shared by all views and editors.  When the active
+
Parts can also specify an error message on the status line, using the method <tt>setErrorMessage</tt>.  The error message, if provided, always takes precedence over any non&#150;error message that was previously shown.  When the error message is cleared, the non&#150;error message is put back on the status line.
part changes, the status line updates to show the new active part&#146;s message.
+
 
+
Parts can also specify an error message on the status line, using the method
+
<tt>setErrorMessage</tt>.  The error message, if provided, always takes
+
precedence over any non&#150;error message that was previously shown.  When
+
the error message is cleared, the non&#150;error message is put back on the status
+
line.
+
  
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>
+
{{Template:FAQ_Tagline}}

Latest revision as of 23:41, 14 June 2006

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&#146;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&#150;error message that was previously shown. When the error message is cleared, the non&#150;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.

Back to the top