开发者

How to write message to status line from handler class in Eclipse RCP programming

I need to change status line message from a handler class. After reading the RCP tutorial and eclipse FAQ, I finally did something like this:

HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().findView(AView.ID).getViewSite().getActionBars().getStatusLineManager().setMessage( "Ha, I'm finished");

What 开发者_如何转开发a long invoking chain!

Am I doing it the right way? Thanks.


From the threads I see in the forums, that looks about right.

Beware though if you have asynchronous feedback to put in this status line.
See this thread for instance.

UIJob job = new UIJob() {
    public IStatus run(IProgressMonitor monitor) {
    //do the long running work here

    Runnable results = new Runnable() {
        public void run(){
              // update UI elements here;
             getViewSite().getActionBars().getStatusLineManager().
               setMessage("End Pasting");
       }
    };
    display.asyncExec(results);
    }
};
job.schedule();

(Note: that may be not your case, but I add this code snippet just for information)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜