@Override
  public TransactionIdImpl getContextTransaction() {
    if (ApplicationManager.getApplication().isWriteIntentLockAcquired()) {
      if (!myWritingAllowed) {
        return null;
      }
    }
    else if (ProgressIndicatorProvider.getGlobalProgressIndicator() == null) {
      return null;
    }

    ModalityState state = ModalityState.defaultModalityState();
    return isWriteSafeModality(state) ? new TransactionIdImpl(state) : null;
  }
@Override
  public TransactionIdImpl getContextTransaction()