void (@NotNull String pattern, @NotNull ProgressIndicator progressIndicator, @NotNull Processor<? super Object> consumer) { try { Thread.sleep(initDelay); } catch (InterruptedException ignored) { } ProgressIndicatorUtils.yieldToPendingWriteActions(); ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(() -> { count++; try { for (Object item : items) { progressIndicator.checkCanceled(); consumer.process(item); Thread.sleep(eachItemDelay); } } catch (InterruptedException ignored) { } }, progressIndicator); }