There is no handler to execute for command

If you follow the Vogella tutorials, especially those about menu contribution, the error message There is no handler to execute for command might appear. They don’t mention that you have to take care about the return value of isHandled().

While I was experiencing the error message after the first time I hit the menu yesterday, I’m absolutely not able today to get the command run once. In fact the behaviour shouldn’t change over night but anyway keep an eye on isHandled.

My plugin output this today1:

11:21:23 zprototype.AbstractApplication::start   Starting the plugin
11:42:47 zprototype.command.LoadModel::addHandlerListener
11:42:47 zprototype.command.LoadModel::isEnabled
11:42:48 zprototype.command.LoadModel::isHandled
11:42:48 zprototype.command.LoadModel::isEnabled
11:42:48 zprototype.command.LoadModel::isEnabled
11:42:48 zprototype.command.LoadModel::execute
11:42:49 zprototype.command.LoadModel::isEnabled

AbstractApplication is actually the entry point of the plugin and LoadModel is the menu handler.

As you can see isHandled is executed before execute so if it returns false a NotHandledException will be thrown.

  1. I’m not sure if this output is alway the same as other developer did run the command once too before the message appeared.

1 Comment

  1. Paul

    Thank you, you saved me a lot of time.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>