From 7768d2e9055355976f709c9ebff9d52b3468af4b Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 5 Jul 2009 19:39:51 +0000 Subject: [PATCH] * minor refactoring --- .../sourceforge/filebot/format/PrivilegedInvocation.java | 6 +++--- .../filebot/similarity/NameSimilarityMetric.java | 3 ++- .../filebot/ui/transfer/FileTransferablePolicy.java | 4 +++- .../filebot/ui/transfer/TransferablePolicy.java | 7 ++++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/source/net/sourceforge/filebot/format/PrivilegedInvocation.java b/source/net/sourceforge/filebot/format/PrivilegedInvocation.java index 01120add..2e46fef4 100644 --- a/source/net/sourceforge/filebot/format/PrivilegedInvocation.java +++ b/source/net/sourceforge/filebot/format/PrivilegedInvocation.java @@ -12,7 +12,7 @@ import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; -public class PrivilegedInvocation implements InvocationHandler { +public final class PrivilegedInvocation implements InvocationHandler { private final Object object; private final AccessControlContext context; @@ -49,11 +49,11 @@ public class PrivilegedInvocation implements InvocationHandler { } - public static I newProxy(Class type, I object, AccessControlContext context) { + public static I newProxy(Class interfaceClass, I object, AccessControlContext context) { InvocationHandler invocationHandler = new PrivilegedInvocation(object, context); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); // create dynamic invocation proxy - return type.cast(Proxy.newProxyInstance(classLoader, new Class[] { type }, invocationHandler)); + return interfaceClass.cast(Proxy.newProxyInstance(classLoader, new Class[] { interfaceClass }, invocationHandler)); } } diff --git a/source/net/sourceforge/filebot/similarity/NameSimilarityMetric.java b/source/net/sourceforge/filebot/similarity/NameSimilarityMetric.java index 499f85f0..8a9a0567 100644 --- a/source/net/sourceforge/filebot/similarity/NameSimilarityMetric.java +++ b/source/net/sourceforge/filebot/similarity/NameSimilarityMetric.java @@ -14,7 +14,7 @@ public class NameSimilarityMetric implements SimilarityMetric { public NameSimilarityMetric() { - // QGramsDistance with a word tokenizer seems to work best for similarity of names + // QGramsDistance with a QGram tokenizer seems to work best for similarity of names metric = new QGramsDistance(new TokeniserQGram3()); } @@ -53,4 +53,5 @@ public class NameSimilarityMetric implements SimilarityMetric { public String toString() { return getClass().getName(); } + } diff --git a/source/net/sourceforge/filebot/ui/transfer/FileTransferablePolicy.java b/source/net/sourceforge/filebot/ui/transfer/FileTransferablePolicy.java index 032b75b8..64c82f47 100644 --- a/source/net/sourceforge/filebot/ui/transfer/FileTransferablePolicy.java +++ b/source/net/sourceforge/filebot/ui/transfer/FileTransferablePolicy.java @@ -88,7 +88,9 @@ public abstract class FileTransferablePolicy extends TransferablePolicy { protected abstract void load(List files) throws IOException; - protected abstract void clear(); + protected void clear() { + // do nothing + } public String getFileFilterDescription() { diff --git a/source/net/sourceforge/filebot/ui/transfer/TransferablePolicy.java b/source/net/sourceforge/filebot/ui/transfer/TransferablePolicy.java index 408bc3ff..b55820fc 100644 --- a/source/net/sourceforge/filebot/ui/transfer/TransferablePolicy.java +++ b/source/net/sourceforge/filebot/ui/transfer/TransferablePolicy.java @@ -20,8 +20,9 @@ public abstract class TransferablePolicy { public boolean canImport(TransferSupport support) { - if (support.isDrop()) + if (support.isDrop()) { support.setShowDropLocation(false); + } try { return accept(support.getTransferable()); @@ -63,7 +64,7 @@ public abstract class TransferablePolicy { return TransferAction.PUT; } - + public static enum TransferAction { PUT(TransferHandler.MOVE), ADD(TransferHandler.COPY), @@ -71,7 +72,7 @@ public abstract class TransferablePolicy { private final int dndConstant; - + private TransferAction(int dndConstant) { this.dndConstant = dndConstant; }