Bug 246067

Summary: [code templates] provide a since tag argument resolver
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: markus.kell.r
Version: 3.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 301337    

Description Dani Megert CLA 2008-09-03 06:38:59 EDT
I20080902-0800.

A since tag argument resolver would allow us to specify the @since tag in our code templates in a generic way.

We could get the tag from the bundle manifest if available or from an additional code template (so we only need to change it once per project).
Comment 1 Benjamin Muskalla CLA 2008-09-16 17:38:10 EDT
I really like the idea.
One thing which came to my mind was regarding non-plugin projects. If nothing is specified the resolver could take a look at the package-info.java if it exists. Not sure about the convention used there at the moment.
Comment 2 Benjamin Muskalla CLA 2008-09-16 17:38:59 EDT
The javadoc @since tag would be the one to choose: http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#packagecomment
Comment 3 Markus Keller CLA 2008-09-17 18:09:23 EDT
(In reply to comment #1)
Nah, the @since in package-info.java should tell when the package was added. It should not be increased with every release of the package.

The variable should rather resolve to the empty string in case no version could be found. E.g. "@since ${version}" would then resolve to "@since " (which would then have to be completed by the user).
Comment 4 Markus Keller CLA 2010-02-02 12:26:08 EST
Could be implemented like this:

- add a new context type "org.eclipse.jdt.ui.default_since_tag_context"
- add a code template for the default since tag

- add a new variable "${since_tag}" that is available in all code template comment contexts
- add a registryId to the registry created in JavaPlugin#getCodeTemplateContextRegistry(), so that PDE can contribute a resolver for the "${since_tag}" variable 
- after creating the registry, check whether it contains a resolver for "${since_tag}", and if it doesn't, add a resolver that inserts the template for the default since tag.