Announcement Announcement Module
Collapse
No announcement yet.
invisible shortcuts Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • invisible shortcuts

    I have created a command in my commands-context.XML file and have defined a label for it in messages.properties with an accelerator attached. if I add the command to a menu, everything works fine and the shortcut key executes the command executor. however, I don't want this command to show up in a menu or anywhere at all, really. I only want a shortcut to work. It seems that the shortcut only gets enabled when the command is part of a menu. Is there any way I can enable it on its own?

    Thanks,
    Brian

  • #2
    I couldn't figure out a way to do it using only the XML, but here's how to do it programmatically.

    In my life cycle adviser, I edited the following code:

    Code:
    final ActionCommand ac = window.getCommandManager().getActionCommand("priceSourceHCommand");
    window.getMenuBar().getControl().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(ac.getAccelerator(), "priceSourceHCommand");
    window.getMenuBar().getControl().getActionMap().put("priceSourceHCommand", ac.getActionAdapter());

    If anyone knows a way to do this declaratively, please speak up.

    Comment

    Working...
    X