void (@NotNull Editor editor, @Nullable Caret caret, DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); if (!editor.isOneLineMode() && project != null) { EditorSearchSession search = EditorSearchSession.get(editor); if (search != null) { search.getComponent().requestFocusInTheSearchFieldAndSelectContent(project); FindUtil.configureFindModel(myReplace, editor, search.getFindModel(), false); } else { FindManager findManager = FindManager.getInstance(project); FindModel model; if (myReplace) { model = findManager.createReplaceInFileModel(); } else { model = new FindModel(); model.copyFrom(findManager.getFindInFileModel()); } boolean consoleViewEditor = ConsoleViewUtil.isConsoleViewEditor(editor); FindUtil.configureFindModel(myReplace, editor, model, consoleViewEditor); EditorSearchSession.start(editor, model, project).getComponent() .requestFocusInTheSearchFieldAndSelectContent(project); if (!consoleViewEditor && editor.getSelectionModel().hasSelection()) { // selection is used as string to find without search model modification so save the pattern explicitly FindUtil.updateFindInFileModel(project, model, true); } } } }