Writing text to the Notes status bar from an Eclipse plugin

I have been asked by a few people on how to do this so I figure I would write about it.

I used this method in the sample I wrote about earlier. The problem in the sample is the message was written by code that has no concept of a view part. So if you do have a view part you can simply get the action bars for the view site. If not, you can get the active part from the current workbench window – like I do below. The problem with this approach is if there is more than one window open it might go to the active one and not the one the code is actually running on. oh well!

static public void LogToStatusLine(final String msg){

Display display = Display.getDefault();

display.asyncExec(new Runnable(){
public void run() {
IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

IWorkbenchPage page = win.getActivePage();

IWorkbenchPart part = page.getActivePart();
IWorkbenchPartSite site = part.getSite();

if (site instanceof IViewSite){
IViewSite vSite = ( IViewSite ) site;

IActionBars actionBars = vSite.getActionBars();

if( actionBars == null )
return ;

IStatusLineManager statusLineManager =

if( statusLineManager == null )
return ;

statusLineManager.setMessage( msg);


Tags: : : :


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.