You can have a reference in your HomeCommand
.
class HomeCommand extends AbstractAction {
private final Action action;
public HomeCommand(Action action){
this.action=action;
}
@Override
public void actionPerformed(ActionEvent ev) {
if(doSomethingSpecial())
performSpecialHomeAction();
else
action.actionPerformed(ev);
}
}
Then when you create it.
KeyStroke homeKey = KeyStroke.getKeyStroke("HOME");
InputMap inputMap = editor.getInputMap(JComponent.WHEN_FOCUSED);
ActionMap actionMap = editor.getActionMap();
Action action = actionMap.get("caret-begin-line");
inputMap.put(homeKey, "caret-begin-line");
actionMap.put("caret-begin-line", new HomeCommand(action));