void (@NotNull JTextComponent textField) { if (myProject.isDisposed()) return; final String text = textField.getText(); FindInProjectSettings findInProjectSettings = FindInProjectSettings.getInstance(myProject); if (textField == mySearchTextComponent) { if (myAddSearchResultsToGlobalSearch) { findInProjectSettings.addStringToFind(text); } if (mySearchFieldWrapper.getTargetComponent() instanceof SearchTextField) { ((SearchTextField)mySearchFieldWrapper.getTargetComponent()).addCurrentTextToHistory(); } } else { findInProjectSettings.addStringToReplace(text); if (myReplaceFieldWrapper.getTargetComponent() instanceof SearchTextField) { ((SearchTextField)myReplaceFieldWrapper.getTargetComponent()).addCurrentTextToHistory(); } } }