String size = OwlUI.getSize(attachment.getLength());
Action action = new Action(size != null ? (NLS.bind(Messages.ApplicationActionBarAdvisor_FILE_SIZE, fileName, size)) : (fileName)) {
@Override
public void run() {
FileDialog dialog = new FileDialog(shellProvider.getShell(), SWT.SAVE);
dialog.setText(Messages.ApplicationActionBarAdvisor_SELECT_FILE_FOR_DOWNLOAD);
dialog.setFileName(Application.IS_WINDOWS ? CoreUtils.getSafeFileNameForWindows(fileName) : fileName);
dialog.setOverwrite(true);
String downloadFolder = preferences.getString(DefaultPreferences.DOWNLOAD_FOLDER);
if (StringUtils.isSet(downloadFolder) && new File(downloadFolder).exists())
dialog.setFilterPath(downloadFolder);
String selectedFileName = dialog.open();
if (StringUtils.isSet(selectedFileName)) {
File file = new File(selectedFileName);
Controller.getDefault().getDownloadService().download(attachmentPair.getFirst(), attachmentPair.getSecond(), file.getName(), file.getParentFile(), true);
/* Remember Download Folder in Settings */