X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FBackupFiles.java;h=828bd0d411edada33a93da2b00d7ee0c9426eae4;hb=d043ce47fc710d3eb2629ba926a8a7417bd67d8c;hp=defc47b50f5abfd852545c5b1593b37cdc248bb6;hpb=cb8e52fbbc5f725e3f7f48c672cdddb0690bd978;p=jalview.git diff --git a/src/jalview/io/BackupFiles.java b/src/jalview/io/BackupFiles.java index defc47b..828bd0d 100644 --- a/src/jalview/io/BackupFiles.java +++ b/src/jalview/io/BackupFiles.java @@ -381,8 +381,8 @@ public class BackupFiles boolean delete = confirmNewerDeleteFile(fileToBeDeleted, replacementFile, true); - Console.trace("BACKUPFILES " + (delete ? "confirmed" : "not") - + " deleting file " + Console.trace("BACKUPFILES " + + (delete ? "confirmed" : "not") + " deleting file " + fileToBeDeleted.getAbsolutePath() + " which is newer than " + replacementFile.getAbsolutePath()); @@ -484,7 +484,8 @@ public class BackupFiles File fileToBeDeleted = backupFiles[i]; boolean delete = true; - Console.trace("BACKUPFILES fileToBeDeleted: " + fileToBeDeleted); + Console.trace( + "BACKUPFILES fileToBeDeleted: " + fileToBeDeleted); boolean newer = false; if (replacementFile != null) @@ -551,8 +552,9 @@ public class BackupFiles // using boolean '&' instead of '&&' as don't want moveFileToFile attempt to // be conditional (short-circuit) ret = ret & moveFileToFile(file, new File(latestBackupFilename)); - Console.debug("BACKUPFILES moving " + file + " to " + latestBackupFilename - + " was " + (ret ? "" : "NOT ") + "successful"); + Console.debug( + "BACKUPFILES moving " + file + " to " + latestBackupFilename + + " was " + (ret ? "" : "NOT ") + "successful"); if (tidyUp) { Console.debug("BACKUPFILES tidying up files"); @@ -631,12 +633,12 @@ public class BackupFiles MessageManager.getString("label.delete"), MessageManager.getString("label.rename") }; + // TODO enable JvOptionPane to behave appropriately when batch/headless confirmButton = Platform.isHeadless() ? JvOptionPane.YES_OPTION - : JvOptionPane.showOptionDialog(Desktop.desktop, + : JvOptionPane.showOptionDialog(Desktop.getDesktopPane(), messageSB.toString(), MessageManager.getString( "label.backupfiles_confirm_delete"), - // "Confirm delete" JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE, null, options, options[0]); @@ -660,14 +662,11 @@ public class BackupFiles MessageManager.getString("label.keep") }; confirmButton = Platform.isHeadless() ? JvOptionPane.YES_OPTION - : JvOptionPane.showOptionDialog(Desktop.desktop, - messageSB.toString(), - MessageManager.getString( - "label.backupfiles_confirm_delete"), - // "Confirm delete" - JvOptionPane.YES_NO_OPTION, - JvOptionPane.WARNING_MESSAGE, null, options, - options[0]); + : JvOptionPane.showOptionDialog(Desktop.getDesktopPane(), + messageSB.toString(), + MessageManager.getString("label.backupfiles_confirm_delete"), + JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE, + null, options, options[0]); } // return should be TRUE if file is to be deleted @@ -701,7 +700,7 @@ public class BackupFiles } int confirmButton = Platform.isHeadless() ? JvOptionPane.YES_OPTION - : JvOptionPane.showConfirmDialog(Desktop.desktop, + : JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(), messageSB.toString(), MessageManager.getString( "label.backupfiles_confirm_delete"), @@ -804,7 +803,7 @@ public class BackupFiles .append(MessageManager.getString("label.continue_operation")); int confirmButton = Platform.isHeadless() ? JvOptionPane.OK_OPTION - : JvOptionPane.showConfirmDialog(Desktop.desktop, + : JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(), messageSB.toString(), MessageManager.getString( "label.backupfiles_confirm_save_file"), @@ -899,8 +898,8 @@ public class BackupFiles // delete destination file - not usually necessary but Just In Case... Console.trace("BACKUPFILES deleting " + newFile.getAbsolutePath()); newFile.delete(); - Console.trace("BACKUPFILES moving " + oldFile.getAbsolutePath() + " to " - + newFile.getAbsolutePath()); + Console.trace("BACKUPFILES moving " + oldFile.getAbsolutePath() + + " to " + newFile.getAbsolutePath()); Files.move(oldPath, newPath, StandardCopyOption.REPLACE_EXISTING); ret = true; Console.trace("BACKUPFILES move seems to have succeeded");