void () { String path = myDirectoryField.getText(); new Task.Modal(myProject, DvcsBundle.message("progress.title.creating.destination.directory"), true) { private ValidationInfo error = null; @Override public void run(@NotNull ProgressIndicator indicator) { error = CloneDvcsValidationUtils.createDestination(path); } @Override public void onSuccess() { if (error == null) { CloneDvcsDialog.super.doOKAction(); } else { myCreateDirectoryValidationInfo = error; startTrackingValidation(); } } }.queue(); }