diff options
author | Alena Laskavaia | 2010-03-23 03:07:14 +0000 |
---|---|---|
committer | Alena Laskavaia | 2010-03-23 03:07:14 +0000 |
commit | 21fa408633f88b979cc3e98f647b18d321cba35b (patch) | |
tree | 330a4c4838895afda35263af8dc4594e5f5ec7f1 /codan | |
parent | 61da6659ce65fc3efa8371ed87396a5f3255a992 (diff) | |
download | org.eclipse.cdt-21fa408633f88b979cc3e98f647b18d321cba35b.tar.gz org.eclipse.cdt-21fa408633f88b979cc3e98f647b18d321cba35b.tar.xz org.eclipse.cdt-21fa408633f88b979cc3e98f647b18d321cba35b.zip |
- added description field for problem interface
Diffstat (limited to 'codan')
5 files changed, 90 insertions, 29 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/schema/checkers.exsd b/codan/org.eclipse.cdt.codan.core/schema/checkers.exsd index 71c0b570886..9dcfee18409 100644 --- a/codan/org.eclipse.cdt.codan.core/schema/checkers.exsd +++ b/codan/org.eclipse.cdt.codan.core/schema/checkers.exsd @@ -161,6 +161,16 @@ </appinfo> </annotation> </attribute> + <attribute name="description" type="string"> + <annotation> + <documentation> + Short description of the problem + </documentation> + <appinfo> + <meta.attribute translatable="true"/> + </appinfo> + </annotation> + </attribute> </complexType> </element> 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 44b958e7fb6..85f9a6aa5f6 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 @@ -11,18 +11,19 @@ package org.eclipse.cdt.codan.core.model; /** - * Interface representing code analysis problem type. For example "Null Pointer Dereference" - * is a problem. It has user visible Name and Message (translatable), as well as some other - * parameters, changeable by user such as enablement, severity and so on. Same problem - * cannot have two severities determined by runtime. If it is the case - two Problem should - * be created (i.e. one for error and one for warning). - * + * Interface representing code analysis problem type. For example + * "Null Pointer Dereference" is a problem. It has user visible Name and Message + * (translatable), as well as some other parameters, changeable by user such as + * enablement, severity and so on. Same problem cannot have two severities + * determined by runtime. If it is the case - two Problem should be created + * (i.e. one for error and one for warning). + * * Clients may implement and extend this interface. * <p> -* <strong>EXPERIMENTAL</strong>. This class or interface has been added as -* part of a work in progress. There is no guarantee that this API will -* work or that it will remain the same. -* </p> + * <strong>EXPERIMENTAL</strong>. This class or interface has been added as part + * of a work in progress. There is no guarantee that this API will work or that + * it will remain the same. + * </p> * */ public interface IProblem extends IProblemElement { @@ -70,4 +71,11 @@ public interface IProblem extends IProblemElement { * @return */ public IProblemParameterInfo getParameterInfo(); + + /** + * Get short description of a problem + * + * @return + */ + public String getDescription(); } diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemWorkingCopy.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemWorkingCopy.java index 4dbb1db2f9f..741e7b11e8b 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemWorkingCopy.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemWorkingCopy.java @@ -15,43 +15,63 @@ package org.eclipse.cdt.codan.core.model; * * Clients may extend and implement this interface * <p> - * <strong>EXPERIMENTAL</strong>. This class or interface has been added as - * part of a work in progress. There is no guarantee that this API will - * work or that it will remain the same. + * <strong>EXPERIMENTAL</strong>. This class or interface has been added as part + * of a work in progress. There is no guarantee that this API will work or that + * it will remain the same. * </p> */ public interface IProblemWorkingCopy extends IProblem { /** - * Set severity for this this problem instance. Severity can only be changed in profile - * not by checker when printing problems. - * @param sev - codan severity + * Set severity for this this problem instance. Severity can only be changed + * in profile not by checker when printing problems. + * + * @param sev + * - codan severity */ void setSeverity(CodanSeverity sev); /** * Set checker enablement. - * @param enabled - true if problem is enabled in profile + * + * @param enabled + * - true if problem is enabled in profile */ void setEnabled(boolean enabled); /** - * Set default message pattern. UI would call this method if user does not like default - * settings, checker should not use method, default message pattern should be set in - * checker extension - * @param messagePattern - java style message patter i.e. "Variable {0} is never used" + * Set default message pattern. UI would call this method if user does not + * like default settings, checker should not use method, default message + * pattern should be set in checker extension + * + * @param messagePattern + * - java style message patter i.e. "Variable {0} is never used" */ void setMessagePattern(String messagePattern); /** - * Set value for the checker parameter, checker may set value during initialization only - * @param key - key of the parameter - * @param value - parameter value + * Set value for the checker parameter, checker may set value during + * initialization only + * + * @param key + * - key of the parameter + * @param value + * - parameter value */ public void setParameter(Object key, Object value); /** - * Set parameter info object for the given problem, see {@link IProblemParameterInfo} + * Set parameter info object for the given problem, see + * {@link IProblemParameterInfo} + * * @param info */ public void setParameterInfo(IProblemParameterInfo info); + + /** + * Set problem description + * + * @param desc + * - problem description - short version, but longer than name + */ + public void setDescription(String desc); } 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 d7f1a1ec504..f7ec159d7ac 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 @@ -14,7 +14,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; - import org.eclipse.cdt.codan.core.CodanCorePlugin; import org.eclipse.cdt.codan.core.PreferenceConstants; import org.eclipse.cdt.codan.core.model.CodanSeverity; @@ -187,6 +186,7 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry { String enab = getAtt(configurationElement, "defaultEnabled", false); //$NON-NLS-1$ 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$ if (enab != null) { p.setEnabled(Boolean.valueOf(enab)); } @@ -198,6 +198,7 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry { if (patt != null) { p.setMessagePattern(patt); } + p.setDescription(desc); addProblem(p, category); return p; } 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 c43346600ae..b1c0444643e 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,7 +11,6 @@ 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; @@ -26,6 +25,7 @@ public class CodanProblem implements IProblemWorkingCopy { private HashMap<Object, Object> parameters = new HashMap<Object, Object>(0); private IProblemParameterInfo parameterInfo; private boolean frozen; + private String description; public CodanSeverity getSeverity() { return severity; @@ -60,7 +60,8 @@ public class CodanProblem implements IProblemWorkingCopy { } public void setSeverity(CodanSeverity sev) { - if (sev == null) throw new NullPointerException(); + if (sev == null) + throw new NullPointerException(); this.severity = sev; } @@ -117,6 +118,27 @@ public class CodanProblem implements IProblemWorkingCopy { } protected void checkSet() { - if (frozen) throw new IllegalStateException("Object is unmodifieble"); //$NON-NLS-1$ + 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; } } |