+ Transferable tr = dtde.getTransferable();
+ DataFlavor[] flavors = tr.getTransferDataFlavors();
+ for (int i = 0; i < flavors.length; i++)
+ {
+ if (flavors[i].isFlavorJavaFileListType())
+ {
+ dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+ Object ob = tr.getTransferData(flavors[i]);
+ if (ob instanceof List)
+ {
+ List list = (List) ob;
+ for (int j = 0; j < list.size(); j++)
+ {
+ Object o = list.get(j);
+
+ if (dtde.getSource() instanceof DropTarget)
+ {
+ DropTarget dt = (DropTarget) dtde.getSource();
+ Component c = dt.getComponent();
+ if (c instanceof VARNAPanel)
+ {
+ String path = o.toString();
+ VARNAPanel varnaPanel = (VARNAPanel) c;
+ try
+ {
+ FullBackup bck = VARNAPanel.importSession(path);
+ _rnaList.add(bck.config, bck.rna, bck.name, true);
+ } catch (ExceptionLoadingFailed e3)
+ {
+ int mn = 1;
+ Collection<RNA> mdls = fr.orsay.lri.varna.factories.RNAFactory
+ .loadSecStr(path);
+ for (RNA r : mdls)
+ {
+ r.drawRNA(varnaPanel.getConfig());
+ String name = r.getName();
+ if (name.equals(""))
+ {
+ name = path.substring(
+ path.lastIndexOf(File.separatorChar) + 1);
+ }
+ if (mdls.size() > 1)
+ {
+ name += " (Model " + mn++ + ")";
+ }
+ _rnaList.add(varnaPanel.getConfig().clone(), r, name,
+ true);
+ // BH 2018 SwingJS clone of varnaPanel or its config will
+ // be the object itself, not a clone
+ }
+ }
+ }
+ }
+ }
+ }
+ // If we made it this far, everything worked.
+ dtde.dropComplete(true);
+ return;
+ }
+ }
+ // Hmm, the user must not have dropped a file list
+ dtde.rejectDrop();