From: Jim Procter Date: Thu, 26 May 2016 10:54:03 +0000 (+0100) Subject: JAL-1552 extra debug logging for dataflavor if drop has no data X-Git-Tag: Release_2_10_0~216^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8bcfd58a217316c956529258080b4a3b171fc14c;p=jalview.git JAL-1552 extra debug logging for dataflavor if drop has no data --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 0419b6f..3e3780a 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -5038,6 +5038,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, "text/uri-list;class=java.lang.String"); if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { + Cache.log.debug("Drop handled as javaFileListFlavor"); // Works on Windows and MacOSX evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); files = (java.util.List) t @@ -5045,14 +5046,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else if (t.isDataFlavorSupported(uriListFlavor)) { + Cache.log.debug("Drop handled as uriListFlavor"); // This is used by Unix drag system evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); String data = (String) t.getTransferData(uriListFlavor); if (data == null) { + Cache.log.debug("standard URIListFlavor (" + uriListFlavor + + ") doesn't resolve. trying others."); // try 'best' dataflavor data = (String) t.getTransferData(DataFlavor .selectBestTextFlavor(t.getTransferDataFlavors())); + Cache.log.debug("Dataflavor " + + DataFlavor.selectBestTextFlavor(t + .getTransferDataFlavors()) + " returned " + data); } files = new java.util.ArrayList(1); for (java.util.StringTokenizer st = new java.util.StringTokenizer( @@ -5078,6 +5085,24 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, files.add(file.toString()); } } + if (files.size() < 1) + { + Cache.log + .debug("Couldn't resolve drop data with 'best text'. Here are the supported flavors:"); + if (data == null && Cache.log.isDebugEnabled()) + { + for (DataFlavor fl : t.getTransferDataFlavors()) + { + Cache.log.debug("Supported transfer dataflavor: " + + fl.toString()); + Object df = t.getTransferData(fl); + if (df != null) + { + Cache.log.debug("Retrieves: " + df); + } + } + } + } } } catch (Exception e) {