From 39745518210675adbd2ac1bf636286d4d5975605 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 26 Nov 2010 14:12:04 +0000 Subject: [PATCH] * fix subtitle drop target on Mac (didn't accept drops before) --- .../filebot/ui/panel/subtitle/SubtitleDropTarget.java | 8 +++++--- .../sourceforge/filebot/ui/transfer/FileTransferable.java | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDropTarget.java b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDropTarget.java index 5268d6d8..18f647ec 100644 --- a/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDropTarget.java +++ b/source/net/sourceforge/filebot/ui/panel/subtitle/SubtitleDropTarget.java @@ -184,12 +184,14 @@ abstract class SubtitleDropTarget extends JButton { @Override public void dragEnter(DropTargetDragEvent dtde) { - DropAction dropAction = DropAction.Cancel; + DropAction dropAction = DropAction.Download; try { dropAction = getDropAction(getFilesFromTransferable(dtde.getTransferable())); } catch (Exception e) { - // ignore + // just accept the drag if we can't access the transferable, + // because on some implementations we can't access transferable data before we accept the drag, + // but accepting or rejecting the drag depends on the files dragged } // update visual representation @@ -197,7 +199,7 @@ abstract class SubtitleDropTarget extends JButton { // accept or reject if (dropAction != DropAction.Cancel) { - dtde.acceptDrag(DnDConstants.ACTION_COPY); + dtde.acceptDrag(DnDConstants.ACTION_REFERENCE); } else { dtde.rejectDrag(); } diff --git a/source/net/sourceforge/filebot/ui/transfer/FileTransferable.java b/source/net/sourceforge/filebot/ui/transfer/FileTransferable.java index a45cfbf8..a0941c1f 100644 --- a/source/net/sourceforge/filebot/ui/transfer/FileTransferable.java +++ b/source/net/sourceforge/filebot/ui/transfer/FileTransferable.java @@ -134,6 +134,6 @@ public class FileTransferable implements Transferable { } // cannot get files from transferable - throw new UnsupportedFlavorException(DataFlavor.javaFileListFlavor); + throw new UnsupportedFlavorException(null); } }