Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2020-12-25 16:51:36 +0000
committerThomas Wolf2020-12-25 16:51:36 +0000
commit8949b40530c13039c23d3d4c427310ae4e89a0aa (patch)
treed196a8fb64a1d1568fb3595d8d927ecb1aa061de /org.eclipse.egit.ui
parente5375b3b40938b25157ae5a64ef73a00dfee7fc0 (diff)
downloadegit-8949b40530c13039c23d3d4c427310ae4e89a0aa.tar.gz
egit-8949b40530c13039c23d3d4c427310ae4e89a0aa.tar.xz
egit-8949b40530c13039c23d3d4c427310ae4e89a0aa.zip
Clean up event listener in ActionUtils
Register the SWT listener also for dispose events and remove the JFace disposal listener. Change-Id: I297cb662e01ebd25a52414cb0f29a298bdaec723 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ActionUtils.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ActionUtils.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ActionUtils.java
index b325dfabf9..9f290e6c33 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ActionUtils.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/ActionUtils.java
@@ -217,16 +217,12 @@ public final class ActionUtils {
*/
public static void setGlobalActions(Control control,
Collection<? extends IAction> actions, IHandlerService service) {
- Collection<IHandlerActivation> handlerActivations = new ArrayList<>();
- control.addDisposeListener(event -> {
- if (!handlerActivations.isEmpty()) {
- service.deactivateHandlers(handlerActivations);
- handlerActivations.clear();
- }
- });
- final ActiveShellExpression expression = new ActiveShellExpression(
+ ActiveShellExpression expression = new ActiveShellExpression(
control.getShell());
class ActivationListener implements Listener {
+
+ private Collection<IHandlerActivation> handlerActivations = new ArrayList<>();
+
@Override
public void handleEvent(Event event) {
switch (event.type) {
@@ -256,6 +252,8 @@ public final class ActionUtils {
}
}
break;
+ default:
+ break;
}
}
}
@@ -264,7 +262,7 @@ public final class ActionUtils {
control.addListener(SWT.FocusOut, activationListener);
control.addListener(SWT.Activate, activationListener);
control.addListener(SWT.FocusIn, activationListener);
-
+ control.addListener(SWT.Dispose, activationListener);
}
/**

Back to the top