Does anyone know why this does not work?
I made some debugging and it seems that the handler is enabled and disabled correctly when the selection changes so that does not seem to be the problem.

From what I can tell the menu item never references the state of the handler directly. Could it be that the menu item is only disabled because all the items in the sub menu are disabled? In that case could I somehow connect the menu item to the state of the handler directly?