进度条仅在调试模式下显示。作业加异步显示
Job job = new Job("Initialize Info ")
{
@Override
protected IStatus run(IProgressMonitor monitor) {
//some action in job thread
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
//
//different actions with UI components.
}
});
return Status.OK_STATUS;
}
};
job.schedule();
当我在调试模式下运行应用程序时,进度条会正确显示,并且所有 UI 组件都在等待作业。但在发布模式下,UI 组件仍在等待作业,但进度条没有反映。
原因是什么?
Job job = new Job("Initialize Info ")
{
@Override
protected IStatus run(IProgressMonitor monitor) {
//some action in job thread
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
//
//different actions with UI components.
}
});
return Status.OK_STATUS;
}
};
job.schedule();
When I run application in debug mode then progress bar is correctly displayed and all UI components waiting for a job. But in release mode UI components still waiting for a job but progress bar doesn't reflect.
What is the reason?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要运行
asycExec
。尝试使用UIJob
:UIJob 是通过 asyncExec 在 UI 线程内运行的作业。
像这样:
You don't need to run
asycExec
. try useUIJob
:The UIJob is a Job that runs within the UI Thread via an asyncExec.
like this: