void (@NotNull String textToSet) { if (!updateTextComponent(false)) { replaceTextInTextComponentEnsuringSelection(textToSet, myReplaceTextComponent); return; } myReplaceTextComponent.setText(textToSet); myReplaceTextComponent.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { ApplicationManager.getApplication().invokeLater(() -> myEventDispatcher.getMulticaster().replaceFieldDocumentChanged()); } }); if (!isMultiline()) { installReplaceOnEnterAction(myReplaceTextComponent); } new VariantsCompletionAction(myReplaceTextComponent); myReplaceFieldWrapper.revalidate(); myReplaceFieldWrapper.repaint(); }