summaryrefslogtreecommitdiffstats
path: root/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java')
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java87
1 files changed, 64 insertions, 23 deletions
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
index a094cc1..56b43c5 100644
--- a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Alena Laskavaia
+ * Copyright (c) 2009, 2010 Alena Laskavaia
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,20 +10,21 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.model;
-import java.util.Collection;
-import java.util.HashMap;
-
import org.eclipse.cdt.codan.core.model.CodanSeverity;
-import org.eclipse.cdt.codan.core.model.IProblem;
-import org.eclipse.cdt.codan.core.model.IProblemCategory;
+import org.eclipse.cdt.codan.core.model.IProblemReporter;
+import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
+import org.eclipse.cdt.codan.core.param.IProblemPreference;
-public class CodanProblem implements IProblem {
+public class CodanProblem implements IProblemWorkingCopy {
private String id;
private String name;
private String message;
private CodanSeverity severity = CodanSeverity.Warning;
private boolean enabled = true;
- private HashMap<Object, Object> properties = new HashMap<Object, Object>(0);
+ private IProblemPreference preference;
+ private boolean frozen;
+ private String description;
+ private String markerType = IProblemReporter.GENERIC_CODE_ANALYSIS_MARKER_TYPE;
public CodanSeverity getSeverity() {
return severity;
@@ -32,6 +33,7 @@ public class CodanProblem implements IProblem {
public CodanProblem(String problemId, String name) {
this.id = problemId;
this.name = name;
+ this.frozen = false;
}
public String getName() {
@@ -42,11 +44,6 @@ public class CodanProblem implements IProblem {
return id;
}
- public IProblemCategory getCategory() {
- // TODO Auto-generated method stub
- return null;
- }
-
@Override
public String toString() {
return name;
@@ -73,19 +70,19 @@ public class CodanProblem implements IProblem {
*/
@Override
public Object clone() throws CloneNotSupportedException {
- return super.clone();
+ CodanProblem prob = (CodanProblem) super.clone();
+ if (preference != null) {
+ prob.preference = (IProblemPreference) preference.clone();
+ }
+ return prob;
}
- public void setProperty(Object key, Object value) {
- properties.put(key, value);
+ public void setPreference(IProblemPreference value) {
+ preference = value;
}
- public Object getProperty(Object key) {
- return properties.get(key);
- };
-
- public Collection<Object> getPropertyKeys() {
- return properties.keySet();
+ public IProblemPreference getPreference() {
+ return preference;
}
/*
@@ -97,10 +94,54 @@ public class CodanProblem implements IProblem {
return message;
}
+ protected void freeze() {
+ frozen = true;
+ }
+
/**
- * @param message the message to set
+ * @param message
+ * the message to set
*/
public void setMessagePattern(String message) {
+ checkSet();
this.message = message;
}
+
+ protected void checkSet() {
+ if (frozen)
+ throw new IllegalStateException("Object is unmodifieble"); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.codan.core.model.IProblem#getDescription()
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.IProblemWorkingCopy#setDescription(java
+ * .lang.String)
+ */
+ 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;
+ }
}