+ added special handling to enable LINK-Drop as "Do-not-resolve-Folders-to-Files-Drop"

This commit is contained in:
Reinhard Pointner 2012-10-22 09:01:50 +00:00
parent c4082db18d
commit 89aa1c5b91
1 changed files with 21 additions and 1 deletions

View File

@ -3,7 +3,9 @@ package net.sourceforge.filebot.ui.rename;
import static java.util.Arrays.*;
import static net.sourceforge.filebot.ui.transfer.FileTransferable.*;
import java.awt.datatransfer.Transferable;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedList;
@ -36,8 +38,26 @@ class FilesListTransferablePolicy extends FileTransferablePolicy {
}
@Override
public void handleTransferable(Transferable tr, TransferAction action) throws Exception {
if (action == TransferAction.LINK) {
// special handling for do-not-resolve-folders-drop
clear();
load(getFilesFromTransferable(tr), false);
} else {
// load files recursively by default
super.handleTransferable(tr, action);
}
}
@Override
protected void load(List<File> files) {
load(files, true);
}
protected void load(List<File> files, boolean recursive) {
List<File> entries = new ArrayList<File>();
LinkedList<File> queue = new LinkedList<File>(files);
@ -47,7 +67,7 @@ class FilesListTransferablePolicy extends FileTransferablePolicy {
if (f.isHidden())
continue;
if (f.isFile() || MediaDetection.isDiskFolder(f)) {
if (!recursive || f.isFile() || MediaDetection.isDiskFolder(f)) {
entries.add(f);
} else {
queue.addAll(0, asList(f.listFiles()));