void () { if (myUpdateProgress.isCanceled()) return; log(myUpdateProgress, myPass, "Started. "); for (ScheduledPass successor : mySuccessorsOnSubmit) { int predecessorsToRun = successor.myRunningPredecessorsCount.decrementAndGet(); if (predecessorsToRun == 0) { submit(successor); } } ProgressManager.getInstance().executeProcessUnderProgress(() -> { boolean success = ApplicationManagerEx.getApplicationEx().tryRunReadAction(() -> { try { if (DumbService.getInstance(myProject).isDumb() && !DumbService.isDumbAware(myPass)) { return; } if (!myUpdateProgress.isCanceled() && !myProject.isDisposed()) { String fileName = myFileEditor.getFile().getName(); String passClassName = StringUtil.getShortName(myPass.getClass()); TraceUtil.runWithSpanThrows(HighlightingPassTracer.HIGHLIGHTING_PASS_TRACER, myOpenTelemetryContext, passClassName, span -> { Activity startupActivity = StartUpMeasurer.startActivity("running " + passClassName); boolean cancelled = false; try (AccessToken ignored = ClientId.withClientId(ClientFileEditorManager.getClientId(myFileEditor))) { try (AccessToken ignored2 = ThreadContext.installThreadContext(myContext, true)) { myPass.collectInformation(myUpdateProgress); } } catch (ProcessCanceledException | CancellationException e) { cancelled = true; throw e; } finally { startupActivity.end(); span.setAttribute(HighlightingPassTracer.FILE_ATTR_SPAN_KEY, fileName); span.setAttribute(HighlightingPassTracer.CANCELLED_ATTR_SPAN_KEY, Boolean.toString(cancelled)); } }); } } catch (ProcessCanceledException e) { log(myUpdateProgress, myPass, "Canceled "); if (!myUpdateProgress.isCanceled()) { //in case some smart asses throw PCE just for fun ((DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(myProject)).stopProcess(true, "PCE was thrown by visitor"); } } catch (RuntimeException | Error e) { myUpdateProgress.cancel(e, "Error occurred"); LOG.error(e); throw e; } }); if (!success) { myUpdateProgress.cancel(); } }, myUpdateProgress); log(myUpdateProgress, myPass, "Finished. "); if (!myUpdateProgress.isCanceled()) { applyInformationToEditorsLater(myFileEditor, myPass, myUpdateProgress, myThreadsToStartCountdown, myContext, ()-> { for (ScheduledPass successor : mySuccessorsOnCompletion) { int predecessorsToRun = successor.myRunningPredecessorsCount.decrementAndGet(); if (predecessorsToRun == 0) { submit(successor); } } }); } }