* minor refactoring

This commit is contained in:
Reinhard Pointner 2009-08-02 17:33:48 +00:00
parent f5e8e0363b
commit 118e0368ae
2 changed files with 5 additions and 6 deletions

View File

@ -151,7 +151,7 @@ class NamesListTransferablePolicy extends FileTransferablePolicy {
try {
while (scanner.hasNext()) {
values.add(scanner.next().getKey().getName());
values.add(new AbstractFile(scanner.next().getKey().getName(), -1));
}
} finally {
scanner.close();

View File

@ -6,7 +6,6 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -33,7 +32,7 @@ public class RenameModel extends MatchModel<Object, File> {
private final FormattedFutureEventList names = new FormattedFutureEventList();
private final Map<Class<?>, MatchFormatter> formatters = new HashMap<Class<?>, MatchFormatter>();
private final Map<Object, MatchFormatter> formatters = new LinkedHashMap<Object, MatchFormatter>();
private final MatchFormatter defaultFormatter = new MatchFormatter() {
@ -119,11 +118,11 @@ public class RenameModel extends MatchModel<Object, File> {
}
public void useFormatter(Class<?> type, MatchFormatter formatter) {
public void useFormatter(Object key, MatchFormatter formatter) {
if (formatter != null) {
formatters.put(type, formatter);
formatters.put(key, formatter);
} else {
formatters.remove(type);
formatters.remove(key);
}
// reformat matches