X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAppVarna.java;h=5c3785a3d6b050bec34250482770efd615f54aaa;hb=6e79eb7f3978f7e4ab11b7e2aa334a6e9b739996;hp=4fe9ac2139d4a41bf3446fa6e735cd22dd60683e;hpb=7ab5d6b0ba5fec1ea4a4239e79c476d841622485;p=jalview.git diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index 4fe9ac2..5c3785a 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -20,17 +20,6 @@ */ package jalview.gui; -import jalview.bin.Cache; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.structure.SecondaryStructureListener; -import jalview.structure.SelectionListener; -import jalview.structure.SelectionSource; -import jalview.structure.StructureSelectionManager; -import jalview.structure.VamsasSource; -import jalview.util.ShiftList; - import java.awt.BorderLayout; import java.awt.Color; import java.util.ArrayList; @@ -41,10 +30,8 @@ import java.util.regex.Pattern; import javax.swing.JInternalFrame; import javax.swing.JSplitPane; - -import jalview.bin.Cache; -import jalview.util.MessageManager; -import jalview.util.ShiftList; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; import fr.orsay.lri.varna.VARNAPanel; import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax; @@ -57,6 +44,18 @@ import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation; import fr.orsay.lri.varna.models.rna.ModeleBase; import fr.orsay.lri.varna.models.rna.RNA; +import jalview.bin.Cache; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.structure.SecondaryStructureListener; +import jalview.structure.SelectionListener; +import jalview.structure.SelectionSource; +import jalview.structure.StructureSelectionManager; +import jalview.structure.VamsasSource; +import jalview.util.MessageManager; +import jalview.util.ShiftList; + public class AppVarna extends JInternalFrame implements InterfaceVARNAListener, SelectionListener, SecondaryStructureListener// implements @@ -134,6 +133,15 @@ public class AppVarna extends JInternalFrame implements // System.out.println(ssm.toString()); ssm.addStructureViewerListener(this); ssm.addSelectionListener(this); + addInternalFrameListener(new InternalFrameAdapter() + { + @Override + public void internalFrameClosed(InternalFrameEvent evt) + { + close(); + } + }); + } public void initVarna() @@ -447,4 +455,19 @@ public class AppVarna extends JInternalFrame implements } + /** + * Tidy up as necessary when the viewer panel is closed + */ + protected void close() + { + /* + * Deregister as a listener, to free references to this object + */ + if (ssm != null) + { + ssm.removeStructureViewerListener(AppVarna.this, null); + ssm.removeSelectionListener(AppVarna.this); + } + } + }