问题
I upgraded my eclipse RCP application from Juno to Luna. This caused my application toolbar to be permenantly disabled.
I found a solution in this thread: Eclipse Luna: Handlers' @CanExecute methods not called (Solution: generate event manually). But alas, the cure didn't work :-(.
I drilled down with the debugger to find the root cause of failure. I found that in HandlerServiceHandler.class the method setEnabled(Object evaluationContext) fails. This is due to the extraction of the wrong execution context from the evaluation context.
I will go into more details: What is happening is that after I perform a selection on the project explorer I send my event. The setEnabled(Object evaluationContext) looks up the handler of the relevant command that is associated with my toolbar item. However, it looks for the handler within the * execution context* of the project explorer. The handler isn't in this context so the method fails!!
Any ideas on how to resolve this. I don't really understand how I can control my contexts well.
Thanks!!!!!
来源:https://stackoverflow.com/questions/25618903/eclipse-luna-handlers-canexecute-methods-not-called-due-to-wrong-context