From 1a7b588ddfc1936a311c653613d75a4d817ec195 Mon Sep 17 00:00:00 2001 From: Nikolaos Pringouris Date: Sun, 10 Mar 2019 22:01:24 +0200 Subject: [PATCH] Enable ToolLifecycleEvent during activation/deactivation of Modal Tools Signed-off-by: Nikolaos Pringouris --- .../udig/project/ui/tool/AbstractModalTool.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/org.locationtech.udig.project.ui/src/org/locationtech/udig/project/ui/tool/AbstractModalTool.java b/plugins/org.locationtech.udig.project.ui/src/org/locationtech/udig/project/ui/tool/AbstractModalTool.java index ef16fadbb6..1ec172e890 100644 --- a/plugins/org.locationtech.udig.project.ui/src/org/locationtech/udig/project/ui/tool/AbstractModalTool.java +++ b/plugins/org.locationtech.udig.project.ui/src/org/locationtech/udig/project/ui/tool/AbstractModalTool.java @@ -13,10 +13,7 @@ import org.locationtech.udig.project.ui.ApplicationGIS; -import org.locationtech.udig.project.ui.internal.ProjectUIPlugin; -import org.locationtech.udig.project.ui.preferences.PreferenceConstants; -import org.eclipse.core.runtime.Platform; import org.eclipse.jface.action.IStatusLineManager; /** @@ -66,8 +63,14 @@ public AbstractModalTool( int targets ) { } public void setActive( boolean active ) { - this.active=active; + boolean oldValue = isActive(); + + boolean tempNotify = isNotifyListeners(); + setNotifyListeners(false); + this.active=active; + setNotifyListeners(tempNotify); + setStatusBarMessage(active); if (!active) { deregisterMouseListeners(); @@ -76,6 +79,11 @@ public void setActive( boolean active ) { registerMouseListeners(); } } + + if(isNotifyListeners() && oldValue != active){ + ToolLifecycleEvent event = new ToolLifecycleEvent(this, ToolLifecycleEvent.Type.ACTIVE, active, oldValue); + fireEvent(event); + } } public boolean isActive() {