FileChooserDescriptor () { FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) { @Override public void validateSelectedFiles(VirtualFile @NotNull [] files) throws Exception { if (files.length != 0) { String selectedPath = files[0].getPath(); boolean valid = isValidSdkHome(selectedPath); if (!valid) { valid = isValidSdkHome(adjustSelectedSdkHome(selectedPath)); if (!valid) { String message = getInvalidHomeMessage(selectedPath); throw new Exception(message); } } } } }; descriptor.setTitle(ProjectBundle.message("sdk.configure.home.title", getPresentableName())); return descriptor; }