* minor refactoring

This commit is contained in:
Reinhard Pointner 2009-07-05 19:39:51 +00:00
parent 2a291d57c0
commit 7768d2e905
4 changed files with 12 additions and 8 deletions

View File

@ -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));
}
}

View File

@ -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();
}
}

View File

@ -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() {

View File

@ -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());