开发者

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

开发者 https://www.devze.com 2023-01-08 15:48 出处:网络
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:

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

精彩评论

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