void () { checkCanceledCalled = false; ProgressManager.getInstance().executeProcessUnderProgress(() -> { assertFalse(CoreProgressManager.threadsUnderCanceledIndicator.contains(Thread.currentThread())); ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator(); assertTrue(indicator != null && !indicator.isCanceled()); indicator.cancel(); assertTrue(CoreProgressManager.threadsUnderCanceledIndicator.contains(Thread.currentThread())); assertTrue(indicator.isCanceled()); final ProgressIndicatorEx nested = new ProgressIndicatorBase(); nested.addStateDelegate(new ProgressIndicatorStub() { @Override public void checkCanceled() throws ProcessCanceledException { checkCanceledCalled = true; throw new RuntimeException("must not call checkCanceled()"); } }); ProgressManager.getInstance().executeProcessUnderProgress(() -> { assertFalse(CoreProgressManager.threadsUnderCanceledIndicator.contains(Thread.currentThread())); ProgressIndicator indicator2 = ProgressIndicatorProvider.getGlobalProgressIndicator(); assertTrue(indicator2 != null && !indicator2.isCanceled()); assertSame(indicator2, nested); ProgressManager.checkCanceled(); }, nested); ProgressIndicator indicator3 = ProgressIndicatorProvider.getGlobalProgressIndicator(); assertSame(indicator, indicator3); assertTrue(CoreProgressManager.threadsUnderCanceledIndicator.contains(Thread.currentThread())); }, new EmptyProgressIndicator()); assertFalse(checkCanceledCalled); }