X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fgui%2FDesktop.java;h=8f0457608d8ada0256bcabfc465ec43909da989a;hb=a0ea87b8523735d447c7aa59db5589b5ed2f8625;hp=e592abf6c6c662314928ad4b1e82ef64ec7b66d2;hpb=26d0f2d76f2377947eed04c2f64d94587127c0c3;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index e592abf..8f04576 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -532,7 +532,7 @@ public class Desktop extends jalview.jbgui.GDesktop public void getIdentifiersOrgData() { // Thread off the identifiers fetcher - addDialogThread(new Runnable() + new Thread(new Runnable() { @Override public void run() @@ -549,7 +549,8 @@ public class Desktop extends jalview.jbgui.GDesktop + e.getMessage()); } } - }); + }).start(); + ; } @Override @@ -3297,6 +3298,21 @@ public class Desktop extends jalview.jbgui.GDesktop return groovyConsole; } + /** + * handles the payload of a drag and drop event. + * + * TODO refactor to desktop utilities class + * + * @param files + * - Data source strings extracted from the drop event + * @param protocols + * - protocol for each data source extracted from the drop event + * @param evt + * - the drop event + * @param t + * - the payload from the drop event + * @throws Exception + */ public static void transferFromDropTarget(List files, List protocols, DropTargetDropEvent evt, Transferable t) throws Exception @@ -3413,32 +3429,8 @@ public class Desktop extends jalview.jbgui.GDesktop files.add(file.toString()); } } - if (Platform.isWindows()) - { - Cache.log - .debug("Scanning dropped content for Windows Link Files"); - - // resolve any .lnk files in the file drop - for (int f = 0; f < files.size(); f++) - { - if (protocols.get(f).equals(DataSourceType.FILE)) - { - File lf = new File(files.get(f)); - if (WindowsShortcut.isPotentialValidLink(lf)) - { - // process link file to get a URL - Cache.log.debug("Found potential link file: " + lf); - WindowsShortcut wscfile = new WindowsShortcut(lf); - String fullname = wscfile.getRealFilename(); - protocols.set(f, FormatAdapter.checkProtocol(fullname)); - files.set(f, fullname); - Cache.log.debug("Parsed real filename " + fullname - + " to extract protocol: " + protocols.get(f)); - } - } - } - } } + if (Cache.log.isDebugEnabled()) { if (data == null || !added) @@ -3472,6 +3464,37 @@ public class Desktop extends jalview.jbgui.GDesktop } } } + if (Platform.isWindows()) + + { + Cache.log.debug("Scanning dropped content for Windows Link Files"); + + // resolve any .lnk files in the file drop + for (int f = 0; f < files.size(); f++) + { + String source = files.get(f).toLowerCase(); + if (protocols.get(f).equals(DataSourceType.FILE) + && (source.endsWith(".lnk") || source.endsWith(".url") + || source.endsWith(".site"))) + { + try { + File lf = new File(files.get(f)); + // process link file to get a URL + Cache.log.debug("Found potential link file: " + lf); + WindowsShortcut wscfile = new WindowsShortcut(lf); + String fullname = wscfile.getRealFilename(); + protocols.set(f, FormatAdapter.checkProtocol(fullname)); + files.set(f, fullname); + Cache.log.debug("Parsed real filename " + fullname + + " to extract protocol: " + protocols.get(f)); + } + catch (Exception ex) + { + Cache.log.error("Couldn't parse "+files.get(f)+" as a link file.",ex); + } + } + } + } } /**