/** * Displays a modal dialog with the provided warning message text. * * @param message The information message text to be displayed. */ public static void showWarning(String message) { showWarning(null, message, null); }
private void displayWarnings() { StringBuilder warnMessage = new StringBuilder(); warnMessage.append("Before executing the tool, please correct the errors below:") .append("\n").append("\n"); for (String msg : warnings) { warnMessage.append("\t").append(msg).append("\n"); } Dialogs.showWarning(warnMessage.toString()); }
private void displayErrorMessage() { if (operatorTask != null) { List<String> errors = operatorTask.getErrors(); if (errors != null && errors.size() > 0){ Dialogs.showWarning("\nIt seems there was en error on execution or the defined tool output error pattern was found.\nPlease consult the SNAP log file"); } } }
private boolean canWriteSelectedFile(File newFile) { if (newFile.isFile() && !newFile.canWrite()) { Dialogs.showWarning(getDisplayName(), MessageFormat.format("The product\n" + "''{0}''\n" + "exists and cannot be overwritten, because it is read only.\n" + "Please choose another file or remove the write protection.", newFile.getPath()), null); return false; } return true; }
private ToolAdapterOperatorDescriptor requestSelection() { ToolAdapterOperatorDescriptor selected = null; int selectedRow = operatorsTable.getSelectedRow(); if (selectedRow >= 0) { selected = ((OperatorsTableModel) operatorsTable.getModel()).getObjectAt(selectedRow); } else { Dialogs.showWarning(Bundle.MessageNoSelection_Text()); } return selected; }
@Override protected void onOK() { final String lonValue = (String) lonBox.getSelectedItem(); selectedLonBand = findBandName(lonValue); final String latValue = (String) latBox.getSelectedItem(); selectedLatBand = findBandName(latValue); if (selectedLatBand == null || selectedLonBand == null || Objects.equals(selectedLatBand, selectedLonBand)) { Dialogs.showWarning(Bundle.CTL_AttachPixelGeoCodingDialogTitle(), "You have to select two different bands for the pixel geo-coding.", null); } else { super.onOK(); } }
private void checkExpressionForExternalReferences(String expression) { final Product[] compatibleProducts = getCompatibleProducts(); if (compatibleProducts.length > 1) { int defaultIndex = Arrays.asList(compatibleProducts).indexOf(targetProduct); RasterDataNode[] rasters = null; try { rasters = BandArithmetic.getRefRasters(expression, compatibleProducts, defaultIndex); } catch (ParseException ignored) { } if (rasters != null && rasters.length > 0) { Set<Product> externalProducts = new HashSet<>(compatibleProducts.length); for (RasterDataNode rdn : rasters) { Product product = rdn.getProduct(); if (product != targetProduct) { externalProducts.add(product); } } if (!externalProducts.isEmpty()) { String message = "The entered maths expression references multiple products.\n" + "It will cause problems unless the session is restored as is.\n\n" + "Note: You can save the session from the file menu."; Dialogs.showWarning(message); } } } }
} else if (!warningStr.isEmpty()) { if (warningStr.length() > 100 && !warningStr.equals(lastWarningMsg)) { Dialogs.showWarning(warningStr); lastWarningMsg = warningStr; } else {
Dialogs.showWarning(product.getName() + " missing " + iBandName + " band"); return; Dialogs.showWarning(product.getName() + " missing " + qBandName + " band"); return; Dialogs.showWarning(product.getName() + " already contains a " + phaseBandName + " band"); return;
private void makePlacemarkNameUnique(Placemark newPlacemark) { if (makePlacemarkNameUnique0(newPlacemark, product)) { Dialogs.showWarning(MessageFormat.format("{0} has been renamed to ''{1}'',\n" + "because a {2} with the former name already exists.", StringUtils.firstLetterUp(placemarkDescriptor.getRoleLabel()), newPlacemark.getName(), placemarkDescriptor.getRoleLabel())); } }
if (productEntryList.length == 0) { if (!closeOnDone) { Dialogs.showWarning("No input products found matching the selected criteria\nor all products have already been processed"); Dialogs.showWarning("No slave products founds");
@Override public void actionPerformed(ActionEvent ignored) { Rectangle bounds = view.getVisibleImageBounds(); if (bounds == null) { Dialogs.showWarning(Bundle.CTL_CreateSubsetFromViewAction_Title(), "The selected area is entirely outside the product's spatial boundaries.", null); } CreateSubsetAction.createSubset(view.getProduct(), bounds); }
Dialogs.showWarning(product.getName() + " missing " + iBandName + " band"); return; Dialogs.showWarning(product.getName() + " missing " + qBandName + " band"); return; Dialogs.showWarning(product.getName() + " already contains a " + intensityBandName + " band"); return;
@Override protected void onOK() { ToolAdapterOperatorDescriptor[] selection = ((AdapterListModel) this.operatorsTable.getModel()).getSelectedItems(); if (selection.length > 0) { this.descriptor = this.descriptorForm.applyChanges(); final Map<OSFamily, org.esa.snap.core.gpf.descriptor.dependency.Bundle> bundles = this.bundleForm.applyChanges(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (fileChooser.showOpenDialog(getButton(ID_OTHER)) == JFileChooser.APPROVE_OPTION) { File targetFolder = fileChooser.getSelectedFile(); final String nbmName = this.descriptor.getName() + ".nbm"; ProgressWorker worker = new ProgressWorker("Export Module Suite", "Creating NetBeans module suite " + nbmName, () -> { try { ModulePackager.packModules(this.descriptor, new File(targetFolder, nbmName), bundles, selection); Dialogs.showInformation(String.format(Bundle.MSG_Export_Complete_Text(), targetFolder.getAbsolutePath()), null); } catch (IOException e) { SystemUtils.LOG.warning(e.getMessage()); Dialogs.showError(e.getMessage()); } }); worker.executeWithBlocking(); super.onOK(); } } else { Dialogs.showWarning("Please select at least one adapter"); } }
@Override protected void onApply() { if (isResampleNeeded(getSelectedProduct()) && BaseIndexOp.RESAMPLE_NONE.equals(getBindingContext().getPropertySet().getValue(PROPERTY_RESAMPLE))) { Dialogs.showWarning("Please select how resampling should be performed"); return; } super.onApply(); }
Dialogs.showWarning("Please convert band " + bandName + " from dB to linear first"); return; Dialogs.showWarning(product.getName() + " already contains an " + bandName + " band"); return; Dialogs.showWarning(product.getName() + " already contains an " + bandName + " band"); return;
targetGeom = transformGeometry(sourceGeom, sourceCrs, targetCrs); } catch (Exception e) { Dialogs.showWarning(DLG_TITLE, "Failed to transform geometry to " + targetCrs.getName() + ".\n" + "Using " + sourceCrs.getName() + " instead.", null); targetGeom = sourceGeom;
static Boolean saveProduct(Product product) { Assert.notNull(product.getFileLocation()); final File file = product.getFileLocation(); if (file.isFile() && !file.canWrite()) { Dialogs.showWarning(Bundle.CTL_SaveProductActionName(), MessageFormat.format("The product\n" + "''{0}''\n" + "exists and cannot be overwritten, because it is read only.\n" + "Please choose another file or remove the write protection.", file.getPath()), null); return false; } SnapApp.getDefault().setStatusBarMessage(MessageFormat.format("Writing product ''{0}'' to {1}...", product.getDisplayName(), file)); boolean incremental = true; WriteProductOperation operation = new WriteProductOperation(product, incremental); BaseProgressUtils.runOffEventThreadWithProgressDialog(operation, Bundle.CTL_SaveProductActionName(), operation.getProgressHandle(), true, 50, 1000); SnapApp.getDefault().setStatusBarMessage(""); return operation.getStatus(); }
Dialogs.showWarning(MessageFormat.format( "One or more {0}s have not been imported,\n{1}because they can not be assigned to a product without a geo-coding.", placemarkDescriptor.getRoleLabel(), intoProductMessage)); Dialogs.showWarning(MessageFormat.format( "One or more {0}s have been renamed,\n{1}because their former names are already existing.", placemarkDescriptor.getRoleLabel(), intoProductMessage));
Dialogs.showWarning(getDisplayName(), MessageFormat.format("The product\n" + "''{0}''\n" +