public ProgressHandle getProgressHandle() { return pm.getProgressHandle(); }
@Override protected void onApply() { BenchmarkExecutor executor = new BenchmarkExecutor(); //launch processing with a progress bar ProgressHandleMonitor pm = ProgressHandleMonitor.create("Running benchmark", executor); executor.setProgressHandleMonitor(pm); ProgressUtils.runOffEventThreadWithProgressDialog(executor, "Benchmarking....", pm.getProgressHandle(), true, 50, 1000); }
private static void addProducts(final FileTableModel tableModel, final File[] files) { final ProgressHandleMonitor pm = ProgressHandleMonitor.create("Populating table"); Runnable operation = () -> { pm.beginTask("Populating table...", files.length); for (File file : files) { if (ProductFunctions.isValidProduct(file)) { tableModel.addFile(file); } pm.worked(1); } pm.done(); }; ProgressUtils.runOffEventThreadWithProgressDialog(operation, "Adding Products", pm.getProgressHandle(), true, 50, 1000); }
private static void addAllOpenProducts(final FileTableModel tableModel) { final ProgressHandleMonitor pm = ProgressHandleMonitor.create("Populating table"); Runnable operation = () -> { final Product[] products = SnapApp.getDefault().getProductManager().getProducts(); pm.beginTask("Populating table...", products.length); for (Product prod : products) { final File file = prod.getFileLocation(); if (file != null && file.exists()) { tableModel.addFile(file); } pm.worked(1); } pm.done(); }; ProgressUtils.runOffEventThreadWithProgressDialog(operation, "Adding Products", pm.getProgressHandle(), true, 50, 1000); }
private static void updateImages(RasterDataNode rasterDataNode, boolean validMaskPropertyChanged) { if (rasterDataNode instanceof VirtualBand) { VirtualBand virtualBand = (VirtualBand) rasterDataNode; if (virtualBand.hasRasterData()) { String title = "Recomputing Raster Data"; ProgressHandleMonitor pm = ProgressHandleMonitor.create(title); Runnable operation = () -> { try { virtualBand.readRasterDataFully(pm); } catch (IOException e) { Dialogs.showError(e.getMessage()); } }; ProgressUtils.runOffEventThreadWithProgressDialog(operation, title, pm.getProgressHandle(), true, 50, // time in ms after which wait cursor is shown 1000); // time in ms after which dialog with "Cancel" button is shown } } OpenImageViewAction.updateProductSceneViewImages(new RasterDataNode[]{rasterDataNode}, view -> { if (validMaskPropertyChanged) { view.updateNoDataImage(); } view.updateImage(); }); }
progressHandleMonitor.getProgressHandle().progress( String.format("Benchmarking ( cache size:%d , nb threads:%d )", benchmarkSingleCalcul.getCacheSize(),