Boolean (String fieldName, PsiField oldBindingField, Project project) { Task.WithResult<Boolean, RuntimeException> task = new Task.WithResult<>(project, UIDesignerBundle.message("dialog.title.check.field.usages", fieldName), true) { @Override protected Boolean compute(@NotNull ProgressIndicator indicator) { return isFieldUnreferenced(oldBindingField); } }; task.queue(); Boolean result; try { result = task.getResult(); } catch (ProcessCanceledException e) { return null; } return result; }