From 0c290ae7eabb8cb32e1eb28f55cceb9e6350d596 Mon Sep 17 00:00:00 2001 From: Elliott Baron Date: Tue, 25 Aug 2009 21:01:56 -0400 Subject: Initial commit: New file. * .gitignore: New file. * org.eclipse.cdt.codan.checkers.ui/.classpath: New file. * org.eclipse.cdt.codan.checkers.ui/.project: New file. * org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/.settings/org.eclipse.jdt.core.prefs: New file. * org.eclipse.cdt.codan.checkers.ui/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/CVS/Template: New file. * org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/META-INF/MANIFEST.MF: New file. * org.eclipse.cdt.codan.checkers.ui/build.properties: New file. * org.eclipse.cdt.codan.checkers.ui/plugin.xml: New file. * org.eclipse.cdt.codan.checkers.ui/src/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CheckersUiActivator.java: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Root: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CodanProblemMarkerResolutionGenerator.java: New file. * org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java: New file. * org.eclipse.cdt.codan.checkers/.classpath: New file. * org.eclipse.cdt.codan.checkers/.project: New file. * org.eclipse.cdt.codan.checkers/.settings/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/.settings/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/.settings/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs: New file. * org.eclipse.cdt.codan.checkers/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/CVS/Template: New file. * org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/META-INF/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF: New file. * org.eclipse.cdt.codan.checkers/build.properties: New file. * org.eclipse.cdt.codan.checkers/plugin.xml: New file. * org.eclipse.cdt.codan.checkers/src/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java: New file. * org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java: New file. * org.eclipse.cdt.codan.core/.classpath: New file. * org.eclipse.cdt.codan.core/.project: New file. * org.eclipse.cdt.codan.core/.settings/CVS/Entries: New file. * org.eclipse.cdt.codan.core/.settings/CVS/Repository: New file. * org.eclipse.cdt.codan.core/.settings/CVS/Root: New file. * org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs: New file. * org.eclipse.cdt.codan.core/CVS/Entries: New file. * org.eclipse.cdt.codan.core/CVS/Repository: New file. * org.eclipse.cdt.codan.core/CVS/Root: New file. * org.eclipse.cdt.codan.core/CVS/Template: New file. * org.eclipse.cdt.codan.core/META-INF/CVS/Entries: New file. * org.eclipse.cdt.codan.core/META-INF/CVS/Repository: New file. * org.eclipse.cdt.codan.core/META-INF/CVS/Root: New file. * org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF: New file. * org.eclipse.cdt.codan.core/build.properties: New file. * org.eclipse.cdt.codan.core/plugin.xml: New file. * org.eclipse.cdt.codan.core/schema/CVS/Entries: New file. * org.eclipse.cdt.codan.core/schema/CVS/Repository: New file. * org.eclipse.cdt.codan.core/schema/CVS/Root: New file. * org.eclipse.cdt.codan.core/schema/checkers.exsd: New file. * org.eclipse.cdt.codan.core/src/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanApplication.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanRuntime.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractIndexAstChecker.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanSeverity.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICAstChecker.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICheckersRegistry.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanAstReconciler.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanBuilder.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemReporter.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemLocation.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodeAnlysisNature.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Repository: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Root: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java: New file. * org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java: New file. * org.eclipse.cdt.codan.ui/.classpath: New file. * org.eclipse.cdt.codan.ui/.project: New file. * org.eclipse.cdt.codan.ui/.settings/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/.settings/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/.settings/CVS/Root: New file. * org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs: New file. * org.eclipse.cdt.codan.ui/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/CVS/Root: New file. * org.eclipse.cdt.codan.ui/CVS/Template: New file. * org.eclipse.cdt.codan.ui/META-INF/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/META-INF/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/META-INF/CVS/Root: New file. * org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF: New file. * org.eclipse.cdt.codan.ui/build.properties: New file. * org.eclipse.cdt.codan.ui/plugin.xml: New file. * org.eclipse.cdt.codan.ui/src/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CheckedTreeEditor.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FieldEditorOverlayPage.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.properties: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/PreferenceInitializer.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Activator.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanCReconciler.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Startup.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Entries: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Repository: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/RunCodeAnalysis.java: New file. * org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/ToggleNatureAction.java: New file. --- .../cdt/codan/core/model/AbstractChecker.java | 76 ++++++++++++++ .../codan/core/model/AbstractIndexAstChecker.java | 97 ++++++++++++++++++ .../org/eclipse/cdt/codan/core/model/CVS/Entries | 16 +++ .../eclipse/cdt/codan/core/model/CVS/Repository | 1 + .../src/org/eclipse/cdt/codan/core/model/CVS/Root | 1 + .../cdt/codan/core/model/CodanSeverity.java | 40 ++++++++ .../eclipse/cdt/codan/core/model/ICAstChecker.java | 21 ++++ .../org/eclipse/cdt/codan/core/model/IChecker.java | 28 ++++++ .../cdt/codan/core/model/ICheckersRegistry.java | 66 +++++++++++++ .../cdt/codan/core/model/ICodanAstReconciler.java | 22 +++++ .../cdt/codan/core/model/ICodanBuilder.java | 22 +++++ .../org/eclipse/cdt/codan/core/model/IProblem.java | 37 +++++++ .../cdt/codan/core/model/IProblemCategory.java | 31 ++++++ .../cdt/codan/core/model/IProblemElement.java | 19 ++++ .../cdt/codan/core/model/IProblemLocation.java | 54 ++++++++++ .../cdt/codan/core/model/IProblemProfile.java | 52 ++++++++++ .../cdt/codan/core/model/IProblemReporter.java | 28 ++++++ .../cdt/codan/core/model/ProblemLocation.java | 109 +++++++++++++++++++++ .../cdt/codan/core/model/ProblemProfile.java | 103 +++++++++++++++++++ 19 files changed, 823 insertions(+) create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractIndexAstChecker.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Entries create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Repository create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Root create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanSeverity.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICAstChecker.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICheckersRegistry.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanAstReconciler.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanBuilder.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemReporter.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemLocation.java create mode 100644 org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java (limited to 'org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model') diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java new file mode 100644 index 0000000..f1e5028 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import org.eclipse.cdt.codan.core.CodanRuntime; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; + +public abstract class AbstractChecker implements IChecker { + protected String name; + + public AbstractChecker() { + } + + /** + * @return true if checker is enabled in context of resource, if returns + * false checker's "processResource" method won't be called + */ + public boolean enabledInContext(IResource res) { + return true; + } + + /** + * Reports a simple problem for given file and line + * + * @param id + * - problem id + * @param file + * - file + * @param lineNumber + * - line + * @param arg + * - problem argument, if problem does not define error message + * it will be error message (not recommended because of + * internationalization) + */ + public void reportProblem(String id, IFile file, int lineNumber, String arg) { + getProblemReporter().reportProblem(id, + new ProblemLocation(file, lineNumber), arg); + } + + /** + * Reports a simple problem for given file and line, error message comes + * from problem definition + * + * @param id + * - problem id + * @param file + * - file + * @param lineNumber + * - line + */ + public void reportProblem(String id, IFile file, int lineNumber) { + getProblemReporter().reportProblem(id, + new ProblemLocation(file, lineNumber), new Object[] {}); + } + + /** + * @return problem reporter for given checker + */ + protected IProblemReporter getProblemReporter() { + return CodanRuntime.getInstance().getProblemReporter(); + } + + public boolean runInEditor() { + return false; + } +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractIndexAstChecker.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractIndexAstChecker.java new file mode 100644 index 0000000..2c87b07 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractIndexAstChecker.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import org.eclipse.cdt.codan.core.CodanCorePlugin; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.dom.ast.IASTFileLocation; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.index.IIndex; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ITranslationUnit; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + +/** + * @author Alena + * + */ +public abstract class AbstractIndexAstChecker extends AbstractChecker implements + ICAstChecker { + private IFile file; + + protected IFile getFile() { + return file; + } + + void processFile(IFile file) throws CoreException, InterruptedException { + // create translation unit and access index + ICElement model = CoreModel.getDefault().create(file); + if (!(model instanceof ITranslationUnit)) + return; + ITranslationUnit tu = (ITranslationUnit) model; + if (tu == null) + return; // not a C/C++ file + IIndex index = CCorePlugin.getIndexManager().getIndex(tu.getCProject()); + // lock the index for read access + index.acquireReadLock(); + try { + // create index based ast + IASTTranslationUnit ast = tu.getAST(index, + ITranslationUnit.AST_SKIP_INDEXED_HEADERS); + // traverse the ast using the visitor pattern. + this.file = file; + processAst(ast); + } finally { + this.file = null; + index.releaseReadLock(); + } + } + + public boolean processResource(IResource resource) { + if (resource instanceof IFile) { + IFile file = (IFile) resource; + try { + processFile(file); + } catch (CoreException e) { + CodanCorePlugin.log(e); + } catch (InterruptedException e) { + // ignore + } + return false; + } + return true; + } + + public void reportProblem(String id, IASTNode astNode, String message) { + IASTFileLocation astLocation = astNode.getFileLocation(); + IPath location = new Path(astLocation.getFileName()); + IFile astFile = ResourcesPlugin.getWorkspace().getRoot() + .getFileForLocation(location); + if (astFile == null) { + astFile = file; + } + getProblemReporter().reportProblem( + id, + new ProblemLocation(astFile, astLocation + .getStartingLineNumber()), message); + } + + public boolean runInEditor() { + return true; + } +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Entries new file mode 100644 index 0000000..9043127 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Entries @@ -0,0 +1,16 @@ +/AbstractChecker.java/1.4/Sat Aug 22 21:31:29 2009// +/AbstractIndexAstChecker.java/1.5/Sat Aug 22 21:31:29 2009// +/CodanSeverity.java/1.2/Wed Apr 22 01:26:56 2009// +/ICAstChecker.java/1.1/Thu Apr 9 12:46:50 2009// +/IChecker.java/1.2/Sat Aug 22 21:31:29 2009// +/ICheckersRegistry.java/1.1/Sat Aug 22 21:16:48 2009// +/ICodanAstReconciler.java/1.1/Sat Aug 22 21:16:48 2009// +/ICodanBuilder.java/1.1/Sat Aug 22 21:16:48 2009// +/IProblem.java/1.3/Sat Aug 22 21:16:48 2009// +/IProblemCategory.java/1.2/Thu Apr 16 01:46:57 2009// +/IProblemElement.java/1.1/Thu Apr 16 01:46:57 2009// +/IProblemLocation.java/1.1/Sat Aug 22 21:16:48 2009// +/IProblemProfile.java/1.3/Sat May 9 01:54:38 2009// +/IProblemReporter.java/1.1/Sat Aug 22 21:16:48 2009// +/ProblemLocation.java/1.1/Sat Aug 22 21:16:48 2009// +/ProblemProfile.java/1.4/Sat Aug 22 21:16:48 2009// diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Repository b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Repository new file mode 100644 index 0000000..48894f7 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Repository @@ -0,0 +1 @@ +org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Root b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Root new file mode 100644 index 0000000..04efa23 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@dev.eclipse.org:/cvsroot/tools diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanSeverity.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanSeverity.java new file mode 100644 index 0000000..acfa4d1 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanSeverity.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import org.eclipse.core.resources.IMarker; + +public enum CodanSeverity { + Info(IMarker.SEVERITY_INFO), Warning(IMarker.SEVERITY_WARNING), Error( + IMarker.SEVERITY_ERROR); + private int value; + + private CodanSeverity(int value) { + this.value = value; + } + + public int intValue() { + return value; + } + + /** + * @return + */ + public static String[] stringValues() { + CodanSeverity[] values = values(); + String[] svalues = new String[values.length]; + for (int i = 0; i < values.length; i++) { + CodanSeverity sev = values[i]; + svalues[i] = sev.toString(); + } + return svalues; + } +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICAstChecker.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICAstChecker.java new file mode 100644 index 0000000..461c0fa --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICAstChecker.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; + +/** + * @author Alena + * + */ +public interface ICAstChecker extends IChecker { + void processAst(IASTTranslationUnit ast); +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java new file mode 100644 index 0000000..4f995db --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import org.eclipse.core.resources.IResource; + +public interface IChecker { + public boolean processResource(IResource resource); + + boolean enabledInContext(IResource resource); + + /** + * Checker must implement this method to determine if it can run in editor + * "as you type", checker must be really light weight to run in this mode + * + * @return true if need to be run in editor as user types, and false + * otherwise + */ + boolean runInEditor(); +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICheckersRegistry.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICheckersRegistry.java new file mode 100644 index 0000000..052d868 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICheckersRegistry.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import java.util.Iterator; + +import org.eclipse.core.resources.IResource; + +/** + * @author Alena + * + */ +public interface ICheckersRegistry { + public abstract Iterator iterator(); + + public abstract void addChecker(IChecker checker); + + public abstract void addProblem(IProblem p, String category); + + public abstract void addCategory(IProblemCategory p, String category); + + public abstract void addRefProblem(IChecker c, IProblem p); + + /** + * @return + */ + public abstract IProblemProfile getDefaultProfile(); + + /** + * @return + */ + public abstract IProblemProfile getWorkspaceProfile(); + + /** + * @param element + * @return + */ + public abstract IProblemProfile getResourceProfile(IResource element); + + /** + * @param element + * @return + */ + public abstract IProblemProfile getResourceProfileWorkingCopy( + IResource element); + + /** + * Set profile for resource. This method is called by UI, and should not be + * called by clients directly + * + * @param resource + * - resource + * @param profile + * - problems profile + */ + public abstract void updateProfile(IResource resource, + IProblemProfile profile); +} \ No newline at end of file diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanAstReconciler.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanAstReconciler.java new file mode 100644 index 0000000..17bc8f7 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanAstReconciler.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * @author Alena + * + */ +public interface ICodanAstReconciler { + public void reconcileAst(IASTTranslationUnit ast, IProgressMonitor monitor); +} \ No newline at end of file diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanBuilder.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanBuilder.java new file mode 100644 index 0000000..ce1f668 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanBuilder.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * @author Alena + * + */ +public interface ICodanBuilder { + public void processResource(IResource resource, IProgressMonitor monitor); +} \ No newline at end of file diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java new file mode 100644 index 0000000..52cfff2 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import java.util.Collection; + +public interface IProblem extends IProblemElement { + String getName(); + + String getId(); + + boolean isEnabled(); + + CodanSeverity getSeverity(); + + String getMessagePattern(); + + void setSeverity(CodanSeverity sev); + + void setEnabled(boolean checked); + + void setMessagePattern(String message); + + public void setProperty(Object key, Object value); + + public Object getProperty(Object key); + + public Collection getPropertyKeys(); +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java new file mode 100644 index 0000000..45a62a0 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +public interface IProblemCategory extends IProblemElement { + String getName(); + + String getId(); + + Object[] getChildren(); + + /** + * @param id + * @return + */ + IProblem findProblem(String id); + + /** + * @param id + * @return + */ + IProblemCategory findCategory(String id); +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java new file mode 100644 index 0000000..b9f7fb8 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +/** + * @author Alena + * + */ +public interface IProblemElement extends Cloneable { + Object clone() throws CloneNotSupportedException; +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java new file mode 100644 index 0000000..f5e4f23 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import org.eclipse.core.resources.IFile; + +/** + * Interface to describe problem location. Usually contains file and linenumber, + * also supports character positions for sophisticated errors. + * + */ +public interface IProblemLocation { + /** + * + * @return File for the problem - absolute full paths + */ + IFile getFile(); + + /** + * + * @return Primary line for the problem, lines start with 1 for file. If -1 + * char position would be used. + */ + int getLineNumber(); + + /** + * + * @return character position where problem starts within file, first char + * is 0, inclusive, tab count as one. If unknown return -1. + */ + int getStartingChar(); + + /** + * + * @return character position where problem ends within file, first char is + * 0, exclusive, tab count as one. If unknown return -1. + */ + int getEndingChar(); + + /** + * + * @return extra data for problem location, checker specific, can be + * backtrace for example + */ + Object getData(); +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java new file mode 100644 index 0000000..9dc465e --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +/** + * Problem Profile contains tree of categories and problems. Profiles can have + * different categories and different problems set, problems with the same id + * can have different severities/enablement in different profiles. To obtain + * profile use class {@link CheckersRegisry#getResourceProfile, + * CheckersRegisry#getDefaultProfile() or CheckersRegisry#getWorkspaceProfile()} + * . + * + */ +public interface IProblemProfile extends IProblemElement { + /** + * @return root category in profile + */ + IProblemCategory getRoot(); + + /** + * Find and return problem by id + * + * @param id + * - problem id + * @return problem instance + */ + IProblem findProblem(String id); + + /** + * Find and return category by id + * + * @param id + * - category id + * @return category instance + */ + IProblemCategory findCategory(String id); + + /** + * Get all defined problems + * + * @return array of problems defined in profile + */ + IProblem[] getProblems(); +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemReporter.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemReporter.java new file mode 100644 index 0000000..814cc40 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemReporter.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + + +/** + * IProblemReporter - interface to report problems + * + */ +public interface IProblemReporter { + /** + * Report a problem with "problemId" id on location determined by "loc", + * using problem specific error message customised by args. + * @param problemId - id of the problem registers with checker + * @param loc - location object + * @param args - custom args, can be null, in this case default message is reported + */ + public void reportProblem(String problemId, IProblemLocation loc, + Object ... args); +} \ No newline at end of file diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemLocation.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemLocation.java new file mode 100644 index 0000000..ced12f0 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemLocation.java @@ -0,0 +1,109 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import org.eclipse.core.resources.IFile; + +/** + * Implementation of IProblemLocation + * + */ +public class ProblemLocation implements IProblemLocation { + protected IFile file; + protected int line; + protected int posStart; + protected int posEnd; + protected Object extra; + + /** + * @param file + * @param line + * @param lineEnd + * @param posStart + * @param posEnd + */ + public ProblemLocation(IFile file, int line) { + this.file = file; + this.line = line; + this.posStart = -1; + this.posEnd = -1; + } + + /** + * @param file + * @param startingLineNumber + * @param endingLineNumber + */ + public ProblemLocation(IFile file, int startChar, int endChar) { + this.file = file; + this.line = -1; + this.posStart = startChar; + this.posEnd = endChar; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.cdt.codan.core.model.IProblemLocation#getData() + */ + public Object getData() { + return extra; + } + + public void setData(Object data) { + this.extra = data; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.cdt.codan.core.model.IProblemLocation#getFile() + */ + public IFile getFile() { + return file; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.cdt.codan.core.model.IProblemLocation#getLine() + */ + public int getLineNumber() { + return getStartingLineNumber(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.cdt.codan.core.model.IProblemLocation#getStartLine() + */ + public int getStartingLineNumber() { + return line; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.cdt.codan.core.model.IProblemLocation#getStartPos() + */ + public int getStartingChar() { + return posStart; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.cdt.codan.core.model.IProblemLocation#getEndingChar() + */ + public int getEndingChar() { + return posEnd; + } +} diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java new file mode 100644 index 0000000..ae90e76 --- /dev/null +++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2009 Alena Laskavaia + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alena Laskavaia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.codan.core.model; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.cdt.codan.internal.core.model.CodanProblemCategory; + +/** + * @author Alena + * + */ +public class ProblemProfile implements IProblemProfile, Cloneable { + private IProblemCategory rootCategory = new CodanProblemCategory("root", + "root"); + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.cdt.codan.core.model.IProblemProfile#getProblem(java.lang + * .String) + */ + public IProblem findProblem(String id) { + return getRoot().findProblem(id); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.cdt.codan.core.model.IProblemProfile#getProblems() + */ + public IProblem[] getProblems() { + Collection problems = new ArrayList(); + collectProblems(getRoot(), problems); + return problems.toArray(new IProblem[problems.size()]); + } + + /** + * @param root + * @param problems + */ + protected void collectProblems(IProblemCategory parent, + Collection problems) { + Object[] children = parent.getChildren(); + for (Object object : children) { + if (object instanceof IProblemCategory) { + IProblemCategory cat = (IProblemCategory) object; + collectProblems(cat, problems); + } else if (object instanceof IProblem) { + problems.add((IProblem) object); + } + } + } + + public IProblemCategory getRoot() { + return rootCategory; + } + + public void addProblem(IProblem p, IProblemCategory cat) { + if (cat == null) + cat = getRoot(); + ((CodanProblemCategory) cat).addChild(p); + } + + public IProblemCategory findCategory(String id) { + return getRoot().findCategory(id); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#clone() + */ + @Override + public Object clone() { + try { + ProblemProfile clone = (ProblemProfile) super.clone(); + clone.rootCategory = (IProblemCategory) ((CodanProblemCategory) this.rootCategory) + .clone(); + return clone; + } catch (CloneNotSupportedException e) { + return this; + } + } + + /** + * @param p + * @param cat + */ + public void addCategory(IProblemCategory category, IProblemCategory parent) { + ((CodanProblemCategory) parent).addChild(category); + } +} -- cgit