使用Jobs控制进度条

时间:2022-08-02 22:45:55

I am trying to update the progress bar in my GUI using the IProgressMonitor, which is passed to the run method of job. But i am not able to do the same. Has anyone tried that.

我正在尝试使用IProgressMonitor更新GUI中的进度条,这将传递给job的run方法。但我无法做同样的事情。有人试过吗。

Also i read job.setUser(true); method displays the progress, can anyone help me with the code for the same

我也读了job.setUser(true);方法显示进度,任何人都可以帮助我使用相同的代码

1 个解决方案

#1


1  

I was also requiring a similar type of feature in which if any job runs in the application then I want to show the progress of that job.

我还需要一个类似的功能,如果任何作业在应用程序中运行,那么我想显示该工作的进度。

So in my Eclipse 4 application, I added the trim bar and tool control inside it. In which I added the progress bar in it UI.

所以在我的Eclipse 4应用程序中,我在其中添加了修剪条和工具控件。我在其中添加了进度条UI。

By adding the below code done the trick

通过添加以下代码完成了诀窍

Job.getJobManager().setProgressProvider(new ProgressProvider() {
        @Override
        public IProgressMonitor createMonitor(Job job) {
            return monitor.addJob(job);
        }
    });

#1


1  

I was also requiring a similar type of feature in which if any job runs in the application then I want to show the progress of that job.

我还需要一个类似的功能,如果任何作业在应用程序中运行,那么我想显示该工作的进度。

So in my Eclipse 4 application, I added the trim bar and tool control inside it. In which I added the progress bar in it UI.

所以在我的Eclipse 4应用程序中,我在其中添加了修剪条和工具控件。我在其中添加了进度条UI。

By adding the below code done the trick

通过添加以下代码完成了诀窍

Job.getJobManager().setProgressProvider(new ProgressProvider() {
        @Override
        public IProgressMonitor createMonitor(Job job) {
            return monitor.addJob(job);
        }
    });