diff --git a/source/net/sourceforge/filebot/resources/ResourceManager.java b/source/net/sourceforge/filebot/resources/ResourceManager.java index bcfa5d14..ca5cf1c9 100644 --- a/source/net/sourceforge/filebot/resources/ResourceManager.java +++ b/source/net/sourceforge/filebot/resources/ResourceManager.java @@ -18,7 +18,7 @@ public class ResourceManager { public static ImageIcon getIcon(String name, String def) { - URL resource = getResource(name, def); + URL resource = getImageResource(name, def); if (resource != null) return new ImageIcon(resource); @@ -39,23 +39,23 @@ public class ResourceManager { public static Image getImage(String name) { try { - return ImageIO.read(getResource(name)); + return ImageIO.read(getImageResource(name)); } catch (IOException e) { throw new RuntimeException(e); } } - private static URL getResource(String name) { + private static URL getImageResource(String name) { return ResourceManager.class.getResource(name + ".png"); } - private static URL getResource(String name, String def) { - URL resource = getResource(name); + private static URL getImageResource(String name, String def) { + URL resource = getImageResource(name); if (resource == null) - resource = getResource(def); + resource = getImageResource(def); return resource; } diff --git a/source/net/sourceforge/filebot/ui/panel/sfv/SfvPanel.java b/source/net/sourceforge/filebot/ui/panel/sfv/SfvPanel.java index bc13de7e..27ed9807 100644 --- a/source/net/sourceforge/filebot/ui/panel/sfv/SfvPanel.java +++ b/source/net/sourceforge/filebot/ui/panel/sfv/SfvPanel.java @@ -103,27 +103,38 @@ public class SfvPanel extends FileBotPanel { private File selectedColumn = null; + public ChecksumTableSaveAction() { + super(sfvTable.getExportHandler()); + } + + + @Override + public ChecksumTableExportHandler getExportHandler() { + return (ChecksumTableExportHandler) super.getExportHandler(); + } + + @Override protected boolean canExport() { - return selectedColumn != null && sfvTable.getExportHandler().canExport(); + return selectedColumn != null && super.canExport(); } @Override protected void export(File file) throws IOException { - sfvTable.getExportHandler().export(file, selectedColumn); + getExportHandler().export(file, selectedColumn); } @Override protected String getDefaultFileName() { - return sfvTable.getExportHandler().getDefaultFileName(selectedColumn); + return getExportHandler().getDefaultFileName(selectedColumn); } @Override protected File getDefaultFolder() { - // if column is a folder use it as default folder in file dialog + // if the column is a folder use it as default folder in the file dialog return selectedColumn.isDirectory() ? selectedColumn : null; } @@ -135,10 +146,10 @@ public class SfvPanel extends FileBotPanel { this.selectedColumn = null; if (options.size() == 1) { - // auto-select if there is only one option + // auto-select option if there is only one option this.selectedColumn = options.get(0); } else if (options.size() > 1) { - // show user his/her options + // user must select one option SelectDialog selectDialog = new SelectDialog(SwingUtilities.getWindowAncestor(SfvPanel.this), options) { @Override diff --git a/source/net/sourceforge/filebot/ui/transfer/SaveAction.java b/source/net/sourceforge/filebot/ui/transfer/SaveAction.java index 8388d57d..222ee908 100644 --- a/source/net/sourceforge/filebot/ui/transfer/SaveAction.java +++ b/source/net/sourceforge/filebot/ui/transfer/SaveAction.java @@ -18,7 +18,7 @@ import net.sourceforge.filebot.resources.ResourceManager; public class SaveAction extends AbstractAction { - protected final FileExportHandler exportHandler; + private final FileExportHandler exportHandler; public SaveAction(FileExportHandler exportHandler) { @@ -27,23 +27,23 @@ public class SaveAction extends AbstractAction { } - protected SaveAction() { - this(null); + public FileExportHandler getExportHandler() { + return exportHandler; } protected boolean canExport() { - return exportHandler.canExport(); + return getExportHandler().canExport(); } protected void export(File file) throws IOException { - exportHandler.export(file); + getExportHandler().export(file); } protected String getDefaultFileName() { - return exportHandler.getDefaultFileName(); + return getExportHandler().getDefaultFileName(); }