SWT Progress Bar

26 Views Asked by At

I have a jface Dialog which has some text fields and a SWT progress bar. Once this dialog box opens the progress bar starts updating but it is somehow blocking the GUI and I am unable to enter values in the textbox. How can I make progress bar independent of other views on the GUI ?

enter image description here

I have tried to add background Job

private BackgroundJob backgroundJob = new BackgroundJob("Executing Background Task");
backgroundJob.schedule();

private class BackgroundJob extends UIJob {

    public BackgroundJob(String name) {
        super(name);
    }

    @Override
    public IStatus runInUIThread(IProgressMonitor monitor) {
        Display.getDefault().asyncExec(new Runnable() {
            @Override
            public void run() {
                progressBar.setSelection(0);

                methodToBeExecuted()

                stopProgressBar();

            }
        });

        return Status.OK_STATUS;
    }
}
0

There are 0 best solutions below