* fix DnD for Mac and keep it working for Linux at the same time...
This commit is contained in:
parent
3220f1250b
commit
cfb06a5bac
|
@ -49,6 +49,7 @@ import net.sourceforge.filebot.cli.ArgumentBean;
|
|||
import net.sourceforge.filebot.cli.ArgumentProcessor;
|
||||
import net.sourceforge.filebot.cli.CmdlineOperations;
|
||||
import net.sourceforge.filebot.format.ExpressionFormat;
|
||||
import net.sourceforge.filebot.gio.GVFS;
|
||||
import net.sourceforge.filebot.media.MediaDetection;
|
||||
import net.sourceforge.filebot.ui.MainFrame;
|
||||
import net.sourceforge.filebot.ui.SinglePanelFrame;
|
||||
|
@ -159,6 +160,7 @@ public class Main {
|
|||
|
||||
// pre-load media.types (when loaded during DnD it will freeze the UI for a few hundred milliseconds)
|
||||
MediaTypes.getDefault();
|
||||
GVFS.isSupported();
|
||||
|
||||
// pre-load certain resources in the background
|
||||
warmupCachedResources();
|
||||
|
|
|
@ -40,7 +40,11 @@ public class GVFS {
|
|||
|
||||
|
||||
public static boolean isSupported() {
|
||||
return Platform.isLinux() || Platform.isFreeBSD();
|
||||
try {
|
||||
return Platform.isLinux() || Platform.isFreeBSD();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -99,6 +99,11 @@ public class FileTransferable implements Transferable {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<File> getFilesFromTransferable(Transferable tr) throws IOException, UnsupportedFlavorException {
|
||||
if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && !GVFS.isSupported()) {
|
||||
// file list flavor
|
||||
return (List<File>) tr.getTransferData(DataFlavor.javaFileListFlavor);
|
||||
}
|
||||
|
||||
if (tr.isDataFlavorSupported(FileTransferable.uriListFlavor)) {
|
||||
// file URI list flavor (Linux)
|
||||
Readable transferData = (Readable) tr.getTransferData(FileTransferable.uriListFlavor);
|
||||
|
@ -143,12 +148,10 @@ public class FileTransferable implements Transferable {
|
|||
}
|
||||
|
||||
return files;
|
||||
} else if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||
// file list flavor
|
||||
return (List<File>) tr.getTransferData(DataFlavor.javaFileListFlavor);
|
||||
}
|
||||
|
||||
// cannot get files from transferable
|
||||
throw new UnsupportedFlavorException(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue