- public static void transferFromDropTarget(List<Object> files, List<DataSourceType> protocols, DropTargetDropEvent evt,
- Transferable t) throws Exception {
-
- DataFlavor uriListFlavor = new DataFlavor("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);
+ @SuppressWarnings("unchecked")
+ public static void transferFromDropTarget(List<Object> files,
+ List<DataSourceType> protocols, DropTargetDropEvent evt,
+ Transferable t) throws Exception
+ {
+
+ // BH 2018 changed List<String> to List<Object> to allow for File from
+ // SwingJS
+
+ // DataFlavor[] flavors = t.getTransferDataFlavors();
+ // for (int i = 0; i < flavors.length; i++) {
+ // if (flavors[i].isFlavorJavaFileListType()) {
+ // evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+ // List<File> list = (List<File>) t.getTransferData(flavors[i]);
+ // for (int j = 0; j < list.size(); j++) {
+ // File file = (File) list.get(j);
+ // byte[] data = getDroppedFileBytes(file);
+ // fileName.setText(file.getName() + " - " + data.length + " " +
+ // evt.getLocation());
+ // JTextArea target = (JTextArea) ((DropTarget)
+ // evt.getSource()).getComponent();
+ // target.setText(new String(data));
+ // }
+ // dtde.dropComplete(true);
+ // return;
+ // }
+ //
+
+ DataFlavor uriListFlavor = new DataFlavor(
+ "text/uri-list;class=java.lang.String"), urlFlavour = null;
+ try
+ {
+ urlFlavour = new DataFlavor(
+ "application/x-java-url; class=java.net.URL");
+ } catch (ClassNotFoundException cfe)
+ {
+ jalview.bin.Console.debug("Couldn't instantiate the URL dataflavor.",
+ cfe);