JAL-1698 bug fix to enable addition of a single structure to an already launched... bug/JAL-1698_Append-Structures
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 17 Apr 2015 09:34:35 +0000 (10:34 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 17 Apr 2015 09:34:35 +0000 (10:34 +0100)
src/jalview/gui/StructureChooser.java
src/jalview/ws/dbsources/PDBRestClient.java

index 3a54cc1..1197921 100644 (file)
@@ -40,7 +40,6 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.Vector;
 
 import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
@@ -205,7 +204,7 @@ public class StructureChooser extends GStructureChooser
 
     if (seq.getPDBId() != null)
     {
-      for (PDBEntry entry : (Vector<PDBEntry>) seq.getPDBId())
+      for (PDBEntry entry : seq.getPDBId())
       {
         queryBuilder.append("text:").append(entry.getId()).append(" OR ");
       }
@@ -513,14 +512,29 @@ public class StructureChooser extends GStructureChooser
         pdbEntry.setType("PDB");
         pdbEntriesToView[count++] = pdbEntry;
       }
-      new StructureViewer(ap.getStructureSelectionManager())
-              .viewStructures(ap, pdbEntriesToView,
-                      ap.av.collateForPDB(pdbEntriesToView));
+
+      StructureViewer sViewer = new StructureViewer(
+              ap.getStructureSelectionManager());
+      if (pdbEntriesToView.length > 1)
+      {
+        sViewer.viewStructures(ap, pdbEntriesToView,
+                ap.av.collateForPDB(pdbEntriesToView));
+      }
+      else
+      {
+        sViewer.viewStructures(pdbEntriesToView[0], selectedSequences,
+                null, ap);
+      }
+
     }
     else if (currentView == VIEWS_ENTER_ID)
     {
-      selectedSequence = ((AssociateSeqOptions) idInputAssSeqPanel
+      SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
               .getCmb_assSeq().getSelectedItem()).getSequence();
+      if (userSelectedSeq != null)
+      {
+        selectedSequence = userSelectedSeq;
+      }
       PDBEntry pdbEntry = new PDBEntry();
       pdbEntry.setId(txt_search.getText());
       pdbEntry.setType("PDB");
@@ -533,8 +547,14 @@ public class StructureChooser extends GStructureChooser
     }
     else if (currentView == VIEWS_FROM_FILE)
     {
-      selectedSequence = ((AssociateSeqOptions) fileChooserAssSeqPanel
+      SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
               .getCmb_assSeq().getSelectedItem()).getSequence();
+      if (userSelectedSeq != null)
+      {
+        selectedSequence = userSelectedSeq;
+      }
+      System.out.println(">>>>>>>>>>>>> Selected file >>>>>>>>>>>>>>> "
+              + selectedPdbFileName);
       new AssociatePdbFileWithSeq().associatePdbWithSeq(
               selectedPdbFileName, jalview.io.AppletFormatAdapter.FILE,
               selectedSequence, true, Desktop.instance);
index fd0c503..c5642a9 100644 (file)
@@ -31,7 +31,7 @@ import com.sun.jersey.api.json.JSONConfiguration;
  */
 public class PDBRestClient
 {
-  private static String PDB_SEARCH_ENDPOINT = "http://wwwdev.ebi.ac.uk/pdbe/search/pdb/select?";
+  private static String PDB_SEARCH_ENDPOINT = "http://www.ebi.ac.uk/pdbe/search/pdb/select?";
 
   private static int DEFAULT_RESPONSE_SIZE = 200;