Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAlena Laskavaia2009-09-23 23:29:36 +0000
committerAlena Laskavaia2009-09-23 23:29:36 +0000
commite75f6ccf26b8554ca3757a594f7cd5b0096bb403 (patch)
tree50691f3afbdc4512d7c871d58deacc583c10005c /codan
parentdb91470f3ca844d0910df6cb195b131754d3cdc6 (diff)
downloadorg.eclipse.cdt-e75f6ccf26b8554ca3757a594f7cd5b0096bb403.tar.gz
org.eclipse.cdt-e75f6ccf26b8554ca3757a594f7cd5b0096bb403.tar.xz
org.eclipse.cdt-e75f6ccf26b8554ca3757a594f7cd5b0096bb403.zip
- fixed some API, added comments
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF3
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java16
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java28
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java19
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java2
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java6
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java3
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanPreferencesLoader.java (renamed from codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java)2
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java (renamed from codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java)6
-rw-r--r--codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java2
11 files changed, 77 insertions, 14 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF b/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
index b77eb2ca230..b6eba46dfdd 100644
--- a/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
+++ b/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
@@ -11,4 +11,5 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.cdt.codan.core,
- org.eclipse.cdt.codan.core.model
+ org.eclipse.cdt.codan.core.model,
+ org.eclipse.cdt.codan.internal.core;x-friends:="org.eclipse.cdt.codan.core,org.eclipse.cdt.codan.core.test,org.eclipse.cdt.codan.ui"
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java
index 4f995db40f8..60f7cb2b99e 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java
@@ -12,9 +12,23 @@ package org.eclipse.cdt.codan.core.model;
import org.eclipse.core.resources.IResource;
+/**
+ * Interface that checker must implement. CDT Checker must be able to process a resource.
+ */
public interface IChecker {
- public boolean processResource(IResource resource);
+ /**
+ * Main method that checker should implement that actually detects errors
+ * @param resource - resource to run on
+ * @return true if need to traverse children
+ */
+ boolean processResource(IResource resource);
+ /**
+ * Implement this method to trim down type of resource you are interested in,
+ * usually it will be c/c++ files only
+ * @param resource
+ * @return
+ */
boolean enabledInContext(IResource resource);
/**
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 52cfff26c20..bbab3139dd8 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
@@ -12,15 +12,38 @@ package org.eclipse.cdt.codan.core.model;
import java.util.Collection;
+/**
+ * Interface representing code analysis problem
+ *
+ */
public interface IProblem extends IProblemElement {
+ /**
+ * Name of the problem - user visible "title", not the message
+ */
String getName();
+ /**
+ * Unique problem id. Should be qualified by plugin name to maintain uniqueness.
+ * @return
+ */
String getId();
+ /**
+ * Is enabled in current context (usually within profile)
+ * @return true if enabled
+ */
boolean isEnabled();
+ /**
+ * Get current severity
+ * @return severity
+ */
CodanSeverity getSeverity();
+ /**
+ * Message pattern, java patter like 'Variable {0} is never used here'
+ * @return pattern
+ */
String getMessagePattern();
void setSeverity(CodanSeverity sev);
@@ -31,6 +54,11 @@ public interface IProblem extends IProblemElement {
public void setProperty(Object key, Object value);
+ /**
+ * Get custom property
+ * @param property name
+ * @return property object
+ */
public Object getProperty(Object key);
public Collection<Object> getPropertyKeys();
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java
index 45a62a0a294..cd3de3a9645 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java
@@ -10,20 +10,37 @@
*******************************************************************************/
package org.eclipse.cdt.codan.core.model;
+/**
+ * Problem category
+ *
+ */
public interface IProblemCategory extends IProblemElement {
+ /**
+ * Category name
+ */
String getName();
+ /**
+ * Unique category id
+ * @return id
+ */
String getId();
- Object[] getChildren();
+ /**
+ * Category children (other categories or problems)
+ * @return
+ */
+ IProblemElement[] getChildren();
/**
+ * Find problem by id within children recursively
* @param id
* @return
*/
IProblem findProblem(String id);
/**
+ * Find category by id within children recursively
* @param id
* @return
*/
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java
index b9f7fb8a378..318f304da0e 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java
@@ -11,7 +11,7 @@
package org.eclipse.cdt.codan.core.model;
/**
- * @author Alena
+ * Problem category or problem
*
*/
public interface IProblemElement extends Cloneable {
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java
index 9dc465e9b22..896eb101e7b 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java
@@ -11,8 +11,10 @@
package org.eclipse.cdt.codan.core.model;
/**
- * Problem Profile contains tree of categories and problems. Profiles can have
- * different categories and different problems set, problems with the same id
+ * Problem Profile contains tree of categories and problems. For user profile is quick way
+ * to switch between problems sets depends on task he is doing (i.e. find real bugs, vs doing code style report)
+ * User can set different profiles in different projects.
+ * Profiles can have different categories and different problems set, problems with the same id
* can have different severities/enablement in different profiles. To obtain
* profile use class {@link CheckersRegisry#getResourceProfile,
* CheckersRegisry#getDefaultProfile() or CheckersRegisry#getWorkspaceProfile()}
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 82ace802583..64141f31882 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
@@ -16,16 +16,15 @@ import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.cdt.codan.core.CodanCorePlugin;
-import org.eclipse.cdt.codan.core.CodanPreferencesLoader;
import org.eclipse.cdt.codan.core.PreferenceConstants;
import org.eclipse.cdt.codan.core.model.IChecker;
import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemCategory;
import org.eclipse.cdt.codan.core.model.IProblemProfile;
-import org.eclipse.cdt.codan.core.model.ProblemProfile;
import org.eclipse.cdt.codan.internal.core.model.CodanProblem;
import org.eclipse.cdt.codan.internal.core.model.CodanProblemCategory;
+import org.eclipse.cdt.codan.internal.core.model.ProblemProfile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ProjectScope;
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanPreferencesLoader.java
index 6fd6318d8b3..bafff9a23cb 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanPreferencesLoader.java
@@ -8,7 +8,7 @@
* Contributors:
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.codan.core;
+package org.eclipse.cdt.codan.internal.core;
import org.eclipse.cdt.codan.core.model.CodanSeverity;
import org.eclipse.cdt.codan.core.model.IProblem;
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java
index 289e0fdec02..fc6348034e1 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java
@@ -40,8 +40,8 @@ public class CodanProblemCategory implements IProblemCategory, Cloneable {
return name;
}
- public Object[] getChildren() {
- return list.toArray();
+ public IProblemElement[] getChildren() {
+ return (IProblemElement[]) list.toArray(new IProblemElement[list.size()]);
}
public void addChild(IProblemElement p) {
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java
index ae90e76c8d9..d2330f194f0 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java
@@ -8,12 +8,14 @@
* Contributors:
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.codan.core.model;
+package org.eclipse.cdt.codan.internal.core.model;
import java.util.ArrayList;
import java.util.Collection;
-import org.eclipse.cdt.codan.internal.core.model.CodanProblemCategory;
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemCategory;
+import org.eclipse.cdt.codan.core.model.IProblemProfile;
/**
* @author Alena
diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java
index 6ba82c63e36..26e433e5e9d 100644
--- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java
+++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.preferences;
-import org.eclipse.cdt.codan.core.CodanPreferencesLoader;
import org.eclipse.cdt.codan.core.PreferenceConstants;
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.IProblemProfile;
+import org.eclipse.cdt.codan.internal.core.CodanPreferencesLoader;
import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;

Back to the top