From: Jim Procter Date: Wed, 5 Aug 2015 17:10:56 +0000 (+0100) Subject: JAL-1821 launch the structure view in a separate thread to avoid blocking the UI X-Git-Tag: Release_2_10_0~549^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=68415afec310b49d7abbf52de72e896eac29e3ba;p=jalview.git JAL-1821 launch the structure view in a separate thread to avoid blocking the UI --- diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index d5e4cbc..5e7ea48 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -783,31 +783,35 @@ public class StructureChooser extends GStructureChooser mainFrame.dispose(); } - private void launchStructureViewer(StructureSelectionManager ssm, - PDBEntry[] pdbEntriesToView, AlignmentPanel alignPanel, - SequenceI[] sequences) + private void launchStructureViewer(final StructureSelectionManager ssm, + final PDBEntry[] pdbEntriesToView, + final AlignmentPanel alignPanel, final SequenceI[] sequences) { - StructureViewer sViewer = new StructureViewer(ssm); - if (pdbEntriesToView.length > 1) + final StructureViewer sViewer = new StructureViewer(ssm); + new Thread(new Runnable() { - ArrayList seqsMap = new ArrayList(); - for (SequenceI seq : sequences) + public void run() { - seqsMap.add(new SequenceI[] - { seq }); + if (pdbEntriesToView.length > 1) + { + ArrayList seqsMap = new ArrayList(); + for (SequenceI seq : sequences) + { + seqsMap.add(new SequenceI[] + { seq }); + } + SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]); + sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel); + // sViewer.viewStructures(pdbEntriesToView, + // alignPanel.av.collateForPDB(pdbEntriesToView), + // alignPanel); + } + else + { + sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel); + } } - SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]); - sViewer.viewStructures(pdbEntriesToView, collatedSeqs, - alignPanel); - // sViewer.viewStructures(pdbEntriesToView, - // alignPanel.av.collateForPDB(pdbEntriesToView), - // alignPanel); - } - else - { - sViewer.viewStructures(pdbEntriesToView[0], sequences, - alignPanel); - } + }).start(); } /**