From: James Procter Date: Thu, 6 Jul 2023 16:35:17 +0000 (+0100) Subject: JAL-4217 catch case when the structure viewer doesn't get added to the desktop window... X-Git-Tag: Release_2_11_4_0~248 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b8719513e0b9b89a731d462cc6d1930e2dc5bb48;p=jalview.git JAL-4217 catch case when the structure viewer doesn't get added to the desktop window (possible knock on for flatlaf JAL-3416) --- diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 36d6434..12ff20b 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1078,7 +1078,36 @@ public class Desktop extends jalview.jbgui.GDesktop setKeyBindings(frame); - desktop.add(frame); + // Since the latest FlatLaf patch, we occasionally have problems showing structureViewer frames... + int tries=3; + boolean shown=false; + Exception last=null; + do + { + try + { + desktop.add(frame); + shown=true; + } catch (IllegalArgumentException iaex) + { + last=iaex; + tries--; + jalview.bin.Console.info( + "Squashed IllegalArgument Exception (" + tries + " left) for "+frame.getTitle(), + iaex); + try + { + Thread.sleep(5); + } catch (InterruptedException iex) + { + } + ; + } + } while (!shown && tries > 0); + if (!shown) + { + jalview.bin.Console.error("Serious Problem whilst showing window "+frame.getTitle(),last); + } windowMenu.add(menuItem);