void (String actionName, boolean replace, JComponent component, FindUI ui) { AnAction action = ActionManager.getInstance().getAction(actionName); new AnAction() { @Override public boolean isDumbAware() { return action.isDumbAware(); } @Override public void actionPerformed(@NotNull AnActionEvent e) { ui.saveSettings(); myModel.copyFrom(FindManager.getInstance(myProject).getFindInProjectModel()); FindUtil.initStringToFindWithSelection(myModel, e.getData(CommonDataKeys.EDITOR)); myModel.setReplaceState(replace); ui.initByModel(); } }.registerCustomShortcutSet(action.getShortcutSet(), component); }