void (@NotNull String pattern, @NotNull ProgressIndicator progressIndicator, @NotNull Processor<? super YAMLKeyNavigationItem> consumer) { if (myProject == null || pattern.isEmpty()) { return; } Runnable task = () -> findKeys(consumer, pattern, progressIndicator); Application application = ApplicationManager.getApplication(); if (application.isUnitTestMode()) { application.runReadAction(task); } else { ApplicationManager.getApplication().assertIsNonDispatchThread(); ProgressIndicatorUtils.yieldToPendingWriteActions(); ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(task, progressIndicator); } }