void () { JBTextField textField = mySearchField; String pattern = textField.getText(); ReadAction.nonBlocking(() -> { DataContext dataContext = getDataContext(); RunAnythingProvider provider = RunAnythingProvider.findMatchedProvider(dataContext, pattern); if (provider == null) { return null; } Object value = provider.findMatchingValue(dataContext, pattern); if (value == null) { return null; } //noinspection unchecked return provider.getIcon(value); }).finishOnUiThread(ModalityState.defaultModalityState(), icon -> { if (icon == null) { return; } textField.putClientProperty(MATCHED_PROVIDER_PROPERTY, icon); }).submit(AppExecutorUtil.getAppExecutorService()); }