From 89350c76ad3884aa1394952979998ea58902063c Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 4 Jul 2022 18:04:13 +0100 Subject: [PATCH] =?utf8?q?JAL-4034=20fix=20#3=20change=20uniprot=20ref=20fet?= =?utf8?q?ch=20dialog=20to=20a=20=E2=80=98warning=E2=80=99=20shown=20when=20?= =?utf8?q?many=20ids=20have=20to=20be=20retrieved?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- resources/lang/Messages.properties | 2 +- src/jalview/gui/StructureChooser.java | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index aed1125..dda5624 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -518,7 +518,7 @@ label.search_3dbeacons = Search 3D-Beacons label.find_models_from_3dbeacons = Search 3D-Beacons for 3D structures and models label.3dbeacons = 3D-Beacons label.fetch_references_for = Fetch database references for {0} sequences ? -label.fetch_references_for_3dbeacons = 3D Beacons needs Uniprot References. Fetch database references for {0} sequences ? +label.fetch_references_for_3dbeacons = 3D Beacons needs to fetch Uniprot References for {0} sequences. Do you want to continue ? label.reset_min_max_colours_to_defaults = Reset min and max colours to defaults from user preferences. label.align_structures_using_linked_alignment_views = Superpose structures using {0} selected alignment view(s) label.threshold_feature_display_by_score = Threshold the feature display by score. diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 5ea68fb..b32e435 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -35,7 +35,6 @@ import java.util.concurrent.Executors; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; -import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JTable; @@ -81,6 +80,11 @@ public class StructureChooser extends GStructureChooser { private static final String AUTOSUPERIMPOSE = "AUTOSUPERIMPOSE"; + /** + * warn user if need to fetch more than this many uniprot records at once + */ + private static final int THRESHOLD_WARN_UNIPROT_FETCH_NEEDED = 20; + private SequenceI selectedSequence; private SequenceI[] selectedSequences; @@ -197,6 +201,7 @@ public class StructureChooser extends GStructureChooser Executors.defaultThreadFactory().newThread(new Runnable() { + @Override public void run() { populateSeqsWithoutSourceDBRef(); @@ -339,6 +344,7 @@ public class StructureChooser extends GStructureChooser }; final Runnable revertview = new Runnable() { + @Override public void run() { if (lastSelected != null) @@ -347,7 +353,8 @@ public class StructureChooser extends GStructureChooser } }; }; - if (ignoreGui) + if (ignoreGui || seqsWithoutSourceDBRef + .size() < THRESHOLD_WARN_UNIPROT_FETCH_NEEDED) { Executors.defaultThreadFactory().newThread(discoverCanonicalDBrefs) .start(); @@ -866,6 +873,7 @@ public class StructureChooser extends GStructureChooser popup.add(viewUrl); SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { popup.show(getResultTable(), x, y); -- 1.7.10.2