private void createPanels() { int size = pReporters.length; /* * Add the style bit for standalone if there is zero or 1 reporters */ if (size < 2) { style |= STANDALONE; } for (int i = 0; i < size; i++) { if (null != pReporters[i]) { /* * Add this reporter to the registry */ reportersRegistry.add(pReporters[i]); /* * Create the reporter panel; adding the style bit for BORDER */ final ProgressReporterPanel panel = new ProgressReporterPanel(scrollChild, pReporters[i], style | BORDER); panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); panel.addTwistieListener(this); panel.addDisposeListener(this); pReporters[i].addListener(new AutoRemoveListener(panel)); } } formatLastPanel(null); }
public int report(IProgressReport progressReport) { if (true == isAutoRemove && false == progressReport.isActive() && !progressReport.isInErrorState()) { if (null != panel && false == panel.isDisposed()) { ProgressReportingManager.getInstance().remove(panel.getProgressReporter()); Utils.execSWTThread( new AERunnable() { public void runSupport() { panel.dispose(); } }); } return RETVAL_OK_TO_DISPOSE; } return RETVAL_OK; }
/** * When any <code>ProgressReporterPanel</code> in this window is disposed re-layout the controls * and window appropriately */ public void widgetDisposed(DisposeEvent e) { if (e.widget instanceof ProgressReporterPanel) { ProgressReporterPanel panel = (ProgressReporterPanel) e.widget; removeReporter(panel.pReporter); panel.removeTwistieListener(this); /* * Must let the GridLayout manager know that this control should be ignored */ ((GridData) panel.getLayoutData()).exclude = true; panel.setVisible(false); /* * If it's the last reporter then close the shell itself since it will be just empty */ if (pReporters.length == 0) { if ((style & AUTO_CLOSE) != 0) { if (null != shell && false == shell.isDisposed()) { shell.close(); } } else { createEmptyPanel(); } } else { /* * Formats the last panel; specifying this panel as the panelToIgnore * because at this point in the code this panel has not been removed * from the window yet */ formatLastPanel(panel); } if (null != shell && false == shell.isDisposed()) { shell.layout(true, true); } } }