From: Jim Procter Date: Fri, 6 Jul 2018 13:32:07 +0000 (+0100) Subject: JAL-3048 internalDialog with dialogRunner X-Git-Tag: Release_2_11_4_0~45^2~18^2~568 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=406e7b1a013740e38221de3a0621232aa229093e;p=jalview.git JAL-3048 internalDialog with dialogRunner --- diff --git a/src/jalview/gui/JvOptionPane.java b/src/jalview/gui/JvOptionPane.java index 89899e2..f0bd800 100644 --- a/src/jalview/gui/JvOptionPane.java +++ b/src/jalview/gui/JvOptionPane.java @@ -768,6 +768,20 @@ public class JvOptionPane extends JOptionPane { runner.firstRun((int) getMockResponse()); } + // two uses: + // + // TODO + // + // 1) AlignViewport for openLinkedAlignment + // + // Show a dialog with the option to open and link (cDNA <-> protein) as a + // new + // alignment, either as a standalone alignment or in a split frame. Returns + // true if the new alignment was opened, false if not, because the user + // declined the offer. + // + // 2) UserDefinedColors warning about saving over a name already defined + // Component parent; /** * @j2sNative parent = this; diff --git a/src/jalview/util/dialogrunner/DialogRunner.java b/src/jalview/util/dialogrunner/DialogRunner.java index 9f23832..fa98869 100644 --- a/src/jalview/util/dialogrunner/DialogRunner.java +++ b/src/jalview/util/dialogrunner/DialogRunner.java @@ -193,7 +193,8 @@ public class DialogRunner implements DialogRunnerI return; } responses.add(response); - List laction = callbacks.get(response); + + List laction = response.isNull() ? null : callbacks.get(response); if (laction == null) { diff --git a/src/jalview/util/dialogrunner/Response.java b/src/jalview/util/dialogrunner/Response.java index 15df8f8..3c771b8 100644 --- a/src/jalview/util/dialogrunner/Response.java +++ b/src/jalview/util/dialogrunner/Response.java @@ -112,4 +112,13 @@ public class Response } return "Unconfigured response."; } + + /** + * null response - triggers the default response + * @return + */ + public boolean isNull() + { + return (type==2 && objresp==null) || (type==1 && (stringresp==null || stringresp.equals(""))); + } } \ No newline at end of file