1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 00:45:28 +02:00

- fixed some API, added comments

This commit is contained in:
Alena Laskavaia 2009-09-23 23:29:36 +00:00
parent db91470f3c
commit e75f6ccf26
11 changed files with 77 additions and 14 deletions

View file

@ -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"

View file

@ -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);
/**

View file

@ -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();

View file

@ -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
*/

View file

@ -11,7 +11,7 @@
package org.eclipse.cdt.codan.core.model;
/**
* @author Alena
* Problem category or problem
*
*/
public interface IProblemElement extends Cloneable {

View file

@ -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()}

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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

View file

@ -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;