Bug 369159 - [Compatibility] ICommandService/IExecutionListener not
fired
Our preExecute event firing needed a little restructuring
diff --git a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java
index f489e55..e8b565f 100644
--- a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java
+++ b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java
@@ -51,7 +51,7 @@
@Optional
private Logger logger;
- public Object preExecute = null;
+ public static Object preExecute = null;
/*
* (non-Javadoc)
diff --git a/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/KeyBindingDispatcher.java b/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/KeyBindingDispatcher.java
index 6835468..fd09328 100644
--- a/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/KeyBindingDispatcher.java
+++ b/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/KeyBindingDispatcher.java
@@ -265,35 +265,27 @@
staticContext.set(Event.class, trigger);
final boolean commandDefined = command.isDefined();
- boolean commandEnabled;
+ // boolean commandEnabled;
boolean commandHandled;
try {
- commandEnabled = handlerService.canExecute(parameterizedCommand, staticContext);
+ // commandEnabled = handlerService.canExecute(parameterizedCommand, staticContext);
commandHandled = HandlerServiceImpl.lookUpHandler(context, command.getId()) != null;
- if (!commandEnabled && commandHandled && commandDefined) {
- if (keyAssistDialog != null) {
- keyAssistDialog.clearRememberedState();
+ try {
+ handlerService.executeHandler(parameterizedCommand, staticContext);
+ } catch (final Exception e) {
+ commandHandled = false;
+ if (logger != null) {
+ logger.error(e);
}
- return true;
}
- if (commandEnabled) {
- try {
- handlerService.executeHandler(parameterizedCommand, staticContext);
- } catch (final Exception e) {
- commandHandled = false;
- if (logger != null) {
- logger.error(e);
- }
- }
- /*
- * Now that the command has executed (and had the opportunity to use the remembered
- * state of the dialog), it is safe to delete that information.
- */
- if (keyAssistDialog != null) {
- keyAssistDialog.clearRememberedState();
- }
+ /*
+ * Now that the command has executed (and had the opportunity to use the remembered
+ * state of the dialog), it is safe to delete that information.
+ */
+ if (keyAssistDialog != null) {
+ keyAssistDialog.clearRememberedState();
}
} finally {
staticContext.dispose();
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
index 16af6ea..09fb611 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
@@ -267,8 +267,7 @@
public void initPreExecuteHook() {
EHandlerService hs = eclipseContext.get(EHandlerService.class);
if (hs instanceof HandlerServiceImpl) {
- HandlerServiceImpl impl = (HandlerServiceImpl) hs;
- impl.preExecute = new Object() {
+ HandlerServiceImpl.preExecute = new Object() {
@Execute
public void execute(IEclipseContext context, ParameterizedCommand command,
@Optional @Named(HandlerServiceImpl.PARM_MAP) Map parms,