public IHyperlink detectHyperlink(IDetectionContext context) {
    CSTNode syntaxElement = context.getSyntaxElement();
    EModelElementRef elementRef =
        findReferencedMetamodelElement(syntaxElement, context.getRegion());

    if (elementRef != null) {
      EModelElement element = elementRef.element;
      CSTNode cstNode = ASTBindingHelper.resolveCSTNode(element, CSTNode.class);
      if (cstNode == null) {
        ASTSyntheticNode referencedDefinitionAST = ASTSyntheticNodeAccess.getASTNode(element);
        if (referencedDefinitionAST != null) {
          cstNode = ASTSyntheticNodeAccess.getCST(referencedDefinitionAST, CSTNode.class);
        }
      }
      if (cstNode != null) {
        URI sourceURI = CSTHelper.getSourceFile(cstNode);
        if (sourceURI != null) {
          if (cstNode instanceof ModelTypeCS) {
            // TODO - use QVT model Switch to get destination region specific to various CST
            cstNode = ((ModelTypeCS) cstNode).getIdentifierCS();
          } else if (cstNode instanceof MappingModuleCS) {
            MappingModuleCS moduleCS = (MappingModuleCS) cstNode;
            if (moduleCS.getHeaderCS() != null) {
              cstNode = moduleCS.getHeaderCS();
              if (moduleCS.getHeaderCS().getPathNameCS() != null) {
                cstNode = moduleCS.getHeaderCS().getPathNameCS();
              }
            }
          } else if (cstNode instanceof ClassifierDefCS) {
            cstNode = ((ClassifierDefCS) cstNode).getSimpleNameCS();
          }
          IRegion destReg = HyperlinkUtil.createRegion(cstNode);
          return new QvtFileHyperlink(elementRef.sourceLinkRegion, sourceURI, destReg, destReg);
        }
      }

      return new MetamodelElementHyperlink(elementRef.sourceLinkRegion, elementRef.element);
    }

    return null;
  }
 private static QvtOperationalEnv getEnv(CSTNode node) {
   return (QvtOperationalEnv) CSTHelper.getEnvironment(node);
 }