private IHyperlink[] createBeanDefinitionParserHyperlink(IHyperlink[] hyperlinks, IDocument document,
Node currentNode) {
String namespaceUri = currentNode.getNamespaceURI();
IFile file = BeansEditorUtils.getFile(document);
IBeansConfig config = BeansCorePlugin.getModel().getConfig(file, true);
// Only search for non-default namespace handlers
if (config != null && namespaceUri != null && !namespaceUri.equals(NamespaceUtils.DEFAULT_NAMESPACE_URI)) {
ClassLoader cl = BeansCorePlugin.getClassLoader();
if (NamespaceUtils.useNamespacesFromClasspath(file.getProject())) {
cl = JdtUtils.getClassLoader(file.getProject(), cl);
}
// Construct NamespaceHandlerResolver using the project's classpath if configured
DelegatingNamespaceHandlerResolver resolver = new DelegatingNamespaceHandlerResolver(cl, config);
NamespaceHandler handler = resolver.resolve(namespaceUri);
if (handler instanceof NamespaceHandlerSupport) {
XmlReaderContext readerContext = new XmlReaderContext((Resource) config.getAdapter(Resource.class),
new NoOpProblemReporter(), null, null, new XmlBeanDefinitionReader(
new DefaultBeanDefinitionRegistry()), resolver);
Object parser = ReflectionUtils.invokeMethod(FIND_PARSER_FOR_ELEMENT_METHOD, handler,
(Element) currentNode, new ParserContext(readerContext, new BeanDefinitionParserDelegate(