UIUtils.setRootFrameWaitCursor(SnapApp.getDefault().getMainFrame()); swingWorker.execute();
snapApp.setStatusBarMessage("Opening image view..."); UIUtils.setRootFrameWaitCursor(snapApp.getMainFrame());
@Override protected Object doInBackground(ProgressMonitor pm) throws Exception { UIUtils.setRootFrameWaitCursor(ImageInfoEditor2.this); if (parentForm.getFormModel().isValid()) { final RasterDataNode[] rasters = parentForm.getFormModel().getRasters(); try { pm.beginTask("Computing statistics", rasters.length); for (RasterDataNode raster : rasters) { raster.getStx(true, SubProgressMonitor.create(pm, 1)); } } finally { pm.done(); } } return null; }
UIUtils.setRootFrameWaitCursor(SnapApp.getDefault().getMainFrame());
UIUtils.setRootFrameWaitCursor(mainFrame); final ProgressMonitorSwingWorker<Void, Void> swingWorker = new ProgressMonitorSwingWorker<Void, Void>(mainFrame, dialogTitle) {
UIUtils.setRootFrameWaitCursor(SnapApp.getDefault().getMainFrame());
/** * Performs the actual "export Mask Pixels" command. */ private void exportVectorDataNode() { SnapApp snapApp = SnapApp.getDefault(); if (vectorDataNode.getFeatureCollection().isEmpty()) { Dialogs.showInformation(Bundle.CTL_ExportGeometryAction_DialogTitle(), "The selected geometry is empty. Nothing to export.", null); return; } final File file = promptForFile(vectorDataNode.getName()); if (file == null) { return; } final SwingWorker<Exception, Object> swingWorker = new ExportVectorNodeSwingWorker(snapApp, vectorDataNode, file); UIUtils.setRootFrameWaitCursor(snapApp.getMainFrame()); snapApp.setStatusBarMessage("Exporting Geometry..."); swingWorker.execute(); }
UIUtils.setRootFrameWaitCursor(SnapApp.getDefault().getMainFrame()); worker.execute();
private void openProductSceneViewRGB(final String name, final Product product, final String[] rgbaExpressions) { final SwingWorker<ProductSceneImage, Object> worker = new ProgressMonitorSwingWorker<ProductSceneImage, Object>( SnapApp.getDefault().getMainFrame(), SnapApp.getDefault().getInstanceName() + " - Creating image for '" + name + "'") { @Override protected ProductSceneImage doInBackground(ProgressMonitor pm) throws Exception { return createProductSceneImageRGB(name, product, rgbaExpressions, pm); } @Override protected void done() { SnapApp.getDefault().getMainFrame().setCursor(Cursor.getDefaultCursor()); String errorMsg = "The RGB image view could not be created."; try { ProductSceneView productSceneView = new ProductSceneView(get()); openDocumentWindow(productSceneView); } catch (OutOfMemoryError e) { Dialogs.showOutOfMemoryError(errorMsg); return; } catch (Exception e) { SnapApp.getDefault().handleError(errorMsg, e); return; } SnapApp.getDefault().setStatusBarMessage(""); } }; SnapApp.getDefault().setStatusBarMessage("Creating RGB image view..."); /*I18N*/ UIUtils.setRootFrameWaitCursor(SnapApp.getDefault().getMainFrame()); worker.execute(); }
private static ProductSceneImage createProductSceneImageHSV(final String name, final Product product, final String[] hsvExpressions, final ProgressMonitor pm) throws Exception { UIUtils.setRootFrameWaitCursor(SnapApp.getDefault().getMainFrame()); Band[] rgbBands = null; boolean errorOccured = false; ProductSceneImage productSceneImage = null; try { pm.beginTask("Creating HSV image...", 2); final String[] rgbaExpressions = convertHSVToRGBExpressions(hsvExpressions); rgbBands = OpenRGBImageViewAction.allocateRgbBands(product, rgbaExpressions); productSceneImage = new ProductSceneImage(name, rgbBands[0], rgbBands[1], rgbBands[2], SnapApp.getDefault().getPreferencesPropertyMap(), SubProgressMonitor.create(pm, 1)); productSceneImage.initVectorDataCollectionLayer(); productSceneImage.initMaskCollectionLayer(); } catch (Exception e) { errorOccured = true; throw e; } finally { pm.done(); if (rgbBands != null) { OpenRGBImageViewAction.releaseRgbBands(rgbBands, errorOccured); } } return productSceneImage; }