Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2011-02-21 21:57:11 -0500
committerAlena Laskavaia2011-02-21 21:57:11 -0500
commit353b63daf91362469785379eed19ed28d45c49bf (patch)
tree6f6f6f786ef6c5a028dc76553978a262b0563239 /codan/org.eclipse.cdt.codan.examples
parentd71dfb3b206f80ee3e212cd9e5874a75aa334b39 (diff)
downloadorg.eclipse.cdt-353b63daf91362469785379eed19ed28d45c49bf.tar.gz
org.eclipse.cdt-353b63daf91362469785379eed19ed28d45c49bf.tar.xz
org.eclipse.cdt-353b63daf91362469785379eed19ed28d45c49bf.zip
make CIndex checker extened AbtractCheckerWithParamters because it should
Diffstat (limited to 'codan/org.eclipse.cdt.codan.examples')
-rw-r--r--codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/NamingConventionFunctionIIndexChecker.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/NamingConventionFunctionIIndexChecker.java b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/NamingConventionFunctionIIndexChecker.java
index e7d1172e5b..f99d01a101 100644
--- a/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/NamingConventionFunctionIIndexChecker.java
+++ b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/NamingConventionFunctionIIndexChecker.java
@@ -21,9 +21,10 @@ import org.eclipse.cdt.codan.core.param.IProblemPreference;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICElementVisitor;
import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.core.runtime.CoreException;
/**
+ * Example demonstrate how to write checked using "C Model"
+ *
* @author Alena
*
*/
@@ -44,16 +45,15 @@ public class NamingConventionFunctionIIndexChecker extends
final IProblem pt = getProblemById(ER_ID, getFile());
try {
unit.accept(new ICElementVisitor() {
- public boolean visit(ICElement element) throws CoreException {
+ public boolean visit(ICElement element) {
if (element.getElementType() == ICElement.C_FUNCTION) {
String parameter = (String) pt.getPreference()
.getValue();
Pattern pattern = Pattern.compile(parameter);
String name = element.getElementName();
if (!pattern.matcher(name).find()) {
- reportProblem(ER_ID, getFile(), 1, // TODO: line
- // number
- name, parameter);
+ // TODO: line number
+ reportProblem(ER_ID, getFile(), 1, name, parameter);
}
return false;
}
@@ -73,10 +73,10 @@ public class NamingConventionFunctionIIndexChecker extends
* (org.eclipse.cdt.codan.core.model.IProblemWorkingCopy)
*/
public void initPreferences(IProblemWorkingCopy problem) {
+ super.initPreferences(problem);
IProblemPreference info = new BasicProblemPreference(PARAM_KEY,
"Name Pattern");
- info.setValue(DEFAULT_PATTERN);
- problem.setPreference(info);
+ addPreference(problem, info, DEFAULT_PATTERN);
}
@Override

Back to the top