From 89aa1c5b919fd8dd9406061bdf5d50eb14383c82 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 22 Oct 2012 09:01:50 +0000 Subject: [PATCH] + added special handling to enable LINK-Drop as "Do-not-resolve-Folders-to-Files-Drop" --- .../rename/FilesListTransferablePolicy.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/source/net/sourceforge/filebot/ui/rename/FilesListTransferablePolicy.java b/source/net/sourceforge/filebot/ui/rename/FilesListTransferablePolicy.java index 5fa3a89c..852ed2f7 100644 --- a/source/net/sourceforge/filebot/ui/rename/FilesListTransferablePolicy.java +++ b/source/net/sourceforge/filebot/ui/rename/FilesListTransferablePolicy.java @@ -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 files) { + load(files, true); + } + + + protected void load(List files, boolean recursive) { List entries = new ArrayList(); LinkedList queue = new LinkedList(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()));