void () { updateContextCombobox(); mySearchField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { myIsUsedTrigger = true; final String pattern = mySearchField.getText(); if (mySearchField.hasFocus()) { ApplicationManager.getApplication().invokeLater(() -> myIsItemSelected = false); if (!myIsItemSelected) { myLastInputText = null; clearSelection(); //invoke later here allows to get correct pattern from mySearchField ApplicationManager.getApplication().invokeLater(() -> { rebuildList(); }); } if (!isHelpMode(pattern)) { updateContextCombobox(); adjustMainListEmptyText(mySearchField); return; } adjustEmptyText(mySearchField, field -> true, "", IdeBundle.message("run.anything.help.list.empty.secondary.text")); } } }); mySearchField.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { rebuildList(); } }); }