public void actionPerformed(final ActionEvent e) { final Dialogs.Answer status = Dialogs.requestDecision("Deleting selected files", "Are you sure you want to delete these products", true, null); if (status == Dialogs.Answer.YES) performFileAction(ProductFileHandler.TYPE.DELETE); } });
@Override public boolean cancel() { Dialogs.Answer answer = Dialogs.requestDecision(Bundle.CTL_WriteProductOperationName(), "Cancellation of writing may lead to an unreadable product.\n\n" + "Do you really want to cancel the write process?", false, null); return answer == Dialogs.Answer.YES; }
@Override public void run() { answer[0] = Dialogs.requestDecision(title, msg, true, null); if (answer[0] == Dialogs.Answer.YES) { newFile[0] = Dialogs.requestFileForOpen(title, false, null, null); } } });
private Dialogs.Answer showQuestionDialog() { return Dialogs.requestDecision(Bundle.CTL_ExportImageAction_MenuText(), "There may not be enough memory to export the image because\n" + "the image dimension is too large. \n Do you really want to keep the image dimension?", true, null); }
/** * Opens question dialog asking the user whether or not to overwrite an existing file. If the given * file does not exists, the question dialog is not shown. * * @param file the file to check for existance * @return <code>True</code> if the user confirms the dialog with 'yes' or the given file does not exist.<br> * <code>False</code> if the user does not want to overwrite the existing file.<br> * <code>null</code> if the user canceled the operation.<br> */ public static Boolean requestOverwriteDecision(String title, File file) { if (!file.exists()) { return Boolean.TRUE; } Answer answer = requestDecision(getDialogTitle(title), MessageFormat.format( "The file ''{0}'' already exists.\nDo you wish to overwrite it?", file), true, null); return answer == Answer.YES ? Boolean.TRUE : answer == Answer.NO ? Boolean.FALSE : null; }
if (Dialogs.requestDecision("Product Errors", "The follow files have errors:\n" + str.toString() + question, false, null) == Dialogs.Answer.YES) {
@Override public void actionPerformed(ActionEvent event) { final ProductNode productNode = lkp.lookup(ProductNode.class); if (productNode != null && productNode instanceof Band) { final Band band = (Band) productNode; final Product product = band.getProduct(); final String unit = band.getUnit(); if (!unit.contains(Unit.DB)) { if (Dialogs.requestDecision("Convert to dB", "Would you like to convert band " + band.getName() + " into dB in a new virtual band?", true, null) == Dialogs.Answer.YES) { convert(product, band, true); } } else { if (Dialogs.requestDecision("Convert to linear", "Would you like to convert band " + band.getName() + " into linear in a new virtual band?", true, null) == Dialogs.Answer.YES) { convert(product, band, false); } } } }
private void requestDeleteClassifier() { String name = (String) classifierNameComboBox.getSelectedItem(); if (name != null) { Dialogs.Answer answer = Dialogs.requestDecision("Delete Classifier", "Are you sure you want to delete classifier " + name, true, null); if (answer.equals(Dialogs.Answer.YES)) { final Path classifierDir = getClassifierFolder(); final File classiferFile = classifierDir.resolve(name + BaseClassifier.CLASSIFIER_FILE_EXTENSION).toFile(); if (classiferFile.exists()) { if (deleteClassifier(classiferFile, name)) { classifierNameComboBox.removeItem(name); if (classifierNameComboBox.getItemCount() == 0) { trainBtn.setSelected(true); } } else { Dialogs.showError("Unable to delete classifier " + classiferFile); } } else { Dialogs.showError("Unable to find classifier " + classiferFile); } } } }
private boolean handleInvalidBandFilter(ProductSceneView view) { Product product = view.getProduct(); Dialogs.Answer answer = Dialogs.requestDecision(DIALOG_TITLE, "The currently selected band filter does not match\n" + "the bands of the selected data product.\n\n" + "Reset filter and use the ones of the selected product?", false, "reset_magic_wand_filter"); if (answer == Dialogs.Answer.YES) { model.setBandNames(); return ensureBandNamesSet(view, product); } else { return false; } }
@Override public int show() { getJDialog().revalidate(); if (this.currentOperation == OperationType.FORCED_EDIT) { if (BundleInstaller.isBundleFileAvailable(this.oldOperatorDescriptor.getBundle())) { SwingUtilities.invokeLater(() -> { Dialogs.Answer answer = Dialogs.requestDecision("Bundle Available", "A bundle has been configured for this adapter.\n" + "Do you want to proceed with bundle download/installation?", false, null); if (answer == Dialogs.Answer.YES) { if (downloadAction != null) { try { downloadAction.call(); } catch (Exception e) { logger.warning(e.getMessage()); } } } else { onOK(); } }); } else { SwingUtilities.invokeLater(this::onOK); } } return super.show(); }
private void tearDown(Throwable throwable, Product result) { //boolean hasBeenCancelled = operatorTask != null && !operatorTask.hasCompleted; if (operatorTask != null) { operatorTask.cancel(); } if (throwable != null) { if (result != null) { final Dialogs.Answer answer = Dialogs.requestDecision(Bundle.ExecutionFailed_Text(), String.format(Bundle.ExecutionFailed_Message(), throwable.getMessage()), false, null); if (answer == Dialogs.Answer.YES) { operatorCompleted(result); } } /*else displayErrors();*/ //SnapDialogs.showError(Bundle.ExecutionFailed_Text(), throwable.getMessage()); } //displayErrors(); displayErrorMessage(); }
private void removeRepository() { final Object selectedItem = repositoryListCombo.getSelectedItem(); final int index = repositoryListCombo.getSelectedIndex(); if (index == 0) { final Dialogs.Answer status = Dialogs.requestDecision("Remove folders", "This will remove all folders and products from the database.\n" + "Are you sure you wish to continue?", true, null); if (status == Dialogs.Answer.YES) { while (repositoryListCombo.getItemCount() > repositoryFolderStartIndex) { final FolderRepository repo = (FolderRepository) repositoryListCombo.getItemAt(repositoryFolderStartIndex); libConfig.removeBaseDir(repo.getBaseDir()); repositoryListCombo.removeItemAt(repositoryFolderStartIndex); } removeProducts(null); // remove all UpdateUI(); } } else if (selectedItem instanceof FolderRepository) { final FolderRepository repo = (FolderRepository) selectedItem; final Dialogs.Answer status = Dialogs.requestDecision("Remove products", "This will remove all products within " + repo.getBaseDir().getAbsolutePath() + " from the database\n" + "Are you sure you wish to continue?", true, null); if (status == Dialogs.Answer.YES) { libConfig.removeBaseDir(repo.getBaseDir()); repositoryListCombo.removeItemAt(index); removeProducts(repo); UpdateUI(); } } }
if (Dialogs.requestDecision("Convert to Intensity", "Would you like to convert i and q bands " + " to Intensity in a new virtual band?", true, null) == Dialogs.Answer.YES) { convert(product, iBandName, qBandName, intensityBandName);
product.getDisplayName()); Dialogs.Answer answer = Dialogs.requestDecision(TITLE, message, false, null); if (answer == Dialogs.Answer.YES) { File sessionDir = sessionFile.getAbsoluteFile().getParentFile(); product.getDisplayName()); Dialogs.Answer answer = Dialogs.requestDecision(TITLE, message, false, null); if (answer == Dialogs.Answer.YES) { SaveProductAction saveProductAction = new SaveProductAction(product);
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; }
if (Dialogs.requestDecision("Convert to Phase", "Would you like to convert i and q bands " + " to Phase in a new virtual band?", true, null) == Dialogs.Answer.YES) { convert(product, iBandName, qBandName, phaseBandName);
if (Dialogs.requestDecision("Convert to Intensity", "Would you like to convert band " + band.getName() + " into Intensity in a new virtual band?", true, null) == Dialogs.Answer.YES) { convert(product, band, false); return; if (Dialogs.requestDecision("Convert to Amplitude", "Would you like to convert band " + band.getName() + " into Amplitude in a new virtual band?", true, null) == Dialogs.Answer.YES) { convert(product, band, true);
@Override public void actionPerformed(ActionEvent event) { final SessionManager manager = SessionManager.getDefault(); if (manager.getSessionFile() != null) { Dialogs.Answer answer = Dialogs.requestDecision(TITLE, "This will close or reopen the current session.\n" + "Do you want to continue?", true, null); if (answer != Dialogs.Answer.YES) { return; } } final File sessionFile = Dialogs.requestFileForOpen(TITLE, false, SessionManager.getDefault().getSessionFileFilter(), LAST_SESSION_DIR_KEY); if (sessionFile == null) { return; } openSession(sessionFile); }
public static void deleteVectorDataNode(VectorDataNode vectorDataNode) { Assert.notNull(vectorDataNode); Product product = vectorDataNode.getProduct(); ProductNodeGroup<Mask> maskGroup = product.getMaskGroup(); Mask vectorMask = null; for (int i = 0; i < maskGroup.getNodeCount(); i++) { Mask mask = maskGroup.get(i); if (mask.getImageType() == Mask.VectorDataType.INSTANCE && Mask.VectorDataType.getVectorData(mask) == vectorDataNode) { vectorMask = mask; break; } } String message; if (vectorMask != null) { List<RasterDataNode> virtualBands = getReferencedVirtualBands(vectorMask); List<RasterDataNode> validMaskNodes = getReferencedValidMasks(vectorMask); List<RasterDataNode> masks = getReferencedMasks(vectorMask); VectorDataNode[] nodes = new VectorDataNode[]{vectorDataNode}; message = formatPromptMessage("Geometry", nodes, virtualBands, validMaskNodes, masks); } else { message = MessageFormat.format("Do you really want to delete the geometry ''{0}''?\nThis action cannot be undone.\n\n", vectorDataNode.getName()); } final Dialogs.Answer answer = Dialogs.requestDecision("Delete Vector Data", message, true, null); if (answer == Dialogs.Answer.YES) { product.getVectorDataGroup().remove(vectorDataNode); } }
private static void deleteRasterDataNodesImpl(RasterDataNode[] rasters, String message) { final Dialogs.Answer answer = Dialogs.requestDecision("Delete Raster Data", message, true, null); if (answer == Dialogs.Answer.YES) { for (RasterDataNode raster : rasters) {