boolean (final @NotNull Params queryParameters, final @NotNull Processor<? super Result> consumer) { final AtomicBoolean toContinue = new AtomicBoolean(true); final Processor<Result> wrapper = result -> { if (!toContinue.get()) { return false; } if (!consumer.process(result)) { toContinue.set(false); return false; } return true; }; if (myRequireReadAction && !ApplicationManager.getApplication().isReadAccessAllowed()) { Runnable runnable = () -> { if (!(queryParameters instanceof QueryParameters) || ((QueryParameters)queryParameters).isQueryValid()) { processQuery(queryParameters, wrapper); } }; if (!DumbService.isDumbAware(this)) { Project project = queryParameters instanceof QueryParameters ? ((QueryParameters)queryParameters).getProject() : null; if (project != null) { DumbService.getInstance(project).runReadActionInSmartMode(runnable); return toContinue.get(); } } ApplicationManager.getApplication().runReadAction(runnable); } else { processQuery(queryParameters, wrapper); } return toContinue.get(); }