From f1202a1c66b239489ba052e632c7dae3db415526 Mon Sep 17 00:00:00 2001 From: Rob Greene Date: Sun, 6 Oct 2019 13:17:46 -0500 Subject: [PATCH] This should clean up all the `TextBundle#format` with array references. #36 --- .../com/webcodepro/applecommander/ui/ac.java | 6 ++--- .../ui/swing/SwingAppleCommander.java | 27 ++----------------- .../ui/swt/DiskExplorerTab.java | 2 +- .../applecommander/ui/swt/DiskMapTab.java | 5 ++-- .../applecommander/ui/swt/DiskWindow.java | 3 +-- .../ui/swt/SwtAppleCommander.java | 2 +- 6 files changed, 10 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/webcodepro/applecommander/ui/ac.java b/src/main/java/com/webcodepro/applecommander/ui/ac.java index 931d981..3eacca4 100644 --- a/src/main/java/com/webcodepro/applecommander/ui/ac.java +++ b/src/main/java/com/webcodepro/applecommander/ui/ac.java @@ -528,9 +528,9 @@ public class ac { showFiles(files, "", display); //$NON-NLS-1$ } System.out.println(textBundle.format("CommandLineStatus", //$NON-NLS-1$ - new Object[] { formattedDisk.getFormat(), - new Integer(formattedDisk.getFreeSpace()), - new Integer(formattedDisk.getUsedSpace()) })); + formattedDisk.getFormat(), + formattedDisk.getFreeSpace(), + formattedDisk.getUsedSpace())); System.out.println(); } } catch (DiskException e) { diff --git a/src/main/java/com/webcodepro/applecommander/ui/swing/SwingAppleCommander.java b/src/main/java/com/webcodepro/applecommander/ui/swing/SwingAppleCommander.java index ca77c9f..666bd7e 100644 --- a/src/main/java/com/webcodepro/applecommander/ui/swing/SwingAppleCommander.java +++ b/src/main/java/com/webcodepro/applecommander/ui/swing/SwingAppleCommander.java @@ -206,34 +206,11 @@ public class SwingAppleCommander extends JFrame implements ActionListener { } } -/* - fileDialog.setFilterNames(names); - fileDialog.setFilterExtensions(extensions); - fileDialog.setFilterPath(userPreferences.getDiskImageDirectory()); - String fullpath = fileDialog.open(); - - if (fullpath != null) { - userPreferences.setDiskImageDirectory(fileDialog.getFilterPath()); - try { - Disk disk = new Disk(fullpath); - FormattedDisk[] formattedDisks = disk.getFormattedDisks(); - if (formattedDisks != null) { - DiskWindow window = new DiskWindow(shell, formattedDisks, imageManager); - window.open(); - } else { - showUnrecognizedDiskFormatMessage(fullpath); - } - } catch (Exception ignored) { - ignored.printStackTrace(); - showUnrecognizedDiskFormatMessage(fullpath); - } - } -*/ - public void showAboutAppleCommander() { JOptionPane.showMessageDialog(null, textBundle.format("SwtAppleCommander.AboutMessage", //$NON-NLS-1$ - new Object[] { AppleCommander.VERSION, textBundle.get("Copyright") }), textBundle.get("SwtAppleCommander.AboutTitle"), //$NON-NLS-1$ + AppleCommander.VERSION, textBundle.get("Copyright")), + textBundle.get("SwtAppleCommander.AboutTitle"), //$NON-NLS-1$ JOptionPane.INFORMATION_MESSAGE); } } diff --git a/src/main/java/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java b/src/main/java/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java index b90e485..edfbaf6 100644 --- a/src/main/java/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java +++ b/src/main/java/com/webcodepro/applecommander/ui/swt/DiskExplorerTab.java @@ -1882,7 +1882,7 @@ public class DiskExplorerTab { } protected void printFooter() { TextBundle textBundle = UiBundle.getInstance(); - String text = textBundle.format("PageNumberText", Integer.toString(page)); //$NON-NLS-1$ + String text = textBundle.format("PageNumberText", page); //$NON-NLS-1$ Point point = gc.stringExtent(text); gc.drawString(text, clientArea.x + (clientArea.width - point.x)/2, diff --git a/src/main/java/com/webcodepro/applecommander/ui/swt/DiskMapTab.java b/src/main/java/com/webcodepro/applecommander/ui/swt/DiskMapTab.java index 8b1ed5c..e41c1e0 100644 --- a/src/main/java/com/webcodepro/applecommander/ui/swt/DiskMapTab.java +++ b/src/main/java/com/webcodepro/applecommander/ui/swt/DiskMapTab.java @@ -98,9 +98,8 @@ public class DiskMapTab { labels[0].toLowerCase())); } else { buf.append(textBundle.format("DiskMapTab.TrackAndSectorDecriptiveLabel", //$NON-NLS-1$ - new Object[] { - labels[0].toLowerCase(), - labels[1].toLowerCase() })); + labels[0].toLowerCase(), + labels[1].toLowerCase())); } title.setText(buf.toString()); title.setLayoutData(data); diff --git a/src/main/java/com/webcodepro/applecommander/ui/swt/DiskWindow.java b/src/main/java/com/webcodepro/applecommander/ui/swt/DiskWindow.java index 5f84644..025c97e 100644 --- a/src/main/java/com/webcodepro/applecommander/ui/swt/DiskWindow.java +++ b/src/main/java/com/webcodepro/applecommander/ui/swt/DiskWindow.java @@ -120,8 +120,7 @@ public class DiskWindow { box.setText(textBundle.get("SwtAppleCommander.DiskException.Title")); //$NON-NLS-1$ box.setMessage( textBundle.format("SwtAppleCommander.DiskException.Message", //$NON-NLS-1$ - new Object[]{e.imagepath, e.toString()} - )); + e.imagepath, e.toString())); box.open(); } diff --git a/src/main/java/com/webcodepro/applecommander/ui/swt/SwtAppleCommander.java b/src/main/java/com/webcodepro/applecommander/ui/swt/SwtAppleCommander.java index dc0c244..4173baf 100644 --- a/src/main/java/com/webcodepro/applecommander/ui/swt/SwtAppleCommander.java +++ b/src/main/java/com/webcodepro/applecommander/ui/swt/SwtAppleCommander.java @@ -310,7 +310,7 @@ public class SwtAppleCommander implements Listener { box.setText(textBundle.get("SwtAppleCommander.AboutTitle")); //$NON-NLS-1$ box.setMessage( textBundle.format("SwtAppleCommander.AboutMessage", //$NON-NLS-1$ - new Object[] { AppleCommander.VERSION, textBundle.get("Copyright") })); //$NON-NLS-1$ + AppleCommander.VERSION, textBundle.get("Copyright"))); //$NON-NLS-1$ box.open(); }