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