From fe37b816d195d732a2369251cfae5efb511f8c00 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 23 May 2009 18:27:35 +0000 Subject: [PATCH] * revert to use plain xml files (not gzipped) for history files --- .../filebot/ui/panel/list/ListPanel.java | 3 ++ .../filebot/ui/panel/rename/History.java | 33 ++----------------- .../ui/panel/rename/HistoryDialog.java | 6 ++-- .../ui/panel/rename/HistorySpooler.java | 2 +- 4 files changed, 9 insertions(+), 35 deletions(-) diff --git a/source/net/sourceforge/filebot/ui/panel/list/ListPanel.java b/source/net/sourceforge/filebot/ui/panel/list/ListPanel.java index 055c47be..eed93f09 100644 --- a/source/net/sourceforge/filebot/ui/panel/list/ListPanel.java +++ b/source/net/sourceforge/filebot/ui/panel/list/ListPanel.java @@ -92,6 +92,9 @@ public class ListPanel extends JComponent { public void actionPerformed(ActionEvent evt) { + // clear selection + list.getListComponent().clearSelection(); + int from = fromSpinnerModel.getNumber().intValue(); int to = toSpinnerModel.getNumber().intValue(); diff --git a/source/net/sourceforge/filebot/ui/panel/rename/History.java b/source/net/sourceforge/filebot/ui/panel/rename/History.java index 1ebf7995..abc198da 100644 --- a/source/net/sourceforge/filebot/ui/panel/rename/History.java +++ b/source/net/sourceforge/filebot/ui/panel/rename/History.java @@ -4,20 +4,13 @@ package net.sourceforge.filebot.ui.panel.rename; import static java.util.Collections.*; -import java.io.BufferedInputStream; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.List; import java.util.Map.Entry; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; @@ -198,14 +191,7 @@ class History { Marshaller marshaller = JAXBContext.newInstance(History.class).createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - // write gzipped xml - OutputStream out = new GZIPOutputStream(new FileOutputStream(file), 32 * 1024); - - try { - marshaller.marshal(history, out); - } finally { - out.close(); - } + marshaller.marshal(history, file); } catch (JAXBException e) { throw new IOException(e); } @@ -216,22 +202,7 @@ class History { try { Unmarshaller unmarshaller = JAXBContext.newInstance(History.class).createUnmarshaller(); - // GZIPInputStream or BufferedInputStream - InputStream in; - - try { - // read gzipped xml - in = new GZIPInputStream(new FileInputStream(file), 32 * 1024); - } catch (IOException e) { - // file is not gzipped, read uncompressed xml instead - in = new BufferedInputStream(new FileInputStream(file)); - } - - try { - return ((History) unmarshaller.unmarshal(in)); - } finally { - in.close(); - } + return ((History) unmarshaller.unmarshal(file)); } catch (JAXBException e) { throw new IOException(e); } diff --git a/source/net/sourceforge/filebot/ui/panel/rename/HistoryDialog.java b/source/net/sourceforge/filebot/ui/panel/rename/HistoryDialog.java index 92eafc28..381de540 100644 --- a/source/net/sourceforge/filebot/ui/panel/rename/HistoryDialog.java +++ b/source/net/sourceforge/filebot/ui/panel/rename/HistoryDialog.java @@ -548,7 +548,7 @@ class HistoryDialog extends JDialog { @Override protected boolean accept(List files) { - return FileUtilities.containsOnly(files, new ExtensionFileFilter("xml", "gz")); + return FileUtilities.containsOnly(files, new ExtensionFileFilter("xml")); } @@ -575,7 +575,7 @@ class HistoryDialog extends JDialog { @Override public String getFileFilterDescription() { - return "history files (.xml.gz)"; + return "history files (.xml)"; } }; @@ -596,7 +596,7 @@ class HistoryDialog extends JDialog { @Override public String getDefaultFileName() { - return "history.xml.gz"; + return "history.xml"; } }; diff --git a/source/net/sourceforge/filebot/ui/panel/rename/HistorySpooler.java b/source/net/sourceforge/filebot/ui/panel/rename/HistorySpooler.java index 210305de..1fd7d2f1 100644 --- a/source/net/sourceforge/filebot/ui/panel/rename/HistorySpooler.java +++ b/source/net/sourceforge/filebot/ui/panel/rename/HistorySpooler.java @@ -20,7 +20,7 @@ final class HistorySpooler { return instance; } - private final File file = new File("history.xml.gz"); + private final File file = new File("history.xml"); private final History sessionHistory = new History();