summaryrefslogtreecommitdiffstats
path: root/org.eclipse.cdt.codan.core
diff options
context:
space:
mode:
authorElliott Baron <ebaron@fedoraproject.org>2009-08-25 21:01:56 -0400
committerElliott Baron <ebaron@fedoraproject.org>2009-08-25 21:01:56 -0400
commit0c290ae7eabb8cb32e1eb28f55cceb9e6350d596 (patch)
treeca8dda9f30ed2be55b5f06cbf59c3d29e82a8832 /org.eclipse.cdt.codan.core
downloadcodan-0c290ae7eabb8cb32e1eb28f55cceb9e6350d596.tar.gz
codan-0c290ae7eabb8cb32e1eb28f55cceb9e6350d596.tar.xz
codan-0c290ae7eabb8cb32e1eb28f55cceb9e6350d596.zip
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.
Diffstat (limited to 'org.eclipse.cdt.codan.core')
-rw-r--r--org.eclipse.cdt.codan.core/.classpath7
-rw-r--r--org.eclipse.cdt.codan.core/.project28
-rw-r--r--org.eclipse.cdt.codan.core/.settings/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.core/.settings/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/.settings/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--org.eclipse.cdt.codan.core/CVS/Entries8
-rw-r--r--org.eclipse.cdt.codan.core/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/CVS/Template0
-rw-r--r--org.eclipse.cdt.codan.core/META-INF/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.core/META-INF/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/META-INF/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF14
-rw-r--r--org.eclipse.cdt.codan.core/build.properties6
-rw-r--r--org.eclipse.cdt.codan.core/plugin.xml72
-rw-r--r--org.eclipse.cdt.codan.core/schema/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.core/schema/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/schema/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/schema/checkers.exsd246
-rw-r--r--org.eclipse.cdt.codan.core/src/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.core/src/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Entries7
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanApplication.java94
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java91
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java119
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanRuntime.java54
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java20
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java76
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractIndexAstChecker.java97
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Entries16
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanSeverity.java40
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICAstChecker.java21
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java28
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICheckersRegistry.java66
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanAstReconciler.java22
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanBuilder.java22
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java37
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java31
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java19
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java54
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java52
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemReporter.java28
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemLocation.java109
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java103
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Entries4
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java319
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java196
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodeAnlysisNature.java88
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries3
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java122
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java106
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java103
77 files changed, 2578 insertions, 0 deletions
diff --git a/org.eclipse.cdt.codan.core/.classpath b/org.eclipse.cdt.codan.core/.classpath
new file mode 100644
index 0000000..16d067f
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.cdt.codan.core/.project b/org.eclipse.cdt.codan.core/.project
new file mode 100644
index 0000000..8ba33e6
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.codan.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.cdt.codan.core/.settings/CVS/Entries b/org.eclipse.cdt.codan.core/.settings/CVS/Entries
new file mode 100644
index 0000000..cf3287f
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/.settings/CVS/Entries
@@ -0,0 +1 @@
+/org.eclipse.jdt.core.prefs/1.3/Mon Aug 10 18:31:46 2009//
diff --git a/org.eclipse.cdt.codan.core/.settings/CVS/Repository b/org.eclipse.cdt.codan.core/.settings/CVS/Repository
new file mode 100644
index 0000000..516da4c
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/.settings/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/.settings
diff --git a/org.eclipse.cdt.codan.core/.settings/CVS/Root b/org.eclipse.cdt.codan.core/.settings/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/.settings/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..4452aee
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Mon Aug 10 14:23:53 EDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/org.eclipse.cdt.codan.core/CVS/Entries b/org.eclipse.cdt.codan.core/CVS/Entries
new file mode 100644
index 0000000..2fa8e25
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/CVS/Entries
@@ -0,0 +1,8 @@
+/.classpath/1.2/Fri Apr 17 20:50:15 2009//
+/.project/1.1/Thu Apr 9 12:46:50 2009//
+D/.settings////
+D/META-INF////
+/build.properties/1.1/Thu Apr 9 12:46:50 2009//
+/plugin.xml/1.5/Sat Aug 22 21:16:49 2009//
+D/schema////
+D/src////
diff --git a/org.eclipse.cdt.codan.core/CVS/Repository b/org.eclipse.cdt.codan.core/CVS/Repository
new file mode 100644
index 0000000..79bae3c
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core
diff --git a/org.eclipse.cdt.codan.core/CVS/Root b/org.eclipse.cdt.codan.core/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.core/CVS/Template b/org.eclipse.cdt.codan.core/CVS/Template
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/CVS/Template
diff --git a/org.eclipse.cdt.codan.core/META-INF/CVS/Entries b/org.eclipse.cdt.codan.core/META-INF/CVS/Entries
new file mode 100644
index 0000000..3abafa4
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/META-INF/CVS/Entries
@@ -0,0 +1 @@
+/MANIFEST.MF/1.4/Sat Aug 22 21:16:49 2009//
diff --git a/org.eclipse.cdt.codan.core/META-INF/CVS/Repository b/org.eclipse.cdt.codan.core/META-INF/CVS/Repository
new file mode 100644
index 0000000..2017070
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/META-INF/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/META-INF
diff --git a/org.eclipse.cdt.codan.core/META-INF/CVS/Root b/org.eclipse.cdt.codan.core/META-INF/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/META-INF/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF b/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b77eb2c
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Code Analysis Core
+Bundle-SymbolicName: org.eclipse.cdt.codan.core;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.cdt.codan.core.CodanCorePlugin
+Bundle-Vendor: CDT
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.cdt.core
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.cdt.codan.core,
+ org.eclipse.cdt.codan.core.model
diff --git a/org.eclipse.cdt.codan.core/build.properties b/org.eclipse.cdt.codan.core/build.properties
new file mode 100644
index 0000000..3595411
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ schema/
diff --git a/org.eclipse.cdt.codan.core/plugin.xml b/org.eclipse.cdt.codan.core/plugin.xml
new file mode 100644
index 0000000..b7b10a0
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/plugin.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="checkers" name="Code Analysis Checkers" schema="schema/checkers.exsd"/>
+
+ <extension
+ id="codanBuilder"
+ name="Code Analysis Project Builder"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ hasNature="true">
+ <run
+ class="org.eclipse.cdt.codan.internal.core.CodanBuilder">
+ </run>
+ </builder>
+ </extension>
+ <extension
+ id="codanNature"
+ name="CDT Code Analysis Nature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.eclipse.cdt.codan.internal.core.CodeAnlysisNature">
+ </run>
+ </runtime>
+ <builder
+ id="org.eclipse.cdt.codan.core.codanBuilder">
+ </builder>
+ </extension>
+ <extension
+ id="codanProblem"
+ name="Code Analysis Problem"
+ point="org.eclipse.core.resources.markers">
+ <super
+ type="org.eclipse.core.resources.problemmarker">
+ </super>
+ <persistent
+ value="true">
+ </persistent>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ </extension>
+
+ <extension
+ point="org.eclipse.cdt.codan.core.checkers"
+ id="org.eclipse.cdt.codan.core.categories">
+
+ <category
+ id="org.eclipse.cdt.codan.core.categories.ProgrammingProblems"
+ name="Potential programming problems"
+ >
+
+ </category>
+ </extension>
+
+ <extension
+ id="application"
+ point="org.eclipse.core.runtime.applications">
+ <application
+ cardinality="singleton-global"
+ thread="main"
+ visible="true">
+ <run
+ class="org.eclipse.cdt.codan.core.CodanApplication">
+ </run>
+ </application>
+ </extension>
+
+
+
+</plugin>
diff --git a/org.eclipse.cdt.codan.core/schema/CVS/Entries b/org.eclipse.cdt.codan.core/schema/CVS/Entries
new file mode 100644
index 0000000..d6ba65d
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/schema/CVS/Entries
@@ -0,0 +1 @@
+/checkers.exsd/1.1/Thu Apr 9 12:46:50 2009//
diff --git a/org.eclipse.cdt.codan.core/schema/CVS/Repository b/org.eclipse.cdt.codan.core/schema/CVS/Repository
new file mode 100644
index 0000000..fb5fc62
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/schema/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/schema
diff --git a/org.eclipse.cdt.codan.core/schema/CVS/Root b/org.eclipse.cdt.codan.core/schema/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/schema/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.core/schema/checkers.exsd b/org.eclipse.cdt.codan.core/schema/checkers.exsd
new file mode 100644
index 0000000..71808a5
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/schema/checkers.exsd
@@ -0,0 +1,246 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.codan.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.cdt.codan.ui" id="checkers" name="Code Analysis Checkers"/>
+ </appinfo>
+ <documentation>
+ Define chckers for Code Analysis framework.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <choice>
+ <element ref="checker"/>
+ <element ref="category"/>
+ </choice>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="checker">
+ <annotation>
+ <documentation>
+ Checker Element. Sets id, name and class that implements checker
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <choice>
+ <element ref="problem"/>
+ </choice>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Checker id.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Checker class. Must implement IChecker.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.cdt.codan.core.model.IChecker"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ User Friendly name of the chcker or error. Would be display to enable/disable an error.
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="problem">
+ <annotation>
+ <documentation>
+ Problem description (Error, Warning, Info produced by a checker)
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Error id. Should be prefixed by plugin name in general.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ User Friendly name of the error. Would be display to enable/disable an error.
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="defaultSeverity" use="default" value="Warning">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="Error">
+ </enumeration>
+ <enumeration value="Warning">
+ </enumeration>
+ <enumeration value="Info">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="category" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.cdt.codan.core.checkers/category/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="category">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="parentCategory" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.cdt.codan.core.checkers/category/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ The following is an example of a single checker definition:
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension
+ point=&quot;org.eclipse.cdt.codan.ui.checkers&quot;&gt;
+ &lt;checker
+ class=&quot;org.aaa.AssignmentInConditionChecker&quot;
+ id=&quot;org.aaa.AssignmentInConditionChecker&quot;
+ name=&quot;Possible Assignment in Condition instead of comparision&quot;&gt;
+ &lt;/checker&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+The following is an example of a checker that produces two types of errors:
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension
+ point=&quot;org.eclipse.cdt.codan.ui.checkers&quot;&gt;
+
+ &lt;checker
+ class=&quot;org.aaa.NullPointerDereferenceChecker&quot;
+ id=&quot;org.aaa.NullPointerDereferenceChecker&quot;
+ name=&quot;Null Pointer Dereference checker&quot;&gt;
+ &lt;problem id=&quot;org.aaa.npe_must&quot; name=&quot;Null Pointer Dereference&quot;/ defaultSeverity=&quot;Error&quot;&gt;
+ &lt;problem id=&quot;org.aaa.npe_may&quot; name=&quot;Possible Null Pointer Dereference&quot;/&gt;
+ &lt;/checker&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.cdt.codan.core/src/CVS/Entries b/org.eclipse.cdt.codan.core/src/CVS/Entries
new file mode 100644
index 0000000..381094d
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/CVS/Entries
@@ -0,0 +1 @@
+D/org////
diff --git a/org.eclipse.cdt.codan.core/src/CVS/Repository b/org.eclipse.cdt.codan.core/src/CVS/Repository
new file mode 100644
index 0000000..27bc9c6
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src
diff --git a/org.eclipse.cdt.codan.core/src/CVS/Root b/org.eclipse.cdt.codan.core/src/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.core/src/org/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/CVS/Entries
new file mode 100644
index 0000000..0f148f8
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/CVS/Entries
@@ -0,0 +1 @@
+D/eclipse////
diff --git a/org.eclipse.cdt.codan.core/src/org/CVS/Repository b/org.eclipse.cdt.codan.core/src/org/CVS/Repository
new file mode 100644
index 0000000..b353745
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org
diff --git a/org.eclipse.cdt.codan.core/src/org/CVS/Root b/org.eclipse.cdt.codan.core/src/org/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Entries
new file mode 100644
index 0000000..e524915
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Entries
@@ -0,0 +1 @@
+D/cdt////
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Repository b/org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Repository
new file mode 100644
index 0000000..d8b6426
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Root b/org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Entries
new file mode 100644
index 0000000..8d969ba
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Entries
@@ -0,0 +1 @@
+D/codan////
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Repository b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Repository
new file mode 100644
index 0000000..4a43fb5
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Root b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/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/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Entries
new file mode 100644
index 0000000..94f7274
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Entries
@@ -0,0 +1,2 @@
+D/core////
+D/internal////
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Repository b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Repository
new file mode 100644
index 0000000..6727da1
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Root b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/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/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Entries
new file mode 100644
index 0000000..fec4197
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Entries
@@ -0,0 +1,7 @@
+/CodanApplication.java/1.2/Sat Aug 22 21:16:48 2009//
+/CodanCorePlugin.java/1.3/Sat Aug 22 21:16:48 2009//
+/CodanPreferencesLoader.java/1.1/Sat Aug 22 21:16:49 2009//
+/CodanRuntime.java/1.1/Sat Aug 22 21:16:48 2009//
+/PreferenceConstants.java/1.2/Sat Apr 18 04:01:43 2009//
+D/builder////
+D/model////
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Repository b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Repository
new file mode 100644
index 0000000..7f0ac5c
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Root b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/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/CodanApplication.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanApplication.java
new file mode 100644
index 0000000..e0287b1
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanApplication.java
@@ -0,0 +1,94 @@
+package org.eclipse.cdt.codan.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.cdt.codan.internal.core.CodanBuilder;
+import org.eclipse.cdt.codan.internal.core.model.CodanMarkerProblemReporter;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+
+public class CodanApplication implements IApplication {
+ private Collection<String> projects = new ArrayList<String>();
+ private boolean verbose = false;
+ private boolean all = false;
+
+ public Object start(IApplicationContext context) throws Exception {
+ String[] args = (String[]) context.getArguments().get(
+ "application.args");
+ if (args == null || args.length == 0) {
+ help();
+ return EXIT_OK;
+ }
+ extractArguments(args);
+ CodanBuilder codanBuilder = new CodanBuilder();
+ CodanRuntime runtime = CodanRuntime.getInstance();
+ runtime.setProblemReporter(new CodanMarkerProblemReporter() {
+ @Override
+ public void reportProblem(String id, int severity, IFile file,
+ int lineNumber, int startChar, int endChar, String message) {
+ System.out.println(file.getLocation() + ":" + lineNumber + ": "
+ + message);
+ }
+ });
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if (all) {
+ log("Launching analysis on workspace");
+ root.accept(codanBuilder.new CodanResourceVisitor());
+ } else {
+ for (String project : projects) {
+ log("Launching analysis on project " + project);
+ IProject wProject = root.getProject(project);
+ if (!wProject.exists()) {
+ System.err.println("Error: project " + project
+ + " does not exist");
+ continue;
+ }
+ wProject.accept(codanBuilder.new CodanResourceVisitor());
+ }
+ }
+ return EXIT_OK;
+ }
+
+ /**
+ * @param string
+ */
+ private void log(String string) {
+ if (verbose)
+ System.err.println(string);
+ }
+
+ /**
+ * @param args
+ */
+ private void extractArguments(String[] args) {
+ for (int i = 0; i < args.length; i++) {
+ String string = args[i];
+ if (string.equals("-verbose")) {
+ verbose = true;
+ } else if (string.equals("-all")) {
+ all = true;
+ } else {
+ projects.add(string);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private void help() {
+ System.out.println("Usage: [options] <project1> <project2> ...");
+ System.out.println("Options:");
+ System.out.println(" -all - run on all projects in workspace");
+ System.out.println(" -verbose - print extra build information");
+ }
+
+ public void stop() {
+ // nothing
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java
new file mode 100644
index 0000000..d60262b
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java
@@ -0,0 +1,91 @@
+package org.eclipse.cdt.codan.core;
+
+import org.eclipse.cdt.codan.internal.core.CodeAnlysisNature;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CodanCorePlugin extends Plugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.codan.core";
+ public static final String NATURE_ID = CodeAnlysisNature.NATURE_ID;
+ // The shared instance
+ private static CodanCorePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public CodanCorePlugin() {
+ }
+
+ public IEclipsePreferences getStorePreferences() {
+ return new InstanceScope().getNode(PLUGIN_ID);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static CodanCorePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Logs the specified status with this plug-in's log.
+ *
+ * @param status
+ * status to log
+ */
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ /**
+ * Logs an internal error with the specified throwable
+ *
+ * @param e
+ * the exception to be logged
+ */
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, 1, "Internal Error", e)); //$NON-NLS-1$
+ }
+
+ /**
+ * Logs an internal error with the specified message.
+ *
+ * @param message
+ * the error message to log
+ */
+ public static void log(String message) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, 1, message, null));
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java
new file mode 100644
index 0000000..6fd6318
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.cdt.codan.core.model.CodanSeverity;
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemProfile;
+import org.eclipse.cdt.codan.internal.core.model.CodanProblem;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+
+/**
+ * @author Alena
+ *
+ */
+public class CodanPreferencesLoader {
+ private IProblemProfile baseModel;
+
+ /**
+ * @param workspaceProfile
+ */
+ public CodanPreferencesLoader(IProblemProfile profile) {
+ setInput(profile);
+ }
+
+ /**
+ *
+ */
+ public CodanPreferencesLoader() {
+ }
+
+ public void setInput(Object model) {
+ baseModel = (IProblemProfile) model;
+ }
+
+ /**
+ * @return
+ */
+ public IProblem[] getProblems() {
+ IProblem[] problems = baseModel.getProblems();
+ return problems;
+ }
+
+ /**
+ * @param id
+ * @param s
+ */
+ public void setProperty(String id, String s) {
+ IProblem prob = baseModel.findProblem(id);
+ if (!(prob instanceof CodanProblem))
+ return;
+ String sevs = s;
+ boolean enabled = true;
+ if (sevs.startsWith("-")) {
+ sevs = sevs.substring(1);
+ enabled = false;
+ }
+ ((CodanProblem) prob).setEnabled(enabled);
+ CodanSeverity sev;
+ try {
+ sev = CodanSeverity.valueOf(sevs);
+ } catch (RuntimeException e) {
+ sev = CodanSeverity.Warning;
+ }
+ ((CodanProblem) prob).setSeverity(sev);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return getInput().toString();
+ }
+
+ /**
+ * @return
+ */
+ public IProblemProfile getInput() {
+ return baseModel;
+ }
+
+ /**
+ * @param id
+ * @return
+ */
+ public String getProperty(String id) {
+ IProblem prob = baseModel.findProblem(id);
+ if (!(prob instanceof CodanProblem))
+ return null;
+ String enabled = prob.isEnabled() ? "" : "-";
+ String severity = prob.getSeverity().toString();
+ String res = enabled + severity;
+ return res;
+ }
+
+ /**
+ * @param storePreferences
+ */
+ public void load(IEclipsePreferences storePreferences) {
+ IProblem[] probs = getProblems();
+ for (int i = 0; i < probs.length; i++) {
+ String id = probs[i].getId();
+ String s = storePreferences.get(id, null);
+ if (s != null) {
+ setProperty(id, s);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanRuntime.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanRuntime.java
new file mode 100644
index 0000000..16375cf
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanRuntime.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;
+
+import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
+import org.eclipse.cdt.codan.core.model.ICodanAstReconciler;
+import org.eclipse.cdt.codan.core.model.ICodanBuilder;
+import org.eclipse.cdt.codan.core.model.IProblemReporter;
+import org.eclipse.cdt.codan.internal.core.CheckersRegisry;
+import org.eclipse.cdt.codan.internal.core.CodanBuilder;
+import org.eclipse.cdt.codan.internal.core.model.CodanMarkerProblemReporter;
+
+/**
+ * Runtime singleton class to get access to Codan framework parts
+ *
+ */
+public class CodanRuntime {
+ private static CodanRuntime instance = new CodanRuntime();
+ private IProblemReporter problemReporter = new CodanMarkerProblemReporter();
+ private CodanBuilder builder = new CodanBuilder();
+ private CheckersRegisry checkers = CheckersRegisry.getInstance();
+
+ public IProblemReporter getProblemReporter() {
+ return problemReporter;
+ }
+
+ public void setProblemReporter(IProblemReporter reporter) {
+ problemReporter = reporter;
+ }
+
+ public static CodanRuntime getInstance() {
+ return instance;
+ }
+
+ public ICodanBuilder getBuilder() {
+ return builder;
+ }
+
+ public ICodanAstReconciler getAstQuickBuilder() {
+ return builder;
+ }
+
+ public ICheckersRegistry getChechersRegistry() {
+ return checkers;
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java
new file mode 100644
index 0000000..a4a1374
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * Constant definitions for plug-in preferences
+ */
+public class PreferenceConstants {
+ public static final String P_RUN_ON_BUILD = "booleanPreference";
+ public static final String P_PROBLEMS = "problems";
+ public static final String P_USE_PARENT = "useParentScope";
+}
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<IChecker> 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<Object> 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<IProblem> problems = new ArrayList<IProblem>();
+ collectProblems(getRoot(), problems);
+ return problems.toArray(new IProblem[problems.size()]);
+ }
+
+ /**
+ * @param root
+ * @param problems
+ */
+ protected void collectProblems(IProblemCategory parent,
+ Collection<IProblem> 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);
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Entries
new file mode 100644
index 0000000..8d16cd3
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Entries
@@ -0,0 +1 @@
+D/core////
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Repository b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Repository
new file mode 100644
index 0000000..badff3b
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Root b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/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/internal/core/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Entries
new file mode 100644
index 0000000..74cd7a6
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Entries
@@ -0,0 +1,4 @@
+/CheckersRegisry.java/1.1/Sat Aug 22 21:16:49 2009//
+/CodanBuilder.java/1.2/Sat Aug 22 21:31:29 2009//
+/CodeAnlysisNature.java/1.1/Sat Aug 22 21:16:49 2009//
+D/model////
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Repository b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Repository
new file mode 100644
index 0000000..408050d
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Root b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/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/internal/core/CheckersRegisry.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java
new file mode 100644
index 0000000..82ace80
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * 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.internal.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.cdt.codan.core.CodanPreferencesLoader;
+import org.eclipse.cdt.codan.core.PreferenceConstants;
+import org.eclipse.cdt.codan.core.model.IChecker;
+import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemCategory;
+import org.eclipse.cdt.codan.core.model.IProblemProfile;
+import org.eclipse.cdt.codan.core.model.ProblemProfile;
+import org.eclipse.cdt.codan.internal.core.model.CodanProblem;
+import org.eclipse.cdt.codan.internal.core.model.CodanProblemCategory;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+
+public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry {
+ private static final String EXTENSION_POINT_NAME = "checkers";
+ private static final String CHECKER_ELEMENT = "checker";
+ private static final String PROBLEM_ELEMENT = "problem";
+ private static final String CATEGORY_ELEMENT = "category";
+ private static final Object DEFAULT = "DEFAULT";
+ private Collection<IChecker> checkers = new ArrayList<IChecker>();
+ private static CheckersRegisry instance;
+ private HashMap<Object, IProblemProfile> profiles = new HashMap<Object, IProblemProfile>();
+
+ private CheckersRegisry() {
+ instance = this;
+ profiles.put(DEFAULT, new ProblemProfile());
+ readCheckersRegistry();
+ }
+
+ private void readCheckersRegistry() {
+ IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(
+ CodanCorePlugin.PLUGIN_ID, EXTENSION_POINT_NAME);
+ if (ep == null)
+ return;
+ IConfigurationElement[] elements = ep.getConfigurationElements();
+ // process categories
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement configurationElement = elements[i];
+ processCategories(configurationElement);
+ }
+ // process shared problems
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement configurationElement = elements[i];
+ processProblem(configurationElement);
+ }
+ // process checkers
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement configurationElement = elements[i];
+ processChecker(configurationElement);
+ }
+ }
+
+ /**
+ * @param configurationElement
+ */
+ private void processCategories(IConfigurationElement configurationElement) {
+ if (configurationElement.getName().equals(CATEGORY_ELEMENT)) {
+ String id = getAtt(configurationElement, "id");
+ if (id == null)
+ return;
+ String name = getAtt(configurationElement, "name");
+ if (name == null)
+ return;
+ CodanProblemCategory cat = new CodanProblemCategory(id, name);
+ String category = getAtt(configurationElement, "parentCategory",
+ false);
+ addCategory(cat, category);
+ }
+ }
+
+ /**
+ * @param configurationElement
+ */
+ private void processChecker(IConfigurationElement configurationElement) {
+ try {
+ if (configurationElement.getName().equals(CHECKER_ELEMENT)) {
+ String id = getAtt(configurationElement, "id");
+ if (id == null)
+ return;
+ String name = getAtt(configurationElement, "name", false);
+ if (name == null)
+ name = id;
+ IChecker checkerObj = null;
+ try {
+ Object checker = configurationElement
+ .createExecutableExtension("class");
+ checkerObj = (IChecker) checker;
+ addChecker(checkerObj);
+ } catch (CoreException e) {
+ CodanCorePlugin.log(e);
+ return;
+ }
+ IConfigurationElement[] children1 = configurationElement
+ .getChildren("problemRef");
+ boolean hasRef = false;
+ IConfigurationElement[] children2 = configurationElement
+ .getChildren(PROBLEM_ELEMENT);
+ if (children2 != null) {
+ for (IConfigurationElement ref : children2) {
+ IProblem p = processProblem(ref);
+ addRefProblem(checkerObj, p);
+ hasRef = true;
+ }
+ }
+ if (children1 != null) {
+ for (IConfigurationElement ref : children1) {
+ hasRef = true;
+ IProblem p = getDefaultProfile().findProblem(
+ ref.getAttribute("refId"));
+ addRefProblem(checkerObj, p);
+ }
+ }
+ if (!hasRef) {
+ addProblem(new CodanProblem(id, name), null);
+ }
+ }
+ } catch (Exception e) {
+ CodanCorePlugin.log(e);
+ }
+ }
+
+ /**
+ * @param configurationElement
+ * @return
+ */
+ private CodanProblem processProblem(
+ IConfigurationElement configurationElement) {
+ if (configurationElement.getName().equals(PROBLEM_ELEMENT)) {
+ String id = getAtt(configurationElement, "id");
+ if (id == null)
+ return null;
+ String name = getAtt(configurationElement, "name");
+ if (name == null)
+ name = id;
+ CodanProblem p = new CodanProblem(id, name);
+ String category = getAtt(configurationElement, "category", false);
+ if (category == null)
+ category = "org.eclipse.cdt.codan.core.categories.ProgrammingProblems";
+ addProblem(p, category);
+ return p;
+ }
+ return null;
+ }
+
+ private static String getAtt(IConfigurationElement configurationElement,
+ String name) {
+ return getAtt(configurationElement, name, true);
+ }
+
+ private static String getAtt(IConfigurationElement configurationElement,
+ String name, boolean req) {
+ String elementValue = configurationElement.getAttribute(name);
+ if (elementValue == null && req)
+ CodanCorePlugin.log("Extension "
+ + configurationElement.getDeclaringExtension()
+ .getUniqueIdentifier()
+ + " missing required attribute: "
+ + configurationElement.getName() + "." + name);
+ return elementValue;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#iterator()
+ */
+ public Iterator<IChecker> iterator() {
+ return checkers.iterator();
+ }
+
+ public static CheckersRegisry getInstance() {
+ if (instance == null)
+ new CheckersRegisry();
+ return instance;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#addChecker(org.eclipse.cdt.codan.core.model.IChecker)
+ */
+ public void addChecker(IChecker checker) {
+ checkers.add(checker);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#addProblem(org.eclipse.cdt.codan.core.model.IProblem, java.lang.String)
+ */
+ public void addProblem(IProblem p, String category) {
+ IProblemCategory cat = getDefaultProfile().findCategory(category);
+ if (cat == null)
+ cat = getDefaultProfile().getRoot();
+ ((ProblemProfile) getDefaultProfile()).addProblem(p, cat);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#addCategory(org.eclipse.cdt.codan.core.model.IProblemCategory, java.lang.String)
+ */
+ public void addCategory(IProblemCategory p, String category) {
+ IProblemCategory cat = getDefaultProfile().findCategory(category);
+ if (cat == null)
+ cat = getDefaultProfile().getRoot();
+ ((ProblemProfile) getDefaultProfile()).addCategory(p, cat);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#addRefProblem(org.eclipse.cdt.codan.core.model.IChecker, org.eclipse.cdt.codan.core.model.IProblem)
+ */
+ public void addRefProblem(IChecker c, IProblem p) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#getDefaultProfile()
+ */
+ public IProblemProfile getDefaultProfile() {
+ return profiles.get(DEFAULT);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#getWorkspaceProfile()
+ */
+ public IProblemProfile getWorkspaceProfile() {
+ IProblemProfile wp = profiles.get(ResourcesPlugin.getWorkspace());
+ if (wp == null) {
+ try {
+ wp = (IProblemProfile) getDefaultProfile().clone();
+ // load default values
+ CodanPreferencesLoader loader = new CodanPreferencesLoader(wp);
+ loader.load(CodanCorePlugin.getDefault().getStorePreferences());
+ } catch (CloneNotSupportedException e) {
+ wp = getDefaultProfile();
+ }
+ }
+ return wp;
+ }
+
+ public void updateProfile(IResource element, IProblemProfile profile) {
+ if (profile == null)
+ profiles.remove(element);
+ else
+ profiles.put(element, profile);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfile(org.eclipse.core.resources.IResource)
+ */
+ public IProblemProfile getResourceProfile(IResource element) {
+ IProblemProfile prof = profiles.get(element);
+ if (prof == null) {
+ if (element instanceof IProject) {
+ try {
+ prof = (IProblemProfile) getWorkspaceProfile().clone();
+ // load default values
+ CodanPreferencesLoader loader = new CodanPreferencesLoader(
+ prof);
+ IEclipsePreferences node = new ProjectScope(
+ (IProject) element)
+ .getNode(CodanCorePlugin.PLUGIN_ID);
+ boolean useWorkspace = node.getBoolean(
+ PreferenceConstants.P_USE_PARENT, false);
+ if (!useWorkspace) {
+ loader.load(node);
+ }
+ updateProfile(element, prof);
+ } catch (CloneNotSupportedException e) {
+ // cant
+ }
+ } else if (element.getParent() != null) {
+ prof = getResourceProfile(element.getParent());
+ } else {
+ prof = getResourceProfile(element.getProject());
+ }
+ } else {
+ }
+ return prof;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfileWorkingCopy(org.eclipse.core.resources.IResource)
+ */
+ public IProblemProfile getResourceProfileWorkingCopy(IResource element) {
+ if (element instanceof IProject) {
+ try {
+ IProblemProfile prof = (IProblemProfile) getWorkspaceProfile()
+ .clone();
+ // load default values
+ CodanPreferencesLoader loader = new CodanPreferencesLoader(prof);
+ IEclipsePreferences node = new ProjectScope((IProject) element)
+ .getNode(CodanCorePlugin.PLUGIN_ID);
+ loader.load(node);
+ return prof;
+ } catch (CloneNotSupportedException e) {
+ // cant
+ }
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java
new file mode 100644
index 0000000..7d58351
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * 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.internal.core;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Map;
+
+import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.cdt.codan.core.CodanRuntime;
+import org.eclipse.cdt.codan.core.model.ICAstChecker;
+import org.eclipse.cdt.codan.core.model.IChecker;
+import org.eclipse.cdt.codan.core.model.ICodanAstReconciler;
+import org.eclipse.cdt.codan.core.model.ICodanBuilder;
+import org.eclipse.cdt.codan.core.model.IProblemReporter;
+import org.eclipse.cdt.codan.internal.core.model.CodanMarkerProblemReporter;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+public class CodanBuilder extends IncrementalProjectBuilder implements
+ ICodanBuilder, ICodanAstReconciler {
+ public static final String BUILDER_ID = "org.eclipse.cdt.codan.core.codanBuilder";
+
+ public class CodanDeltaVisitor implements IResourceDeltaVisitor {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse
+ * .core.resources.IResourceDelta)
+ */
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.internal.core.ICodanBuilder#visit(org.eclipse
+ * .core.resources.IResourceDelta)
+ */
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ IResource resource = delta.getResource();
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED:
+ // handle added resource
+ processResource(resource, new NullProgressMonitor());
+ break;
+ case IResourceDelta.REMOVED:
+ // handle removed resource
+ break;
+ case IResourceDelta.CHANGED:
+ // handle changed resource
+ processResource(resource, new NullProgressMonitor());
+ break;
+ }
+ // return true to continue visiting children.
+ return true;
+ }
+ }
+
+ public class CodanResourceVisitor implements IResourceVisitor {
+ public boolean visit(IResource resource) {
+ if (!(resource instanceof IProject))
+ processResource(resource, new NullProgressMonitor());
+ // return true to continue visiting children.
+ return true;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.internal.events.InternalBuilder#build(int,
+ * java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
+ throws CoreException {
+ if (kind == FULL_BUILD) {
+ fullBuild(monitor);
+ } else {
+ IResourceDelta delta = getDelta(getProject());
+ if (delta == null) {
+ fullBuild(monitor);
+ } else {
+ incrementalBuild(delta, monitor);
+ }
+ }
+ return null;
+ }
+
+ public void processResource(IResource resource, IProgressMonitor monitor) {
+ // String string = Platform.getPreferencesService().getString(
+ // CodanCorePlugin.PLUGIN_ID, "problems", "", null);
+ // System.err.println("set = " + string);
+ // delete general markers
+ IProblemReporter problemReporter = CodanRuntime.getInstance()
+ .getProblemReporter();
+ if (problemReporter instanceof CodanMarkerProblemReporter) {
+ ((CodanMarkerProblemReporter) problemReporter)
+ .deleteMarkers(resource);
+ }
+ for (IChecker checker : CheckersRegisry.getInstance()) {
+ try {
+ boolean run = false;
+ if (checker.enabledInContext(resource))
+ run = true;
+ if (run)
+ checker.processResource(resource);
+ } catch (Throwable e) {
+ CodanCorePlugin.log(e);
+ }
+ }
+ if (resource instanceof IProject) {
+ try {
+ resource.accept(getResourceVisitor());
+ } catch (CoreException e) {
+ CodanCorePlugin.log(e);
+ }
+ }
+ }
+
+ public void reconcileAst(IASTTranslationUnit ast, IProgressMonitor monitor) {
+ if (ast == null)
+ return;
+ String filePath = ast.getFilePath();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IFile[] resources;
+ URI uri = new File(filePath).toURI();
+ resources = root.findFilesForLocationURI(uri);
+ if (resources != null && resources.length > 0) {
+ IFile resource = resources[0];
+ IProblemReporter problemReporter = CodanRuntime.getInstance()
+ .getProblemReporter();
+ // TODO: this is wrong - should not delete all markers -
+ // only those that contributed by the checker that we run now
+ if (problemReporter instanceof CodanMarkerProblemReporter) {
+ ((CodanMarkerProblemReporter) problemReporter)
+ .deleteMarkers(resource);
+ }
+ for (IChecker checker : CheckersRegisry.getInstance()) {
+ try {
+ boolean run = false;
+ if (checker.enabledInContext(resource))
+ run = true;
+ if (run && checker instanceof ICAstChecker
+ && checker.runInEditor())
+ ((ICAstChecker) checker).processAst(ast);
+ } catch (Throwable e) {
+ CodanCorePlugin.log(e);
+ }
+ }
+ }
+ }
+
+ protected void fullBuild(final IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ getProject().accept(new CodanResourceVisitor());
+ } catch (CoreException e) {
+ }
+ }
+
+ protected void incrementalBuild(IResourceDelta delta,
+ IProgressMonitor monitor) throws CoreException {
+ // the visitor does the work.
+ delta.accept(new CodanDeltaVisitor());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.codan.core.model.ICodanBuilder#getResourceVisitor()
+ */
+ public CodanResourceVisitor getResourceVisitor() {
+ return new CodanResourceVisitor();
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodeAnlysisNature.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodeAnlysisNature.java
new file mode 100644
index 0000000..5157e16
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodeAnlysisNature.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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.internal.core;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+
+public class CodeAnlysisNature implements IProjectNature {
+ /**
+ * ID of this project nature
+ */
+ public static final String NATURE_ID = "org.eclipse.cdt.codan.core.codanNature";
+ private IProject project;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IProjectNature#configure()
+ */
+ public void configure() throws CoreException {
+ IProjectDescription desc = project.getDescription();
+ ICommand[] commands = desc.getBuildSpec();
+ for (int i = 0; i < commands.length; ++i) {
+ if (commands[i].getBuilderName().equals(CodanBuilder.BUILDER_ID)) {
+ return;
+ }
+ }
+ ICommand[] newCommands = new ICommand[commands.length + 1];
+ System.arraycopy(commands, 0, newCommands, 0, commands.length);
+ ICommand command = desc.newCommand();
+ command.setBuilderName(CodanBuilder.BUILDER_ID);
+ newCommands[newCommands.length - 1] = command;
+ desc.setBuildSpec(newCommands);
+ project.setDescription(desc, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+ */
+ public void deconfigure() throws CoreException {
+ IProjectDescription description = getProject().getDescription();
+ ICommand[] commands = description.getBuildSpec();
+ for (int i = 0; i < commands.length; ++i) {
+ if (commands[i].getBuilderName().equals(CodanBuilder.BUILDER_ID)) {
+ ICommand[] newCommands = new ICommand[commands.length - 1];
+ System.arraycopy(commands, 0, newCommands, 0, i);
+ System.arraycopy(commands, i + 1, newCommands, i,
+ commands.length - i - 1);
+ description.setBuildSpec(newCommands);
+ project.setDescription(description, null);
+ return;
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.resources.IProjectNature#getProject()
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core
+ * .resources.IProject)
+ */
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries
new file mode 100644
index 0000000..19054e0
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries
@@ -0,0 +1,3 @@
+/CodanMarkerProblemReporter.java/1.1/Sat Aug 22 21:16:48 2009//
+/CodanProblem.java/1.1/Sat Aug 22 21:16:48 2009//
+/CodanProblemCategory.java/1.1/Sat Aug 22 21:16:48 2009//
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Repository b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Repository
new file mode 100644
index 0000000..cf80971
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Root b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/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/internal/core/model/CodanMarkerProblemReporter.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
new file mode 100644
index 0000000..ebf00c9
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * 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.internal.core.model;
+
+import java.text.MessageFormat;
+
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemLocation;
+import org.eclipse.cdt.codan.core.model.IProblemReporter;
+import org.eclipse.cdt.codan.internal.core.CheckersRegisry;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+
+public class CodanMarkerProblemReporter implements IProblemReporter {
+ public static final String GENERIC_CODE_ANALYSIS_MARKER_TYPE = "org.eclipse.cdt.codan.core.codanProblem";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.IProblemReporter#reportProblem(java.
+ * lang.String, org.eclipse.cdt.codan.core.model.IProblemLocation,
+ * java.lang.Object[])
+ */
+ public void reportProblem(String id, IProblemLocation loc, Object... args) {
+ IFile file = loc.getFile();
+ int lineNumber = loc.getLineNumber();
+ if (file == null)
+ throw new NullPointerException("file");
+ if (id == null)
+ throw new NullPointerException("id");
+ IProblem problem = CheckersRegisry.getInstance().getResourceProfile(
+ file).findProblem(id);
+ if (problem == null)
+ throw new IllegalArgumentException("Id is not registered");
+ if (problem.isEnabled() == false)
+ return; // skip
+ int severity = problem.getSeverity().intValue();
+ String messagePattern = problem.getMessagePattern();
+ String message = id;
+ if (messagePattern == null) {
+ if (args != null && args.length > 0 && args[0] instanceof String)
+ message = (String) args[0];
+ } else {
+ MessageFormat.format(messagePattern, args);
+ }
+ reportProblem(id, severity, file, lineNumber, loc.getStartingChar(),
+ loc.getEndingChar(), message);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.IProblemReporter#reportProblem(java.
+ * lang.String, org.eclipse.core.resources.IFile, int, java.lang.String)
+ */
+ public void reportProblem(String id, int severity, IFile file,
+ int lineNumber, int startChar, int endChar, String message) {
+ try {
+ // Do not put in duplicates
+ IMarker[] cur = file.findMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE,
+ false, IResource.DEPTH_ZERO);
+ if (cur != null) {
+ for (IMarker element : cur) {
+ int line = ((Integer) element
+ .getAttribute(IMarker.LINE_NUMBER)).intValue();
+ if (line == lineNumber) {
+ String mesg = (String) element
+ .getAttribute(IMarker.MESSAGE);
+ int sev = ((Integer) element
+ .getAttribute(IMarker.SEVERITY)).intValue();
+ if (sev == severity && mesg.equals(message))
+ return;
+ }
+ }
+ }
+ IMarker marker = file
+ .createMarker(GENERIC_CODE_ANALYSIS_MARKER_TYPE);
+ marker.setAttribute(IMarker.MESSAGE, message);
+ marker.setAttribute(IMarker.SEVERITY, severity);
+ marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
+ marker.setAttribute(IMarker.PROBLEM, id);
+ marker.setAttribute(IMarker.CHAR_END, endChar);
+ marker.setAttribute(IMarker.CHAR_START, startChar);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void deleteMarkers(IResource file) {
+ try {
+ file.deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, false,
+ IResource.DEPTH_ZERO);
+ } catch (CoreException ce) {
+ ce.printStackTrace();
+ }
+ }
+
+ public void deleteAllMarkers() {
+ try {
+ // TODO delete contributed markers too
+ ResourcesPlugin.getWorkspace().getRoot().deleteMarkers(
+ GENERIC_CODE_ANALYSIS_MARKER_TYPE, false,
+ IResource.DEPTH_INFINITE);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
new file mode 100644
index 0000000..a094cc1
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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.internal.core.model;
+
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.eclipse.cdt.codan.core.model.CodanSeverity;
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemCategory;
+
+public class CodanProblem implements IProblem {
+ private String id;
+ private String name;
+ private String message;
+ private CodanSeverity severity = CodanSeverity.Warning;
+ private boolean enabled = true;
+ private HashMap<Object, Object> properties = new HashMap<Object, Object>(0);
+
+ public CodanSeverity getSeverity() {
+ return severity;
+ }
+
+ public CodanProblem(String problemId, String name) {
+ this.id = problemId;
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public IProblemCategory getCategory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setSeverity(CodanSeverity sev) {
+ if (sev == null)
+ throw new NullPointerException();
+ this.severity = sev;
+ }
+
+ public void setEnabled(boolean checked) {
+ this.enabled = checked;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public void setProperty(Object key, Object value) {
+ properties.put(key, value);
+ }
+
+ public Object getProperty(Object key) {
+ return properties.get(key);
+ };
+
+ public Collection<Object> getPropertyKeys() {
+ return properties.keySet();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.codan.core.model.IProblem#getMessagePattern()
+ */
+ public String getMessagePattern() {
+ return message;
+ }
+
+ /**
+ * @param message the message to set
+ */
+ public void setMessagePattern(String message) {
+ this.message = message;
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java
new file mode 100644
index 0000000..289e0fd
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.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.internal.core.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemCategory;
+import org.eclipse.cdt.codan.core.model.IProblemElement;
+
+public class CodanProblemCategory implements IProblemCategory, Cloneable {
+ private String id;
+ private String name;
+ private ArrayList<IProblemElement> list = new ArrayList<IProblemElement>();
+
+ public CodanProblemCategory(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ public Object[] getChildren() {
+ return list.toArray();
+ }
+
+ public void addChild(IProblemElement p) {
+ list.add(p);
+ }
+
+ public IProblem findProblem(String id) {
+ Object[] children = this.getChildren();
+ for (Object object : children) {
+ if (object instanceof IProblemCategory) {
+ IProblemCategory cat = (IProblemCategory) object;
+ IProblem found = cat.findProblem(id);
+ if (found != null)
+ return found;
+ } else if (object instanceof IProblem) {
+ IProblem p = (IProblem) object;
+ if (p.getId().equals(id))
+ return p;
+ }
+ }
+ return null;
+ }
+
+ public IProblemCategory findCategory(String id) {
+ if (getId().equals(id))
+ return this;
+ Object[] children = getChildren();
+ for (Object object : children) {
+ if (object instanceof IProblemCategory) {
+ IProblemCategory cat = (IProblemCategory) object;
+ IProblemCategory found = cat.findCategory(id);
+ if (found != null)
+ return found;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() {
+ try {
+ CodanProblemCategory clone = (CodanProblemCategory) super.clone();
+ clone.list = new ArrayList<IProblemElement>();
+ for (Iterator<IProblemElement> iterator = this.list.iterator(); iterator
+ .hasNext();) {
+ IProblemElement child = iterator.next();
+ clone.list.add((IProblemElement) child.clone());
+ }
+ return clone;
+ } catch (CloneNotSupportedException e) {
+ return this;
+ }
+ }
+}