* complete dnd support for ubuntu :D
This commit is contained in:
parent
036eefc5b9
commit
9053df6316
|
@ -53,7 +53,7 @@ public class FileTransferable implements Transferable {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
sb.append(file.toURI());
|
sb.append("file:///" + file.toURI().getPath());
|
||||||
sb.append("\r\n");
|
sb.append("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public abstract class FileTransferablePolicy extends TransferablePolicy {
|
||||||
if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||||
return (List<File>) tr.getTransferData(DataFlavor.javaFileListFlavor);
|
return (List<File>) tr.getTransferData(DataFlavor.javaFileListFlavor);
|
||||||
} else if (tr.isDataFlavorSupported(FileBotUtil.uriListFlavor)) {
|
} else if (tr.isDataFlavorSupported(FileBotUtil.uriListFlavor)) {
|
||||||
String transferString = (String) tr.getTransferData(DataFlavor.stringFlavor);
|
String transferString = (String) tr.getTransferData(FileBotUtil.uriListFlavor);
|
||||||
|
|
||||||
String lines[] = transferString.split("\r?\n");
|
String lines[] = transferString.split("\r?\n");
|
||||||
ArrayList<File> files = new ArrayList<File>(lines.length);
|
ArrayList<File> files = new ArrayList<File>(lines.length);
|
||||||
|
@ -57,9 +57,11 @@ public abstract class FileTransferablePolicy extends TransferablePolicy {
|
||||||
files.add(file);
|
files.add(file);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// URISyntaxException, IllegalArgumentException
|
// URISyntaxException, IllegalArgumentException
|
||||||
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.WARNING, "Invalid file url: " + line, e);
|
Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).log(Level.WARNING, "Invalid file url: " + line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return files;
|
||||||
}
|
}
|
||||||
} catch (UnsupportedFlavorException e) {
|
} catch (UnsupportedFlavorException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue