Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2010-05-15 22:18:02 -0400
committerAlena Laskavaia2010-05-15 22:18:02 -0400
commit3c2fd7ab95931e4527b67854237535705b9f8cdb (patch)
treee07124cf1367ef391068681dea5cf3a551a9bf59 /codan/org.eclipse.cdt.codan.examples
parenta0fe770fada2659aa000fcc63d078cf26821bf30 (diff)
downloadorg.eclipse.cdt-3c2fd7ab95931e4527b67854237535705b9f8cdb.tar.gz
org.eclipse.cdt-3c2fd7ab95931e4527b67854237535705b9f8cdb.tar.xz
org.eclipse.cdt-3c2fd7ab95931e4527b67854237535705b9f8cdb.zip
Cleaned up problem preferences interfaces and fixed persistence
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.java31
1 files changed, 13 insertions, 18 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 2daaf0d0a3..7ebb8e217f 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
@@ -11,12 +11,13 @@
package org.eclipse.cdt.codan.examples.checkers;
import java.util.regex.Pattern;
+
import org.eclipse.cdt.codan.core.cxx.model.AbstractCIndexChecker;
-import org.eclipse.cdt.codan.core.model.ICheckerWithParameters;
+import org.eclipse.cdt.codan.core.model.ICheckerWithPreferences;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
-import org.eclipse.cdt.codan.core.param.AbstractProblemParameterInfo;
-import org.eclipse.cdt.codan.core.param.IProblemParameterInfo;
+import org.eclipse.cdt.codan.core.param.BasicProblemPreference;
+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;
@@ -27,7 +28,7 @@ import org.eclipse.core.runtime.CoreException;
*
*/
public class NamingConventionFunctionIIndexChecker extends
- AbstractCIndexChecker implements ICheckerWithParameters {
+ AbstractCIndexChecker implements ICheckerWithPreferences {
private static final String DEFAULT_PATTERN = "^[a-z]"; // name starts with english lowercase letter //$NON-NLS-1$
public static final String PARAM_KEY = "pattern"; //$NON-NLS-1$
private static final String ER_ID = "org.eclipse.cdt.codan.examples.checkers.NamingConventionFunctionProblem"; //$NON-NLS-1$
@@ -45,7 +46,8 @@ public class NamingConventionFunctionIIndexChecker extends
unit.accept(new ICElementVisitor() {
public boolean visit(ICElement element) throws CoreException {
if (element.getElementType() == ICElement.C_FUNCTION) {
- String parameter = (String) pt.getParameter(PARAM_KEY);
+ String parameter = (String) pt.getPreference()
+ .getValue();
Pattern pattern = Pattern.compile(parameter);
String name = element.getElementName();
if (!pattern.matcher(name).find()) {
@@ -67,21 +69,14 @@ public class NamingConventionFunctionIIndexChecker extends
* (non-Javadoc)
*
* @see
- * org.eclipse.cdt.codan.core.model.ICheckerWithParameters#initParameters
+ * org.eclipse.cdt.codan.core.model.ICheckerWithPreferences#initParameters
* (org.eclipse.cdt.codan.core.model.IProblemWorkingCopy)
*/
- public void initParameters(IProblemWorkingCopy problem) {
- IProblemParameterInfo info = new AbstractProblemParameterInfo() {
- public String getLabel() {
- return "Name Pattern";
- }
-
- public String getKey() {
- return PARAM_KEY;
- }
- };
- problem.setParameterInfo(info);
- problem.setParameter(PARAM_KEY, DEFAULT_PATTERN);
+ public void initPreferences(IProblemWorkingCopy problem) {
+ IProblemPreference info = new BasicProblemPreference(PARAM_KEY,
+ "Name Pattern");
+ info.setValue(DEFAULT_PATTERN);
+ problem.setPreference(info);
}
@Override

Back to the top