TextValidationFunction (GraphProperty<String> locationProperty) { return fieldText -> { try { File file = Paths.get(FileUtil.expandUserHome(FileUtil.join(locationProperty.get(), fieldText))).toFile(); if (file.exists()) { String[] children = file.list(); if (children != null && children.length > 0) { return JavaStartersBundle.message("message.directory.0.not.empty.warning", file.getAbsolutePath()); } } } catch (InvalidPathException ipe) { return null; } return null; }; }