void (@NotNull Disposable parentDisposable, @Nullable TransactionId expectedContext, @NotNull Runnable transaction) { ModalityState modality = expectedContext == null ? ModalityState.nonModal() : ((TransactionIdImpl)expectedContext).myModality; Application app = ApplicationManager.getApplication(); if (app.isWriteIntentLockAcquired() && myWritingAllowed && !ModalityState.current().dominates(modality)) { if (!Disposer.isDisposed(parentDisposable)) { transaction.run(); } } else { AppUIExecutor.onWriteThread(modality).later().expireWith(parentDisposable).execute(transaction); } }