为 eclipse 作业禁用繁忙的光标

Disabling busy cursor for eclipse Job

这段代码满足了我的需要,除了正常光标和忙碌光标之间的快速切换之外。

    /* this code is run inside the createPartControl(Composite parent) method of a ViewPart */
    Job job = new Job("refreshing")
    {
        @Override
        protected IStatus run(IProgressMonitor monitor)
        {

            while (data.isReading())
            {
                Display.getDefault().syncExec(new Runnable()
                {

                    @Override
                    public void run()
                    {

                        treeViewer.setInput(DataView.this.dataModel.getArray());

                    }

                });
            }

            return Status.OK_STATUS;
        }
    };
    job.schedule();

那么有没有办法在eclipse中禁用Job的忙碌光标呢? 此外,这是否会发生,因为作业是在 GUI 中调用的 class?

致电

job.setSystem(true);

在您安排工作之前。来自 JavaDoc:

Sets whether or not this job is a system job. System jobs are typically not revealed to users in any UI presentation of jobs. Other than their UI presentation, system jobs act exactly like other jobs. If this value is not explicitly set, jobs are treated as non-system jobs. This method must be called before the job is scheduled.

但是我认为繁忙的光标来自 AbstractTreeViewer.createChildren 中的 BusyIndicator.showWhile 调用,树 setInput 将调用该调用。我认为你对此无能为力。