【Eclipse RCP】 定时清除状态栏信息

傅博容
2023-12-01
public boolean doTimer() {
       Timer timer1 = new Timer();
       timer1.schedule(new MyTimerTask(), 10* 1000)
}    

//TimerTask 类
class MyTimerTask extends TimerTask {
        @SuppressWarnings("restriction")
        public void run() {
            Display.getDefault().asyncExec(new Runnable() {
                public void run() {
                    WorkbenchWindow workbenchWindow = (WorkbenchWindow) PlatformUI
                            .getWorkbench().getActiveWorkbenchWindow();
                    IStatusLineManager lineManager = workbenchWindow
                            .getStatusLineManager();
                    lineManager.removeAll();
                    lineManager.setErrorMessage("");
                }
            });
        }
    }



 类似资料: