diff --git a/codan/org.eclipse.cdt.codan.core/plugin.xml b/codan/org.eclipse.cdt.codan.core/plugin.xml
index c6127da064a..3257042185e 100644
--- a/codan/org.eclipse.cdt.codan.core/plugin.xml
+++ b/codan/org.eclipse.cdt.codan.core/plugin.xml
@@ -31,16 +31,24 @@
id="codanProblem"
name="Code Analysis Problem"
point="org.eclipse.core.resources.markers">
-
+
+
+
+
+
+
+
+
+
diff --git a/codan/org.eclipse.cdt.codan.core/schema/checkers.exsd b/codan/org.eclipse.cdt.codan.core/schema/checkers.exsd
index 9dcfee18409..19901171a72 100644
--- a/codan/org.eclipse.cdt.codan.core/schema/checkers.exsd
+++ b/codan/org.eclipse.cdt.codan.core/schema/checkers.exsd
@@ -171,6 +171,16 @@
+
+
+
+ Marker type to use to generate problem, default is the generic codan marker
+
+
+
+
+
+
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java
index 85f9a6aa5f6..62d3a3e840d 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java
@@ -25,6 +25,8 @@ package org.eclipse.cdt.codan.core.model;
* it will remain the same.
*
*
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
*/
public interface IProblem extends IProblemElement {
/**
@@ -78,4 +80,11 @@ public interface IProblem extends IProblemElement {
* @return
*/
public String getDescription();
+
+ /**
+ * Return marker id for the problem
+ *
+ * @return
+ */
+ public String getMarkerType();
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java
index 3f37a82432c..108f0c574b0 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java
@@ -187,6 +187,8 @@ public class CheckersRegisry implements Iterable, ICheckersRegistry {
String sev = getAtt(configurationElement, "defaultSeverity", false); //$NON-NLS-1$
String patt = getAtt(configurationElement, "messagePattern", false); //$NON-NLS-1$
String desc = getAtt(configurationElement, "description", false); //$NON-NLS-1$
+ String markerType = getAtt(configurationElement,
+ "markerType", false); //$NON-NLS-1$
if (enab != null) {
p.setEnabled(Boolean.valueOf(enab));
}
@@ -198,6 +200,9 @@ public class CheckersRegisry implements Iterable, ICheckersRegistry {
if (patt != null) {
p.setMessagePattern(patt);
}
+ if (markerType != null) {
+ p.setMarkerType(markerType);
+ }
p.setDescription(desc);
addProblem(p, category);
return p;
@@ -323,7 +328,7 @@ public class CheckersRegisry implements Iterable, ICheckersRegistry {
wp = (IProblemProfile) getDefaultProfile().clone();
// load default values
CodanPreferencesLoader loader = new CodanPreferencesLoader(wp);
- loader.load(loader.getWorkspaceNode());
+ loader.load(CodanPreferencesLoader.getWorkspaceNode());
} catch (CloneNotSupportedException e) {
wp = getDefaultProfile();
}
@@ -357,7 +362,7 @@ public class CheckersRegisry implements Iterable, ICheckersRegistry {
// load default values
CodanPreferencesLoader loader = new CodanPreferencesLoader(
prof);
- Preferences projectNode = loader
+ Preferences projectNode = CodanPreferencesLoader
.getProjectNode((IProject) element);
boolean useWorkspace = projectNode.getBoolean(
PreferenceConstants.P_USE_PARENT, false);
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanApplication.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanApplication.java
index 01841129f12..2d6fd47976a 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanApplication.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanApplication.java
@@ -37,8 +37,9 @@ public class CodanApplication implements IApplication {
CodanRuntime runtime = CodanRuntime.getInstance();
runtime.setProblemReporter(new CodanMarkerProblemReporter() {
@Override
- public void reportProblem(String id, int severity, IFile file,
- int lineNumber, int startChar, int endChar, String message) {
+ public void reportProblem(String id, String markerType,
+ int severity, IFile file, int lineNumber, int startChar,
+ int endChar, String message) {
System.out.println(file.getLocation() + ":" + lineNumber + ": "
+ message);
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
index 32c7910801c..f52db454915 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
@@ -59,8 +59,8 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
} else {
message = MessageFormat.format(messagePattern, args);
}
- reportProblem(id, severity, file, lineNumber, loc.getStartingChar(),
- loc.getEndingChar(), message);
+ reportProblem(id, problem.getMarkerType(), severity, file, lineNumber,
+ loc.getStartingChar(), loc.getEndingChar(), message);
}
/*
@@ -70,12 +70,13 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
* org.eclipse.cdt.codan.core.model.IProblemReporter#reportProblem(java.
* lang.String, org.eclipse.core.resources.IFile, int, java.lang.String)
*/
- public void reportProblem(String id, int severity, IFile file,
- int lineNumber, int startChar, int endChar, String message) {
+ public void reportProblem(String id, String markerType, int severity,
+ IFile file, int lineNumber, int startChar, int endChar,
+ String message) {
try {
// Do not put in duplicates
- IMarker[] cur = file.findMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE,
- false, IResource.DEPTH_ZERO);
+ IMarker[] cur = file.findMarkers(markerType, false,
+ IResource.DEPTH_ZERO);
if (cur != null) {
for (IMarker element : cur) {
int line = ((Integer) element
@@ -90,8 +91,7 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
}
}
}
- IMarker marker = file
- .createMarker(GENERIC_CODE_ANALYSIS_MARKER_TYPE);
+ IMarker marker = file.createMarker(markerType);
marker.setAttribute(IMarker.MESSAGE, message);
marker.setAttribute(IMarker.SEVERITY, severity);
marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
index b1c0444643e..b6365758646 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
@@ -11,9 +11,10 @@
package org.eclipse.cdt.codan.internal.core.model;
import java.util.HashMap;
+
import org.eclipse.cdt.codan.core.model.CodanSeverity;
-import org.eclipse.cdt.codan.core.model.IProblemCategory;
import org.eclipse.cdt.codan.core.model.IProblemParameterInfo;
+import org.eclipse.cdt.codan.core.model.IProblemReporter;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
public class CodanProblem implements IProblemWorkingCopy {
@@ -26,6 +27,7 @@ public class CodanProblem implements IProblemWorkingCopy {
private IProblemParameterInfo parameterInfo;
private boolean frozen;
private String description;
+ private String markerType = IProblemReporter.GENERIC_CODE_ANALYSIS_MARKER_TYPE;
public CodanSeverity getSeverity() {
return severity;
@@ -45,11 +47,6 @@ public class CodanProblem implements IProblemWorkingCopy {
return id;
}
- public IProblemCategory getCategory() {
- // TODO Auto-generated method stub
- return null;
- }
-
@Override
public String toString() {
return name;
@@ -89,7 +86,7 @@ public class CodanProblem implements IProblemWorkingCopy {
public Object getParameter(Object key) {
return parameters.get(key);
- };
+ }
public IProblemParameterInfo getParameterInfo() {
return parameterInfo;
@@ -141,4 +138,17 @@ public class CodanProblem implements IProblemWorkingCopy {
public void setDescription(String desc) {
this.description = desc;
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.codan.core.model.IProblem#getMarkerType()
+ */
+ public String getMarkerType() {
+ return markerType;
+ }
+
+ public void setMarkerType(String type) {
+ markerType = type;
+ }
}