diff --git a/build.xml b/build.xml
index e93bf33f..37f4370a 100644
--- a/build.xml
+++ b/build.xml
@@ -60,15 +60,9 @@
-
diff --git a/source/net/sourceforge/filebot/ListChangeSynchronizer.java b/source/net/sourceforge/filebot/ListChangeSynchronizer.java
new file mode 100644
index 00000000..9f7f6b56
--- /dev/null
+++ b/source/net/sourceforge/filebot/ListChangeSynchronizer.java
@@ -0,0 +1,51 @@
+
+package net.sourceforge.filebot;
+
+
+import java.util.List;
+
+import ca.odell.glazedlists.EventList;
+import ca.odell.glazedlists.event.ListEvent;
+import ca.odell.glazedlists.event.ListEventListener;
+
+
+//TODO: testcase, class doc
+public class ListChangeSynchronizer implements ListEventListener {
+
+ private final List target;
+
+
+ public ListChangeSynchronizer(EventList source, List target) {
+ this.target = target;
+ source.addListEventListener(this);
+ }
+
+
+ public void listChanged(ListEvent listChanges) {
+ EventList source = listChanges.getSourceList();
+
+ // update target list
+ while (listChanges.next()) {
+ int index = listChanges.getIndex();
+ int type = listChanges.getType();
+
+ switch (type) {
+ case ListEvent.INSERT:
+ target.add(index, source.get(index));
+ break;
+ case ListEvent.UPDATE:
+ target.set(index, source.get(index));
+ break;
+ case ListEvent.DELETE:
+ target.remove(index);
+ break;
+ }
+ }
+ }
+
+
+ public static ListChangeSynchronizer syncEventListToList(EventList source, List target) {
+ return new ListChangeSynchronizer(source, target);
+ }
+
+}
diff --git a/source/net/sourceforge/filebot/ui/AbstractSearchPanel.java b/source/net/sourceforge/filebot/ui/AbstractSearchPanel.java
index 3d020100..14a549b0 100644
--- a/source/net/sourceforge/filebot/ui/AbstractSearchPanel.java
+++ b/source/net/sourceforge/filebot/ui/AbstractSearchPanel.java
@@ -34,6 +34,7 @@ import net.sourceforge.tuned.ProgressIterator;
import net.sourceforge.tuned.ui.SelectButtonTextField;
import net.sourceforge.tuned.ui.SwingWorkerPropertyChangeAdapter;
import net.sourceforge.tuned.ui.TunedUtil;
+import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.swing.AutoCompleteSupport;
@@ -46,14 +47,13 @@ public abstract class AbstractSearchPanel extends Fi
private final SelectButtonTextField searchField;
- private final EventList searchHistory;
+ private final EventList searchHistory = new BasicEventList();
- public AbstractSearchPanel(String title, Icon icon, EventList searchHistory) {
+ @SuppressWarnings("unchecked")
+ public AbstractSearchPanel(String title, Icon icon) {
super(title, icon);
- this.searchHistory = searchHistory;
-
setLayout(new BorderLayout(10, 5));
searchField = new SelectButtonTextField();
@@ -84,6 +84,15 @@ public abstract class AbstractSearchPanel extends Fi
add(searchBox, BorderLayout.NORTH);
add(centerPanel, BorderLayout.CENTER);
+ /*
+ * TODO: fetchHistory
+ // no need to care about thread-safety, history-lists are only accessed from the EDT
+ CompositeList