From 0d69df1fcdf53cd75eae383f8dcf62ea211edce6 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 19 Feb 2020 15:03:44 +0000 Subject: [PATCH] JAL-3187 JAL-2764 close feature settings when parent align frame is closed (need to check feature settings is open before closing it :) ) --- src/jalview/gui/AlignFrame.java | 6 +++++- src/jalview/gui/Desktop.java | 13 +++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 0297a74..de82fd8 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1479,9 +1479,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, closeView(alignPanel); } } - if (closeAllTabs) { + if (featureSettings != null && featureSettings.isOpen()) + { + featureSettings.close(); + featureSettings = null; + } /* * this will raise an INTERNAL_FRAME_CLOSED event and this method will * be called recursively, with the frame now in 'closed' state diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index ed9ed50..1b8dda7 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1924,7 +1924,10 @@ public class Desktop extends jalview.jbgui.GDesktop } // FIXME: ideally should use UI interface API - FeatureSettings viewFeatureSettings = af.featureSettings; + FeatureSettings viewFeatureSettings = (af.featureSettings != null + && af.featureSettings.isOpen()) + ? af.featureSettings + : null; Rectangle fsBounds = af.getFeatureSettingsGeometry(); for (int i = 0; i < size; i++) { @@ -1935,9 +1938,10 @@ public class Desktop extends jalview.jbgui.GDesktop // transfer reference for existing feature settings to new alignFrame if (ap == af.alignPanel) { - newaf.featureSettings = (viewFeatureSettings.fr.ap == ap) - ? viewFeatureSettings - : null; + if (viewFeatureSettings != null && viewFeatureSettings.fr.ap == ap) + { + newaf.featureSettings = viewFeatureSettings; + } newaf.setFeatureSettingsGeometry(fsBounds); } @@ -1966,6 +1970,7 @@ public class Desktop extends jalview.jbgui.GDesktop } } + af.featureSettings = null; af.alignPanels.clear(); af.closeMenuItem_actionPerformed(true); -- 1.7.10.2