{
DataFlavor uriListFlavor = new DataFlavor(
- "text/uri-list;class=java.lang.String");
+ "text/uri-list;class=java.lang.String"), urlFlavour = null;
+ try
+ {
+ urlFlavour = new DataFlavor(
+ "application/x-java-url; class=java.net.URL");
+ } catch (ClassNotFoundException cfe)
+ {
+ Cache.log.debug("Couldn't instantiate the URL dataflavor.", cfe);
+ }
+
+ if (urlFlavour != null && t.isDataFlavorSupported(urlFlavour))
+ {
+
+ try
+ {
+ java.net.URL url = (URL) t.getTransferData(urlFlavour);
+ // nb: java 8 osx bug https://bugs.openjdk.java.net/browse/JDK-8156099
+ // means url may be null.
+ if (url != null)
+ {
+ protocols.add(DataSourceType.URL);
+ files.add(url.toString());
+ Cache.log.debug("Drop handled as URL dataflavor "
+ + files.get(files.size() - 1));
+ return;
+ }
+ else
+ {
+ if (Platform.isAMac())
+ {
+ System.err.println(
+ "Please ignore plist error - occurs due to problem with java 8 on OSX");
+ }
+ ;
+ }
+ } catch (Throwable ex)
+ {
+ Cache.log.debug("URL drop handler failed.", ex);
+ }
+ }
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))
{
// Works on Windows and MacOSX
new DataFlavor("text/plain;class=java.lang.String"));
if (Cache.log.isDebugEnabled())
{
- Cache.log.debug("fallback returned " + data);
+ Cache.log.debug("Plain text drop content returned " + data);
}
}
while (protocols.size() < files.size())