boolean (@Nullable ProgressIndicator indicator) { if (!hasCheckCanceledHooks()) { return false; } CheckCanceledHook[] activeHooks = myHooks.isEmpty() ? CheckCanceledHook.EMPTY_ARRAY : myHooks.toArray(CheckCanceledHook.EMPTY_ARRAY); boolean result = myRunSleepHook && sleepIfNeededToGivePriorityToAnotherThread(); for (CheckCanceledHook hook : activeHooks) { if (hook.runHook(indicator)) { result = true; // but still continue to other hooks } } return result; }