@SuppressWarnings("unchecked")
public void validate(IValidatable validatable) {
Object o = validatable.getValue();
if (o != null) {
JcrNode node = nodeModel.getObject();
Path path = null;
if (o instanceof Path) {
path = (Path) o;
} else {
path = new Path(o.toString());
}
if (!path.isAbsolute()) {
Path parent = new Path(node.getPath());
if (!((BrixNode) node).isFolder())
parent = parent.parent();
path = parent.append(path);
} else {
path = new Path(SitePlugin.get().toRealWebNodePath(path.toString()));
}
if (node.getSession().itemExists(path.toString()) == false) {
ValidationError error = new ValidationError();
error.setMessage("Node ${path} could not be found");
error.addMessageKey("NodePathValidator");
error.getVariables().put("path", path.toString());
validatable.error(error);