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; }
/** Removes all panels whose reporter is no longer active */ private void removeInActivePanels() { Control[] controls = scrollChild.getChildren(); for (int i = 0; i < controls.length; i++) { if (null == controls[i] || true == controls[i].isDisposed()) { continue; } if (controls[i] instanceof ProgressReporterPanel) { IProgressReporter pReporter = ((ProgressReporterPanel) controls[i]).getProgressReporter(); if (false == pReporter.getProgressReport().isActive()) { if (!pReporter.getProgressReport().isInErrorState()) { ProgressReportingManager.getInstance().remove(pReporter); controls[i].dispose(); } } } } }
private void init() { if (COConfigurationManager.getBooleanParameter("Save Torrent Files")) { try { dirName = COConfigurationManager.getDirectoryParameter("General_sDefaultTorrent_Directory"); } catch (Exception egnore) { } } if (dirName == null) { DirectoryDialog dd = new DirectoryDialog(parent, SWT.NULL); dd.setText(MessageText.getString("fileDownloadWindow.saveTorrentIn")); dirName = dd.open(); } if (dirName == null) return; pReporter = ProgressReportingManager.getInstance().addReporter(); setupAndShowDialog(); downloader = TorrentDownloaderFactory.create(this, original_url, referrer, request_properties, dirName); downloader.setIgnoreReponseCode(true); downloader.start(); }