/** * 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; }
title = getDialogTitle(title != null ? title : Bundle.LBL_Message()); if (preferencesKey != null) { String decision = getPreferences().get(preferencesKey + PREF_KEY_SUFFIX_DONTSHOW, "");
public static Product maybeResample(Product product) { String title = Dialogs.getDialogTitle("Resampling Required"); final List<Resampler> availableResamplers = getAvailableResamplers(product); int optionType;
boolean storeResult; int optionType = allowCancel ? NotifyDescriptor.YES_NO_CANCEL_OPTION : NotifyDescriptor.YES_NO_OPTION; title = getDialogTitle(title != null ? title : Bundle.LBL_Question()); if (preferencesKey != null) { String decision = getPreferences().get(preferencesKey + PREF_KEY_SUFFIX_DECISION, "");
Dialogs.getDialogTitle("Multiple Readers Available"), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.OK_OPTION);
private static File requestFolderForSave2(String title, final String preferenceKey) { Assert.notNull(preferenceKey, "preferenceKey"); String lastDir = SnapApp.getDefault().getPreferences().get(preferenceKey, SystemUtils.getUserHomeDir().getPath()); File currentDir = new File(lastDir); SnapFileChooser fileChooser = new SnapFileChooser(); fileChooser.setCurrentDirectory(currentDir); fileChooser.setDialogTitle(Dialogs.getDialogTitle(title)); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setAcceptAllFileFilterUsed(false); int result = fileChooser.showSaveDialog(SnapApp.getDefault().getMainFrame()); if (fileChooser.getCurrentDirectory() != null) { SnapApp.getDefault().getPreferences().put(preferenceKey, fileChooser.getCurrentDirectory().getPath()); } if (result == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); if (file == null || file.getName().equals("")) { return null; } String path = file.getPath(); return new File(path); } return null; }
fileChooser.setSelectedFile(new File(FileUtils.exchangeExtension(fileName, defaultExtension))); fileChooser.setDialogTitle(getDialogTitle(title)); fileChooser.setFileSelectionMode(dirsOnly ? JFileChooser.DIRECTORIES_ONLY : JFileChooser.FILES_ONLY); if (accessory != null) {
fileChooser.setFileFilter(fileFilter); fileChooser.setDialogTitle(getDialogTitle(title)); fileChooser.setFileSelectionMode(dirsOnly ? JFileChooser.DIRECTORIES_ONLY : JFileChooser.FILES_ONLY); int result = fileChooser.showOpenDialog(SnapApp.getDefault().getMainFrame());