mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
@Override annotations.
This commit is contained in:
parent
4071a34762
commit
d8c53b2501
87 changed files with 311 additions and 13 deletions
|
@ -37,6 +37,7 @@ public class CheckersUiActivator extends AbstractUIPlugin {
|
||||||
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
|
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
@ -49,6 +50,7 @@ public class CheckersUiActivator extends AbstractUIPlugin {
|
||||||
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
|
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
plugin = null;
|
plugin = null;
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
|
|
|
@ -39,6 +39,7 @@ public class CaseBreakQuickFixBreak extends AbstractAstRewriteQuickFix {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Messages.CaseBreakQuickFixBreak_Label;
|
return Messages.CaseBreakQuickFixBreak_Label;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.eclipse.text.edits.InsertEdit;
|
||||||
import org.eclipse.text.edits.MalformedTreeException;
|
import org.eclipse.text.edits.MalformedTreeException;
|
||||||
|
|
||||||
public class CaseBreakQuickFixComment extends AbstractCodanCMarkerResolution {
|
public class CaseBreakQuickFixComment extends AbstractCodanCMarkerResolution {
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Messages.CaseBreakQuickFixComment_Label;
|
return Messages.CaseBreakQuickFixComment_Label;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,12 @@ import org.eclipse.jface.text.IDocument;
|
||||||
* quick fix for catch by value
|
* quick fix for catch by value
|
||||||
*/
|
*/
|
||||||
public class CatchByConstReferenceQuickFix extends AbstractCodanCMarkerResolution {
|
public class CatchByConstReferenceQuickFix extends AbstractCodanCMarkerResolution {
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Messages.CatchByConstReferenceQuickFix_Message;
|
return Messages.CatchByConstReferenceQuickFix_Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void apply(IMarker marker, IDocument document) {
|
public void apply(IMarker marker, IDocument document) {
|
||||||
CatchByReferenceQuickFix.applyCatchByReferenceQuickFix(marker, document, true);
|
CatchByReferenceQuickFix.applyCatchByReferenceQuickFix(marker, document, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,12 @@ import org.eclipse.jface.text.IDocument;
|
||||||
* quick fix for catch by value
|
* quick fix for catch by value
|
||||||
*/
|
*/
|
||||||
public class CatchByReferenceQuickFix extends AbstractCodanCMarkerResolution {
|
public class CatchByReferenceQuickFix extends AbstractCodanCMarkerResolution {
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Messages.CatchByReferenceQuickFix_Message;
|
return Messages.CatchByReferenceQuickFix_Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void apply(IMarker marker, IDocument document) {
|
public void apply(IMarker marker, IDocument document) {
|
||||||
applyCatchByReferenceQuickFix(marker, document, false);
|
applyCatchByReferenceQuickFix(marker, document, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.jface.text.IDocument;
|
||||||
* quick fix for assignment in condition
|
* quick fix for assignment in condition
|
||||||
*/
|
*/
|
||||||
public class QuickFixAssignmentInCondition extends AbstractCodanCMarkerResolution {
|
public class QuickFixAssignmentInCondition extends AbstractCodanCMarkerResolution {
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Messages.QuickFixAssignmentInCondition_Message;
|
return Messages.QuickFixAssignmentInCondition_Message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.ltk.core.refactoring.Change;
|
import org.eclipse.ltk.core.refactoring.Change;
|
||||||
|
|
||||||
public class QuickFixCreateField extends AbstractAstRewriteQuickFix {
|
public class QuickFixCreateField extends AbstractAstRewriteQuickFix {
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Messages.QuickFixCreateField_0;
|
return Messages.QuickFixCreateField_0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.ltk.core.refactoring.Change;
|
import org.eclipse.ltk.core.refactoring.Change;
|
||||||
|
|
||||||
public class QuickFixCreateLocalVariable extends AbstractAstRewriteQuickFix {
|
public class QuickFixCreateLocalVariable extends AbstractAstRewriteQuickFix {
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Messages.QuickFixCreateLocalVariable_0;
|
return Messages.QuickFixCreateLocalVariable_0;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +39,7 @@ public class QuickFixCreateLocalVariable extends AbstractAstRewriteQuickFix {
|
||||||
* @param astName
|
* @param astName
|
||||||
* @param r
|
* @param r
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void modifyAST(IIndex index, IMarker marker) {
|
public void modifyAST(IIndex index, IMarker marker) {
|
||||||
CxxAstUtils utils = CxxAstUtils.getInstance();
|
CxxAstUtils utils = CxxAstUtils.getInstance();
|
||||||
IASTTranslationUnit ast;
|
IASTTranslationUnit ast;
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.ltk.core.refactoring.CompositeChange;
|
import org.eclipse.ltk.core.refactoring.CompositeChange;
|
||||||
|
|
||||||
public class QuickFixCreateParameter extends AbstractAstRewriteQuickFix {
|
public class QuickFixCreateParameter extends AbstractAstRewriteQuickFix {
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Messages.QuickFixCreateParameter_0;
|
return Messages.QuickFixCreateParameter_0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
|
||||||
public class SuggestedParenthesisQuickFix extends AbstractCodanCMarkerResolution {
|
public class SuggestedParenthesisQuickFix extends AbstractCodanCMarkerResolution {
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Messages.SuggestedParenthesisQuickFix_Message;
|
return Messages.SuggestedParenthesisQuickFix_Message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class CodanCheckersActivator extends Plugin {
|
||||||
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
|
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
@ -49,6 +50,7 @@ public class CodanCheckersActivator extends Plugin {
|
||||||
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
|
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
plugin = null;
|
plugin = null;
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
|
@ -71,7 +73,7 @@ public class CodanCheckersActivator extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(String message) {
|
public static void log(String message) {
|
||||||
getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, message));
|
getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,6 +81,6 @@ public class CodanCheckersActivator extends Plugin {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static IStatus getStatus(Throwable e) {
|
public static IStatus getStatus(Throwable e) {
|
||||||
return new Status(Status.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
|
return new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
|
||||||
CheckerLaunchMode.RUN_ON_DEMAND);
|
CheckerLaunchMode.RUN_ON_DEMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
try {
|
try {
|
||||||
ast.accept(new OnEachClass());
|
ast.accept(new OnEachClass());
|
||||||
|
@ -77,6 +78,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
|
||||||
shouldVisitParameterDeclarations = true;
|
shouldVisitParameterDeclarations = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTDeclaration declaration) {
|
public int visit(IASTDeclaration declaration) {
|
||||||
// Looking for the variables declarations.
|
// Looking for the variables declarations.
|
||||||
if (declaration instanceof IASTSimpleDeclaration) {
|
if (declaration instanceof IASTSimpleDeclaration) {
|
||||||
|
@ -96,6 +98,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTParameterDeclaration parameterDecl) {
|
public int visit(IASTParameterDeclaration parameterDecl) {
|
||||||
// Looking for parameters declaration. Skip references & pointers.
|
// Looking for parameters declaration. Skip references & pointers.
|
||||||
if (!hasPointerOrReference(parameterDecl.getDeclarator())) {
|
if (!hasPointerOrReference(parameterDecl.getDeclarator())) {
|
||||||
|
@ -122,6 +125,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
if (expression instanceof ICPPASTNewExpression) {
|
if (expression instanceof ICPPASTNewExpression) {
|
||||||
// New expression.
|
// New expression.
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
|
||||||
public class AssignmentInConditionChecker extends AbstractIndexAstChecker {
|
public class AssignmentInConditionChecker extends AbstractIndexAstChecker {
|
||||||
private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem"; //$NON-NLS-1$
|
private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
// traverse the ast using the visitor pattern.
|
// traverse the ast using the visitor pattern.
|
||||||
ast.accept(new CheckCodeVisitor());
|
ast.accept(new CheckCodeVisitor());
|
||||||
|
@ -36,6 +37,7 @@ public class AssignmentInConditionChecker extends AbstractIndexAstChecker {
|
||||||
shouldVisitExpressions = true;
|
shouldVisitExpressions = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
if (isAssignmentExpression(expression) && isUsedAsCondition(expression)) {
|
if (isAssignmentExpression(expression) && isUsedAsCondition(expression)) {
|
||||||
reportProblem(ER_ID, expression, expression.getRawSignature());
|
reportProblem(ER_ID, expression, expression.getRawSignature());
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
public class AssignmentToItselfChecker extends AbstractIndexAstChecker {
|
public class AssignmentToItselfChecker extends AbstractIndexAstChecker {
|
||||||
private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem"; //$NON-NLS-1$
|
private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
// traverse the ast using the visitor pattern.
|
// traverse the ast using the visitor pattern.
|
||||||
ast.accept(new ASTVisitor() {
|
ast.accept(new ASTVisitor() {
|
||||||
|
@ -32,6 +33,7 @@ public class AssignmentToItselfChecker extends AbstractIndexAstChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
// visit expressions
|
// visit expressions
|
||||||
|
@Override
|
||||||
public int visit(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
if (isAssignmentToItself(expression)) {
|
if (isAssignmentToItself(expression)) {
|
||||||
reportProblem(ER_ID, expression, expression.getRawSignature());
|
reportProblem(ER_ID, expression, expression.getRawSignature());
|
||||||
|
|
|
@ -217,6 +217,7 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
|
||||||
return getCommentMap().getLastFreestandingCommentForNode(statement);
|
return getCommentMap().getLastFreestandingCommentForNode(statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void initPreferences(IProblemWorkingCopy problem) {
|
public void initPreferences(IProblemWorkingCopy problem) {
|
||||||
super.initPreferences(problem);
|
super.initPreferences(problem);
|
||||||
addPreference(problem, PARAM_NO_BREAK_COMMENT, CheckersMessages.CaseBreakChecker_DefaultNoBreakCommentDescription,
|
addPreference(problem, PARAM_NO_BREAK_COMMENT, CheckersMessages.CaseBreakChecker_DefaultNoBreakCommentDescription,
|
||||||
|
@ -225,6 +226,7 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
|
||||||
addPreference(problem, PARAM_EMPTY_CASE, CheckersMessages.CaseBreakChecker_EmptyCaseDescription, Boolean.FALSE);
|
addPreference(problem, PARAM_EMPTY_CASE, CheckersMessages.CaseBreakChecker_EmptyCaseDescription, Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
_checkLastCase = (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_LAST_CASE);
|
_checkLastCase = (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_LAST_CASE);
|
||||||
_checkEmptyCase = (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_EMPTY_CASE);
|
_checkEmptyCase = (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_EMPTY_CASE);
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class CatchByReference extends AbstractIndexAstChecker {
|
||||||
public static final String PARAM_EXCEPT_ARG_LIST = "exceptions"; //$NON-NLS-1$
|
public static final String PARAM_EXCEPT_ARG_LIST = "exceptions"; //$NON-NLS-1$
|
||||||
public static final String PARAM_UNKNOWN_TYPE = "unknown"; //$NON-NLS-1$
|
public static final String PARAM_UNKNOWN_TYPE = "unknown"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
// traverse the ast using the visitor pattern.
|
// traverse the ast using the visitor pattern.
|
||||||
ast.accept(new OnCatch());
|
ast.accept(new OnCatch());
|
||||||
|
@ -55,6 +56,7 @@ public class CatchByReference extends AbstractIndexAstChecker {
|
||||||
shouldVisitStatements = true;
|
shouldVisitStatements = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTStatement stmt) {
|
public int visit(IASTStatement stmt) {
|
||||||
if (stmt instanceof ICPPASTTryBlockStatement) {
|
if (stmt instanceof ICPPASTTryBlockStatement) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.internal.checkers;
|
package org.eclipse.cdt.codan.internal.checkers;
|
||||||
|
|
||||||
import java.util.Stack;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker;
|
import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
|
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
|
||||||
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
|
@ -36,7 +37,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
|
@ -57,6 +57,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization"; //$NON-NLS-1$
|
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization"; //$NON-NLS-1$
|
||||||
public static final String PARAM_SKIP = "skip"; //$NON-NLS-1$
|
public static final String PARAM_SKIP = "skip"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
ast.accept(new OnEachClass());
|
ast.accept(new OnEachClass());
|
||||||
}
|
}
|
||||||
|
@ -64,7 +65,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
class OnEachClass extends ASTVisitor {
|
class OnEachClass extends ASTVisitor {
|
||||||
|
|
||||||
// NOTE: Classes can be nested and even can be declared in constructors of the other classes
|
// NOTE: Classes can be nested and even can be declared in constructors of the other classes
|
||||||
private Stack< Set<IField> > constructorsStack = new Stack< Set<IField> >();
|
private final Stack< Set<IField> > constructorsStack = new Stack< Set<IField> >();
|
||||||
|
|
||||||
OnEachClass() {
|
OnEachClass() {
|
||||||
shouldVisitDeclarations = true;
|
shouldVisitDeclarations = true;
|
||||||
|
@ -72,6 +73,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
shouldVisitExpressions = skipConstructorsWithFCalls();
|
shouldVisitExpressions = skipConstructorsWithFCalls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTDeclaration declaration) {
|
public int visit(IASTDeclaration declaration) {
|
||||||
ICPPConstructor constructor = getConstructor(declaration);
|
ICPPConstructor constructor = getConstructor(declaration);
|
||||||
if (constructor != null) {
|
if (constructor != null) {
|
||||||
|
@ -87,6 +89,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int leave(IASTDeclaration declaration) {
|
public int leave(IASTDeclaration declaration) {
|
||||||
if (getConstructor(declaration) != null) {
|
if (getConstructor(declaration) != null) {
|
||||||
for (IField field : constructorsStack.pop()) {
|
for (IField field : constructorsStack.pop()) {
|
||||||
|
@ -96,6 +99,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
if (!constructorsStack.empty() && expression instanceof IASTFunctionCallExpression) {
|
if (!constructorsStack.empty() && expression instanceof IASTFunctionCallExpression) {
|
||||||
Set<IField> actualConstructorFields = constructorsStack.peek();
|
Set<IField> actualConstructorFields = constructorsStack.peek();
|
||||||
|
@ -141,15 +145,16 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
} else if (expr instanceof ICPPASTUnaryExpression) {
|
} else if (expr instanceof ICPPASTUnaryExpression) {
|
||||||
ICPPASTUnaryExpression unExpr = (ICPPASTUnaryExpression)expr;
|
ICPPASTUnaryExpression unExpr = (ICPPASTUnaryExpression)expr;
|
||||||
switch (unExpr.getOperator()) {
|
switch (unExpr.getOperator()) {
|
||||||
case ICPPASTUnaryExpression.op_amper:
|
case IASTUnaryExpression.op_amper:
|
||||||
case ICPPASTUnaryExpression.op_star:
|
case IASTUnaryExpression.op_star:
|
||||||
case ICPPASTUnaryExpression.op_bracketedPrimary:
|
case IASTUnaryExpression.op_bracketedPrimary:
|
||||||
return referencesThis(unExpr.getOperand());
|
return referencesThis(unExpr.getOperand());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
if (!constructorsStack.empty()) {
|
if (!constructorsStack.empty()) {
|
||||||
Set<IField> actualConstructorFields = constructorsStack.peek();
|
Set<IField> actualConstructorFields = constructorsStack.peek();
|
||||||
|
@ -198,7 +203,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
|
||||||
IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding();
|
IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding();
|
||||||
if (binding instanceof ICPPConstructor) {
|
if (binding instanceof ICPPConstructor) {
|
||||||
ICPPConstructor constructor = (ICPPConstructor) binding;
|
ICPPConstructor constructor = (ICPPConstructor) binding;
|
||||||
if (constructor.getClassOwner().getKey()!=ICPPClassType.k_union) {
|
if (constructor.getClassOwner().getKey()!=ICompositeType.k_union) {
|
||||||
return constructor;
|
return constructor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
|
||||||
public static final String PARAM_METHODS = "macro"; //$NON-NLS-1$
|
public static final String PARAM_METHODS = "macro"; //$NON-NLS-1$
|
||||||
public static final String PARAM_EXCEPT_ARG_LIST = "exceptions"; //$NON-NLS-1$
|
public static final String PARAM_EXCEPT_ARG_LIST = "exceptions"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
final List<IProblem> pts = getProblemsByMainId(ER_ID, getFile());
|
final List<IProblem> pts = getProblemsByMainId(ER_ID, getFile());
|
||||||
try {
|
try {
|
||||||
|
@ -45,6 +46,7 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
|
||||||
shouldVisitDeclarations = true;
|
shouldVisitDeclarations = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTDeclaration element) {
|
public int visit(IASTDeclaration element) {
|
||||||
if (element instanceof IASTFunctionDefinition) {
|
if (element instanceof IASTFunctionDefinition) {
|
||||||
IASTName astName = ((IASTFunctionDefinition) element).getDeclarator().getName();
|
IASTName astName = ((IASTFunctionDefinition) element).getDeclarator().getName();
|
||||||
|
@ -109,6 +111,7 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckerWithPreferences#initParameters
|
* org.eclipse.cdt.codan.core.model.ICheckerWithPreferences#initParameters
|
||||||
* (org.eclipse.cdt.codan.core.model.IProblemWorkingCopy)
|
* (org.eclipse.cdt.codan.core.model.IProblemWorkingCopy)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void initPreferences(IProblemWorkingCopy problem) {
|
public void initPreferences(IProblemWorkingCopy problem) {
|
||||||
super.initPreferences(problem);
|
super.initPreferences(problem);
|
||||||
addPreference(problem, PARAM_KEY, CheckersMessages.NamingConventionFunctionChecker_LabelNamePattern, "^[a-z]"); //$NON-NLS-1$
|
addPreference(problem, PARAM_KEY, CheckersMessages.NamingConventionFunctionChecker_LabelNamePattern, "^[a-z]"); //$NON-NLS-1$
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
|
||||||
public class NonVirtualDestructor extends AbstractIndexAstChecker {
|
public class NonVirtualDestructor extends AbstractIndexAstChecker {
|
||||||
public static final String PROBLEM_ID = "org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem"; //$NON-NLS-1$
|
public static final String PROBLEM_ID = "org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
// Traverse the AST using the visitor pattern.
|
// Traverse the AST using the visitor pattern.
|
||||||
ast.accept(new OnEachClass());
|
ast.accept(new OnEachClass());
|
||||||
|
@ -70,6 +71,7 @@ public class NonVirtualDestructor extends AbstractIndexAstChecker {
|
||||||
shouldVisitDeclSpecifiers = true;
|
shouldVisitDeclSpecifiers = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTDeclSpecifier decl) {
|
public int visit(IASTDeclSpecifier decl) {
|
||||||
if (decl instanceof ICPPASTCompositeTypeSpecifier) {
|
if (decl instanceof ICPPASTCompositeTypeSpecifier) {
|
||||||
ICPPASTCompositeTypeSpecifier spec = (ICPPASTCompositeTypeSpecifier) decl;
|
ICPPASTCompositeTypeSpecifier spec = (ICPPASTCompositeTypeSpecifier) decl;
|
||||||
|
|
|
@ -71,6 +71,7 @@ public class ProblemBindingChecker extends AbstractIndexAstChecker {
|
||||||
getLaunchModePreference(problem).enableInLaunchModes(CheckerLaunchMode.RUN_AS_YOU_TYPE, CheckerLaunchMode.RUN_ON_DEMAND);
|
getLaunchModePreference(problem).enableInLaunchModes(CheckerLaunchMode.RUN_AS_YOU_TYPE, CheckerLaunchMode.RUN_ON_DEMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
try {
|
try {
|
||||||
ast.accept(new ASTVisitor() {
|
ast.accept(new ASTVisitor() {
|
||||||
|
|
|
@ -42,7 +42,6 @@ import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLambdaExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLambdaExpression;
|
||||||
|
@ -66,7 +65,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
|
||||||
public static final String RET_NORET_ID = "org.eclipse.cdt.codan.checkers.errnoreturn"; //$NON-NLS-1$
|
public static final String RET_NORET_ID = "org.eclipse.cdt.codan.checkers.errnoreturn"; //$NON-NLS-1$
|
||||||
|
|
||||||
class ReturnStmpVisitor extends ASTVisitor {
|
class ReturnStmpVisitor extends ASTVisitor {
|
||||||
private IASTFunctionDefinition func;
|
private final IASTFunctionDefinition func;
|
||||||
boolean hasret;
|
boolean hasret;
|
||||||
|
|
||||||
ReturnStmpVisitor(IASTFunctionDefinition func) {
|
ReturnStmpVisitor(IASTFunctionDefinition func) {
|
||||||
|
@ -77,12 +76,14 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
|
||||||
this.hasret = false;
|
this.hasret = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTDeclaration element) {
|
public int visit(IASTDeclaration element) {
|
||||||
if (element != func)
|
if (element != func)
|
||||||
return PROCESS_SKIP; // skip inner functions
|
return PROCESS_SKIP; // skip inner functions
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTExpression expr) {
|
public int visit(IASTExpression expr) {
|
||||||
if (expr instanceof ICPPASTLambdaExpression) {
|
if (expr instanceof ICPPASTLambdaExpression) {
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
|
@ -90,6 +91,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTStatement stmt) {
|
public int visit(IASTStatement stmt) {
|
||||||
if (stmt instanceof IASTReturnStatement) {
|
if (stmt instanceof IASTReturnStatement) {
|
||||||
IASTReturnStatement ret = (IASTReturnStatement) stmt;
|
IASTReturnStatement ret = (IASTReturnStatement) stmt;
|
||||||
|
@ -246,7 +248,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected boolean isExplicitReturn(IASTFunctionDefinition func) {
|
protected boolean isExplicitReturn(IASTFunctionDefinition func) {
|
||||||
return getDeclSpecType(func) != ICASTSimpleDeclSpecifier.t_unspecified;
|
return getDeclSpecType(func) != IASTSimpleDeclSpecifier.t_unspecified;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,6 +308,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* checker must implement @link ICheckerWithPreferences */
|
/* checker must implement @link ICheckerWithPreferences */
|
||||||
|
@Override
|
||||||
public void initPreferences(IProblemWorkingCopy problem) {
|
public void initPreferences(IProblemWorkingCopy problem) {
|
||||||
super.initPreferences(problem);
|
super.initPreferences(problem);
|
||||||
if (problem.getId().equals(RET_NO_VALUE_ID) || problem.getId().equals(RET_NORET_ID)) {
|
if (problem.getId().equals(RET_NO_VALUE_ID) || problem.getId().equals(RET_NORET_ID)) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class ReturnStyleChecker extends AbstractIndexAstChecker {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
ast.accept(new ASTVisitor() {
|
ast.accept(new ASTVisitor() {
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class StatementHasNoEffectChecker extends AbstractIndexAstChecker {
|
||||||
public static final String PARAM_MACRO_ID = "macro"; //$NON-NLS-1$
|
public static final String PARAM_MACRO_ID = "macro"; //$NON-NLS-1$
|
||||||
public static final String PARAM_EXCEPT_ARG_LIST = "exceptions"; //$NON-NLS-1$
|
public static final String PARAM_EXCEPT_ARG_LIST = "exceptions"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
ast.accept(new CheckStmpVisitor());
|
ast.accept(new CheckStmpVisitor());
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class SuggestedParenthesisChecker extends AbstractIndexAstChecker {
|
||||||
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem"; //$NON-NLS-1$
|
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem"; //$NON-NLS-1$
|
||||||
public static final String PARAM_NOT = "paramNot"; //$NON-NLS-1$
|
public static final String PARAM_NOT = "paramNot"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
// traverse the ast using the visitor pattern.
|
// traverse the ast using the visitor pattern.
|
||||||
ast.accept(new ExpressionVisitor());
|
ast.accept(new ExpressionVisitor());
|
||||||
|
@ -45,6 +46,7 @@ public class SuggestedParenthesisChecker extends AbstractIndexAstChecker {
|
||||||
shouldVisitExpressions = true;
|
shouldVisitExpressions = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
int precedence = getPrecedence(expression);
|
int precedence = getPrecedence(expression);
|
||||||
IASTNode parent = expression.getParent();
|
IASTNode parent = expression.getParent();
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class SuspiciousSemicolonChecker extends AbstractIndexAstChecker {
|
||||||
public static final String PARAM_ELSE = "else"; //$NON-NLS-1$
|
public static final String PARAM_ELSE = "else"; //$NON-NLS-1$
|
||||||
public static final String PARAM_ALFTER_ELSE = "afterelse"; //$NON-NLS-1$
|
public static final String PARAM_ALFTER_ELSE = "afterelse"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
ast.accept(new ASTVisitor() {
|
ast.accept(new ASTVisitor() {
|
||||||
{
|
{
|
||||||
|
@ -74,6 +75,7 @@ public class SuspiciousSemicolonChecker extends AbstractIndexAstChecker {
|
||||||
return macro != null;
|
return macro != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void initPreferences(IProblemWorkingCopy problem) {
|
public void initPreferences(IProblemWorkingCopy problem) {
|
||||||
super.initPreferences(problem);
|
super.initPreferences(problem);
|
||||||
addPreference(problem, PARAM_ELSE, CheckersMessages.SuspiciousSemicolonChecker_ParamElse, Boolean.FALSE);
|
addPreference(problem, PARAM_ELSE, CheckersMessages.SuspiciousSemicolonChecker_ParamElse, Boolean.FALSE);
|
||||||
|
|
|
@ -101,6 +101,7 @@ public class UnusedSymbolInFileScopeChecker extends AbstractIndexAstChecker {
|
||||||
!staticVariableDeclarations.isEmpty();
|
!staticVariableDeclarations.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
if (ast.isHeaderUnit())
|
if (ast.isHeaderUnit())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -78,6 +78,7 @@ public class ScanfFormatStringSecurityChecker extends AbstractIndexAstChecker {
|
||||||
new VulnerableFunction("sscanf", 1) //$NON-NLS-1$
|
new VulnerableFunction("sscanf", 1) //$NON-NLS-1$
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
ast.accept(new FormatStringVisitor());
|
ast.accept(new FormatStringVisitor());
|
||||||
}
|
}
|
||||||
|
@ -111,6 +112,7 @@ public class ScanfFormatStringSecurityChecker extends AbstractIndexAstChecker {
|
||||||
shouldVisitExpressions = true;
|
shouldVisitExpressions = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
if (expression instanceof IASTFunctionCallExpression) {
|
if (expression instanceof IASTFunctionCallExpression) {
|
||||||
IASTFunctionCallExpression callExpression = (IASTFunctionCallExpression) expression;
|
IASTFunctionCallExpression callExpression = (IASTFunctionCallExpression) expression;
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class Activator extends Plugin {
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
|
* org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
@ -47,6 +48,7 @@ public class Activator extends Plugin {
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
|
* org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
plugin = null;
|
plugin = null;
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class CodanCommentMap implements ICodanCommentMap {
|
||||||
* @see org.eclipse.cdt.codan.core.cxx.model.ICodanCommentMap#
|
* @see org.eclipse.cdt.codan.core.cxx.model.ICodanCommentMap#
|
||||||
* getTrailingCommentsForNode(org.eclipse.cdt.core.dom.ast.IASTNode)
|
* getTrailingCommentsForNode(org.eclipse.cdt.core.dom.ast.IASTNode)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<IASTComment> getTrailingCommentsForNode(IASTNode node) {
|
public List<IASTComment> getTrailingCommentsForNode(IASTNode node) {
|
||||||
return commentedNodeMap.getTrailingCommentsForNode(node);
|
return commentedNodeMap.getTrailingCommentsForNode(node);
|
||||||
}
|
}
|
||||||
|
@ -46,6 +47,7 @@ public class CodanCommentMap implements ICodanCommentMap {
|
||||||
* @see org.eclipse.cdt.codan.core.cxx.model.ICodanCommentMap#
|
* @see org.eclipse.cdt.codan.core.cxx.model.ICodanCommentMap#
|
||||||
* getLeadingCommentsForNode(org.eclipse.cdt.core.dom.ast.IASTNode)
|
* getLeadingCommentsForNode(org.eclipse.cdt.core.dom.ast.IASTNode)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<IASTComment> getLeadingCommentsForNode(IASTNode node) {
|
public List<IASTComment> getLeadingCommentsForNode(IASTNode node) {
|
||||||
return commentedNodeMap.getLeadingCommentsForNode(node);
|
return commentedNodeMap.getLeadingCommentsForNode(node);
|
||||||
}
|
}
|
||||||
|
@ -57,6 +59,7 @@ public class CodanCommentMap implements ICodanCommentMap {
|
||||||
* org.eclipse.cdt.codan.core.cxx.model.ICodanCommentMap#getFreestandingForNode
|
* org.eclipse.cdt.codan.core.cxx.model.ICodanCommentMap#getFreestandingForNode
|
||||||
* (org.eclipse.cdt.core.dom.ast.IASTStatement)
|
* (org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<IASTComment> getFreestandingForNode(IASTNode node) {
|
public List<IASTComment> getFreestandingForNode(IASTNode node) {
|
||||||
return commentedNodeMap.getFreestandingCommentsForNode(node);
|
return commentedNodeMap.getFreestandingCommentsForNode(node);
|
||||||
}
|
}
|
||||||
|
@ -65,6 +68,7 @@ public class CodanCommentMap implements ICodanCommentMap {
|
||||||
* @param node
|
* @param node
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IASTComment getLastLeadingCommentForNode(IASTNode node) {
|
public IASTComment getLastLeadingCommentForNode(IASTNode node) {
|
||||||
IASTComment comment = null;
|
IASTComment comment = null;
|
||||||
List<IASTComment> comms = getLeadingCommentsForNode(node);
|
List<IASTComment> comms = getLeadingCommentsForNode(node);
|
||||||
|
@ -78,6 +82,7 @@ public class CodanCommentMap implements ICodanCommentMap {
|
||||||
* @param node
|
* @param node
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IASTComment getFirstTrailingCommentForNode(IASTNode node) {
|
public IASTComment getFirstTrailingCommentForNode(IASTNode node) {
|
||||||
IASTComment comment = null;
|
IASTComment comment = null;
|
||||||
List<IASTComment> comms = getTrailingCommentsForNode(node);
|
List<IASTComment> comms = getTrailingCommentsForNode(node);
|
||||||
|
@ -91,6 +96,7 @@ public class CodanCommentMap implements ICodanCommentMap {
|
||||||
* @param node
|
* @param node
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IASTComment getLastFreestandingCommentForNode(IASTNode node) {
|
public IASTComment getLastFreestandingCommentForNode(IASTNode node) {
|
||||||
IASTComment comment = null;
|
IASTComment comment = null;
|
||||||
List<IASTComment> comms = getFreestandingForNode(node);
|
List<IASTComment> comms = getFreestandingForNode(node);
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class CxxDecisionNode extends DecisionNode {
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toStringData() {
|
public String toStringData() {
|
||||||
if (getNode() == null)
|
if (getNode() == null)
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class CxxExitNode extends ExitNode implements IExitNode {
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toStringData() {
|
public String toStringData() {
|
||||||
if (getNode() == null)
|
if (getNode() == null)
|
||||||
return "return; // fake"; //$NON-NLS-1$
|
return "return; // fake"; //$NON-NLS-1$
|
||||||
|
|
|
@ -27,14 +27,17 @@ public class CxxNodeFactory extends NodeFactory implements INodeFactory {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IPlainNode createPlainNode() {
|
public IPlainNode createPlainNode() {
|
||||||
return new CxxPlainNode();
|
return new CxxPlainNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IDecisionNode createDecisionNode() {
|
public IDecisionNode createDecisionNode() {
|
||||||
return new CxxDecisionNode();
|
return new CxxDecisionNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IExitNode createExitNode() {
|
public IExitNode createExitNode() {
|
||||||
return new CxxExitNode();
|
return new CxxExitNode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class CxxPlainNode extends PlainNode {
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toStringData() {
|
public String toStringData() {
|
||||||
if (getNode() == null)
|
if (getNode() == null)
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
* Abstract class for checkers that do all the work on function definition level
|
* Abstract class for checkers that do all the work on function definition level
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractAstFunctionChecker extends AbstractIndexAstChecker implements ICheckerWithPreferences {
|
public abstract class AbstractAstFunctionChecker extends AbstractIndexAstChecker implements ICheckerWithPreferences {
|
||||||
|
@Override
|
||||||
public void processAst(IASTTranslationUnit ast) {
|
public void processAst(IASTTranslationUnit ast) {
|
||||||
// traverse the ast using the visitor pattern.
|
// traverse the ast using the visitor pattern.
|
||||||
ast.accept(new ASTVisitor() {
|
ast.accept(new ASTVisitor() {
|
||||||
|
@ -27,6 +28,7 @@ public abstract class AbstractAstFunctionChecker extends AbstractIndexAstChecker
|
||||||
shouldVisitDeclarations = true;
|
shouldVisitDeclarations = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTDeclaration element) {
|
public int visit(IASTDeclaration element) {
|
||||||
if (element instanceof IASTFunctionDefinition) {
|
if (element instanceof IASTFunctionDefinition) {
|
||||||
processFunction((IASTFunctionDefinition) element);
|
processFunction((IASTFunctionDefinition) element);
|
||||||
|
|
|
@ -53,6 +53,7 @@ public abstract class AbstractCIndexChecker extends AbstractCheckerWithProblemPr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public synchronized boolean processResource(IResource resource) {
|
public synchronized boolean processResource(IResource resource) {
|
||||||
if (resource instanceof IFile) {
|
if (resource instanceof IFile) {
|
||||||
IFile file = (IFile) resource;
|
IFile file = (IFile) resource;
|
||||||
|
|
|
@ -88,6 +88,7 @@ public abstract class AbstractIndexAstChecker extends AbstractCheckerWithProblem
|
||||||
*
|
*
|
||||||
* @see IRunnableInEditorChecker#processModel(Object, ICheckerInvocationContext)
|
* @see IRunnableInEditorChecker#processModel(Object, ICheckerInvocationContext)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public synchronized void processModel(Object model, ICheckerInvocationContext context) {
|
public synchronized void processModel(Object model, ICheckerInvocationContext context) {
|
||||||
if (model instanceof IASTTranslationUnit) {
|
if (model instanceof IASTTranslationUnit) {
|
||||||
setContext(context);
|
setContext(context);
|
||||||
|
|
|
@ -137,6 +137,7 @@ public class CxxModelsCache implements ICodanDisposable {
|
||||||
* @see IDisposable#dispose()
|
* @see IDisposable#dispose()
|
||||||
* This method should not be called concurrently with any other method.
|
* This method should not be called concurrently with any other method.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
Assert.isTrue(!disposed, "CxxASTCache.dispose() called more than once."); //$NON-NLS-1$
|
Assert.isTrue(!disposed, "CxxASTCache.dispose() called more than once."); //$NON-NLS-1$
|
||||||
disposed = true;
|
disposed = true;
|
||||||
|
|
|
@ -41,6 +41,7 @@ public abstract class AbstractChecker implements IChecker {
|
||||||
* @return true if checker is enabled in context of resource, if returns
|
* @return true if checker is enabled in context of resource, if returns
|
||||||
* false checker's "processResource" method won't be called
|
* false checker's "processResource" method won't be called
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean enabledInContext(IResource res) {
|
public boolean enabledInContext(IResource res) {
|
||||||
return res instanceof IFile;
|
return res instanceof IFile;
|
||||||
}
|
}
|
||||||
|
@ -120,6 +121,7 @@ public abstract class AbstractChecker implements IChecker {
|
||||||
* @return problem reporter for given checker
|
* @return problem reporter for given checker
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemReporter getProblemReporter() {
|
public IProblemReporter getProblemReporter() {
|
||||||
return problemReporter;
|
return problemReporter;
|
||||||
}
|
}
|
||||||
|
@ -166,6 +168,7 @@ public abstract class AbstractChecker implements IChecker {
|
||||||
* Defines if checker should be run as user type in editor. Override this
|
* Defines if checker should be run as user type in editor. Override this
|
||||||
* method is checker is too heavy for that (runs too long)
|
* method is checker is too heavy for that (runs too long)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean runInEditor() {
|
public boolean runInEditor() {
|
||||||
return this instanceof IRunnableInEditorChecker;
|
return this instanceof IRunnableInEditorChecker;
|
||||||
}
|
}
|
||||||
|
@ -202,6 +205,7 @@ public abstract class AbstractChecker implements IChecker {
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void before(IResource resource) {
|
public void before(IResource resource) {
|
||||||
IProblemReporter problemReporter = CodanRuntime.getInstance().getProblemReporter();
|
IProblemReporter problemReporter = CodanRuntime.getInstance().getProblemReporter();
|
||||||
this.problemReporter = problemReporter;
|
this.problemReporter = problemReporter;
|
||||||
|
@ -220,6 +224,7 @@ public abstract class AbstractChecker implements IChecker {
|
||||||
/**
|
/**
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void after(IResource resource) {
|
public void after(IResource resource) {
|
||||||
if (problemReporter instanceof IProblemReporterSessionPersistent) {
|
if (problemReporter instanceof IProblemReporterSessionPersistent) {
|
||||||
// Delete general markers
|
// Delete general markers
|
||||||
|
@ -241,6 +246,7 @@ public abstract class AbstractChecker implements IChecker {
|
||||||
* @see IChecker#processResource(IResource, ICheckerInvocationContext)
|
* @see IChecker#processResource(IResource, ICheckerInvocationContext)
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public synchronized boolean processResource(IResource resource, ICheckerInvocationContext context)
|
public synchronized boolean processResource(IResource resource, ICheckerInvocationContext context)
|
||||||
throws OperationCanceledException {
|
throws OperationCanceledException {
|
||||||
this.setContext(context);
|
this.setContext(context);
|
||||||
|
|
|
@ -35,6 +35,7 @@ public abstract class AbstractCheckerWithProblemPreferences extends AbstractChec
|
||||||
/**
|
/**
|
||||||
* Checker that actually has parameter must override this
|
* Checker that actually has parameter must override this
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void initPreferences(IProblemWorkingCopy problem) {
|
public void initPreferences(IProblemWorkingCopy problem) {
|
||||||
getTopLevelPreference(problem); // initialize
|
getTopLevelPreference(problem); // initialize
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ public abstract class AbstractProblemLocation implements IProblemLocation {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemLocation#getData()
|
* @see org.eclipse.cdt.codan.core.model.IProblemLocation#getData()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getData() {
|
public Object getData() {
|
||||||
return extra;
|
return extra;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +82,7 @@ public abstract class AbstractProblemLocation implements IProblemLocation {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemLocation#getFile()
|
* @see org.eclipse.cdt.codan.core.model.IProblemLocation#getFile()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IResource getFile() {
|
public IResource getFile() {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
@ -96,6 +98,7 @@ public abstract class AbstractProblemLocation implements IProblemLocation {
|
||||||
/**
|
/**
|
||||||
* Problem line number referenced in problem view in location field
|
* Problem line number referenced in problem view in location field
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getLineNumber() {
|
public int getLineNumber() {
|
||||||
return getStartingLineNumber();
|
return getStartingLineNumber();
|
||||||
}
|
}
|
||||||
|
@ -112,6 +115,7 @@ public abstract class AbstractProblemLocation implements IProblemLocation {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemLocation#getStartPos()
|
* @see org.eclipse.cdt.codan.core.model.IProblemLocation#getStartPos()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getStartingChar() {
|
public int getStartingChar() {
|
||||||
return posStart;
|
return posStart;
|
||||||
}
|
}
|
||||||
|
@ -121,6 +125,7 @@ public abstract class AbstractProblemLocation implements IProblemLocation {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemLocation#getEndingChar()
|
* @see org.eclipse.cdt.codan.core.model.IProblemLocation#getEndingChar()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getEndingChar() {
|
public int getEndingChar() {
|
||||||
return posEnd;
|
return posEnd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.core.resources.IResource;
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractProblemReporter implements IProblemReporter {
|
public abstract class AbstractProblemReporter implements IProblemReporter {
|
||||||
|
@Override
|
||||||
public void reportProblem(String id, IProblemLocation loc, Object... args) {
|
public void reportProblem(String id, IProblemLocation loc, Object... args) {
|
||||||
IResource file = loc.getFile();
|
IResource file = loc.getFile();
|
||||||
if (file == null)
|
if (file == null)
|
||||||
|
|
|
@ -29,6 +29,7 @@ public interface ICheckersRegistry extends Iterable<IChecker> {
|
||||||
*
|
*
|
||||||
* @return iterator for registered checkers
|
* @return iterator for registered checkers
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Iterator<IChecker> iterator();
|
public Iterator<IChecker> iterator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,18 +31,22 @@ public abstract class AbstractProblemPreference implements IProblemPreference {
|
||||||
private String uiInfo;
|
private String uiInfo;
|
||||||
private IProblemPreference parent;
|
private IProblemPreference parent;
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getToolTip() {
|
public String getToolTip() {
|
||||||
return toolTip;
|
return toolTip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getUiInfo() {
|
public String getUiInfo() {
|
||||||
return uiInfo;
|
return uiInfo;
|
||||||
}
|
}
|
||||||
|
@ -104,10 +108,12 @@ public abstract class AbstractProblemPreference implements IProblemPreference {
|
||||||
this.uiInfo = uiinfo;
|
this.uiInfo = uiinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setValue(Object value) {
|
public void setValue(Object value) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
@ -142,6 +148,7 @@ public abstract class AbstractProblemPreference implements IProblemPreference {
|
||||||
return tokenizer;
|
return tokenizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IProblemPreference getParent() {
|
public IProblemPreference getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +161,7 @@ public abstract class AbstractProblemPreference implements IProblemPreference {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getQualifiedKey() {
|
public String getQualifiedKey() {
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
return getKey();
|
return getKey();
|
||||||
|
@ -166,6 +174,7 @@ public abstract class AbstractProblemPreference implements IProblemPreference {
|
||||||
*/
|
*/
|
||||||
public abstract void importValue(StreamTokenizer tokenizer) throws IOException;
|
public abstract void importValue(StreamTokenizer tokenizer) throws IOException;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void importValue(String str) {
|
public void importValue(String str) {
|
||||||
StreamTokenizer tokenizer = getImportTokenizer(str);
|
StreamTokenizer tokenizer = getImportTokenizer(str);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class BasicProblemPreference extends AbstractProblemPreference {
|
||||||
protected Object value;
|
protected Object value;
|
||||||
private PreferenceType type = PreferenceType.TYPE_STRING;
|
private PreferenceType type = PreferenceType.TYPE_STRING;
|
||||||
|
|
||||||
|
@Override
|
||||||
public PreferenceType getType() {
|
public PreferenceType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +79,7 @@ public class BasicProblemPreference extends AbstractProblemPreference {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String exportValue() {
|
public String exportValue() {
|
||||||
Pattern pat = Pattern.compile("^[A-Za-z0-9._-]+$"); //$NON-NLS-1$
|
Pattern pat = Pattern.compile("^[A-Za-z0-9._-]+$"); //$NON-NLS-1$
|
||||||
String x = String.valueOf(getValue());
|
String x = String.valueOf(getValue());
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class FileScopeProblemPreference extends AbstractProblemPreference {
|
||||||
setLabel(Messages.FileScopeProblemPreference_Label);
|
setLabel(Messages.FileScopeProblemPreference_Label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PreferenceType getType() {
|
public PreferenceType getType() {
|
||||||
return PreferenceType.TYPE_CUSTOM;
|
return PreferenceType.TYPE_CUSTOM;
|
||||||
}
|
}
|
||||||
|
@ -130,6 +131,7 @@ public class FileScopeProblemPreference extends AbstractProblemPreference {
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String exportValue() {
|
public String exportValue() {
|
||||||
return exportPathList(INCLUSION, inclusion) + "," //$NON-NLS-1$
|
return exportPathList(INCLUSION, inclusion) + "," //$NON-NLS-1$
|
||||||
+ exportPathList(EXCLUSION, exclusion);
|
+ exportPathList(EXCLUSION, exclusion);
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
|
||||||
setLabel(label);
|
setLabel(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PreferenceType getType() {
|
public PreferenceType getType() {
|
||||||
return PreferenceType.TYPE_LIST;
|
return PreferenceType.TYPE_LIST;
|
||||||
}
|
}
|
||||||
|
@ -69,6 +70,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
|
||||||
*
|
*
|
||||||
* @return read only preference matching the key
|
* @return read only preference matching the key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemPreference addChildDescriptor(IProblemPreference desc) {
|
public IProblemPreference addChildDescriptor(IProblemPreference desc) {
|
||||||
Object value = desc.getValue();
|
Object value = desc.getValue();
|
||||||
String key = desc.getKey();
|
String key = desc.getKey();
|
||||||
|
@ -107,6 +109,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
|
||||||
* @throws NumberFormatException
|
* @throws NumberFormatException
|
||||||
* if key is not number
|
* if key is not number
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemPreference getChildDescriptor(String key) throws NumberFormatException {
|
public IProblemPreference getChildDescriptor(String key) throws NumberFormatException {
|
||||||
if (key == null || key.equals(COMMON_DESCRIPTOR_KEY)) {
|
if (key == null || key.equals(COMMON_DESCRIPTOR_KEY)) {
|
||||||
// return common descriptor
|
// return common descriptor
|
||||||
|
@ -125,6 +128,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
|
||||||
/**
|
/**
|
||||||
* Return array of clones values of child preferences.
|
* Return array of clones values of child preferences.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemPreference[] getChildDescriptors() {
|
public IProblemPreference[] getChildDescriptors() {
|
||||||
IProblemPreference[] res = new IProblemPreference[list.size()];
|
IProblemPreference[] res = new IProblemPreference[list.size()];
|
||||||
for (int i = 0; i < res.length; i++) {
|
for (int i = 0; i < res.length; i++) {
|
||||||
|
@ -133,6 +137,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getChildValue(String key) {
|
public Object getChildValue(String key) {
|
||||||
int index = Integer.parseInt(key);
|
int index = Integer.parseInt(key);
|
||||||
return getChildValue(index);
|
return getChildValue(index);
|
||||||
|
@ -146,6 +151,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
|
||||||
return list.get(index);
|
return list.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setChildValue(String key, Object value) {
|
public void setChildValue(String key, Object value) {
|
||||||
int i = Integer.valueOf(key).intValue();
|
int i = Integer.valueOf(key).intValue();
|
||||||
setChildValue(i, value);
|
setChildValue(i, value);
|
||||||
|
@ -180,6 +186,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
|
||||||
/**
|
/**
|
||||||
* Removes child value by key
|
* Removes child value by key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void removeChildValue(String key) {
|
public void removeChildValue(String key) {
|
||||||
int index = Integer.parseInt(key);
|
int index = Integer.parseInt(key);
|
||||||
list.remove(index);
|
list.remove(index);
|
||||||
|
@ -197,6 +204,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
|
||||||
return list1;
|
return list1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String exportValue() {
|
public String exportValue() {
|
||||||
StringBuffer buf = new StringBuffer("("); //$NON-NLS-1$
|
StringBuffer buf = new StringBuffer("("); //$NON-NLS-1$
|
||||||
for (Iterator<Object> iterator = list.iterator(); iterator.hasNext();) {
|
for (Iterator<Object> iterator = list.iterator(); iterator.hasNext();) {
|
||||||
|
@ -258,6 +266,7 @@ public class ListProblemPreference extends AbstractProblemPreference implements
|
||||||
* If info key is '#' resets common descriptor to null, otherwise removes
|
* If info key is '#' resets common descriptor to null, otherwise removes
|
||||||
* value
|
* value
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void removeChildDescriptor(IProblemPreference info) {
|
public void removeChildDescriptor(IProblemPreference info) {
|
||||||
if (info.getKey().equals(COMMON_DESCRIPTOR_KEY))
|
if (info.getKey().equals(COMMON_DESCRIPTOR_KEY))
|
||||||
setChildDescriptor(null);
|
setChildDescriptor(null);
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class MapProblemPreference extends AbstractProblemPreference implements I
|
||||||
setLabel(label);
|
setLabel(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PreferenceType getType() {
|
public PreferenceType getType() {
|
||||||
return PreferenceType.TYPE_MAP;
|
return PreferenceType.TYPE_MAP;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +61,7 @@ public class MapProblemPreference extends AbstractProblemPreference implements I
|
||||||
* Get parameter preference for element by key
|
* Get parameter preference for element by key
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemPreference getChildDescriptor(String key) {
|
public IProblemPreference getChildDescriptor(String key) {
|
||||||
return hash.get(key);
|
return hash.get(key);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +73,7 @@ public class MapProblemPreference extends AbstractProblemPreference implements I
|
||||||
*
|
*
|
||||||
* @param desc
|
* @param desc
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemPreference addChildDescriptor(IProblemPreference desc) {
|
public IProblemPreference addChildDescriptor(IProblemPreference desc) {
|
||||||
((AbstractProblemPreference) desc).setParent(this);
|
((AbstractProblemPreference) desc).setParent(this);
|
||||||
hash.put(desc.getKey(), desc);
|
hash.put(desc.getKey(), desc);
|
||||||
|
@ -83,6 +86,7 @@ public class MapProblemPreference extends AbstractProblemPreference implements I
|
||||||
* and not assume that modifying its elements would modify actual child
|
* and not assume that modifying its elements would modify actual child
|
||||||
* values.
|
* values.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemPreference[] getChildDescriptors() {
|
public IProblemPreference[] getChildDescriptors() {
|
||||||
return hash.values().toArray(new IProblemPreference[hash.values().size()]);
|
return hash.values().toArray(new IProblemPreference[hash.values().size()]);
|
||||||
}
|
}
|
||||||
|
@ -90,6 +94,7 @@ public class MapProblemPreference extends AbstractProblemPreference implements I
|
||||||
/**
|
/**
|
||||||
* Returns value of the child element by its key
|
* Returns value of the child element by its key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getChildValue(String key) {
|
public Object getChildValue(String key) {
|
||||||
IProblemPreference childInfo = getChildDescriptor(key);
|
IProblemPreference childInfo = getChildDescriptor(key);
|
||||||
return childInfo.getValue();
|
return childInfo.getValue();
|
||||||
|
@ -98,6 +103,7 @@ public class MapProblemPreference extends AbstractProblemPreference implements I
|
||||||
/**
|
/**
|
||||||
* Set child value by its key
|
* Set child value by its key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setChildValue(String key, Object value) {
|
public void setChildValue(String key, Object value) {
|
||||||
IProblemPreference pref = getChildDescriptor(key);
|
IProblemPreference pref = getChildDescriptor(key);
|
||||||
if (pref == null)
|
if (pref == null)
|
||||||
|
@ -110,6 +116,7 @@ public class MapProblemPreference extends AbstractProblemPreference implements I
|
||||||
/**
|
/**
|
||||||
* Removes child value and descriptor by key
|
* Removes child value and descriptor by key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void removeChildValue(String key) {
|
public void removeChildValue(String key) {
|
||||||
hash.remove(key);
|
hash.remove(key);
|
||||||
}
|
}
|
||||||
|
@ -125,6 +132,7 @@ public class MapProblemPreference extends AbstractProblemPreference implements I
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String exportValue() {
|
public String exportValue() {
|
||||||
StringBuffer buf = new StringBuffer("{"); //$NON-NLS-1$
|
StringBuffer buf = new StringBuffer("{"); //$NON-NLS-1$
|
||||||
for (Iterator<String> iterator = hash.keySet().iterator(); iterator.hasNext();) {
|
for (Iterator<String> iterator = hash.keySet().iterator(); iterator.hasNext();) {
|
||||||
|
@ -205,6 +213,7 @@ public class MapProblemPreference extends AbstractProblemPreference implements I
|
||||||
/**
|
/**
|
||||||
* Removes child descriptor by its key
|
* Removes child descriptor by its key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void removeChildDescriptor(IProblemPreference info) {
|
public void removeChildDescriptor(IProblemPreference info) {
|
||||||
hash.remove(info.getKey());
|
hash.remove(info.getKey());
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,12 @@ public class CheckerInvocationContext implements ICheckerInvocationContext {
|
||||||
objectStorage = new HashMap<Class<?>, Object>();
|
objectStorage = new HashMap<Class<?>, Object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IResource getResource() {
|
public IResource getResource() {
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public synchronized <T> T get(Class<T> objectClass) {
|
public synchronized <T> T get(Class<T> objectClass) {
|
||||||
T object = (T) objectStorage.get(objectClass);
|
T object = (T) objectStorage.get(objectClass);
|
||||||
|
@ -54,6 +56,7 @@ public class CheckerInvocationContext implements ICheckerInvocationContext {
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see ICheckerInvocationContext#add(Object)
|
* @see ICheckerInvocationContext#add(Object)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public synchronized <T extends ICodanDisposable> void add(T object) {
|
public synchronized <T extends ICodanDisposable> void add(T object) {
|
||||||
Object old = objectStorage.put(object.getClass(), object);
|
Object old = objectStorage.put(object.getClass(), object);
|
||||||
if (old != null && object != old) {
|
if (old != null && object != old) {
|
||||||
|
@ -66,6 +69,7 @@ public class CheckerInvocationContext implements ICheckerInvocationContext {
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see IDisposableCache#dispose()
|
* @see IDisposableCache#dispose()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
for (Map.Entry<Class<?>, Object> entry : objectStorage.entrySet()) {
|
for (Map.Entry<Class<?>, Object> entry : objectStorage.entrySet()) {
|
||||||
Object obj = entry.getValue();
|
Object obj = entry.getValue();
|
||||||
|
|
|
@ -241,6 +241,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#iterator()
|
* @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#iterator()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Iterator<IChecker> iterator() {
|
public Iterator<IChecker> iterator() {
|
||||||
return checkers.iterator();
|
return checkers.iterator();
|
||||||
}
|
}
|
||||||
|
@ -263,6 +264,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addChecker(org.eclipse
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addChecker(org.eclipse
|
||||||
* .cdt.codan.core.model.IChecker)
|
* .cdt.codan.core.model.IChecker)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addChecker(IChecker checker) {
|
public void addChecker(IChecker checker) {
|
||||||
checkers.add(checker);
|
checkers.add(checker);
|
||||||
}
|
}
|
||||||
|
@ -274,6 +276,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addProblem(org.eclipse
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addProblem(org.eclipse
|
||||||
* .cdt.codan.core.model.IProblem, java.lang.String)
|
* .cdt.codan.core.model.IProblem, java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addProblem(IProblem p, String category) {
|
public void addProblem(IProblem p, String category) {
|
||||||
IProblemCategory cat = getDefaultProfile().findCategory(category);
|
IProblemCategory cat = getDefaultProfile().findCategory(category);
|
||||||
if (cat == null)
|
if (cat == null)
|
||||||
|
@ -288,6 +291,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addCategory(org.eclipse
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#addCategory(org.eclipse
|
||||||
* .cdt.codan.core.model.IProblemCategory, java.lang.String)
|
* .cdt.codan.core.model.IProblemCategory, java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addCategory(IProblemCategory p, String category) {
|
public void addCategory(IProblemCategory p, String category) {
|
||||||
IProblemCategory cat = getDefaultProfile().findCategory(category);
|
IProblemCategory cat = getDefaultProfile().findCategory(category);
|
||||||
if (cat == null)
|
if (cat == null)
|
||||||
|
@ -303,6 +307,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
* eclipse.cdt.codan.core.model.IChecker,
|
* eclipse.cdt.codan.core.model.IChecker,
|
||||||
* org.eclipse.cdt.codan.core.model.IProblem)
|
* org.eclipse.cdt.codan.core.model.IProblem)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addRefProblem(IChecker c, IProblem p) {
|
public void addRefProblem(IChecker c, IProblem p) {
|
||||||
Collection<IProblem> plist = problemList.get(c);
|
Collection<IProblem> plist = problemList.get(c);
|
||||||
if (plist == null) {
|
if (plist == null) {
|
||||||
|
@ -327,6 +332,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
*
|
*
|
||||||
* @return collection of problems or null
|
* @return collection of problems or null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Collection<IProblem> getRefProblems(IChecker checker) {
|
public Collection<IProblem> getRefProblems(IChecker checker) {
|
||||||
return problemList.get(checker);
|
return problemList.get(checker);
|
||||||
}
|
}
|
||||||
|
@ -337,6 +343,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getDefaultProfile()
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getDefaultProfile()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemProfile getDefaultProfile() {
|
public IProblemProfile getDefaultProfile() {
|
||||||
return profiles.get(DEFAULT);
|
return profiles.get(DEFAULT);
|
||||||
}
|
}
|
||||||
|
@ -347,6 +354,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getWorkspaceProfile()
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getWorkspaceProfile()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemProfile getWorkspaceProfile() {
|
public IProblemProfile getWorkspaceProfile() {
|
||||||
IProblemProfile wp = profiles.get(ResourcesPlugin.getWorkspace());
|
IProblemProfile wp = profiles.get(ResourcesPlugin.getWorkspace());
|
||||||
if (wp == null) {
|
if (wp == null) {
|
||||||
|
@ -365,6 +373,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
return wp;
|
return wp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateProfile(IResource element, IProblemProfile profile) {
|
public void updateProfile(IResource element, IProblemProfile profile) {
|
||||||
// updating profile can invalidate all cached profiles
|
// updating profile can invalidate all cached profiles
|
||||||
IProblemProfile defaultProfile = getDefaultProfile();
|
IProblemProfile defaultProfile = getDefaultProfile();
|
||||||
|
@ -381,6 +390,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfile
|
* org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfile
|
||||||
* (org.eclipse.core.resources.IResource)
|
* (org.eclipse.core.resources.IResource)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemProfile getResourceProfile(IResource element) {
|
public IProblemProfile getResourceProfile(IResource element) {
|
||||||
IProblemProfile prof = profiles.get(element);
|
IProblemProfile prof = profiles.get(element);
|
||||||
if (prof == null) {
|
if (prof == null) {
|
||||||
|
@ -410,6 +420,7 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
|
||||||
* @seeorg.eclipse.cdt.codan.core.model.ICheckersRegistry#
|
* @seeorg.eclipse.cdt.codan.core.model.ICheckersRegistry#
|
||||||
* getResourceProfileWorkingCopy(org.eclipse.core.resources.IResource)
|
* getResourceProfileWorkingCopy(org.eclipse.core.resources.IResource)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemProfile getResourceProfileWorkingCopy(IResource element) {
|
public IProblemProfile getResourceProfileWorkingCopy(IResource element) {
|
||||||
IProblemProfile prof = (IProblemProfile) getResourceProfile(element).clone();
|
IProblemProfile prof = (IProblemProfile) getResourceProfile(element).clone();
|
||||||
return prof;
|
return prof;
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class CodanApplication implements IApplication {
|
||||||
private boolean verbose = false;
|
private boolean verbose = false;
|
||||||
private boolean all = false;
|
private boolean all = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object start(IApplicationContext context) throws Exception {
|
public Object start(IApplicationContext context) throws Exception {
|
||||||
String[] args = (String[]) context.getArguments().get("application.args"); //$NON-NLS-1$
|
String[] args = (String[]) context.getArguments().get("application.args"); //$NON-NLS-1$
|
||||||
if (args == null || args.length == 0) {
|
if (args == null || args.length == 0) {
|
||||||
|
@ -107,6 +108,7 @@ public class CodanApplication implements IApplication {
|
||||||
System.out.println(Messages.CodanApplication_verbose_option);
|
System.out.println(Messages.CodanApplication_verbose_option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class CodanBuilder extends IncrementalProjectBuilder implements ICodanBui
|
||||||
this.monitor = monitor;
|
this.monitor = monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean visit(IResourceDelta delta) throws CoreException {
|
public boolean visit(IResourceDelta delta) throws CoreException {
|
||||||
IResource resource = delta.getResource();
|
IResource resource = delta.getResource();
|
||||||
switch (delta.getKind()) {
|
switch (delta.getKind()) {
|
||||||
|
@ -93,6 +94,7 @@ public class CodanBuilder extends IncrementalProjectBuilder implements ICodanBui
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processResource(IResource resource, IProgressMonitor monitor) {
|
public void processResource(IResource resource, IProgressMonitor monitor) {
|
||||||
processResource(resource, monitor, null, CheckerLaunchMode.RUN_ON_FULL_BUILD);
|
processResource(resource, monitor, null, CheckerLaunchMode.RUN_ON_FULL_BUILD);
|
||||||
}
|
}
|
||||||
|
@ -105,6 +107,7 @@ public class CodanBuilder extends IncrementalProjectBuilder implements ICodanBui
|
||||||
* @param mode - launch mode, @see {@link CheckerLaunchMode}
|
* @param mode - launch mode, @see {@link CheckerLaunchMode}
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void processResource(IResource resource, IProgressMonitor monitor, CheckerLaunchMode mode) {
|
public void processResource(IResource resource, IProgressMonitor monitor, CheckerLaunchMode mode) {
|
||||||
processResource(resource, monitor, null, mode);
|
processResource(resource, monitor, null, mode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class CodeAnlysisNature implements IProjectNature {
|
||||||
public static final String NATURE_ID = "org.eclipse.cdt.codan.core.codanNature"; //$NON-NLS-1$
|
public static final String NATURE_ID = "org.eclipse.cdt.codan.core.codanNature"; //$NON-NLS-1$
|
||||||
private IProject project;
|
private IProject project;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void configure() throws CoreException {
|
public void configure() throws CoreException {
|
||||||
IProjectDescription desc = project.getDescription();
|
IProjectDescription desc = project.getDescription();
|
||||||
ICommand[] commands = desc.getBuildSpec();
|
ICommand[] commands = desc.getBuildSpec();
|
||||||
|
@ -43,6 +44,7 @@ public class CodeAnlysisNature implements IProjectNature {
|
||||||
project.setDescription(desc, null);
|
project.setDescription(desc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void deconfigure() throws CoreException {
|
public void deconfigure() throws CoreException {
|
||||||
IProjectDescription description = getProject().getDescription();
|
IProjectDescription description = getProject().getDescription();
|
||||||
ICommand[] commands = description.getBuildSpec();
|
ICommand[] commands = description.getBuildSpec();
|
||||||
|
@ -58,10 +60,12 @@ public class CodeAnlysisNature implements IProjectNature {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IProject getProject() {
|
public IProject getProject() {
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setProject(IProject project) {
|
public void setProject(IProject project) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,12 @@ public abstract class AbstractBasicBlock implements IBasicBlock, ICfgData {
|
||||||
public final static IBasicBlock[] EMPTY_LIST = new IBasicBlock[0];
|
public final static IBasicBlock[] EMPTY_LIST = new IBasicBlock[0];
|
||||||
private Object data;
|
private Object data;
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getData() {
|
public Object getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setData(Object data) {
|
public void setData(Object data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,14 +27,17 @@ public abstract class AbstractSingleIncomingNode extends AbstractBasicBlock impl
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock[] getIncomingNodes() {
|
public IBasicBlock[] getIncomingNodes() {
|
||||||
return new IBasicBlock[] { prev };
|
return new IBasicBlock[] { prev };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getIncomingSize() {
|
public int getIncomingSize() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock getIncoming() {
|
public IBasicBlock getIncoming() {
|
||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,14 +27,17 @@ public abstract class AbstractSingleOutgoingNode extends AbstractBasicBlock impl
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock[] getOutgoingNodes() {
|
public IBasicBlock[] getOutgoingNodes() {
|
||||||
return new IBasicBlock[] { next };
|
return new IBasicBlock[] { next };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getOutgoingSize() {
|
public int getOutgoingSize() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock getOutgoing() {
|
public IBasicBlock getOutgoing() {
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class BranchNode extends PlainNode implements IBranchNode {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class ConnectorNode extends AbstractSingleOutgoingNode implements IConnec
|
||||||
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IBasicBlock#
|
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IBasicBlock#
|
||||||
* getIncomingIterator()
|
* getIncomingIterator()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IBasicBlock[] getIncomingNodes() {
|
public IBasicBlock[] getIncomingNodes() {
|
||||||
return incoming.toArray(new IBasicBlock[incoming.size()]);
|
return incoming.toArray(new IBasicBlock[incoming.size()]);
|
||||||
}
|
}
|
||||||
|
@ -46,6 +47,7 @@ public class ConnectorNode extends AbstractSingleOutgoingNode implements IConnec
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.cfg.IBasicBlock#getIncomingSize ()
|
* @see org.eclipse.cdt.codan.core.model.cfg.IBasicBlock#getIncomingSize ()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getIncomingSize() {
|
public int getIncomingSize() {
|
||||||
return incoming.size();
|
return incoming.size();
|
||||||
}
|
}
|
||||||
|
@ -56,6 +58,7 @@ public class ConnectorNode extends AbstractSingleOutgoingNode implements IConnec
|
||||||
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IConnectorNode#
|
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IConnectorNode#
|
||||||
* hasBackwardIncoming()
|
* hasBackwardIncoming()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean hasBackwardIncoming() {
|
public boolean hasBackwardIncoming() {
|
||||||
for (IBasicBlock node : incoming) {
|
for (IBasicBlock node : incoming) {
|
||||||
if (node instanceof IJumpNode) {
|
if (node instanceof IJumpNode) {
|
||||||
|
|
|
@ -39,10 +39,12 @@ public class ControlFlowGraph implements IControlFlowGraph {
|
||||||
this.start = start;
|
this.start = start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Iterator<IExitNode> getExitNodeIterator() {
|
public Iterator<IExitNode> getExitNodeIterator() {
|
||||||
return exitNodes.iterator();
|
return exitNodes.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getExitNodeSize() {
|
public int getExitNodeSize() {
|
||||||
return exitNodes.size();
|
return exitNodes.size();
|
||||||
}
|
}
|
||||||
|
@ -63,6 +65,7 @@ public class ControlFlowGraph implements IControlFlowGraph {
|
||||||
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IControlFlowGraph#
|
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IControlFlowGraph#
|
||||||
* getStartNode()
|
* getStartNode()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IStartNode getStartNode() {
|
public IStartNode getStartNode() {
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
@ -97,6 +100,7 @@ public class ControlFlowGraph implements IControlFlowGraph {
|
||||||
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IControlFlowGraph#
|
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IControlFlowGraph#
|
||||||
* getUnconnectedNodeIterator()
|
* getUnconnectedNodeIterator()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Iterator<IBasicBlock> getUnconnectedNodeIterator() {
|
public Iterator<IBasicBlock> getUnconnectedNodeIterator() {
|
||||||
return deadNodes.iterator();
|
return deadNodes.iterator();
|
||||||
}
|
}
|
||||||
|
@ -107,6 +111,7 @@ public class ControlFlowGraph implements IControlFlowGraph {
|
||||||
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IControlFlowGraph#
|
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IControlFlowGraph#
|
||||||
* getUnconnectedNodeSize()
|
* getUnconnectedNodeSize()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getUnconnectedNodeSize() {
|
public int getUnconnectedNodeSize() {
|
||||||
return deadNodes.size();
|
return deadNodes.size();
|
||||||
}
|
}
|
||||||
|
@ -116,6 +121,7 @@ public class ControlFlowGraph implements IControlFlowGraph {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.cfg.IControlFlowGraph#getNodes ()
|
* @see org.eclipse.cdt.codan.core.model.cfg.IControlFlowGraph#getNodes ()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Collection<IBasicBlock> getNodes() {
|
public Collection<IBasicBlock> getNodes() {
|
||||||
Collection<IBasicBlock> result = new LinkedHashSet<IBasicBlock>();
|
Collection<IBasicBlock> result = new LinkedHashSet<IBasicBlock>();
|
||||||
getNodes(getStartNode(), result);
|
getNodes(getStartNode(), result);
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class DecisionNode extends AbstractSingleIncomingNode implements IDecisio
|
||||||
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IBasicBlock#
|
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IBasicBlock#
|
||||||
* getOutgoingIterator()
|
* getOutgoingIterator()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IBasicBlock[] getOutgoingNodes() {
|
public IBasicBlock[] getOutgoingNodes() {
|
||||||
return next.toArray(new IBasicBlock[next.size()]);
|
return next.toArray(new IBasicBlock[next.size()]);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +54,7 @@ public class DecisionNode extends AbstractSingleIncomingNode implements IDecisio
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.cfg.IBasicBlock#getOutgoingSize ()
|
* @see org.eclipse.cdt.codan.core.model.cfg.IBasicBlock#getOutgoingSize ()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getOutgoingSize() {
|
public int getOutgoingSize() {
|
||||||
return next.size();
|
return next.size();
|
||||||
}
|
}
|
||||||
|
@ -63,6 +65,7 @@ public class DecisionNode extends AbstractSingleIncomingNode implements IDecisio
|
||||||
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IDecisionNode#
|
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.IDecisionNode#
|
||||||
* getConnectionNode()
|
* getConnectionNode()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IConnectorNode getMergeNode() {
|
public IConnectorNode getMergeNode() {
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,17 @@ public class ExitNode extends AbstractSingleIncomingNode implements IExitNode {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock[] getOutgoingNodes() {
|
public IBasicBlock[] getOutgoingNodes() {
|
||||||
return EMPTY_LIST;
|
return EMPTY_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getOutgoingSize() {
|
public int getOutgoingSize() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IStartNode getStartNode() {
|
public IStartNode getStartNode() {
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,12 @@ public class JumpNode extends AbstractSingleIncomingNode implements IJumpNode {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock[] getOutgoingNodes() {
|
public IBasicBlock[] getOutgoingNodes() {
|
||||||
return new IBasicBlock[] { jump };
|
return new IBasicBlock[] { jump };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getOutgoingSize() {
|
public int getOutgoingSize() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -40,14 +42,17 @@ public class JumpNode extends AbstractSingleIncomingNode implements IJumpNode {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.cfg.IJumpNode#getJumpNode()
|
* @see org.eclipse.cdt.codan.core.model.cfg.IJumpNode#getJumpNode()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IConnectorNode getJumpNode() {
|
public IConnectorNode getJumpNode() {
|
||||||
return jump;
|
return jump;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock getOutgoing() {
|
public IBasicBlock getOutgoing() {
|
||||||
return jump;
|
return jump;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBackwardArc() {
|
public boolean isBackwardArc() {
|
||||||
return backward;
|
return backward;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class NodeFactory implements INodeFactory {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createPlainNode ()
|
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createPlainNode ()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IPlainNode createPlainNode() {
|
public IPlainNode createPlainNode() {
|
||||||
return new PlainNode();
|
return new PlainNode();
|
||||||
}
|
}
|
||||||
|
@ -53,6 +54,7 @@ public class NodeFactory implements INodeFactory {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createJumpNode ()
|
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createJumpNode ()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IJumpNode createJumpNode() {
|
public IJumpNode createJumpNode() {
|
||||||
return new JumpNode();
|
return new JumpNode();
|
||||||
}
|
}
|
||||||
|
@ -63,6 +65,7 @@ public class NodeFactory implements INodeFactory {
|
||||||
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.INodeFactory#
|
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.INodeFactory#
|
||||||
* createDecisionNode()
|
* createDecisionNode()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IDecisionNode createDecisionNode() {
|
public IDecisionNode createDecisionNode() {
|
||||||
return new DecisionNode();
|
return new DecisionNode();
|
||||||
}
|
}
|
||||||
|
@ -73,6 +76,7 @@ public class NodeFactory implements INodeFactory {
|
||||||
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.INodeFactory#
|
* @seeorg.eclipse.cdt.codan.provisional.core.model.cfg.INodeFactory#
|
||||||
* createConnectiorNode()
|
* createConnectiorNode()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IConnectorNode createConnectorNode() {
|
public IConnectorNode createConnectorNode() {
|
||||||
return new ConnectorNode();
|
return new ConnectorNode();
|
||||||
}
|
}
|
||||||
|
@ -82,6 +86,7 @@ public class NodeFactory implements INodeFactory {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createStartNode ()
|
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createStartNode ()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IStartNode createStartNode() {
|
public IStartNode createStartNode() {
|
||||||
return new StartNode();
|
return new StartNode();
|
||||||
}
|
}
|
||||||
|
@ -91,10 +96,12 @@ public class NodeFactory implements INodeFactory {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createExitNode ()
|
* @see org.eclipse.cdt.codan.core.model.cfg.INodeFactory#createExitNode ()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IExitNode createExitNode() {
|
public IExitNode createExitNode() {
|
||||||
return new ExitNode();
|
return new ExitNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBranchNode createBranchNode(String label) {
|
public IBranchNode createBranchNode(String label) {
|
||||||
return new BranchNode(label);
|
return new BranchNode(label);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,16 +24,19 @@ public class PlainNode extends AbstractSingleIncomingNode implements IPlainNode
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock[] getOutgoingNodes() {
|
public IBasicBlock[] getOutgoingNodes() {
|
||||||
return new IBasicBlock[] { next };
|
return new IBasicBlock[] { next };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getOutgoingSize() {
|
public int getOutgoingSize() {
|
||||||
if (next == null)
|
if (next == null)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock getOutgoing() {
|
public IBasicBlock getOutgoing() {
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,12 @@ public class StartNode extends AbstractSingleOutgoingNode implements IStartNode
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IBasicBlock[] getIncomingNodes() {
|
public IBasicBlock[] getIncomingNodes() {
|
||||||
return EMPTY_LIST;
|
return EMPTY_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getIncomingSize() {
|
public int getIncomingSize() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,10 +60,12 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
|
||||||
this.checker = checker;
|
this.checker = checker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IResource getResource() {
|
public IResource getResource() {
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IChecker getChecker() {
|
public IChecker getChecker() {
|
||||||
return checker;
|
return checker;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +91,7 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void deleteProblems(IResource file) {
|
public void deleteProblems(IResource file) {
|
||||||
try {
|
try {
|
||||||
file.deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, true, IResource.DEPTH_ZERO);
|
file.deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, true, IResource.DEPTH_ZERO);
|
||||||
|
@ -97,6 +100,7 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void deleteAllProblems() {
|
public void deleteAllProblems() {
|
||||||
try {
|
try {
|
||||||
ResourcesPlugin.getWorkspace().getRoot().deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE,
|
ResourcesPlugin.getWorkspace().getRoot().deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE,
|
||||||
|
@ -106,9 +110,11 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void deleteProblems(final IResource file, final IChecker checker) {
|
public void deleteProblems(final IResource file, final IChecker checker) {
|
||||||
try {
|
try {
|
||||||
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||||
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
Collection<IMarker> markers = findResourceMarkers(file, checker);
|
Collection<IMarker> markers = findResourceMarkers(file, checker);
|
||||||
for (Iterator<IMarker> iterator = markers.iterator(); iterator.hasNext();) {
|
for (Iterator<IMarker> iterator = markers.iterator(); iterator.hasNext();) {
|
||||||
|
@ -156,15 +162,18 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
|
||||||
* @return session aware problem reporter
|
* @return session aware problem reporter
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemReporterSessionPersistent createReporter(IResource resource, IChecker checker) {
|
public IProblemReporterSessionPersistent createReporter(IResource resource, IChecker checker) {
|
||||||
return new CodanMarkerProblemReporter(resource, checker);
|
return new CodanMarkerProblemReporter(resource, checker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
if (checker == null)
|
if (checker == null)
|
||||||
deleteProblems(false);
|
deleteProblems(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void done() {
|
public void done() {
|
||||||
if (checker != null) {
|
if (checker != null) {
|
||||||
if (toAdd.size() == 0)
|
if (toAdd.size() == 0)
|
||||||
|
@ -178,6 +187,7 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
|
||||||
protected void reconcileMarkers() {
|
protected void reconcileMarkers() {
|
||||||
try {
|
try {
|
||||||
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||||
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
Collection<IMarker> markers = findResourceMarkers(resource, checker);
|
Collection<IMarker> markers = findResourceMarkers(resource, checker);
|
||||||
for (Iterator<IMarker> iterator = markers.iterator(); iterator.hasNext();) {
|
for (Iterator<IMarker> iterator = markers.iterator(); iterator.hasNext();) {
|
||||||
|
@ -271,6 +281,7 @@ public class CodanMarkerProblemReporter extends AbstractProblemReporter implemen
|
||||||
*
|
*
|
||||||
* @see IProblemReporterSessionPersistent#deleteProblems(boolean)
|
* @see IProblemReporterSessionPersistent#deleteProblems(boolean)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void deleteProblems(boolean all) {
|
public void deleteProblems(boolean all) {
|
||||||
if (all)
|
if (all)
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
this.multiple = multiple;
|
this.multiple = multiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CodanSeverity getSeverity() {
|
public CodanSeverity getSeverity() {
|
||||||
return severity;
|
return severity;
|
||||||
}
|
}
|
||||||
|
@ -49,10 +50,12 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -70,10 +73,12 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setSeverity(CodanSeverity sev) {
|
public void setSeverity(CodanSeverity sev) {
|
||||||
if (sev == null)
|
if (sev == null)
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
|
@ -82,6 +87,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
notifyChanged(ProblemProfileChangeEvent.PROBLEM_KEY);
|
notifyChanged(ProblemProfileChangeEvent.PROBLEM_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setEnabled(boolean checked) {
|
public void setEnabled(boolean checked) {
|
||||||
checkSet();
|
checkSet();
|
||||||
this.enabled = checked;
|
this.enabled = checked;
|
||||||
|
@ -103,6 +109,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
return prob;
|
return prob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPreference(IProblemPreference value) {
|
public void setPreference(IProblemPreference value) {
|
||||||
if (value == null)
|
if (value == null)
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
|
@ -110,6 +117,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
notifyChanged(ProblemProfileChangeEvent.PROBLEM_PREF_KEY);
|
notifyChanged(ProblemProfileChangeEvent.PROBLEM_PREF_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IProblemPreference getPreference() {
|
public IProblemPreference getPreference() {
|
||||||
return rootPreference;
|
return rootPreference;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +127,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblem#getMessagePattern()
|
* @see org.eclipse.cdt.codan.core.model.IProblem#getMessagePattern()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getMessagePattern() {
|
public String getMessagePattern() {
|
||||||
return messagePattern;
|
return messagePattern;
|
||||||
}
|
}
|
||||||
|
@ -127,6 +136,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
* @param messagePattern
|
* @param messagePattern
|
||||||
* the message to set
|
* the message to set
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setMessagePattern(String messagePattern) {
|
public void setMessagePattern(String messagePattern) {
|
||||||
checkSet();
|
checkSet();
|
||||||
this.messagePattern = messagePattern;
|
this.messagePattern = messagePattern;
|
||||||
|
@ -137,6 +147,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblem#getDescription()
|
* @see org.eclipse.cdt.codan.core.model.IProblem#getDescription()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
@ -148,6 +159,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
* org.eclipse.cdt.codan.core.model.IProblemWorkingCopy#setDescription(java
|
* org.eclipse.cdt.codan.core.model.IProblemWorkingCopy#setDescription(java
|
||||||
* .lang.String)
|
* .lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setDescription(String desc) {
|
public void setDescription(String desc) {
|
||||||
checkSet();
|
checkSet();
|
||||||
this.description = desc;
|
this.description = desc;
|
||||||
|
@ -158,6 +170,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblem#getMarkerType()
|
* @see org.eclipse.cdt.codan.core.model.IProblem#getMarkerType()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getMarkerType() {
|
public String getMarkerType() {
|
||||||
return markerType;
|
return markerType;
|
||||||
}
|
}
|
||||||
|
@ -177,6 +190,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemMultiple#isMultiple()
|
* @see org.eclipse.cdt.codan.core.model.IProblemMultiple#isMultiple()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isMultiple() {
|
public boolean isMultiple() {
|
||||||
return multiple;
|
return multiple;
|
||||||
}
|
}
|
||||||
|
@ -186,6 +200,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemMultiple#isOriginal()
|
* @see org.eclipse.cdt.codan.core.model.IProblemMultiple#isOriginal()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isOriginal() {
|
public boolean isOriginal() {
|
||||||
return !id.contains(CheckersRegistry.CLONE_SUFFIX);
|
return !id.contains(CheckersRegistry.CLONE_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,12 @@ public class CodanProblemCategory extends CodanProblemElement implements IProble
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +47,7 @@ public class CodanProblemCategory extends CodanProblemElement implements IProble
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IProblemElement[] getChildren() {
|
public IProblemElement[] getChildren() {
|
||||||
return list.toArray(new IProblemElement[list.size()]);
|
return list.toArray(new IProblemElement[list.size()]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class CodanProblemElement implements IProblemElement {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getProfile()
|
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getProfile()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemProfile getProfile() {
|
public IProblemProfile getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +37,7 @@ public class CodanProblemElement implements IProblemElement {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getCategory()
|
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getCategory()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemCategory getParentCategory() {
|
public IProblemCategory getParentCategory() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class CodanProblemMarker implements ICodanProblemMarker {
|
||||||
private IProblem problem;
|
private IProblem problem;
|
||||||
private Object args[];
|
private Object args[];
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getArgs() {
|
public Object[] getArgs() {
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +61,7 @@ public class CodanProblemMarker implements ICodanProblemMarker {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#getLocation()
|
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#getLocation()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemLocation getLocation() {
|
public IProblemLocation getLocation() {
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
@ -69,6 +71,7 @@ public class CodanProblemMarker implements ICodanProblemMarker {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#getProblem()
|
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#getProblem()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblem getProblem() {
|
public IProblem getProblem() {
|
||||||
return problem;
|
return problem;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +81,7 @@ public class CodanProblemMarker implements ICodanProblemMarker {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#getResource()
|
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#getResource()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IResource getResource() {
|
public IResource getResource() {
|
||||||
return loc.getFile();
|
return loc.getFile();
|
||||||
}
|
}
|
||||||
|
@ -87,6 +91,7 @@ public class CodanProblemMarker implements ICodanProblemMarker {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#createMarker()
|
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#createMarker()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IMarker createMarker() throws CoreException {
|
public IMarker createMarker() throws CoreException {
|
||||||
IResource file = loc.getFile();
|
IResource file = loc.getFile();
|
||||||
int lineNumber = loc.getLineNumber();
|
int lineNumber = loc.getLineNumber();
|
||||||
|
@ -112,6 +117,7 @@ public class CodanProblemMarker implements ICodanProblemMarker {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#createMessage()
|
* @see org.eclipse.cdt.codan.core.model.ICodanProblemMarker#createMessage()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String createMessage() {
|
public String createMessage() {
|
||||||
String messagePattern = problem.getMessagePattern();
|
String messagePattern = problem.getMessagePattern();
|
||||||
String message = problem.getId();
|
String message = problem.getId();
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class ProblemLocationFactory implements IProblemLocationFactory {
|
||||||
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
|
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
|
||||||
* createProblemLocation(org.eclipse.core.resources.IFile, int)
|
* createProblemLocation(org.eclipse.core.resources.IFile, int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemLocation createProblemLocation(IFile file, int line) {
|
public IProblemLocation createProblemLocation(IFile file, int line) {
|
||||||
return new CodanProblemLocation(file, line);
|
return new CodanProblemLocation(file, line);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +36,7 @@ public class ProblemLocationFactory implements IProblemLocationFactory {
|
||||||
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
|
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
|
||||||
* createProblemLocation(org.eclipse.core.resources.IFile, int, int)
|
* createProblemLocation(org.eclipse.core.resources.IFile, int, int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar) {
|
public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar) {
|
||||||
return new CodanProblemLocation(file, startChar, endChar);
|
return new CodanProblemLocation(file, startChar, endChar);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +47,7 @@ public class ProblemLocationFactory implements IProblemLocationFactory {
|
||||||
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
|
* @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
|
||||||
* createProblemLocation(org.eclipse.core.resources.IFile, int, int, int)
|
* createProblemLocation(org.eclipse.core.resources.IFile, int, int, int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar, int line) {
|
public IProblemLocation createProblemLocation(IFile file, int startChar, int endChar, int line) {
|
||||||
return new CodanProblemLocation(file, startChar, endChar, line);
|
return new CodanProblemLocation(file, startChar, endChar, line);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
* org.eclipse.cdt.codan.core.model.IProblemProfile#getProblem(java.lang
|
* org.eclipse.cdt.codan.core.model.IProblemProfile#getProblem(java.lang
|
||||||
* .String)
|
* .String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblem findProblem(String id) {
|
public IProblem findProblem(String id) {
|
||||||
return CodanProblemCategory.findProblem(getRoot(), id);
|
return CodanProblemCategory.findProblem(getRoot(), id);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +55,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemProfile#getProblems()
|
* @see org.eclipse.cdt.codan.core.model.IProblemProfile#getProblems()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblem[] getProblems() {
|
public IProblem[] getProblems() {
|
||||||
Collection<IProblem> problems = new ArrayList<IProblem>();
|
Collection<IProblem> problems = new ArrayList<IProblem>();
|
||||||
collectProblems(getRoot(), problems);
|
collectProblems(getRoot(), problems);
|
||||||
|
@ -76,6 +78,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IProblemCategory getRoot() {
|
public IProblemCategory getRoot() {
|
||||||
return rootCategory;
|
return rootCategory;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +89,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
((CodanProblemCategory) cat).addChild(p);
|
((CodanProblemCategory) cat).addChild(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IProblemCategory findCategory(String id) {
|
public IProblemCategory findCategory(String id) {
|
||||||
return CodanProblemCategory.findCategory(getRoot(), id);
|
return CodanProblemCategory.findCategory(getRoot(), id);
|
||||||
}
|
}
|
||||||
|
@ -124,6 +128,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getProfile()
|
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getProfile()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemProfile getProfile() {
|
public IProblemProfile getProfile() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -133,6 +138,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getParentCategory()
|
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getParentCategory()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IProblemCategory getParentCategory() {
|
public IProblemCategory getParentCategory() {
|
||||||
return getRoot();
|
return getRoot();
|
||||||
}
|
}
|
||||||
|
@ -141,6 +147,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
/**
|
/**
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addProfileChangeListener(IProblemProfileChangeListener listener) {
|
public void addProfileChangeListener(IProblemProfileChangeListener listener) {
|
||||||
if (preferenceChangeListeners == null)
|
if (preferenceChangeListeners == null)
|
||||||
preferenceChangeListeners = new ListenerList();
|
preferenceChangeListeners = new ListenerList();
|
||||||
|
@ -150,6 +157,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
/**
|
/**
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void removeProfileChangeListener(IProblemProfileChangeListener listener) {
|
public void removeProfileChangeListener(IProblemProfileChangeListener listener) {
|
||||||
if (preferenceChangeListeners == null)
|
if (preferenceChangeListeners == null)
|
||||||
return;
|
return;
|
||||||
|
@ -169,10 +177,12 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
for (int i = 0; i < listeners.length; i++) {
|
for (int i = 0; i < listeners.length; i++) {
|
||||||
final IProblemProfileChangeListener listener = (IProblemProfileChangeListener) listeners[i];
|
final IProblemProfileChangeListener listener = (IProblemProfileChangeListener) listeners[i];
|
||||||
ISafeRunnable job = new ISafeRunnable() {
|
ISafeRunnable job = new ISafeRunnable() {
|
||||||
|
@Override
|
||||||
public void handleException(Throwable exception) {
|
public void handleException(Throwable exception) {
|
||||||
// already logged in Platform#run()
|
// already logged in Platform#run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
listener.profileChange(event);
|
listener.profileChange(event);
|
||||||
}
|
}
|
||||||
|
@ -186,6 +196,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemProfile#getResource()
|
* @see org.eclipse.cdt.codan.core.model.IProblemProfile#getResource()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getResource() {
|
public Object getResource() {
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class ControlFlowGraphPlugin extends AbstractUIPlugin {
|
||||||
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
|
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
@ -40,6 +41,7 @@ public class ControlFlowGraphPlugin extends AbstractUIPlugin {
|
||||||
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
|
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
plugin = null;
|
plugin = null;
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
|
|
|
@ -100,20 +100,25 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider {
|
class ViewContentProvider implements IStructuredContentProvider, ITreeContentProvider {
|
||||||
|
@Override
|
||||||
public void inputChanged(Viewer v, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer v, Object oldInput, Object newInput) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getElements(Object parent) {
|
public Object[] getElements(Object parent) {
|
||||||
return getChildren(parent);
|
return getChildren(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getParent(Object child) {
|
public Object getParent(Object child) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getChildren(Object parent) {
|
public Object[] getChildren(Object parent) {
|
||||||
if (parent instanceof Collection) {
|
if (parent instanceof Collection) {
|
||||||
return ((Collection) parent).toArray();
|
return ((Collection) parent).toArray();
|
||||||
|
@ -122,7 +127,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
DeadNodes dead = new DeadNodes();
|
DeadNodes dead = new DeadNodes();
|
||||||
Iterator<IBasicBlock> iter = ((IControlFlowGraph) parent).getUnconnectedNodeIterator();
|
Iterator<IBasicBlock> iter = ((IControlFlowGraph) parent).getUnconnectedNodeIterator();
|
||||||
for (; iter.hasNext();) {
|
for (; iter.hasNext();) {
|
||||||
IBasicBlock iBasicBlock = (IBasicBlock) iter.next();
|
IBasicBlock iBasicBlock = iter.next();
|
||||||
dead.add(iBasicBlock);
|
dead.add(iBasicBlock);
|
||||||
}
|
}
|
||||||
ArrayList all = new ArrayList();
|
ArrayList all = new ArrayList();
|
||||||
|
@ -146,6 +151,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasChildren(Object parent) {
|
public boolean hasChildren(Object parent) {
|
||||||
return getChildren(parent).length > 0;
|
return getChildren(parent).length > 0;
|
||||||
}
|
}
|
||||||
|
@ -169,6 +175,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ViewLabelProvider extends LabelProvider {
|
class ViewLabelProvider extends LabelProvider {
|
||||||
|
@Override
|
||||||
public String getText(Object obj) {
|
public String getText(Object obj) {
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -192,6 +199,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
return "0x" + Integer.toHexString(System.identityHashCode(obj));
|
return "0x" + Integer.toHexString(System.identityHashCode(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Image getImage(Object obj) {
|
public Image getImage(Object obj) {
|
||||||
String imageKey = "task.png";
|
String imageKey = "task.png";
|
||||||
if (obj instanceof IDecisionNode || obj instanceof IControlFlowGraph)
|
if (obj instanceof IDecisionNode || obj instanceof IControlFlowGraph)
|
||||||
|
@ -220,6 +228,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
* This is a callback that will allow us to create the viewer and initialize
|
* This is a callback that will allow us to create the viewer and initialize
|
||||||
* it.
|
* it.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void createPartControl(Composite parent) {
|
public void createPartControl(Composite parent) {
|
||||||
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||||
drillDownAdapter = new DrillDownAdapter(viewer);
|
drillDownAdapter = new DrillDownAdapter(viewer);
|
||||||
|
@ -236,6 +245,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
MenuManager menuMgr = new MenuManager("#PopupMenu");
|
MenuManager menuMgr = new MenuManager("#PopupMenu");
|
||||||
menuMgr.setRemoveAllWhenShown(true);
|
menuMgr.setRemoveAllWhenShown(true);
|
||||||
menuMgr.addMenuListener(new IMenuListener() {
|
menuMgr.addMenuListener(new IMenuListener() {
|
||||||
|
@Override
|
||||||
public void menuAboutToShow(IMenuManager manager) {
|
public void menuAboutToShow(IMenuManager manager) {
|
||||||
ControlFlowGraphView.this.fillContextMenu(manager);
|
ControlFlowGraphView.this.fillContextMenu(manager);
|
||||||
}
|
}
|
||||||
|
@ -272,6 +282,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
|
|
||||||
private void makeActions() {
|
private void makeActions() {
|
||||||
action1 = new Action() {
|
action1 = new Action() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
IEditorPart e = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
|
IEditorPart e = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
|
||||||
ITranslationUnit tu = (ITranslationUnit) CDTUITools.getEditorInputCElement(e.getEditorInput());
|
ITranslationUnit tu = (ITranslationUnit) CDTUITools.getEditorInputCElement(e.getEditorInput());
|
||||||
|
@ -289,6 +300,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
action1.setToolTipText("Synchronize");
|
action1.setToolTipText("Synchronize");
|
||||||
action1.setImageDescriptor(ControlFlowGraphPlugin.getDefault().getImageDescriptor("icons/refresh_view.gif"));
|
action1.setImageDescriptor(ControlFlowGraphPlugin.getDefault().getImageDescriptor("icons/refresh_view.gif"));
|
||||||
doubleClickAction = new Action() {
|
doubleClickAction = new Action() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ISelection selection = viewer.getSelection();
|
ISelection selection = viewer.getSelection();
|
||||||
Object obj = ((IStructuredSelection) selection).getFirstElement();
|
Object obj = ((IStructuredSelection) selection).getFirstElement();
|
||||||
|
@ -299,6 +311,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
|
|
||||||
private void hookDoubleClickAction() {
|
private void hookDoubleClickAction() {
|
||||||
viewer.addDoubleClickListener(new IDoubleClickListener() {
|
viewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||||
|
@Override
|
||||||
public void doubleClick(DoubleClickEvent event) {
|
public void doubleClick(DoubleClickEvent event) {
|
||||||
doubleClickAction.run();
|
doubleClickAction.run();
|
||||||
}
|
}
|
||||||
|
@ -316,6 +329,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
shouldVisitDeclarations = true;
|
shouldVisitDeclarations = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int visit(IASTDeclaration decl) {
|
public int visit(IASTDeclaration decl) {
|
||||||
if (decl instanceof IASTFunctionDefinition) {
|
if (decl instanceof IASTFunctionDefinition) {
|
||||||
CxxControlFlowGraph graph = new ControlFlowGraphBuilder().build((IASTFunctionDefinition) decl);
|
CxxControlFlowGraph graph = new ControlFlowGraphBuilder().build((IASTFunctionDefinition) decl);
|
||||||
|
@ -327,6 +341,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
};
|
};
|
||||||
ast.accept(visitor);
|
ast.accept(visitor);
|
||||||
viewer.getControl().getDisplay().asyncExec(new Runnable() {
|
viewer.getControl().getDisplay().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
viewer.setInput(functions);
|
viewer.setInput(functions);
|
||||||
|
@ -337,6 +352,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
/**
|
/**
|
||||||
* Passing the focus request to the viewer's control.
|
* Passing the focus request to the viewer's control.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
viewer.getControl().setFocus();
|
viewer.getControl().setFocus();
|
||||||
}
|
}
|
||||||
|
@ -410,6 +426,7 @@ public class ControlFlowGraphView extends ViewPart {
|
||||||
|
|
||||||
private void hookSingleClickAction() {
|
private void hookSingleClickAction() {
|
||||||
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
new ASTHighlighterAction(null).run();
|
new ASTHighlighterAction(null).run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
|
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
@ -49,6 +50,7 @@ public class Activator extends AbstractUIPlugin {
|
||||||
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
|
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
plugin = null;
|
plugin = null;
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class CodanProblemMarkerResolutionGenerator implements IMarkerResolutionG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IMarkerResolution[] getResolutions(IMarker marker) {
|
public IMarkerResolution[] getResolutions(IMarker marker) {
|
||||||
if (resolutionsLoaded == false) {
|
if (resolutionsLoaded == false) {
|
||||||
readExtensions();
|
readExtensions();
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class OpenProblemPreferences implements IObjectActionDelegate {
|
||||||
public OpenProblemPreferences() {
|
public OpenProblemPreferences() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
if (selection instanceof IStructuredSelection) {
|
if (selection instanceof IStructuredSelection) {
|
||||||
IStructuredSelection ss = (IStructuredSelection) selection;
|
IStructuredSelection ss = (IStructuredSelection) selection;
|
||||||
|
@ -45,10 +46,12 @@ public class OpenProblemPreferences implements IObjectActionDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void selectionChanged(IAction action, ISelection selection) {
|
public void selectionChanged(IAction action, ISelection selection) {
|
||||||
this.selection = selection;
|
this.selection = selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||||
this.targetPart = targetPart;
|
this.targetPart = targetPart;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,12 @@ import org.eclipse.ui.IWorkbenchPart;
|
||||||
public class RunCodeAnalysis implements IObjectActionDelegate {
|
public class RunCodeAnalysis implements IObjectActionDelegate {
|
||||||
private ISelection sel;
|
private ISelection sel;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
Job job = new Job(CodanUIMessages.Job_TitleRunningAnalysis) {
|
Job job = new Job(CodanUIMessages.Job_TitleRunningAnalysis) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -67,6 +69,7 @@ public class RunCodeAnalysis implements IObjectActionDelegate {
|
||||||
job.schedule();
|
job.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void selectionChanged(IAction action, ISelection selection) {
|
public void selectionChanged(IAction action, ISelection selection) {
|
||||||
this.sel = selection;
|
this.sel = selection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class ToggleNatureAction implements IObjectActionDelegate {
|
||||||
*
|
*
|
||||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
if (selection instanceof IStructuredSelection) {
|
if (selection instanceof IStructuredSelection) {
|
||||||
for (Iterator it = ((IStructuredSelection) selection).iterator(); it.hasNext();) {
|
for (Iterator it = ((IStructuredSelection) selection).iterator(); it.hasNext();) {
|
||||||
|
@ -56,6 +57,7 @@ public class ToggleNatureAction implements IObjectActionDelegate {
|
||||||
* org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
|
* org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
|
||||||
* .IAction, org.eclipse.jface.viewers.ISelection)
|
* .IAction, org.eclipse.jface.viewers.ISelection)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void selectionChanged(IAction action, ISelection selection) {
|
public void selectionChanged(IAction action, ISelection selection) {
|
||||||
this.selection = selection;
|
this.selection = selection;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +69,7 @@ public class ToggleNatureAction implements IObjectActionDelegate {
|
||||||
* org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
|
* org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
|
||||||
* action.IAction, org.eclipse.ui.IWorkbenchPart)
|
* action.IAction, org.eclipse.ui.IWorkbenchPart)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,10 +139,12 @@ public class ExclusionInclusionEntryDialog extends StatusDialog {
|
||||||
// -------- ExclusionPatternAdapter --------
|
// -------- ExclusionPatternAdapter --------
|
||||||
private class ExclusionPatternAdapter implements IDialogFieldListener, IStringButtonAdapter {
|
private class ExclusionPatternAdapter implements IDialogFieldListener, IStringButtonAdapter {
|
||||||
// -------- IDialogFieldListener
|
// -------- IDialogFieldListener
|
||||||
|
@Override
|
||||||
public void dialogFieldChanged(DialogField field) {
|
public void dialogFieldChanged(DialogField field) {
|
||||||
doStatusLineUpdate();
|
doStatusLineUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void changeControlPressed(DialogField field) {
|
public void changeControlPressed(DialogField field) {
|
||||||
doChangeControlPressed();
|
doChangeControlPressed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements IWor
|
||||||
*
|
*
|
||||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IAdaptable getElement() {
|
public IAdaptable getElement() {
|
||||||
if (element.getAdapter(IProject.class) != null)
|
if (element.getAdapter(IProject.class) != null)
|
||||||
return (IProject) element.getAdapter(IProject.class);
|
return (IProject) element.getAdapter(IProject.class);
|
||||||
|
@ -80,6 +81,7 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements IWor
|
||||||
*
|
*
|
||||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
|
* @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setElement(IAdaptable element) {
|
public void setElement(IAdaptable element) {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
if (getElement() != null) {
|
if (getElement() != null) {
|
||||||
|
|
|
@ -71,6 +71,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc) Method declared on FieldEditor.
|
* (non-Javadoc) Method declared on FieldEditor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void adjustForNumColumns(int numColumns) {
|
protected void adjustForNumColumns(int numColumns) {
|
||||||
Control control = getLabelControl();
|
Control control = getLabelControl();
|
||||||
if (control != null) {
|
if (control != null) {
|
||||||
|
@ -84,6 +85,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc) Method declared on FieldEditor.
|
* (non-Javadoc) Method declared on FieldEditor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void doFillIntoGrid(Composite parent, int numColumns) {
|
protected void doFillIntoGrid(Composite parent, int numColumns) {
|
||||||
doFillLabelIntoGrid(parent, numColumns);
|
doFillLabelIntoGrid(parent, numColumns);
|
||||||
doFillBoxIntoGrid(parent, numColumns);
|
doFillBoxIntoGrid(parent, numColumns);
|
||||||
|
@ -113,6 +115,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc) Method declared on FieldEditor.
|
* (non-Javadoc) Method declared on FieldEditor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void doLoad() {
|
protected void doLoad() {
|
||||||
if (getTreeControl() != null) {
|
if (getTreeControl() != null) {
|
||||||
String s = getPreferenceStore().getString(getPreferenceName());
|
String s = getPreferenceStore().getString(getPreferenceName());
|
||||||
|
@ -140,6 +143,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
* @Override
|
* @Override
|
||||||
* @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
|
* @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void checkStateChanged(CheckStateChangedEvent event) {
|
public void checkStateChanged(CheckStateChangedEvent event) {
|
||||||
Object element = event.getElement();
|
Object element = event.getElement();
|
||||||
treeViewer.setGrayed(element, false);
|
treeViewer.setGrayed(element, false);
|
||||||
|
@ -185,6 +189,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc) Method declared on FieldEditor.
|
* (non-Javadoc) Method declared on FieldEditor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void doLoadDefault() {
|
protected void doLoadDefault() {
|
||||||
if (getTreeControl() != null) {
|
if (getTreeControl() != null) {
|
||||||
String s = getPreferenceStore().getDefaultString(getPreferenceName());
|
String s = getPreferenceStore().getDefaultString(getPreferenceName());
|
||||||
|
@ -195,6 +200,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc) Method declared on FieldEditor.
|
* (non-Javadoc) Method declared on FieldEditor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void doStore() {
|
protected void doStore() {
|
||||||
String s = modelToString(getViewer().getInput());
|
String s = modelToString(getViewer().getInput());
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
|
@ -230,6 +236,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc) Method declared on FieldEditor.
|
* (non-Javadoc) Method declared on FieldEditor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getNumberOfControls() {
|
public int getNumberOfControls() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
@ -250,6 +257,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc) Method declared on FieldEditor.
|
* (non-Javadoc) Method declared on FieldEditor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
if (getTreeControl() != null) {
|
if (getTreeControl() != null) {
|
||||||
getTreeControl().setFocus();
|
getTreeControl().setFocus();
|
||||||
|
@ -259,6 +267,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* @see FieldEditor.setEnabled(boolean,Composite).
|
* @see FieldEditor.setEnabled(boolean,Composite).
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setEnabled(boolean enabled, Composite parent) {
|
public void setEnabled(boolean enabled, Composite parent) {
|
||||||
super.setEnabled(enabled, parent);
|
super.setEnabled(enabled, parent);
|
||||||
createListControl(parent).setEnabled(enabled);
|
createListControl(parent).setEnabled(enabled);
|
||||||
|
@ -276,6 +285,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
*/
|
*/
|
||||||
protected abstract String modelToString(Object model);
|
protected abstract String modelToString(Object model);
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void createControl(Composite parent) {
|
protected void createControl(Composite parent) {
|
||||||
GridLayout ly = (GridLayout) parent.getLayout();
|
GridLayout ly = (GridLayout) parent.getLayout();
|
||||||
doFillIntoGrid(parent, ly.numColumns);
|
doFillIntoGrid(parent, ly.numColumns);
|
||||||
|
@ -295,6 +305,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc) Method declared on FieldEditor.
|
* (non-Javadoc) Method declared on FieldEditor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
@ -302,6 +313,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements ICheckSta
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc) Method declared on FieldEditor.
|
* (non-Javadoc) Method declared on FieldEditor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void refreshValidState() {
|
protected void refreshValidState() {
|
||||||
isValid = checkState();
|
isValid = checkState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements IWork
|
||||||
setPreferenceStore(new ScopedPreferenceStore(new InstanceScope(), CodanCorePlugin.PLUGIN_ID));
|
setPreferenceStore(new ScopedPreferenceStore(new InstanceScope(), CodanCorePlugin.PLUGIN_ID));
|
||||||
// setDescription("Code Analysis Preference Page");
|
// setDescription("Code Analysis Preference Page");
|
||||||
problemSelectionListener = new ISelectionChangedListener() {
|
problemSelectionListener = new ISelectionChangedListener() {
|
||||||
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
if (infoButton != null) {
|
if (infoButton != null) {
|
||||||
if (event.getSelection() instanceof ITreeSelection) {
|
if (event.getSelection() instanceof ITreeSelection) {
|
||||||
|
@ -99,6 +100,7 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements IWork
|
||||||
addField(checkedTreeEditor);
|
addField(checkedTreeEditor);
|
||||||
checkedTreeEditor.getTreeViewer().addSelectionChangedListener(problemSelectionListener);
|
checkedTreeEditor.getTreeViewer().addSelectionChangedListener(problemSelectionListener);
|
||||||
checkedTreeEditor.getTreeViewer().addDoubleClickListener(new IDoubleClickListener() {
|
checkedTreeEditor.getTreeViewer().addDoubleClickListener(new IDoubleClickListener() {
|
||||||
|
@Override
|
||||||
public void doubleClick(DoubleClickEvent event) {
|
public void doubleClick(DoubleClickEvent event) {
|
||||||
openCustomizeDialog();
|
openCustomizeDialog();
|
||||||
}
|
}
|
||||||
|
@ -213,6 +215,7 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements IWork
|
||||||
* @see
|
* @see
|
||||||
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(IWorkbench workbench) {
|
public void init(IWorkbench workbench) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
|
||||||
*
|
*
|
||||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
|
* @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setElement(IAdaptable element) {
|
public void setElement(IAdaptable element) {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
}
|
}
|
||||||
|
@ -120,6 +121,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
|
||||||
*
|
*
|
||||||
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public IAdaptable getElement() {
|
public IAdaptable getElement() {
|
||||||
if (element == null)
|
if (element == null)
|
||||||
return element;
|
return element;
|
||||||
|
@ -360,6 +362,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage i
|
||||||
manager.addToRoot(targetNode);
|
manager.addToRoot(targetNode);
|
||||||
final PreferenceDialog dialog = new PreferenceDialog(getControl().getShell(), manager);
|
final PreferenceDialog dialog = new PreferenceDialog(getControl().getShell(), manager);
|
||||||
BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
|
BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
dialog.create();
|
dialog.create();
|
||||||
dialog.setMessage(targetNode.getLabelText());
|
dialog.setMessage(targetNode.getLabelText());
|
||||||
|
|
|
@ -212,6 +212,7 @@ public class FileScopePreferencePage extends PreferencePage {
|
||||||
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter#customButtonPressed(org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField,
|
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter#customButtonPressed(org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField,
|
||||||
* int)
|
* int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void customButtonPressed(ListDialogField field, int index) {
|
public void customButtonPressed(ListDialogField field, int index) {
|
||||||
doCustomButtonPressed(field, index);
|
doCustomButtonPressed(field, index);
|
||||||
}
|
}
|
||||||
|
@ -219,6 +220,7 @@ public class FileScopePreferencePage extends PreferencePage {
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter#selectionChanged(org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField)
|
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter#selectionChanged(org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void selectionChanged(ListDialogField field) {
|
public void selectionChanged(ListDialogField field) {
|
||||||
doSelectionChanged(field);
|
doSelectionChanged(field);
|
||||||
}
|
}
|
||||||
|
@ -226,6 +228,7 @@ public class FileScopePreferencePage extends PreferencePage {
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter#doubleClicked(org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField)
|
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter#doubleClicked(org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void doubleClicked(ListDialogField field) {
|
public void doubleClicked(ListDialogField field) {
|
||||||
doDoubleClicked(field);
|
doDoubleClicked(field);
|
||||||
}
|
}
|
||||||
|
@ -233,6 +236,7 @@ public class FileScopePreferencePage extends PreferencePage {
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener#dialogFieldChanged(org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
|
* @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener#dialogFieldChanged(org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dialogFieldChanged(DialogField field) {
|
public void dialogFieldChanged(DialogField field) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
|
||||||
* org.eclipse.jface.viewers.ICheckStateProvider#isChecked(java.lang
|
* org.eclipse.jface.viewers.ICheckStateProvider#isChecked(java.lang
|
||||||
* .Object)
|
* .Object)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isChecked(Object element) {
|
public boolean isChecked(Object element) {
|
||||||
if (element instanceof IProblem) {
|
if (element instanceof IProblem) {
|
||||||
IProblem p = (IProblem) element;
|
IProblem p = (IProblem) element;
|
||||||
|
@ -88,6 +89,7 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
|
||||||
* org.eclipse.jface.viewers.ICheckStateProvider#isGrayed(java.lang.
|
* org.eclipse.jface.viewers.ICheckStateProvider#isGrayed(java.lang.
|
||||||
* Object)
|
* Object)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isGrayed(Object element) {
|
public boolean isGrayed(Object element) {
|
||||||
if (element instanceof IProblem) {
|
if (element instanceof IProblem) {
|
||||||
IProblem p = (IProblem) element;
|
IProblem p = (IProblem) element;
|
||||||
|
@ -130,14 +132,17 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProblemsContentProvider implements IContentProvider, ITreeContentProvider {
|
class ProblemsContentProvider implements IContentProvider, ITreeContentProvider {
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getChildren(Object parentElement) {
|
public Object[] getChildren(Object parentElement) {
|
||||||
if (parentElement instanceof Object[])
|
if (parentElement instanceof Object[])
|
||||||
return (Object[]) parentElement;
|
return (Object[]) parentElement;
|
||||||
|
@ -150,14 +155,17 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getParent(Object element) {
|
public Object getParent(Object element) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
return getChildren(element).length > 0;
|
return getChildren(element).length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
return getChildren(inputElement);
|
return getChildren(inputElement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,7 @@ public class ProblemDetails extends ViewPart {
|
||||||
description.addSelectionListener(linkSelAdapter);
|
description.addSelectionListener(linkSelAdapter);
|
||||||
ISelectionService ser = (ISelectionService) getSite().getService(ISelectionService.class);
|
ISelectionService ser = (ISelectionService) getSite().getService(ISelectionService.class);
|
||||||
ser.addSelectionListener(new ISelectionListener() {
|
ser.addSelectionListener(new ISelectionListener() {
|
||||||
|
@Override
|
||||||
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
|
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
|
||||||
if (part.getSite().getId().equals(problemsViewId)) {
|
if (part.getSite().getId().equals(problemsViewId)) {
|
||||||
processSelection(selection);
|
processSelection(selection);
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class RunCodanCommand extends AbstractHandler {
|
||||||
public RunCodanCommand() {
|
public RunCodanCommand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
|
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
|
||||||
RunCodeAnalysis action = new RunCodeAnalysis();
|
RunCodeAnalysis action = new RunCodeAnalysis();
|
||||||
|
|
Loading…
Add table
Reference in a new issue