void () { mySelectedClass = calcSelectedClass(); if (mySelectedClass == null) { setOKActionEnabled(false); } else { T selectedClass = mySelectedClass; ReadAction .nonBlocking(() -> DumbModeAccessType.RELIABLE_DATA_ONLY.ignoreDumbMode(() -> myClassFilter.isAccepted(selectedClass))) .finishOnUiThread(getModalityState(), isAccepted -> setOKActionEnabled(mySelectedClass != null && isAccepted)) .submit(AppExecutorUtil.getAppExecutorService()); } }