ModalityState () { ModalityState contextModality = currentThreadContextModality(); if (contextModality != null) { return contextModality; } ProgressManager progressManager = ProgressManager.getInstanceOrNull(); ModalityState progressModality = progressManager == null ? null : progressManager.getCurrentProgressModality(); return progressModality == null ? ModalityState.nonModal() : progressModality; }