Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core')
-rw-r--r--codan/org.eclipse.cdt.codan.core/plugin.xml12
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanPreferencesLoader.java12
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CheckersRegisry.java27
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java (renamed from codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemsProfile.java)2
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java (renamed from codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemsProfile.java)10
5 files changed, 38 insertions, 25 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/plugin.xml b/codan/org.eclipse.cdt.codan.core/plugin.xml
index 954c0210f13..19f1fba88e8 100644
--- a/codan/org.eclipse.cdt.codan.core/plugin.xml
+++ b/codan/org.eclipse.cdt.codan.core/plugin.xml
@@ -42,6 +42,16 @@
point="org.eclipse.core.runtime.preferences">
</extension>
-
+ <extension
+ point="org.eclipse.cdt.codan.core.checkers"
+ id="org.eclipse.cdt.codan.core.categories">
+
+ <category
+ id="org.eclipse.cdt.codan.core.categories.ProgrammingProblems"
+ name="Potential programming problems"
+ >
+
+ </category>
+ </extension>
</plugin>
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanPreferencesLoader.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanPreferencesLoader.java
index 7419498d433..1e689729849 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanPreferencesLoader.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanPreferencesLoader.java
@@ -17,7 +17,7 @@ import java.util.Map;
import org.eclipse.cdt.codan.core.model.CodanProblem;
import org.eclipse.cdt.codan.core.model.CodanSeverity;
import org.eclipse.cdt.codan.core.model.IProblem;
-import org.eclipse.cdt.codan.core.model.IProblemsProfile;
+import org.eclipse.cdt.codan.core.model.IProblemProfile;
/**
* @author Alena
@@ -25,12 +25,12 @@ import org.eclipse.cdt.codan.core.model.IProblemsProfile;
*/
public class CodanPreferencesLoader {
private static String LIST_SEP = ",";
- private IProblemsProfile baseModel;
+ private IProblemProfile baseModel;
/**
* @param workspaceProfile
*/
- public CodanPreferencesLoader(IProblemsProfile profile) {
+ public CodanPreferencesLoader(IProblemProfile profile) {
setInput(profile);
}
@@ -41,7 +41,7 @@ public class CodanPreferencesLoader {
}
public void setInput(Object model) {
- baseModel = (IProblemsProfile) model;
+ baseModel = (IProblemProfile) model;
}
/**
@@ -133,8 +133,8 @@ public class CodanPreferencesLoader {
*/
private Map<Object, Boolean> fillChecked(Object element,
HashMap<Object, Boolean> hashMap) {
- if (element instanceof IProblemsProfile) {
- IProblemsProfile profile = (IProblemsProfile) element;
+ if (element instanceof IProblemProfile) {
+ IProblemProfile profile = (IProblemProfile) element;
IProblem[] problems = profile.getProblems();
for (IProblem iProblem : problems) {
hashMap.put(iProblem, iProblem.isEnabled());
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CheckersRegisry.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CheckersRegisry.java
index 7d5e2fb754b..9ecfd9770ba 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CheckersRegisry.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CheckersRegisry.java
@@ -35,11 +35,11 @@ public class CheckersRegisry implements Iterable<IChecker> {
private static final Object DEFAULT = "DEFAULT";
private Collection<IChecker> checkers = new ArrayList<IChecker>();
private static CheckersRegisry instance;
- private HashMap<Object, IProblemsProfile> profiles = new HashMap<Object, IProblemsProfile>();
+ private HashMap<Object, IProblemProfile> profiles = new HashMap<Object, IProblemProfile>();
private CheckersRegisry() {
instance = this;
- profiles.put(DEFAULT, new ProblemsProfile());
+ profiles.put(DEFAULT, new ProblemProfile());
readCheckersRegistry();
}
@@ -127,7 +127,9 @@ public class CheckersRegisry implements Iterable<IChecker> {
if (name == null)
name = id;
CodanProblem p = new CodanProblem(id, name);
- String category = getAtt(configurationElement, "category");
+ String category = getAtt(configurationElement, "category", false);
+ if (category == null)
+ category = "org.eclipse.cdt.codan.core.categories.ProgrammingProblems";
addProblem(p, category);
return p;
}
@@ -146,7 +148,8 @@ public class CheckersRegisry implements Iterable<IChecker> {
CodanCorePlugin.log("Extension "
+ configurationElement.getDeclaringExtension()
.getUniqueIdentifier()
- + " missing required attribute: " + name);
+ + " missing required attribute: "
+ + configurationElement.getName() + "." + name);
return elementValue;
}
@@ -165,7 +168,7 @@ public class CheckersRegisry implements Iterable<IChecker> {
}
public void addProblem(IProblem p, String category) {
- ((ProblemsProfile) getDefaultProfile()).addProblem(p,
+ ((ProblemProfile) getDefaultProfile()).addProblem(p,
getDefaultProfile().getRoot());
}
@@ -175,18 +178,18 @@ public class CheckersRegisry implements Iterable<IChecker> {
/**
* @return
*/
- public IProblemsProfile getDefaultProfile() {
+ public IProblemProfile getDefaultProfile() {
return profiles.get(DEFAULT);
}
/**
* @return
*/
- public IProblemsProfile getWorkspaceProfile() {
- IProblemsProfile wp = profiles.get(ResourcesPlugin.getWorkspace());
+ public IProblemProfile getWorkspaceProfile() {
+ IProblemProfile wp = profiles.get(ResourcesPlugin.getWorkspace());
if (wp == null) {
try {
- wp = (IProblemsProfile) getDefaultProfile().clone();
+ wp = (IProblemProfile) getDefaultProfile().clone();
// load default values
CodanPreferencesLoader loader = new CodanPreferencesLoader(wp);
String s = CodanCorePlugin.getDefault().getStorePreferences()
@@ -203,12 +206,12 @@ public class CheckersRegisry implements Iterable<IChecker> {
* @param element
* @return
*/
- public IProblemsProfile getResourceProfile(IResource element) {
- IProblemsProfile prof = profiles.get(element);
+ public IProblemProfile getResourceProfile(IResource element) {
+ IProblemProfile prof = profiles.get(element);
if (prof == null) {
if (element instanceof IProject) {
try {
- prof = (IProblemsProfile) getWorkspaceProfile().clone();
+ prof = (IProblemProfile) getWorkspaceProfile().clone();
// load default values
CodanPreferencesLoader loader = new CodanPreferencesLoader(
prof);
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemsProfile.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java
index 82ad198be5e..86e2880582a 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemsProfile.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java
@@ -14,7 +14,7 @@ package org.eclipse.cdt.codan.core.model;
* @author Alena
*
*/
-public interface IProblemsProfile extends IProblemElement {
+public interface IProblemProfile extends IProblemElement {
IProblemCategory getRoot();
IProblem findProblem(String id);
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemsProfile.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java
index d2b81f45fa0..5a60d13c990 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemsProfile.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java
@@ -17,7 +17,7 @@ import java.util.Collection;
* @author Alena
*
*/
-public class ProblemsProfile implements IProblemsProfile, Cloneable {
+public class ProblemProfile implements IProblemProfile, Cloneable {
private IProblemCategory rootCategory = new CodanProblemCategory("root",
"root");
@@ -25,7 +25,7 @@ public class ProblemsProfile implements IProblemsProfile, Cloneable {
* (non-Javadoc)
*
* @see
- * org.eclipse.cdt.codan.core.model.IProblemsProfile#getProblem(java.lang
+ * org.eclipse.cdt.codan.core.model.IProblemProfile#getProblem(java.lang
* .String)
*/
@Override
@@ -36,7 +36,7 @@ public class ProblemsProfile implements IProblemsProfile, Cloneable {
/*
* (non-Javadoc)
*
- * @see org.eclipse.cdt.codan.core.model.IProblemsProfile#getProblems()
+ * @see org.eclipse.cdt.codan.core.model.IProblemProfile#getProblems()
*/
@Override
public IProblem[] getProblems() {
@@ -65,7 +65,7 @@ public class ProblemsProfile implements IProblemsProfile, Cloneable {
/*
* (non-Javadoc)
*
- * @see org.eclipse.cdt.codan.core.model.IProblemsProfile#getRoot()
+ * @see org.eclipse.cdt.codan.core.model.IProblemProfile#getRoot()
*/
@Override
public IProblemCategory getRoot() {
@@ -90,7 +90,7 @@ public class ProblemsProfile implements IProblemsProfile, Cloneable {
@Override
public Object clone() {
try {
- ProblemsProfile clone = (ProblemsProfile) super.clone();
+ ProblemProfile clone = (ProblemProfile) super.clone();
clone.rootCategory = (IProblemCategory) ((CodanProblemCategory) this.rootCategory)
.clone();
return clone;

Back to the top