/** * Displays a modal dialog with the provided error message text. * * @param message The error message text to be displayed. */ public static void showError(String message) { showError(null, message); }
protected static void showErrorMsg(String msg) { Dialogs.showError("Oops!", msg); }
/** * Displays a modal dialog indicating an 'Out of Memory'-error with the * provided error message text. It also displays a hint how to solve the problem. * * @param message The error message text to be displayed. */ public static void showOutOfMemoryError(String message) { showError("Out of Memory", String.format("%s\n\n" + "You can try to release memory by closing products or image views which\n" + "you currently not really need.", message)); }
public static boolean validateFolder(final File file) { if (!file.exists()) { if (!file.mkdirs()) { Dialogs.showError("Unable to create folder\n" + file.getAbsolutePath()); return false; } } return true; }
private static void handleException(Throwable t) { SystemUtils.LOG.severe(t.getMessage()); Dialogs.showError(t.getMessage()); }
@Override public boolean verify(JComponent input) { if (input instanceof JTextComponent) { boolean isValid = false; String text = ((JTextComponent) input).getText(); isValid = verifyValue(text); if (!isValid) { Dialogs.showError(errorMessage); } return isValid; } else { return true; } }
@Override protected void onOK() { try { final double gain = Double.parseDouble(gainField.getText()); final double bias = Double.parseDouble(biasField.getText()); final double exp = Double.parseDouble(expField.getText()); final boolean isLog = logCheck.isSelected(); applyScaling(_product, _band, gain, bias, exp, isLog); hide(); } catch (Exception e) { Dialogs.showError(e.getMessage()); } }
private void updateBinningFormModel() { AggregatorConfig[] aggregatorConfigs = new AggregatorConfig[aggregatorItems.size()]; for (int i = 0; i < aggregatorItems.size(); i++) { AggregatorItem aggregatorItem = aggregatorItems.get(i); aggregatorConfigs[i] = aggregatorItem.aggregatorConfig; } try { binningFormModel.setProperty(BinningFormModel.PROPERTY_KEY_AGGREGATOR_CONFIGS, aggregatorConfigs); } catch (ValidationException e) { Dialogs.showError("Aggregator Configuration", e.getMessage()); } }
@Override public void actionPerformed(ActionEvent e) { try { filterSetStore.storeFilterSetModel(filterSet); setModified(false); } catch (IOException ioe) { Dialogs.showError("Save","Failed to save:\n" + ioe.getMessage()); } } });
@Override public boolean verify(JComponent input) { String text = ((JTextComponent) input).getText(); if (text != null && text.length() > 0) { actionPerformed(null); return getBinding().getProblem() == null; } Dialogs.showError(messageToDisplay); return false; } }
private void paste() { try { final File[] fileList = ClipboardUtils.getClipboardFileList(); if (fileList != null) { setFiles(fileList); } } catch (Exception e) { if (SnapApp.getDefault() != null) { Dialogs.showError("Unable to paste from clipboard: " + e.getMessage()); } } }
@Override protected void onOK() { super.onOK(); for (FilterSet userFilterSet : userFilterSets) { userFilterSet.setEditable(true); try { filterSetStore.storeFilterSetModel(userFilterSet); } catch (IOException e) { Dialogs.showError(TITLE, "Failed to store filter sets:\n" + e.getMessage()); } } }
private static ProductEntry getProductEntry(final File file) { try { return ProductDB.instance().getProductEntry(file); } catch (Exception e) { if (SnapApp.getDefault() != null) { Dialogs.showError("Error getting product entry: " + e.getMessage()); } } return null; }
public void saveSessionAsQuitely(final File newSessionFile) { if (!saveProductsOrLetItBe(newSessionFile)) { return; } try { final Session session = createSession(newSessionFile); SessionIO.getInstance().writeSession(session, newSessionFile); } catch (Exception e) { e.printStackTrace(); Dialogs.showError(TITLE, e.getMessage()); } }
public CoordinateReferenceSystem getFeatureCrs() { CoordinateReferenceSystem crs = null; try { crs = crsSelectionPanel.getCrs(ProductUtils.getCenterGeoPos(product)); } catch (FactoryException e) { Dialogs.showError(title, "Cannot create coordinate reference system.\n" + e.getMessage()); } return crs; }
public void actionPerformed(final ActionEvent e) { final PromptDialog dlg = new PromptDialog("Rename", "Name", panel.getTitle(), PromptDialog.TYPE.TEXTFIELD); dlg.show(); if (dlg.IsOK()) { try { panel.setTitle(dlg.getValue("Name")); } catch (Exception ex) { Dialogs.showError(ex.getMessage()); } } } });
private void performOpenAction() { try { final int row = aoiTable.getSelectedRow(); if (row >= 0) { final AOI aoi = aoiManager.getAOIAt(row); final AOIDialog dlg = new AOIDialog(SnapApp.getDefault().getMainFrame(), aoi); dlg.show(); UpdateUI(); performSelectAction(); } } catch (Exception e) { Dialogs.showError("Unable to open AOI: " + e.getMessage()); } }
private boolean validateUI() { final UIValidation validation = opUI.validateParameters(); if (validation.getState() == UIValidation.State.WARNING) { final String msg = "Warning: " + validation.getMsg() + "\n\nWould you like to continue?"; return Dialogs.requestDecision("Warning", msg, false, null) == Dialogs.Answer.YES; } else if (validation.getState() == UIValidation.State.ERROR) { final String msg = "Error: " + validation.getMsg(); Dialogs.showError(msg); return false; } return true; }
private boolean ensureBandNamesSet(ProductSceneView view, Product product) { if (model.getBandCount() == 0) { model.setSpectralBandNames(product); } if (model.getBandCount() == 0) { model.setBandNames(view.getRaster().getName()); } if (model.getBandCount() == 0) { // It's actually hard to get here, because we have a selected image view... Dialogs.showError(DIALOG_TITLE, "No bands selected."); return false; } return true; }