void () { Runnable baseRunnable = () -> { try (var ignored = SlowOperations.startSection(SlowOperations.ACTION_PERFORM)) { doRun(); } }; Runnable runnable = shouldDisableAccessChecks() ? () -> NonProjectFileWritingAccessProvider.disableChecksDuring(baseRunnable) : baseRunnable; if (ApplicationManager.getApplication().isUnitTestMode()) { ApplicationManager.getApplication().assertWriteIntentLockAcquired(); runnable.run(); return; } if (ApplicationManager.getApplication().isWriteAccessAllowed()) { LOG.error("Refactorings should not be started inside write action\n because they start progress inside and any read action from the progress task would cause the deadlock", new Exception()); DumbService.getInstance(myProject).smartInvokeLater(runnable); } else { runnable.run(); } }