Main Content

slreq.registerNavigationFcn

Register navigation function for referenced requirements

    Description

    slreq.registerNavigationFcn(domain,callbackFunction) registers a navigation callback function, callbackFunction, for referenced requirements imported from ReqIF™ files that have the Domain property value equal to domain. Use this function to enable navigation from the Requirements Editor to the original requirement in a third-party requirements management tool.

    Note

    The navigation callback function should take this form:

    function myCustomNavigationFunction(ref)
    % Enter your implementation here
    end
    The function should take the slreq.Reference object as an input.

    example

    Examples

    collapse all

    This example shows how to register and get the registered navigation callback function for referenced requirements imported from ReqIF™ files.

    Import the ReqIF file mySpec.reqif into Requirements Toolbox™.

    count = slreq.import("mySpec.reqif");

    Get the handle for the imported requirement set. Check the domain for the imported referenced requirements.

    rs = slreq.find("Type","ReqSet","Name","mySpec");
    topRef = children(rs);
    domain = topRef.Domain
    domain = 
    'Third-Party Tool'
    

    Check if there are any currently registered navigation callback functions for the domain.

    callback = slreq.getNavigationFcn(domain)
    callback =
    
      0x0 empty char array
    

    Register the custom navigation callback function myNavigationFcn for the domain. Confirm that the navigation callback function was registered.

    slreq.registerNavigationFcn(domain,"myNavigationFunction")
    callback = slreq.getNavigationFcn(domain)
    callback = 
    'myNavigationFunction'
    

    Cleanup

    Unregister the custom navigation callback function.

    slreq.registerNavigationFcn(domain,'');

    Input Arguments

    collapse all

    Third-party requirements tool domain for which to register the navigation callback function, specified as a string scalar or character vector.

    This argument should match the Domain property value of the referenced requirement.

    Navigation callback function name to register, specified as a string scalar or a character vector.

    Tips

    • You can clear the registered navigation callback function for a domain by entering:

      slreq.registerNavigationFcn(domain,"")

    • You can get the value of the Domain property for a referenced requirement at the MATLAB® command prompt by entering:

      domain = myReferencedRequirement.Domain
      domain =
      
          'Third-Party Tool'

    • You can use the template generated by Requirements Toolbox™ to create your navigation callback function. For more information, see Navigate from Imported Requirements to Original Requirements.

    Version History

    Introduced in R2019a