After a couple of missteps and much hair pulling, I’ve finally managed to get my menu bar and ApplicationCommandManager working; all command items of my menu are successfully registered with the command manager and dispatched to the correct target. Same with shortcuts. Except for one snag: right after my app starts up, none of my shortcuts work until I click anywhere in my main component. So I’m assuming it’s a focus issue. I tried to manually grab focus with grabKeyboardFocus() after my app starts up, but that didn’t change anything.
After some detective work, it looks like all the right things are happening when I press a shortcut combo:
- the correct ApplicationCommandTarget is found by going up the chain via getNextCommandTarget()
- the target is queried via getCommandInfo() with the correct commandID and successfully sets the ApplicationCommandInfo
But at that point it stops and perform() is never called on the target. Note that selecting a menu item that invokes the same command works, so it must be something about the key mappings. Any ideas?