0

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!!!!!

Community
  • 1
  • 1
whomaniac
  • 1,258
  • 4
  • 15
  • 22
  • So where are you defining your handler? – greg-449 Sep 02 '14 at 08:44
  • In the e4xmi file I have a handler defined. This handler is connected to a command which is connected to a toolbar item. – whomaniac Sep 02 '14 at 10:44
  • Yes but where in the e4xmi, is it in the top level Handlers list or in the Handlers list for a particular window? – greg-449 Sep 02 '14 at 10:48
  • The handler lookup should work, all contexts from the active leaf up to the application context are searched. Your handler will be in the application context. Are you sure the command id is correct? – greg-449 Sep 02 '14 at 12:01
  • I use the find button to link the command to its handler and tool item in e4xmi. So I don't see where I can go wrong. Thanks for your answers by the way. – whomaniac Sep 02 '14 at 12:17
  • I came back to look at this after a long time. I probably shoul've said that I got an exception with css spy when I am loading my rcp app. org.osgi.framework.BundleException: Could not resolve module: org.eclipse.e4.tools.css.spy [174] Another singleton bundle selected: osgi.identity; osgi.identity="org.eclipse.e4.tools.css.spy"; type="osgi.bundle"; version:Version="0.12.0.v20130814-1230"; singleton:="true" at org.eclipse.osgi.container.Module.start(Module.java:434) – whomaniac Jul 07 '15 at 12:58
  • I moved event broker code to another place and now I am in MainWindow context (not application context). It is still not working... Sometimes HandlerServiceImpl.lookUpHandler() in setEnabled() returns null and sometime it isn't null but setEnabled() still disables the toolItem... – whomaniac Jul 07 '15 at 13:29

0 Answers0