AttrImpl attribute, IDOMNode parent, IReporter reporter, boolean reportError,
BeansEditorValidator validator, String text) {
IProject project = file.getProject();
ValidationRuleDefinition ruleDefinition = getValidationRule(project, BeanFactoryRule.class);
BeanFactoryRule rule = (BeanFactoryRule) (ruleDefinition != null ? ruleDefinition.getRule() : null);
BeanHelper parentBean = new BeanHelper(parent, file, project);
parentBean.getBeanDefinition().setFactoryMethodName(text);
AttrImpl factoryBeanAttr = (AttrImpl) parent.getAttributes().getNamedItem(
BeansSchemaConstants.ATTR_FACTORY_BEAN);
if (factoryBeanAttr != null) {
parentBean.getBeanDefinition().setFactoryBeanName(factoryBeanAttr.getNodeValue());
}
BeansValidationContextHelper context = new BeansValidationContextHelper(attribute, parent, contextElement,
project, reporter, validator, QuickfixProcessorFactory.FACTORY_METHOD, 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_METHOD, null, new ValidationProblemAttribute("CLASS",
mergedClassName));
}
if (rule != null) {
context.setCurrentRuleDefinition(ruleDefinition);
rule.validate(parentBean, context, null);
if (context.getErrorFound()) {
return true;
}
}