ValidationRuleDefinition propertyRuleDefinition = getValidationRule(project, BeanPropertyRule.class);
BeanPropertyRule propertyRule = (BeanPropertyRule) (propertyRuleDefinition != null ? propertyRuleDefinition
.getRule() : null);
ValidationRuleDefinition depracationRuleDefinition = getValidationRule(project, BeanDeprecationRule.class);
BeanDeprecationRule deprecationRule = (BeanDeprecationRule) (depracationRuleDefinition != null ? depracationRuleDefinition
.getRule() : null);
IDOMNode parentBeanNode = getParentBeanNode(parent);
if (parentBeanNode == null) {
return false;
}
BeanHelper parentBean = new BeanHelper(parentBeanNode, file, project);
BeansValidationContextHelper context = new BeansValidationContextHelper(attribute, parent, contextElement,
project, reporter, validator, QuickfixProcessorFactory.PROPERTY, false, reportError, config);
BeanPropertyHelper property = new BeanPropertyHelper(parent, file, parentBean);
if (propertyRule != null) {
context.setCurrentRuleDefinition(propertyRuleDefinition);
propertyRule.validate(property, context, null);
}
if (context.getErrorFound()) {
return true;
}
context = new BeansValidationContextHelper(attribute, parent, contextElement, project, reporter, validator,
QuickfixProcessorFactory.DEPRECATED, false, reportError, config);
ITextRegion valueRegion = attribute.getValueRegion();
AbstractBeanDefinition mergedBd = (AbstractBeanDefinition) BeansModelUtils.getMergedBeanDefinition(parentBean,
context.getContextElement());
// For non-factory beans validate it's init-method and
// destroy-method
String mergedClassName = mergedBd.getBeanClassName();
if (valueRegion != null && mergedClassName != null) {
// add rename refactoring option
validator.createAndAddEmptyMessage(valueRegion, parent, "", reporter,
QuickfixProcessorFactory.RENAME_PROPERTY, null, new ValidationProblemAttribute("CLASS",
mergedClassName));
}
if (deprecationRule != null) {
context.setCurrentRuleDefinition(depracationRuleDefinition);
deprecationRule.validate(property, context, null);
}
return context.getErrorFound();
}