void (@Nullable ProgressIndicator indicator) { boolean isNonCancelable = Cancellation.isInNonCancelableSection(); if (isNonCancelable || indicator == null) { ((CoreProgressManager)ProgressManager.getInstance()).runCheckCanceledHooks(indicator); } if (isNonCancelable) return; Cancellation.checkCancelled(); if (indicator == null) return; indicator.checkCanceled(); // check for cancellation as usual and run the hooks if (indicator.isCanceled()) { // if a just-canceled indicator or PCE is disabled indicator.checkCanceled(); // ... let the just-canceled indicator provide a customized PCE throw new ProcessCanceledException(); // ... otherwise PCE is disabled so throw it manually } }