void (@Nullable ProgressSuspender suspender, @NotNull Disposable parentDisposable, @NotNull Runnable onSuspendStart, @NotNull Runnable onSuspendStop) { if (suspender == null) { return; } ApplicationManager.getApplication().getMessageBus().connect(parentDisposable) .subscribe(ProgressSuspender.TOPIC, new ProgressSuspender.SuspenderListener() { @Override public void suspendedStatusChanged(@NotNull ProgressSuspender changedSuspender) { if (suspender != changedSuspender) { return; } if (suspender.isSuspended()) { onSuspendStart.run(); } else { onSuspendStop.run(); } } }); }