This content has been marked as final.
Show 2 replies
-
1. Re: Help needed in writing a simple UI validator
gastaldi Apr 24, 2015 3:40 AM (in response to mani_mylavarapu)Hi mani,
One solution would be to use the Resource.resolveChildren, like in this example:
public void initializeUI(UIBuilder builder) throws Exception { Project project = getSelectedProject(builder); final Resource<?> projectRoot = project.getRoot(); targetDirectory.addValidator(new UIValidator() { @Override public void validate(UIValidationContext context) { try { projectRoot.resolveChildren(targetDirectory.getValue()); } catch (RuntimeException re) { context.addValidationError(targetDirectory, "Target Directory is not a child of the project root " + projectRoot); } } }); }
-
2. Re: Help needed in writing a simple UI validator
mani_mylavarapu Apr 24, 2015 4:58 AM (in response to gastaldi)Thank you for your suggestion.
Is it possible to validate this at compile time.For example the moment user clicks on browse for directory or something he can actually pick the directory from current project rather than getting error at run time once the user executes the command.