From: tcofoegbu Date: Fri, 17 Apr 2015 09:34:35 +0000 (+0100) Subject: JAL-1698 bug fix to enable addition of a single structure to an already launched... X-Git-Tag: Jalview_2_9~66^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fbug%2FJAL-1698_Append-Structures;p=jalview.git JAL-1698 bug fix to enable addition of a single structure to an already launched structure viewer --- diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 3a54cc1..1197921 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -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) 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); diff --git a/src/jalview/ws/dbsources/PDBRestClient.java b/src/jalview/ws/dbsources/PDBRestClient.java index fd0c503..c5642a9 100644 --- a/src/jalview/ws/dbsources/PDBRestClient.java +++ b/src/jalview/ws/dbsources/PDBRestClient.java @@ -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;