'no sources selected' calls method on feature settings dialog to prompt user.
authorjprocter <Jim Procter>
Mon, 30 Apr 2007 15:36:20 +0000 (15:36 +0000)
committerjprocter <Jim Procter>
Mon, 30 Apr 2007 15:36:20 +0000 (15:36 +0000)
fixed never-ending das feature retrieval bug.

src/jalview/io/DasSequenceFeatureFetcher.java

index c8b5d3e..58ae580 100755 (executable)
@@ -172,6 +172,8 @@ public class DasSequenceFeatureFetcher
      {\r
        System.out.println("No DAS Sources active");\r
        af.setProgressBar("No DAS Sources Active", startTime);\r
+       cancelled = true;\r
+       fsettings.noDasSourceActive();\r
        return;\r
      }\r
 \r
@@ -249,7 +251,9 @@ public class DasSequenceFeatureFetcher
 \r
   void nextSequence(DasSource dasSource, SequenceI seq)\r
   {\r
-      DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(seq.getDBRef(),\r
+    if (cancelled)\r
+      return;\r
+    DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(seq.getDBRef(),\r
           new String[]\r
           {\r
         //  jalview.datamodel.DBRefSource.PDB,\r
@@ -263,11 +267,11 @@ public class DasSequenceFeatureFetcher
       if (uprefs != null)\r
         {\r
           // do any of these ids match the source's coordinate system ?\r
-          for (int j = 0; j < uprefs.length; j++)\r
+          for (int j = 0; !dasCoordSysFound && j < uprefs.length; j++)\r
           {\r
             DasCoordinateSystem cs[] = dasSource.getCoordinateSystem();\r
 \r
-            for(int csIndex=0; csIndex<cs.length; csIndex++)\r
+            for(int csIndex=0; csIndex<cs.length && !dasCoordSysFound; csIndex++)\r
             {\r
               if (cs.length > 0 && jalview.util.DBRefUtils\r
                   .isDasCoordinateSystem(cs[csIndex].getName(), uprefs[j]))\r
@@ -280,11 +284,10 @@ public class DasSequenceFeatureFetcher
                 System.out.println(seq.getName() + " " + (seq.getDatasetSequence() == null)\r
                                    + " " + dasSource.getUrl());\r
 \r
-                dasCoordSysFound = false;\r
+                dasCoordSysFound = true; // break's out of the loop\r
                 createFeatureFetcher(seq,\r
                                      dasSource,\r
                                      uprefs[j]);\r
-                break; // only do this for one reference - assume same source will send same features for all IDs\r
               }\r
               else\r
                 System.out.println("IGNORE " + cs[csIndex].getName());\r
@@ -474,6 +477,10 @@ public class DasSequenceFeatureFetcher
    */\r
   SequenceFeature newSequenceFeature(Map dasfeature, String nickname)\r
   {\r
+    if (dasfeature==null)\r
+    {\r
+      return null;\r
+    }\r
     try\r
     {\r
       /**\r