private void createLoadingBar() { new ProgressMonitorDialog(parent); Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.setText("Report Loading"); shell.addDisposeListener( new org.eclipse.swt.events.DisposeListener() { @Override public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) { if (thread.isAlive()) { thread.interrupt(); reportFinished = true; } } }); Label label = new Label(shell, SWT.NONE); label.setSize(new Point(260, 20)); label.setLocation(20, 30); label.setText("Please wait while the report loads."); label.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); label.setAlignment(SWT.CENTER); Label timelabel = new Label(shell, SWT.NONE); timelabel.setSize(new Point(260, 20)); timelabel.setLocation(20, 50); // timelabel.setText("(approx " + timeEst + ")"); timelabel.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); timelabel.setAlignment(SWT.CENTER); ProgressBar progressBar = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE); progressBar.setSize(new Point(200, 20)); progressBar.setLocation(50, 80); Button button = new Button(shell, SWT.NONE); button.setSize(new Point(100, 30)); button.setLocation(100, 120); button.setText("Cancel"); button.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); button.setAlignment(SWT.CENTER); button.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { @Override public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { if ((thread != null) && thread.isAlive()) { thread.interrupt(); reportFinished = true; } } }); shell.setSize(new Point(300, 200)); LayoutUtils.centerGUI(shell); shell.open(); while (!reportFinished) { if (!parent.getDisplay().readAndDispatch()) { parent.getDisplay().sleep(); } } if (!shell.isDisposed()) { shell.close(); } }