From 3cb2a66b67c4c55897a022768a1ee446f416fd01 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Mon, 11 Jul 2022 17:14:56 +0100 Subject: [PATCH] JAL-4034 Non-blocking 3D Beacons query after warning dialog --- src/jalview/gui/StructureChooser.java | 53 ++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 3f5f39c..a5fb2dd 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -357,29 +357,48 @@ public class StructureChooser extends GStructureChooser int threshold = Cache.getDefault("THRESHOLD_WARN_UNIPROT_FETCH", THRESHOLD_WARN_UNIPROT_FETCH_NEEDED); Console.debug("Using Uniprot fetch threshold of " + threshold); + boolean runThread = false; if (ignoreGui || seqsWithoutSourceDBRef.size() < threshold) { + runThread = true; + } + // need cancel and no to result in the discoverPDB action - mocked is + // 'cancel' TODO: mock should be OK + if (!runThread) + { + int answer = JvOptionPane.showOptionDialog(this, + + MessageManager.formatMessage( + "label.fetch_references_for_3dbeacons", + seqsWithoutSourceDBRef.size()), + + MessageManager.getString("label.3dbeacons"), + + JvOptionPane.YES_NO_OPTION, + + JvOptionPane.PLAIN_MESSAGE, + + null, + + new Object[] + { MessageManager.getString("action.ok"), + MessageManager.getString("action.cancel") }, + + MessageManager.getString("action.ok") + + ); + runThread = (answer == JvOptionPane.OK_OPTION); + } + if (runThread) + { Executors.defaultThreadFactory().newThread(discoverCanonicalDBrefs) .start(); return; } - // need cancel and no to result in the discoverPDB action - mocked is - // 'cancel' TODO: mock should be OK - JvOptionPane.newOptionDialog(this) - .setResponseHandler(JvOptionPane.OK_OPTION, - discoverCanonicalDBrefs) - .setResponseHandler(JvOptionPane.CANCEL_OPTION, revertview) - .setResponseHandler(JvOptionPane.NO_OPTION, revertview) - .showDialog( - MessageManager.formatMessage( - "label.fetch_references_for_3dbeacons", - seqsWithoutSourceDBRef.size()), - MessageManager.getString("label.3dbeacons"), - JvOptionPane.YES_NO_OPTION, JvOptionPane.PLAIN_MESSAGE, - null, new Object[] - { MessageManager.getString("action.ok"), - MessageManager.getString("action.cancel") }, - MessageManager.getString("action.ok")); + else + { + revertview.run(); + } } /** -- 1.7.10.2