* fix subtitle drop target on Mac (didn't accept drops before)
This commit is contained in:
parent
051c34c98d
commit
3974551821
|
@ -184,12 +184,14 @@ abstract class SubtitleDropTarget extends JButton {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dragEnter(DropTargetDragEvent dtde) {
|
public void dragEnter(DropTargetDragEvent dtde) {
|
||||||
DropAction dropAction = DropAction.Cancel;
|
DropAction dropAction = DropAction.Download;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dropAction = getDropAction(getFilesFromTransferable(dtde.getTransferable()));
|
dropAction = getDropAction(getFilesFromTransferable(dtde.getTransferable()));
|
||||||
} catch (Exception e) {
|
} 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
|
// update visual representation
|
||||||
|
@ -197,7 +199,7 @@ abstract class SubtitleDropTarget extends JButton {
|
||||||
|
|
||||||
// accept or reject
|
// accept or reject
|
||||||
if (dropAction != DropAction.Cancel) {
|
if (dropAction != DropAction.Cancel) {
|
||||||
dtde.acceptDrag(DnDConstants.ACTION_COPY);
|
dtde.acceptDrag(DnDConstants.ACTION_REFERENCE);
|
||||||
} else {
|
} else {
|
||||||
dtde.rejectDrag();
|
dtde.rejectDrag();
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,6 @@ public class FileTransferable implements Transferable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// cannot get files from transferable
|
// cannot get files from transferable
|
||||||
throw new UnsupportedFlavorException(DataFlavor.javaFileListFlavor);
|
throw new UnsupportedFlavorException(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue