* fix dnd on mac (and possibly linux)

This commit is contained in:
Reinhard Pointner 2011-12-09 05:37:03 +00:00
parent d982c0a697
commit c2bfedd978
2 changed files with 60 additions and 57 deletions

View File

@ -19,9 +19,12 @@ public abstract class FileTransferablePolicy extends TransferablePolicy {
try {
List<File> files = getFilesFromTransferable(tr);
if (!containsOnly(files, TEMPORARY)) {
return accept(getFilesFromTransferable(tr));
// ignore temporary files (may not work on all platforms since the DnD data may not be accessible during the drag)
if (files != null && files.size() > 0 && containsOnly(files, TEMPORARY)) {
return false;
}
return accept(files);
} catch (UnsupportedFlavorException e) {
// no file list flavor
}

View File

@ -489,12 +489,12 @@ public final class FileUtilities {
public static final FileFilter TEMPORARY = new FileFilter() {
private final File TEMP_DIR = new File(System.getProperty("java.io.tmpdir"));
private final String tmpdir = System.getProperty("java.io.tmpdir");
@Override
public boolean accept(File file) {
return file.getAbsolutePath().startsWith(TEMP_DIR.getAbsolutePath());
return file.getAbsolutePath().startsWith(tmpdir);
}
};