void () { if (!inspectionStarted.get()) { SwingUtilities.invokeLater(this); return; } inspectionStarted.set(false); WriteAction.run(() -> { }); // have to restart while (!inspectionStarted.get()) { UIUtil.dispatchAllInvocationEvents(); } doRunInspection.set(false); }