JAL-3032 DND enabled; additional io changes for File vs. String
[jalview.git] / src / jalview / io / AppletFormatAdapter.java
index bc2465a..4c25634 100755 (executable)
@@ -174,7 +174,7 @@ public class AppletFormatAdapter
         if (isParseWithJMOL)
         {
           // needs a File option
-          alignFile = new JmolParser(inFile, sourceType);
+          alignFile = new JmolParser(selectedFile == null ? inFile : selectedFile, sourceType);
         }
         else
         {
@@ -421,15 +421,22 @@ public class AppletFormatAdapter
     return null;
   }
 
+
   /**
    * Determines the protocol (i.e DataSourceType.{FILE|PASTE|URL}) for the input
    * data
+   * 
+   * BH 2018 allows File or String, and can return RELATIVE_URL
    *
-   * @param data
+   * @param dataObject File or String
    * @return the protocol for the input data
    */
-  public static DataSourceType checkProtocol(String data)
+  public static DataSourceType checkProtocol(Object dataObject)
   {
+    if(dataObject instanceof File)
+      return DataSourceType.FILE;
+    
+    String data = dataObject.toString();
     DataSourceType protocol = DataSourceType.PASTE;
     String ft = data.toLowerCase().trim();
     if (ft.indexOf("http:") == 0 || ft.indexOf("https:") == 0