Search in sources :

Example 1 with CShowHotkeysAction

use of com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CShowHotkeysAction in project binnavi by google.

the class CGraphHotkeys method registerHotKeys.

/**
   * Register the default hotkeys of a graph view.
   * 
   * @param parent Parent window used for dialogs.
   * @param panel The panel where the view is shown.
   * @param debuggerProvider Provides the debugger used by some hotkeys.
   * @param searchField The search field that is shown in the graph panel.
   * @param addressField The address field that is shown in the graph panel.
   */
public static void registerHotKeys(final JFrame parent, final CGraphPanel panel, final IFrontEndDebuggerProvider debuggerProvider, final CGraphSearchField searchField, final CGotoAddressField addressField) {
    Preconditions.checkNotNull(parent, "IE01606: Parent argument can not be null");
    Preconditions.checkNotNull(panel, "IE01607: Panel argument can not be null");
    Preconditions.checkNotNull(searchField, "IE01608: Search field argument can not be null");
    Preconditions.checkNotNull(addressField, "IE01609: Address field argument can not be null");
    final InputMap inputMap = panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    final ActionMap actionMap = panel.getActionMap();
    inputMap.put(HotKeys.GRAPH_GOTO_ADDRESS_FIELD_KEY.getKeyStroke(), "GOTO_ADDRESS_FIELD");
    actionMap.put("GOTO_ADDRESS_FIELD", new AbstractAction() {

        /**
       * Used for serialization.
       */
        private static final long serialVersionUID = -8994014581850287793L;

        @Override
        public void actionPerformed(final ActionEvent event) {
            addressField.requestFocusInWindow();
        }
    });
    inputMap.put(HotKeys.GRAPH_SHOW_HOTKEYS_ACCELERATOR_KEY.getKeyStroke(), "SHOW_HOTKEYS");
    actionMap.put("SHOW_HOTKEYS", new CShowHotkeysAction(parent));
    registerSearchKeys(panel.getModel().getGraph().getView(), searchField, inputMap, actionMap);
    registerDebuggerKeys(panel.getModel().getParent(), panel.getModel().getGraph(), debuggerProvider, inputMap, actionMap);
}
Also used : ActionMap(javax.swing.ActionMap) ActionEvent(java.awt.event.ActionEvent) CShowHotkeysAction(com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CShowHotkeysAction) InputMap(javax.swing.InputMap) AbstractAction(javax.swing.AbstractAction)

Aggregations

CShowHotkeysAction (com.google.security.zynamics.binnavi.Gui.GraphWindows.Actions.CShowHotkeysAction)1 ActionEvent (java.awt.event.ActionEvent)1 AbstractAction (javax.swing.AbstractAction)1 ActionMap (javax.swing.ActionMap)1 InputMap (javax.swing.InputMap)1