public static void registerAction(JComponent component, KeyStroke keyStroke, Action action,
			int focusCondition) {
		if (keyStroke == null) {
			Msg.debug(KeyBindingUtils.class, "Attempted to register an action without " +
				"providing a keystroke - action: " + action.getValue(Action.NAME));
			return;
		}

		InputMap im = component.getInputMap(focusCondition);
		if (im == null) {
			return;
		}

		ActionMap am = component.getActionMap();
		if (am == null) {
			return;
		}

		Object keyText = im.get(keyStroke);
		if (keyText == null || keyText.equals(NO_KEYBINDING_NAME)) {
			// no binding--just pick a name
			keyText = action.getValue(Action.NAME);
			if (keyText == null) {
				Msg.error(KeyBindingUtils.class, "Action must have a name to be registered",
					ReflectionUtilities.createJavaFilteredThrowable());
				return;
			}

			im.put(keyStroke, keyText);
		}

		am.put(keyText, action);
	}
Registers the given action with the given key binding on the given
component.

@param component the component to which the action will be registered
@param keyStroke the keystroke for to which the action will be bound
@param action the action to execute when the given keystroke is triggered
@param focusCondition the focus condition under which to bind the action
           ({@link JComponent#getInputMap(int)}).  See {@link JComponent} for more info;
           the default is usually {@link JComponent#WHEN_FOCUSED}
Ghidra/Framework/Docking/src/main/java/docking/actions/KeyBindingUtils.java