mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-02 08:25:02 -04:00
* minor refactoring
This commit is contained in:
parent
2a291d57c0
commit
7768d2e905
@ -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> I newProxy(Class<I> type, I object, AccessControlContext context) {
|
||||
public static <I> I newProxy(Class<I> 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));
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,7 +88,9 @@ public abstract class FileTransferablePolicy extends TransferablePolicy {
|
||||
protected abstract void load(List<File> files) throws IOException;
|
||||
|
||||
|
||||
protected abstract void clear();
|
||||
protected void clear() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
public String getFileFilterDescription() {
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user