mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
- fixed some API, added comments
This commit is contained in:
parent
db91470f3c
commit
e75f6ccf26
11 changed files with 77 additions and 14 deletions
|
@ -11,4 +11,5 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||||
Export-Package: org.eclipse.cdt.codan.core,
|
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"
|
||||||
|
|
|
@ -12,9 +12,23 @@ package org.eclipse.cdt.codan.core.model;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface that checker must implement. CDT Checker must be able to process a resource.
|
||||||
|
*/
|
||||||
public interface IChecker {
|
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);
|
boolean enabledInContext(IResource resource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,15 +12,38 @@ package org.eclipse.cdt.codan.core.model;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface representing code analysis problem
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface IProblem extends IProblemElement {
|
public interface IProblem extends IProblemElement {
|
||||||
|
/**
|
||||||
|
* Name of the problem - user visible "title", not the message
|
||||||
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unique problem id. Should be qualified by plugin name to maintain uniqueness.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is enabled in current context (usually within profile)
|
||||||
|
* @return true if enabled
|
||||||
|
*/
|
||||||
boolean isEnabled();
|
boolean isEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current severity
|
||||||
|
* @return severity
|
||||||
|
*/
|
||||||
CodanSeverity getSeverity();
|
CodanSeverity getSeverity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message pattern, java patter like 'Variable {0} is never used here'
|
||||||
|
* @return pattern
|
||||||
|
*/
|
||||||
String getMessagePattern();
|
String getMessagePattern();
|
||||||
|
|
||||||
void setSeverity(CodanSeverity sev);
|
void setSeverity(CodanSeverity sev);
|
||||||
|
@ -31,6 +54,11 @@ public interface IProblem extends IProblemElement {
|
||||||
|
|
||||||
public void setProperty(Object key, Object value);
|
public void setProperty(Object key, Object value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get custom property
|
||||||
|
* @param property name
|
||||||
|
* @return property object
|
||||||
|
*/
|
||||||
public Object getProperty(Object key);
|
public Object getProperty(Object key);
|
||||||
|
|
||||||
public Collection<Object> getPropertyKeys();
|
public Collection<Object> getPropertyKeys();
|
||||||
|
|
|
@ -10,20 +10,37 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.core.model;
|
package org.eclipse.cdt.codan.core.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Problem category
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface IProblemCategory extends IProblemElement {
|
public interface IProblemCategory extends IProblemElement {
|
||||||
|
/**
|
||||||
|
* Category name
|
||||||
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unique category id
|
||||||
|
* @return id
|
||||||
|
*/
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
Object[] getChildren();
|
/**
|
||||||
|
* Category children (other categories or problems)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IProblemElement[] getChildren();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Find problem by id within children recursively
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IProblem findProblem(String id);
|
IProblem findProblem(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Find category by id within children recursively
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
package org.eclipse.cdt.codan.core.model;
|
package org.eclipse.cdt.codan.core.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alena
|
* Problem category or problem
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IProblemElement extends Cloneable {
|
public interface IProblemElement extends Cloneable {
|
||||||
|
|
|
@ -11,8 +11,10 @@
|
||||||
package org.eclipse.cdt.codan.core.model;
|
package org.eclipse.cdt.codan.core.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Problem Profile contains tree of categories and problems. Profiles can have
|
* Problem Profile contains tree of categories and problems. For user profile is quick way
|
||||||
* different categories and different problems set, problems with the same id
|
* 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
|
* can have different severities/enablement in different profiles. To obtain
|
||||||
* profile use class {@link CheckersRegisry#getResourceProfile,
|
* profile use class {@link CheckersRegisry#getResourceProfile,
|
||||||
* CheckersRegisry#getDefaultProfile() or CheckersRegisry#getWorkspaceProfile()}
|
* CheckersRegisry#getDefaultProfile() or CheckersRegisry#getWorkspaceProfile()}
|
||||||
|
|
|
@ -16,16 +16,15 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.CodanCorePlugin;
|
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.PreferenceConstants;
|
||||||
import org.eclipse.cdt.codan.core.model.IChecker;
|
import org.eclipse.cdt.codan.core.model.IChecker;
|
||||||
import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
|
import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblem;
|
import org.eclipse.cdt.codan.core.model.IProblem;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblemCategory;
|
import org.eclipse.cdt.codan.core.model.IProblemCategory;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblemProfile;
|
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.CodanProblem;
|
||||||
import org.eclipse.cdt.codan.internal.core.model.CodanProblemCategory;
|
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.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.ProjectScope;
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Alena Laskavaia - initial API and implementation
|
* 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.CodanSeverity;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblem;
|
import org.eclipse.cdt.codan.core.model.IProblem;
|
|
@ -40,8 +40,8 @@ public class CodanProblemCategory implements IProblemCategory, Cloneable {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] getChildren() {
|
public IProblemElement[] getChildren() {
|
||||||
return list.toArray();
|
return (IProblemElement[]) list.toArray(new IProblemElement[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addChild(IProblemElement p) {
|
public void addChild(IProblemElement p) {
|
||||||
|
|
|
@ -8,12 +8,14 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Alena Laskavaia - initial API and implementation
|
* 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.ArrayList;
|
||||||
import java.util.Collection;
|
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
|
* @author Alena
|
|
@ -10,12 +10,12 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.internal.ui.preferences;
|
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.PreferenceConstants;
|
||||||
import org.eclipse.cdt.codan.core.model.CodanSeverity;
|
import org.eclipse.cdt.codan.core.model.CodanSeverity;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblem;
|
import org.eclipse.cdt.codan.core.model.IProblem;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblemCategory;
|
import org.eclipse.cdt.codan.core.model.IProblemCategory;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblemProfile;
|
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.BaseLabelProvider;
|
||||||
import org.eclipse.jface.viewers.CellEditor;
|
import org.eclipse.jface.viewers.CellEditor;
|
||||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||||
|
|
Loading…
Add table
Reference in a new issue