JAL-2780 JAL-2871 only look up current table view once
authorJim Procter <jprocter@issues.jalview.org>
Mon, 5 Feb 2018 16:38:48 +0000 (16:38 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 5 Feb 2018 16:38:48 +0000 (16:38 +0000)
src/jalview/gui/StructureChooser.java

index 217f653..452677e 100644 (file)
@@ -745,21 +745,24 @@ public class StructureChooser extends GStructureChooser
         FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
                 .getSelectedItem());
         String currentView = selectedFilterOpt.getView();
+        JTable restable = (currentView == VIEWS_FILTER) ? getResultTable()
+                : tbl_local_pdb;
+
         if (currentView == VIEWS_FILTER)
         {
-          int pdbIdColIndex = getResultTable().getColumn("PDB Id")
+          int pdbIdColIndex = restable.getColumn("PDB Id")
                   .getModelIndex();
-          int refSeqColIndex = getResultTable().getColumn("Ref Sequence")
+          int refSeqColIndex = restable.getColumn("Ref Sequence")
                   .getModelIndex();
-          int[] selectedRows = getResultTable().getSelectedRows();
+          int[] selectedRows = restable.getSelectedRows();
           PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
           int count = 0;
           List<SequenceI> selectedSeqsToView = new ArrayList<>();
           for (int row : selectedRows)
           {
-            String pdbIdStr = getResultTable()
+            String pdbIdStr = restable
                     .getValueAt(row, pdbIdColIndex).toString();
-            SequenceI selectedSeq = (SequenceI) getResultTable()
+            SequenceI selectedSeq = (SequenceI) restable
                     .getValueAt(row, refSeqColIndex);
             selectedSeqsToView.add(selectedSeq);
             PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);