OK, well if "connector to Feature" is new in 7.5 there's reason to believe it'll make its way into the code template framework as well.
Meantime, the RefGUIDList helps with the original question. Not quite there, but almost.
1) Create a Tagged Value Type (Settings -> UML) according to:
Tag Name: TracedReqs
Description: List of Requirements
Detail:
Type=RefGUIDList;
Values=Requirement;
(You could add a 'Stereotypes=' line as well if you want to restrict the types of requirements an operation can be traced to.)
2) Create a Profile with a <<metaclass>> Operation and a <<stereotype>> ReqTraced extending Operation.
In the ReqTraced stereotype, add an attribute called TracedReqs.
My naming is terrible, but the important thing is that the attribute in the stereotype has the exact same name as the tagged value type you created in step 1. It doesn't need a type, just the name. The rest is EA Magic[size=8]TM[/size].
3) In the code generation templates for the language of your choice, add a Stereotyped Override to the Operation Notes template. Using the suitable comment formatting macro, add
%opTag:"TracedReqs"%
to the output.
You will need to go back and mark all your requirement-traced operations with the stereotype, of course. Once you've done that, go into the profile (the imported profile, not the profile definition), right-click the ReqTraced stereotype and select Synch. This will add the tag to all the stereotyped operations.
Operation tags aren't visible in the diagrams, but you can see them in the Tagged Value window.
The problem with this solution is that you don't get the requirement names in the comments, you get the GUIDs which are meaningless.
So does anyone know how to get the name from a GUID in the code template framework?
/Uffe