Community
Participate
Working Groups
Build Identifier: 20101216-1529 Currently, checkers.exsd provides the messagePattern attribute for problem elements. This attribute is used to show a problem description in an IMarker *and* as a message in the "Code Analysis" Preference UI. When messagePattern is used in IMarkers, the placeholders in the pattern are replaced by values that are context-dependent (e.g. the name of a variable.) In the case of the "Code Analysis" Preference UI, such placeholders (if specified) are replaced with 'X', 'Y' and 'Z'. I'm creating a codan checker that runs a command-line tool for code analysis. We get the output of such tool and create IMarkers. Since use a single problem for all the issues found from the command line tool, the messagePattern for that problem is simply "{0}". This works fine, but in the Preference UI, the message (or description) shows as "X". In this case, I'd like to specify some context for this message in the Preference UI, such as "<context dependent>". A solution could be to add such optional parameters to the element "problem." If they are not specified, it will fall back to the existing "X", "Y" and "Z". For example, for my checker I could have: <problem category="org.eclipse.cdt.codan.core.categories.MyProblems" defaultEnabled="true" defaultSeverity="Warning" description="%problem.description.MyWarning" id="org.eclipse.cdt.codan.external.checkers.MyCheck.warning" messagePattern="%problem.messagePattern.MyWarning" exampleParam0="%problem.exampleParam0.MyWarning" name="%problem.name.MyWarning"> </problem> and in the bundle.properties: problem.name.MyWarning = Warnings problem.description.MyWarning = Warnings reported by Clang_Check problem.exampleParam0.MyWarning = <context dependent> problem.messagePattern.MyWarning = {0} In the "Code Analysis" Preference UI the message for this problem will show up as: Message: <context dependent> Reproducible: Always Steps to Reproduce: 1. Create a C++ Project 2. Open Project Preferences 3. Go to C/C++ General -> Code Analysis 4. Click on the problem "Class has a virtual method and non-virtual destructor" 5. See the description of the problem in the "Info" box: it has "X", "Y" and "Z" as values for the placeholders in the original message pattern.
Fixed in HEAD > 20110219.
*** cdt cvs genie on behalf of sprigogin *** Bug 337625 - Support for example parameters for message pattern to be used in codan preference UI. [*] CheckersRegistry.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegistry.java?root=Tools_Project&r1=1.4&r2=1.5 [*] IProblem.java 1.14 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java?root=Tools_Project&r1=1.13&r2=1.14 [*] checkers.exsd 1.8 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/schema/checkers.exsd?root=Tools_Project&r1=1.7&r2=1.8 [*] CodanProblem.java 1.11 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java?root=Tools_Project&r1=1.10&r2=1.11 [*] CodanPreferencePage.java 1.22 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java?root=Tools_Project&r1=1.21&r2=1.22