public IHyperlink[] detectHyperlinks(
      final ITextViewer textViewer, final IRegion region, boolean canShowMultipleHyperlinks) {
    if (region == null || textViewer == null) {
      return null;
    }

    IDocument document = textViewer.getDocument();
    if (document == null) {
      return null;
    }

    IRegion lineInfo;
    String line;
    try {
      lineInfo = document.getLineInformationOfOffset(region.getOffset());
      line = document.get(lineInfo.getOffset(), lineInfo.getLength());
    } catch (BadLocationException ex) {
      return null;
    }

    if (line.length() == 0) {
      return null;
    }
    final List<IHyperlink> hyperlinks = new ArrayList<IHyperlink>();
    final int offset = region.getOffset();

    XmlUtils.performOnCurrentElement(
        document,
        offset,
        new NodeOperation<Node>() {
          public void process(Node node, IStructuredDocument structured) {
            if (textViewer instanceof ISourceViewer) {
              IHyperlink[] links = openExternalMarkerDefinition((ISourceViewer) textViewer, offset);
              if (links.length > 0) {
                hyperlinks.addAll(Arrays.asList(links));
              }
            }
            // check if we have a property expression at cursor
            IHyperlink link = openPropertyDefinition(node, textViewer, offset);
            if (link != null) {
              hyperlinks.add(link);
            }
            // now check if the dependency/plugin has a version element or not, if not, try
            // searching for it in DM/PM of effective pom
            link = openDPManagement(node, textViewer, offset);
            if (link != null) {
              hyperlinks.add(link);
            }
            // check if <module> text is selected.
            link = openModule(node, textViewer, offset);
            if (link != null) {
              hyperlinks.add(link);
            }
            link = openPOMbyID(node, textViewer, offset);
            if (link != null) {
              hyperlinks.add(link);
            }
          }
        });

    if (hyperlinks.size() > 0) {
      return hyperlinks.toArray(new IHyperlink[0]);
    }
    return null;
  }