From 28d2fa783954f8a4b761c73aa1dd2b3aa796b88b Mon Sep 17 00:00:00 2001 From: lempinen Date: Wed, 10 Oct 2012 06:03:53 +0000 Subject: [PATCH] Added an override to remove() that removes the HoverTextNode event handler from event handlers. (fixes #3762) @Override public void remove() { super.remove(); removeEventHandler(this); } git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@25957 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/ui/elements/HoverTextNode.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/HoverTextNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/HoverTextNode.java index eef60ea7..8bef287f 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/HoverTextNode.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/HoverTextNode.java @@ -68,6 +68,12 @@ public class HoverTextNode extends TextNode implements ISelectionPainterNode { addEventHandler(this); } + @Override + public void remove() { + super.remove(); + removeEventHandler(this); + } + @Override public int getEventMask(){ return EventTypes.FocusLostMask | super.getEventMask(); @@ -75,12 +81,12 @@ public class HoverTextNode extends TextNode implements ISelectionPainterNode { @Override protected boolean handleFocusEvent(FocusEvent e) { - int eventType = EventTypes.toType(e); - if (eventType == EventTypes.FocusLost){ - //If focus of the element (and the diagram) is lost, save the name of the node - fireTextEditingEnded(); - } - return false; + int eventType = EventTypes.toType(e); + if (eventType == EventTypes.FocusLost){ + //If focus of the element (and the diagram) is lost, save the name of the node + fireTextEditingEnded(); + } + return false; } - + } -- 2.47.1