From 74b0004b3f12d875261905cbc501ac40b547091f Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 5 Nov 2021 12:45:13 +0000 Subject: [PATCH] JAL-3875 fully reset filter combo-box when fetch 3d-beacons button is pressed, and ensure first 3d-beacons option selected when structures are discovered even when cached structures are present. --- src/jalview/gui/StructureChooser.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index e400b51..ce57373 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -191,7 +191,7 @@ public class StructureChooser extends GStructureChooser @Override public void actionPerformed(ActionEvent e) { - promptForTDBFetch(); + promptForTDBFetch(false); } }); @@ -242,7 +242,11 @@ public class StructureChooser extends GStructureChooser updateCurrentView(); } - private void promptForTDBFetch() + /** + * raises dialog for Uniprot fetch followed by 3D beacons search + * @param ignoreGui - when true, don't ask, just fetch + */ + public void promptForTDBFetch(boolean ignoreGui) { final long progressId = System.currentTimeMillis(); @@ -260,6 +264,9 @@ public class StructureChooser extends GStructureChooser // redo initial discovery - this time with 3d beacons // Executors. previousWantedFields=null; + lastSelected=(FilterOption) cmb_filterOption.getSelectedItem(); + cmb_filterOption.setSelectedItem(null); + cachedPDBExists=false; // reset to initial initialStructureDiscovery(); if (!isStructuresDiscovered()) { @@ -267,6 +274,7 @@ public class StructureChooser extends GStructureChooser btn_queryTDB.setToolTipText(MessageManager.getString("status.no_structures_discovered_from_3d_beacons")); btn_queryTDB.setEnabled(false); } else { + cmb_filterOption.setSelectedIndex(0); // select 'best' btn_queryTDB.setVisible(false); progressBar.setProgressBar(null, progressId); } @@ -322,8 +330,13 @@ public class StructureChooser extends GStructureChooser } }; }; + if (ignoreGui) + { + Executors.defaultThreadFactory().newThread(discoverCanonicalDBrefs).start(); + return; + } // need cancel and no to result in the discoverPDB action - mocked is - // 'cancel' + // 'cancel' TODO: mock should be OK JvOptionPane.newOptionDialog(this) .setResponseHandler(JvOptionPane.OK_OPTION, discoverCanonicalDBrefs) -- 1.7.10.2