summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--.gitignore1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/.classpath7
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/.project28
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/CVS/Entries7
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/CVS/Template0
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/META-INF/MANIFEST.MF15
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/build.properties4
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/plugin.xml11
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CheckersUiActivator.java50
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CodanProblemMarkerResolutionGenerator.java30
-rw-r--r--org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java82
-rw-r--r--org.eclipse.cdt.codan.checkers/.classpath7
-rw-r--r--org.eclipse.cdt.codan.checkers/.project28
-rw-r--r--org.eclipse.cdt.codan.checkers/.settings/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers/.settings/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/.settings/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--org.eclipse.cdt.codan.checkers/CVS/Entries7
-rw-r--r--org.eclipse.cdt.codan.checkers/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/CVS/Template0
-rw-r--r--org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/META-INF/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF12
-rw-r--r--org.eclipse.cdt.codan.checkers/build.properties5
-rw-r--r--org.eclipse.cdt.codan.checkers/plugin.xml55
-rw-r--r--org.eclipse.cdt.codan.checkers/src/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java74
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java103
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java59
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries3
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java181
-rw-r--r--org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java110
-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
-rw-r--r--org.eclipse.cdt.codan.ui/.classpath7
-rw-r--r--org.eclipse.cdt.codan.ui/.project28
-rw-r--r--org.eclipse.cdt.codan.ui/.settings/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/.settings/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/.settings/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--org.eclipse.cdt.codan.ui/CVS/Entries7
-rw-r--r--org.eclipse.cdt.codan.ui/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/CVS/Template0
-rw-r--r--org.eclipse.cdt.codan.ui/META-INF/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/META-INF/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/META-INF/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF18
-rw-r--r--org.eclipse.cdt.codan.ui/build.properties5
-rw-r--r--org.eclipse.cdt.codan.ui/plugin.xml70
-rw-r--r--org.eclipse.cdt.codan.ui/src/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/src/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java97
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Entries8
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CheckedTreeEditor.java330
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java89
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FieldEditorOverlayPage.java363
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.java47
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.properties4
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/PreferenceInitializer.java33
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java306
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Activator.java98
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Entries4
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanCReconciler.java71
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Startup.java93
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/RunCodeAnalysis.java69
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/ToggleNatureAction.java130
222 files changed, 5463 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1f163cf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*/bin
diff --git a/org.eclipse.cdt.codan.checkers.ui/.classpath b/org.eclipse.cdt.codan.checkers.ui/.classpath
new file mode 100644
index 0000000..1fa3e68
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.cdt.codan.checkers.ui/.project b/org.eclipse.cdt.codan.checkers.ui/.project
new file mode 100644
index 0000000..4c29868
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.codan.checkers.ui</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.checkers.ui/.settings/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Entries
new file mode 100644
index 0000000..2303ef8
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Entries
@@ -0,0 +1 @@
+/org.eclipse.jdt.core.prefs/1.1/Sat Apr 18 02:11:07 2009//
diff --git a/org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Repository
new file mode 100644
index 0000000..5684555
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/.settings
diff --git a/org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.cdt.codan.checkers.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..5edb6f2
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Apr 17 21:55:42 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.compliance=1.5
+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.checkers.ui/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/CVS/Entries
new file mode 100644
index 0000000..47e41bc
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/CVS/Entries
@@ -0,0 +1,7 @@
+/.classpath/1.1/Sat Apr 18 02:11:07 2009//
+/.project/1.1/Sat Apr 18 02:11:07 2009//
+D/.settings////
+D/META-INF////
+/build.properties/1.1/Sat Apr 18 02:11:07 2009//
+/plugin.xml/1.1/Sat Apr 18 02:11:07 2009//
+D/src////
diff --git a/org.eclipse.cdt.codan.checkers.ui/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/CVS/Repository
new file mode 100644
index 0000000..c7e5368
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui
diff --git a/org.eclipse.cdt.codan.checkers.ui/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/CVS/Template b/org.eclipse.cdt.codan.checkers.ui/CVS/Template
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/CVS/Template
diff --git a/org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Entries
new file mode 100644
index 0000000..bb6a97a
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Entries
@@ -0,0 +1 @@
+/MANIFEST.MF/1.1/Sat Apr 18 02:11:07 2009//
diff --git a/org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Repository
new file mode 100644
index 0000000..36326a6
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/META-INF
diff --git a/org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/META-INF/MANIFEST.MF b/org.eclipse.cdt.codan.checkers.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..faffd30
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Checkers Ui
+Bundle-SymbolicName: org.eclipse.cdt.codan.checkers.ui;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.cdt.codan.checkers.ui.CheckersUiActivator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.ide;bundle-version="3.5.0",
+ org.eclipse.jface.text;bundle-version="3.5.0",
+ org.eclipse.ui.editors;bundle-version="3.5.0",
+ org.eclipse.core.resources;bundle-version="3.5.0",
+ org.eclipse.cdt.codan.checkers;bundle-version="1.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/org.eclipse.cdt.codan.checkers.ui/build.properties b/org.eclipse.cdt.codan.checkers.ui/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.cdt.codan.checkers.ui/plugin.xml b/org.eclipse.cdt.codan.checkers.ui/plugin.xml
new file mode 100644
index 0000000..783ff1d
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/plugin.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ class="org.eclipse.cdt.codan.checkers.ui.quickfix.CodanProblemMarkerResolutionGenerator"
+ markerType="org.eclipse.cdt.codan.core.codanProblem">
+ </markerResolutionGenerator>
+ </extension>
+</plugin>
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/src/CVS/Entries
new file mode 100644
index 0000000..381094d
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/CVS/Entries
@@ -0,0 +1 @@
+D/org////
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/src/CVS/Repository
new file mode 100644
index 0000000..ccb7248
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/src
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/src/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Entries
new file mode 100644
index 0000000..0f148f8
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Entries
@@ -0,0 +1 @@
+D/eclipse////
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Repository
new file mode 100644
index 0000000..30e0dd1
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/src/org
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Entries
new file mode 100644
index 0000000..e524915
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Entries
@@ -0,0 +1 @@
+D/cdt////
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Repository
new file mode 100644
index 0000000..f3c8514
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Entries
new file mode 100644
index 0000000..8d969ba
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Entries
@@ -0,0 +1 @@
+D/codan////
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Repository
new file mode 100644
index 0000000..1a7cf10
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Entries
new file mode 100644
index 0000000..513604d
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Entries
@@ -0,0 +1 @@
+D/checkers////
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Repository
new file mode 100644
index 0000000..dde7cb7
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Entries
new file mode 100644
index 0000000..7f0205c
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Entries
@@ -0,0 +1 @@
+D/ui////
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Repository
new file mode 100644
index 0000000..24fc549
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Entries
new file mode 100644
index 0000000..fc31844
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Entries
@@ -0,0 +1,2 @@
+/CheckersUiActivator.java/1.1/Sat Apr 18 02:11:07 2009//
+D/quickfix////
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Repository
new file mode 100644
index 0000000..25cd7cf
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CheckersUiActivator.java b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CheckersUiActivator.java
new file mode 100644
index 0000000..1635684
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CheckersUiActivator.java
@@ -0,0 +1,50 @@
+package org.eclipse.cdt.codan.checkers.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CheckersUiActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.codan.checkers.ui";
+
+ // The shared instance
+ private static CheckersUiActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public CheckersUiActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 CheckersUiActivator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Entries b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Entries
new file mode 100644
index 0000000..641ef34
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Entries
@@ -0,0 +1,2 @@
+/CodanProblemMarkerResolutionGenerator.java/1.2/Tue Apr 21 00:36:20 2009//
+/QuickFixAssignmentInCondition.java/1.1/Sat Apr 18 02:11:07 2009//
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Repository b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Repository
new file mode 100644
index 0000000..3bdd833
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Root b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CodanProblemMarkerResolutionGenerator.java b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CodanProblemMarkerResolutionGenerator.java
new file mode 100644
index 0000000..1470e7f
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CodanProblemMarkerResolutionGenerator.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Andrew Gvozdev
+ * 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:
+ * Andrew Gvozdev - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.checkers.ui.quickfix;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator;
+
+public class CodanProblemMarkerResolutionGenerator implements IMarkerResolutionGenerator {
+ public IMarkerResolution[] getResolutions(IMarker marker) {
+ final Pattern patternBuildDependsAdd = Pattern.compile("Possible assignment in condition.*");
+ String description = marker.getAttribute(IMarker.MESSAGE, "no message");
+ Matcher matcherBuildDependsAdd = patternBuildDependsAdd.matcher(description);
+ if (matcherBuildDependsAdd.matches()) {
+ return new IMarkerResolution[] { new QuickFixAssignmentInCondition() };
+ }
+ return new IMarkerResolution[0];
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java
new file mode 100644
index 0000000..5c28d53
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Andrew Gvozdev
+ * 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:
+ * Andrew Gvozdev - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.checkers.ui.quickfix;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.FindReplaceDocumentAdapter;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class QuickFixAssignmentInCondition implements IMarkerResolution {
+ public String getLabel() {
+ return "Change to '=='";
+ }
+
+ public void run(IMarker marker) {
+ // See if there is an open editor on the file containing the marker
+ IWorkbenchWindow w = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ if (w == null) {
+ return;
+ }
+ IWorkbenchPage page = w.getActivePage();
+ if (page == null) {
+ return;
+ }
+ IFileEditorInput input = new FileEditorInput((IFile) marker
+ .getResource());
+ IEditorPart editorPart = page.findEditor(input);
+ if (editorPart == null) {
+ // open an editor
+ try {
+ editorPart = IDE.openEditor(page, (IFile) marker.getResource(),
+ true);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ if (editorPart == null) {
+ return;
+ }
+ if (editorPart instanceof ITextEditor) {
+ ITextEditor editor = (ITextEditor) editorPart;
+ IDocument doc = editor.getDocumentProvider().getDocument(
+ editor.getEditorInput());
+ int line = marker.getAttribute(IMarker.LINE_NUMBER, -1) - 1;
+ FindReplaceDocumentAdapter dad = new FindReplaceDocumentAdapter(doc);
+ try {
+ dad.find(doc.getLineOffset(line), "=", /* forwardSearch */
+ true, /* caseSensitive */false,
+ /* wholeWord */false, /* regExSearch */false);
+ dad.replace("==", /* regExReplace */false);
+ marker.delete();
+ } catch (BadLocationException e) {
+ // TODO: log the error
+ e.printStackTrace();
+ } catch (CoreException e) {
+ // TODO: log the error
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.cdt.codan.checkers/.classpath b/org.eclipse.cdt.codan.checkers/.classpath
new file mode 100644
index 0000000..1fa3e68
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.cdt.codan.checkers/.project b/org.eclipse.cdt.codan.checkers/.project
new file mode 100644
index 0000000..6b76138
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.codan.checkers</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.checkers/.settings/CVS/Entries b/org.eclipse.cdt.codan.checkers/.settings/CVS/Entries
new file mode 100644
index 0000000..c7206e9
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/.settings/CVS/Entries
@@ -0,0 +1 @@
+/org.eclipse.jdt.core.prefs/1.2/Tue Jun 2 21:11:37 2009//
diff --git a/org.eclipse.cdt.codan.checkers/.settings/CVS/Repository b/org.eclipse.cdt.codan.checkers/.settings/CVS/Repository
new file mode 100644
index 0000000..d2cb1b1
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/.settings/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/.settings
diff --git a/org.eclipse.cdt.codan.checkers/.settings/CVS/Root b/org.eclipse.cdt.codan.checkers/.settings/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/.settings/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..bd2d10b
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Tue Jun 02 17:10:46 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.checkers/CVS/Entries b/org.eclipse.cdt.codan.checkers/CVS/Entries
new file mode 100644
index 0000000..79d42fe
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/CVS/Entries
@@ -0,0 +1,7 @@
+/.classpath/1.2/Fri Apr 17 20:50:15 2009//
+/.project/1.1/Thu Apr 9 12:48:43 2009//
+D/.settings////
+D/META-INF////
+/build.properties/1.1/Thu Apr 9 12:48:44 2009//
+/plugin.xml/1.5/Sat May 9 01:16:26 2009//
+D/src////
diff --git a/org.eclipse.cdt.codan.checkers/CVS/Repository b/org.eclipse.cdt.codan.checkers/CVS/Repository
new file mode 100644
index 0000000..856ae55
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers
diff --git a/org.eclipse.cdt.codan.checkers/CVS/Root b/org.eclipse.cdt.codan.checkers/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/CVS/Template b/org.eclipse.cdt.codan.checkers/CVS/Template
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/CVS/Template
diff --git a/org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries
new file mode 100644
index 0000000..011c155
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries
@@ -0,0 +1 @@
+/MANIFEST.MF/1.4/Sat Apr 18 02:11:45 2009//
diff --git a/org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository
new file mode 100644
index 0000000..f2114bc
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/META-INF
diff --git a/org.eclipse.cdt.codan.checkers/META-INF/CVS/Root b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/META-INF/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF b/org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..50e70f6
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Checkers
+Bundle-SymbolicName: org.eclipse.cdt.codan.checkers;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.cdt.codan.checkers.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;bundle-version="3.5.0",
+ org.eclipse.cdt.core;bundle-version="5.1.0",
+ org.eclipse.cdt.codan.core;bundle-version="1.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/org.eclipse.cdt.codan.checkers/build.properties b/org.eclipse.cdt.codan.checkers/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/org.eclipse.cdt.codan.checkers/plugin.xml b/org.eclipse.cdt.codan.checkers/plugin.xml
new file mode 100644
index 0000000..7ba8f3e
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/plugin.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.cdt.codan.core.checkers"
+ id="org.eclipse.cdt.codan.core.checkers.sample">
+
+ <checker
+ class="org.eclipse.cdt.codan.checkers.sample.AssignmentInConditionChecker"
+ id="org.eclipse.cdt.codan.checkers.sample.AssignmentInConditionChecker"
+ name="Assignment in condition">
+ <problem
+ defaultSeverity="Warning"
+ id="org.eclipse.cdt.codan.checkers.sample.AssignmentInConditionProblem"
+ name="Assignment in condition">
+ </problem>
+
+
+ </checker>
+ <checker
+ class="org.eclipse.cdt.codan.checkers.sample.StatementHasNoEffectChecker"
+ id="org.eclipse.cdt.codan.checkers.sample.StatementHasNoEffectChecker"
+ name="StatementHasNoEffectChecker">
+ <problem
+ category="org.eclipse.cdt.codan.core.categories.ProgrammingProblems"
+ defaultSeverity="Warning"
+ id="org.eclipse.cdt.codan.checkers.sample.StatementHasNoEffectProblem"
+ name="Statement has no effect">
+ </problem>
+ </checker>
+
+ <checker
+ class="org.eclipse.cdt.codan.checkers.sample.NonVirtualDestructor"
+ id="org.eclipse.cdt.codan.checkers.sample.NonVirtualDescructor"
+ name="NonVirtualDescructorChecker">
+ <problem
+ category="org.eclipse.cdt.codan.core.categories.ProgrammingProblems"
+ defaultSeverity="Warning"
+ id="org.eclipse.cdt.codan.checkers.sample.NonVirtualDestructorProblem"
+ name="Class has a virtual method and non-virtual destructor">
+ </problem>
+ </checker>
+ <checker
+ class="org.eclipse.cdt.codan.checkers.CloseOpenedFilesChecker"
+ id="org.eclipse.cdt.codan.checkers.CloseOpenedFilesChecker"
+ name="Closing unopened file">
+ <problem
+ category="org.eclipse.cdt.codan.core.categories.ProgrammingProblems"
+ defaultSeverity="Warning"
+ id="org.eclipse.cdt.codan.checkers.CloseOpenedFilesProblem"
+ name="Attempting to close an unopened file">
+ </problem>
+ </checker>
+ </extension>
+</plugin>
diff --git a/org.eclipse.cdt.codan.checkers/src/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/CVS/Entries
new file mode 100644
index 0000000..381094d
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/CVS/Entries
@@ -0,0 +1 @@
+D/org////
diff --git a/org.eclipse.cdt.codan.checkers/src/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/CVS/Repository
new file mode 100644
index 0000000..5218fe8
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src
diff --git a/org.eclipse.cdt.codan.checkers/src/CVS/Root b/org.eclipse.cdt.codan.checkers/src/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/src/org/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/CVS/Entries
new file mode 100644
index 0000000..0f148f8
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/CVS/Entries
@@ -0,0 +1 @@
+D/eclipse////
diff --git a/org.eclipse.cdt.codan.checkers/src/org/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/CVS/Repository
new file mode 100644
index 0000000..5dd4d70
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org
diff --git a/org.eclipse.cdt.codan.checkers/src/org/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries
new file mode 100644
index 0000000..e524915
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries
@@ -0,0 +1 @@
+D/cdt////
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository
new file mode 100644
index 0000000..e5eb786
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries
new file mode 100644
index 0000000..8d969ba
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries
@@ -0,0 +1 @@
+D/codan////
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository
new file mode 100644
index 0000000..1a2ee41
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries
new file mode 100644
index 0000000..513604d
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries
@@ -0,0 +1 @@
+D/checkers////
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository
new file mode 100644
index 0000000..edbf463
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java
new file mode 100644
index 0000000..2915e7d
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java
@@ -0,0 +1,74 @@
+package org.eclipse.cdt.codan.checkers;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.codan.checkers";
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#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 Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * @param e
+ */
+ public static void log(Throwable e) {
+ getDefault().getLog().log(getStatus(e));
+ }
+
+ public static void log(String message) {
+ getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, message));
+ }
+
+ /**
+ * @param e
+ * @return
+ */
+ public static IStatus getStatus(Throwable e) {
+ return new Status(Status.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
+ }
+}
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries
new file mode 100644
index 0000000..0f9ebcd
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries
@@ -0,0 +1,2 @@
+/Activator.java/1.3/Sat May 9 01:36:37 2009//
+D/sample////
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository
new file mode 100644
index 0000000..c37351c
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java
new file mode 100644
index 0000000..354223f
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Elliott Baron
+ * 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:
+ * Elliott Baron - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.checkers;
+
+import java.text.MessageFormat;
+
+import org.eclipse.cdt.codan.core.model.AbstractIndexAstChecker;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
+import org.eclipse.cdt.core.dom.ast.IASTExpression;
+import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
+import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
+import org.eclipse.cdt.core.dom.ast.IASTInitializer;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+
+public class CloseOpenedFilesChecker extends AbstractIndexAstChecker {
+ private static final String ERR_ID = Activator.PLUGIN_ID + ".CloseOpenedFilesProblem";
+
+ public void processAst(IASTTranslationUnit ast) {
+ // traverse the AST using the visitor pattern
+ CloseOpenedFilesVisitor visitor = new CloseOpenedFilesVisitor();
+ ast.accept(visitor);
+
+ IASTName closeFD = visitor.getCloseFD();
+ if (closeFD != null) {
+ IASTName openFD = visitor.getOpenFD();
+ if (openFD == null || !matchingFileDescriptors(closeFD.getBinding(), openFD.getBinding())) {
+ String message = MessageFormat.format("File descriptor \"{0}\" has not been opened", closeFD.toString());
+ reportProblem(ERR_ID, closeFD, message);
+ }
+ }
+ }
+
+ private boolean matchingFileDescriptors(IBinding closeFD, IBinding openFD) {
+ // FIXME elaborate
+ return closeFD.equals(openFD);
+ }
+
+ class CloseOpenedFilesVisitor extends ASTVisitor {
+
+ public static final String OPEN = "open";
+ public static final String CLOSE = "close";
+
+ private IASTName openFD;
+ private IASTName closeFD;
+
+ public CloseOpenedFilesVisitor() {
+ shouldVisitExpressions = true;
+ }
+
+ @Override
+ public int visit(IASTExpression expression) {
+ if (expression instanceof IASTFunctionCallExpression) {
+ IASTFunctionCallExpression callExpression = (IASTFunctionCallExpression) expression;
+ IASTExpression funcName = callExpression.getFunctionNameExpression();
+ if (funcName instanceof IASTIdExpression) {
+ IASTName name = ((IASTIdExpression) funcName).getName();
+ String simpleName = String.valueOf(name.getSimpleID());
+ if (simpleName.equals(OPEN)) {
+ IASTNode parent = callExpression.getParent();
+ if (parent instanceof IASTInitializer) {
+ parent = parent.getParent();
+ if (parent instanceof IASTDeclarator) {
+ openFD = ((IASTDeclarator) parent).getName();
+ }
+ }
+ }
+ else if (simpleName.equals(CLOSE)) {
+ IASTExpression paramExpression = callExpression.getParameterExpression();
+ if (paramExpression instanceof IASTIdExpression) {
+ closeFD = ((IASTIdExpression) paramExpression).getName();
+ }
+ }
+ }
+
+ return PROCESS_SKIP;
+ }
+ else {
+ return PROCESS_CONTINUE;
+ }
+ }
+
+ public IASTName getOpenFD() {
+ return openFD;
+ }
+
+ public IASTName getCloseFD() {
+ return closeFD;
+ }
+ }
+
+}
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java
new file mode 100644
index 0000000..5ce5661
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.checkers.sample;
+
+import org.eclipse.cdt.codan.core.model.AbstractIndexAstChecker;
+import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
+import org.eclipse.cdt.core.dom.ast.IASTExpression;
+import org.eclipse.cdt.core.dom.ast.IASTForStatement;
+import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+
+public class AssignmentInConditionChecker extends AbstractIndexAstChecker {
+ private static final String ER_ID = "org.eclipse.cdt.codan.checkers.sample.AssignmentInConditionProblem";
+
+ public void processAst(IASTTranslationUnit ast) {
+ // traverse the ast using the visitor pattern.
+ ast.accept(new CheckCodeVisitor());
+ }
+
+ class CheckCodeVisitor extends ASTVisitor {
+ CheckCodeVisitor() {
+ shouldVisitExpressions = true;
+ }
+
+ public int visit(IASTExpression expression) {
+ if (isAssignmentExpression(expression)
+ && isUsedAsCondition(expression)) {
+ reportProblem(ER_ID, expression, "Possible assignment in condition");
+ }
+ return PROCESS_CONTINUE;
+ }
+
+ private boolean isAssignmentExpression(IASTExpression e) {
+ if (e instanceof IASTBinaryExpression) {
+ IASTBinaryExpression binExpr = (IASTBinaryExpression) e;
+ return binExpr.getOperator() == IASTBinaryExpression.op_assign;
+ }
+ return false;
+ }
+
+ private boolean isUsedAsCondition(IASTExpression expression) {
+ ASTNodeProperty prop = expression.getPropertyInParent();
+ if (prop == IASTForStatement.CONDITION
+ || prop == IASTIfStatement.CONDITION)
+ return true;
+ return false;
+ }
+ }
+}
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries
new file mode 100644
index 0000000..7071b8d
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries
@@ -0,0 +1,3 @@
+/AssignmentInConditionChecker.java/1.4/Fri Jul 31 20:39:13 2009//
+/NonVirtualDestructor.java/1.4/Fri Jul 31 20:39:13 2009//
+/StatementHasNoEffectChecker.java/1.5/Fri Jul 31 20:39:13 2009//
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository
new file mode 100644
index 0000000..28a5431
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java
new file mode 100644
index 0000000..45f7e72
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * 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.checkers.sample;
+
+import java.text.MessageFormat;
+
+import org.eclipse.cdt.codan.checkers.Activator;
+import org.eclipse.cdt.codan.core.model.AbstractIndexAstChecker;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
+
+/**
+ * Checker to find that class has virtual method and non virtual destructor
+ *
+ * @author Alena
+ *
+ */
+public class NonVirtualDestructor extends AbstractIndexAstChecker {
+ private static final String ER_ID = "org.eclipse.cdt.codan.checkers.sample.NonVirtualDestructorProblem";
+
+ public void processAst(IASTTranslationUnit ast) {
+ // traverse the ast using the visitor pattern.
+ ast.accept(new OnEachClass());
+ }
+
+ class OnEachClass extends ASTVisitor {
+ private IASTName className;
+ private IBinding virMethodName;
+ private IBinding destName;
+
+ OnEachClass() {
+ // shouldVisitDeclarations = true;
+ shouldVisitDeclSpecifiers = true;
+ }
+
+ public int visit(IASTDeclSpecifier decl) {
+ if (isClassDecl(decl)) {
+ try {
+ boolean err = hasErrorCondition(decl);
+ if (err) {
+ String mess;
+ String clazz = className.toString();
+ String method = virMethodName.getName();
+ IASTNode ast = decl;
+ if (destName != null) {
+ if (destName instanceof ICPPInternalBinding) {
+ ICPPInternalBinding bin = (ICPPInternalBinding) destName;
+ ast = bin.getDeclarations()[0];
+ }
+ mess = MessageFormat
+ .format(
+ "Class ''{0}'' has virtual method ''{1}'' but non-virtual destructor ''{2}''",
+ clazz, method, destName.getName());
+ reportProblem(ER_ID, ast, mess);
+ }
+ }
+ } catch (DOMException e) {
+ // ignore, no error
+ } catch (Exception e) {
+ Activator.log(e);
+ }
+ return PROCESS_SKIP;
+ }
+ return PROCESS_CONTINUE;
+ }
+
+ /**
+ * @param decl
+ * @throws DOMException
+ */
+ private boolean hasErrorCondition(IASTDeclSpecifier decl)
+ throws DOMException {
+ ICPPASTCompositeTypeSpecifier spec = (ICPPASTCompositeTypeSpecifier) decl;
+ className = spec.getName();
+ IBinding binding = className.getBinding();
+ if (binding == null) {
+ binding = className.resolveBinding();
+ }
+ if (binding instanceof ICPPClassType) {
+ ICPPClassType type = (ICPPClassType) binding;
+ virMethodName = null;
+ destName = null;
+ // check for the following conditions:
+ // class has own virtual method and own non-virtual destructor
+ // class has own virtual method and base non-virtual destructor
+ // class has base virtual method and own non-virtual destructor
+ ICPPMethod[] declaredMethods = type.getDeclaredMethods();
+ boolean hasOwnVirtualMethod = false;
+ boolean hasOwnNonVirDestructor = false;
+ boolean hasDestructor = false;
+ boolean hasVirtualMethod = false;
+ for (int i = 0; i < declaredMethods.length; i++) {
+ ICPPMethod icppMethod = declaredMethods[i];
+ if (icppMethod.isVirtual() && !icppMethod.isDestructor()) {
+ hasOwnVirtualMethod = true;
+ virMethodName = icppMethod;
+ }
+ if (icppMethod.isDestructor()) {
+ hasDestructor = true;
+ if (!icppMethod.isVirtual()) {
+ hasOwnNonVirDestructor = true;
+ destName = icppMethod;
+ }
+ }
+ }
+ boolean hasVirDestructor = false;
+ // class has own virtual method and own non-virtual destructor
+ if (hasOwnVirtualMethod && hasOwnNonVirDestructor) {
+ return true;
+ }
+ // class does not have virtual methods but has virtual
+ // destructor
+ // - not an error
+ if (hasOwnVirtualMethod == false && hasDestructor == true
+ && hasOwnNonVirDestructor == false) {
+ return false;
+ }
+ ICPPMethod[] allDeclaredMethods = type.getAllDeclaredMethods();
+ for (int i = 0; i < allDeclaredMethods.length; i++) {
+ ICPPMethod icppMethod = allDeclaredMethods[i];
+ if (icppMethod.isVirtual() && !icppMethod.isDestructor()) {
+ hasVirtualMethod = true;
+ if (virMethodName == null)
+ virMethodName = icppMethod;
+ }
+ if (icppMethod.isDestructor()) {
+ hasDestructor = true;
+ if (icppMethod.isVirtual()) {
+ hasVirDestructor = true;
+ } else {
+ if (destName == null)
+ destName = icppMethod;
+ }
+ }
+ }
+ if (hasOwnVirtualMethod) {
+ // class has own virtual method and base non-virtual
+ // destructor
+ if (hasDestructor == true && hasVirDestructor == false) {
+ return true;
+ }
+ } else if (hasVirtualMethod) {
+ // class has base virtual method and own non-virtual
+ // destructor
+ if (hasOwnNonVirDestructor == true) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param decl
+ * @return
+ */
+ private boolean isClassDecl(IASTDeclSpecifier decl) {
+ if (decl instanceof ICPPASTCompositeTypeSpecifier) {
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java
new file mode 100644
index 0000000..c08f58a
--- /dev/null
+++ b/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.checkers.sample;
+
+import org.eclipse.cdt.codan.core.model.AbstractIndexAstChecker;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
+import org.eclipse.cdt.core.dom.ast.IASTExpression;
+import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
+import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
+import org.eclipse.cdt.core.dom.ast.IASTStatement;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
+import org.eclipse.cdt.core.dom.ast.IBasicType;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTBinaryExpression;
+
+/**
+ * Checker that detects statements without effect such as
+ *
+ * a+b;
+ *
+ * or
+ *
+ * +b;
+ *
+ *
+ */
+public class StatementHasNoEffectChecker extends AbstractIndexAstChecker {
+ private static final String ER_ID = "org.eclipse.cdt.codan.checkers.sample.StatementHasNoEffectProblem";
+
+ public void processAst(IASTTranslationUnit ast) {
+ // traverse the ast using the visitor pattern.
+ ast.accept(new CheckStmpVisitor());
+ }
+
+ class CheckStmpVisitor extends ASTVisitor {
+ CheckStmpVisitor() {
+ shouldVisitStatements = true;
+ }
+
+ public int visit(IASTStatement stmt) {
+ if (stmt instanceof IASTExpressionStatement) {
+ if (hasNoEffect(((IASTExpressionStatement) stmt)
+ .getExpression())) {
+ reportProblem(ER_ID, stmt, "Statement has no effect");
+ }
+ return PROCESS_SKIP;
+ }
+ return PROCESS_CONTINUE;
+ }
+
+ /**
+ * We consider has not effect binary statements without assignment and
+ * unary statement which is not dec and inc. If operator is overloaded
+ * we not going to bother.
+ *
+ * @param e
+ * @return
+ */
+ private boolean hasNoEffect(IASTExpression e) {
+ if (e instanceof IASTBinaryExpression) {
+ IASTBinaryExpression binExpr = (IASTBinaryExpression) e;
+ if (binExpr.getOperator() == IASTBinaryExpression.op_assign)
+ return false;
+ if (binExpr instanceof CPPASTBinaryExpression) {
+ // unfortunately ICPPASTBinaryExpression does not have
+ // getOverload public method
+ CPPASTBinaryExpression cppBin = (CPPASTBinaryExpression) binExpr;
+ ICPPFunction overload = cppBin.getOverload();
+ if (overload != null)
+ return false;
+ IType expressionType = binExpr.getOperand1()
+ .getExpressionType();
+ if (!(expressionType instanceof IBasicType)) {
+ return false; // must be overloaded but parser could not
+ // find it
+ }
+ }
+ return true;
+ }
+ if (e instanceof IASTUnaryExpression) {
+ IASTUnaryExpression unaryExpr = (IASTUnaryExpression) e;
+ int operator = unaryExpr.getOperator();
+ switch (operator) {
+ case IASTUnaryExpression.op_postFixDecr:
+ case IASTUnaryExpression.op_prefixDecr:
+ case IASTUnaryExpression.op_postFixIncr:
+ case IASTUnaryExpression.op_prefixIncr:
+ return false;
+ }
+ return true;
+ }
+ if (e instanceof IASTIdExpression) {
+ // simply a;
+ return true;
+ }
+ return false;
+ }
+ }
+}
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;
+ }
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/.classpath b/org.eclipse.cdt.codan.ui/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.cdt.codan.ui/.project b/org.eclipse.cdt.codan.ui/.project
new file mode 100644
index 0000000..1a97756
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.codan.ui</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.ui/.settings/CVS/Entries b/org.eclipse.cdt.codan.ui/.settings/CVS/Entries
new file mode 100644
index 0000000..e7a8ed5
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/.settings/CVS/Entries
@@ -0,0 +1 @@
+/org.eclipse.jdt.core.prefs/1.1/Thu Apr 9 12:47:54 2009//
diff --git a/org.eclipse.cdt.codan.ui/.settings/CVS/Repository b/org.eclipse.cdt.codan.ui/.settings/CVS/Repository
new file mode 100644
index 0000000..3ffeb3f
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/.settings/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/.settings
diff --git a/org.eclipse.cdt.codan.ui/.settings/CVS/Root b/org.eclipse.cdt.codan.ui/.settings/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/.settings/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..57703d3
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Apr 03 21:34:42 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.compliance=1.5
+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.ui/CVS/Entries b/org.eclipse.cdt.codan.ui/CVS/Entries
new file mode 100644
index 0000000..f361049
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/CVS/Entries
@@ -0,0 +1,7 @@
+/.classpath/1.1/Thu Apr 9 12:47:54 2009//
+/.project/1.1/Thu Apr 9 12:47:54 2009//
+D/.settings////
+D/META-INF////
+/build.properties/1.1/Thu Apr 9 12:47:54 2009//
+/plugin.xml/1.2/Fri Apr 24 12:49:45 2009//
+D/src////
diff --git a/org.eclipse.cdt.codan.ui/CVS/Repository b/org.eclipse.cdt.codan.ui/CVS/Repository
new file mode 100644
index 0000000..d36759f
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui
diff --git a/org.eclipse.cdt.codan.ui/CVS/Root b/org.eclipse.cdt.codan.ui/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/CVS/Template b/org.eclipse.cdt.codan.ui/CVS/Template
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/CVS/Template
diff --git a/org.eclipse.cdt.codan.ui/META-INF/CVS/Entries b/org.eclipse.cdt.codan.ui/META-INF/CVS/Entries
new file mode 100644
index 0000000..a9833bb
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/META-INF/CVS/Entries
@@ -0,0 +1 @@
+/MANIFEST.MF/1.2/Fri Apr 24 12:49:44 2009//
diff --git a/org.eclipse.cdt.codan.ui/META-INF/CVS/Repository b/org.eclipse.cdt.codan.ui/META-INF/CVS/Repository
new file mode 100644
index 0000000..4b3c83e
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/META-INF/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/META-INF
diff --git a/org.eclipse.cdt.codan.ui/META-INF/CVS/Root b/org.eclipse.cdt.codan.ui/META-INF/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/META-INF/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF b/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9d5357d
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Code Analyzers Framework
+Bundle-SymbolicName: org.eclipse.cdt.codan.ui; singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.cdt.codan.ui.Activator
+Bundle-Vendor: Eclipse
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.cdt.core;bundle-version="5.1.0",
+ org.eclipse.cdt.codan.core;bundle-version="1.0.0",
+ org.eclipse.cdt.ui;bundle-version="5.1.0",
+ org.eclipse.ui.workbench.texteditor;bundle-version="3.5.0",
+ org.eclipse.ui.editors;bundle-version="3.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+
diff --git a/org.eclipse.cdt.codan.ui/build.properties b/org.eclipse.cdt.codan.ui/build.properties
new file mode 100644
index 0000000..2b0d95b
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .
diff --git a/org.eclipse.cdt.codan.ui/plugin.xml b/org.eclipse.cdt.codan.ui/plugin.xml
new file mode 100644
index 0000000..eff5ea6
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/plugin.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ objectClass="org.eclipse.core.resources.IProject"
+ nameFilter="*"
+ id="org.eclipse.cdt.codan.ui.runaction">
+ <action
+ label="Run Code Analysis"
+ class="org.eclipse.cdt.codan.ui.actions.RunCodeAnalysis"
+ menubarPath="additions"
+ enablesFor="+"
+ id="org.eclipse.cdt.codan.ui.actions.RunCodeAnalysis">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
+ class="org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage"
+ id="org.eclipse.cdt.codan.ui.preferences.CodanPreferencePage"
+ name="Code Analysis">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ name="C/C++ Code Analysis "
+
+ class="org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage"
+ id="org.eclipse.cdt.codan.ui.properties.codanProblemsPropertyPage">
+ <enabledWhen>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ </enabledWhen>
+ </page>
+ <page
+ category="org.eclipse.cdt.codan.ui.properties.codanProblemsPropertyPage"
+ class="org.eclipse.cdt.codan.internal.ui.preferences.BuildPropertyPage"
+ id="org.eclipse.cdt.codan.ui.properties.buildPropertyPage"
+ name="Build">
+ <enabledWhen>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ </enabledWhen>
+ </page>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.cdt.codan.internal.ui.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.eclipse.cdt.codan.ui.Startup"></startup>
+ </extension>
+</plugin>
diff --git a/org.eclipse.cdt.codan.ui/src/CVS/Entries b/org.eclipse.cdt.codan.ui/src/CVS/Entries
new file mode 100644
index 0000000..381094d
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/CVS/Entries
@@ -0,0 +1 @@
+D/org////
diff --git a/org.eclipse.cdt.codan.ui/src/CVS/Repository b/org.eclipse.cdt.codan.ui/src/CVS/Repository
new file mode 100644
index 0000000..7360e77
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src
diff --git a/org.eclipse.cdt.codan.ui/src/CVS/Root b/org.eclipse.cdt.codan.ui/src/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/src/org/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/CVS/Entries
new file mode 100644
index 0000000..0f148f8
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/CVS/Entries
@@ -0,0 +1 @@
+D/eclipse////
diff --git a/org.eclipse.cdt.codan.ui/src/org/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/CVS/Repository
new file mode 100644
index 0000000..b7801e5
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org
diff --git a/org.eclipse.cdt.codan.ui/src/org/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Entries
new file mode 100644
index 0000000..e524915
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Entries
@@ -0,0 +1 @@
+D/cdt////
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Repository
new file mode 100644
index 0000000..1c695f0
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Entries
new file mode 100644
index 0000000..8d969ba
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Entries
@@ -0,0 +1 @@
+D/codan////
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Repository
new file mode 100644
index 0000000..b18dad4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Entries
new file mode 100644
index 0000000..2aec24b
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Entries
@@ -0,0 +1,2 @@
+D/internal////
+D/ui////
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Repository
new file mode 100644
index 0000000..7b25e2f
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Entries
new file mode 100644
index 0000000..7f0205c
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Entries
@@ -0,0 +1 @@
+D/ui////
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Repository
new file mode 100644
index 0000000..94f06ce
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/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.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Entries
new file mode 100644
index 0000000..f769284
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Entries
@@ -0,0 +1 @@
+D/preferences////
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Repository
new file mode 100644
index 0000000..39360cc
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java
new file mode 100644
index 0000000..95f7ff6
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java
@@ -0,0 +1,97 @@
+package org.eclipse.cdt.codan.internal.ui.preferences;
+
+import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.cdt.codan.core.PreferenceConstants;
+import org.eclipse.cdt.codan.ui.actions.ToggleNatureAction;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+
+public class BuildPropertyPage extends FieldEditorPreferencePage implements
+ IWorkbenchPropertyPage {
+ private IAdaptable element;
+
+ /**
+ *
+ */
+ public BuildPropertyPage() {
+ setPreferenceStore(org.eclipse.cdt.codan.ui.Activator.getDefault()
+ .getPreferenceStore());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
+ * ()
+ */
+ @Override
+ protected void createFieldEditors() {
+ addField(new BooleanFieldEditor(PreferenceConstants.P_RUN_ON_BUILD,
+ "&Run with Build", getFieldEditorParent()));
+ }
+
+ @Override
+ public boolean performOk() {
+ boolean result = super.performOk();
+ if (result) {
+ IAdaptable res = getElement();
+ if (res instanceof IProject) {
+ boolean runOnBuild = getPreferenceStore().getBoolean(
+ PreferenceConstants.P_RUN_ON_BUILD);
+ new ToggleNatureAction().toggleNature((IProject) res,
+ runOnBuild);
+ // if (runOnBuild == false) {
+ // boolean openQuestion = MessageDialog
+ // .openQuestion(
+ // getShell(),
+ // "Confirmation",
+ // "Do you want to remove existing problems? If build is disabled they won't be updated anymore.");
+ // if (openQuestion == true) {
+ // CodanMarkerProblemReporter.deleteAllMarkers();
+ // }
+ // }
+ return true;
+ }
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
+ */
+ public IAdaptable getElement() {
+ return element;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime
+ * .IAdaptable)
+ */
+ public void setElement(IAdaptable element) {
+ this.element = element;
+ ProjectScope ps = new ProjectScope((IProject) getElement());
+ ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps,
+ CodanCorePlugin.PLUGIN_ID);
+ scoped
+ .setSearchContexts(new IScopeContext[] { ps,
+ new InstanceScope() });
+ setPreferenceStore(scoped);
+ }
+
+ protected String getPageId() {
+ return "org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage";
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Entries
new file mode 100644
index 0000000..fb8ead1
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Entries
@@ -0,0 +1,8 @@
+/BuildPropertyPage.java/1.4/Sat Aug 22 21:16:50 2009//
+/CheckedTreeEditor.java/1.4/Wed Apr 22 01:26:58 2009//
+/CodanPreferencePage.java/1.4/Sat Aug 22 21:16:50 2009//
+/FieldEditorOverlayPage.java/1.3/Sat Apr 18 04:01:44 2009//
+/Messages.java/1.1/Thu Apr 9 12:47:54 2009//
+/Messages.properties/1.1/Thu Apr 9 12:47:54 2009//
+/PreferenceInitializer.java/1.2/Thu Apr 16 01:46:56 2009//
+/ProblemsTreeEditor.java/1.7/Sat Aug 22 21:16:50 2009//
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Repository
new file mode 100644
index 0000000..34cf58a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CheckedTreeEditor.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CheckedTreeEditor.java
new file mode 100644
index 0000000..7c98ef4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CheckedTreeEditor.java
@@ -0,0 +1,330 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.internal.ui.preferences;
+
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+
+/**
+ * An abstract field editor that manages a checked tree. Values in the tree
+ * should be set outside by setting getTreeViewer().setContentProvider() and
+ * getTreeViewer().setInput() Control stores checked elements only in preference
+ * storage.
+ *
+ * <p>
+ * Subclasses may implement the <code>parseString</code>,
+ * <code>createList</code>, <code>storeValue</code> and
+ * <code>getListSeparator</code> framework methods.
+ * </p>
+ */
+public abstract class CheckedTreeEditor extends FieldEditor implements
+ ICheckStateListener {
+ /**
+ * The list widget; <code>null</code> if none (before creation or after
+ * disposal).
+ */
+ private CheckboxTreeViewer treeViewer;
+ private Composite listParent;
+ private boolean isValid;
+ private boolean emptySelectionAllowed = false;
+
+ /**
+ * Creates a new list field editor
+ */
+ protected CheckedTreeEditor() {
+ }
+
+ /**
+ * Creates a list field editor.
+ *
+ * @param name
+ * the name of the preference this field editor works on
+ * @param labelText
+ * the label text of the field editor
+ * @param parent
+ * the parent of the field editor's control
+ */
+ public CheckedTreeEditor(String name, String labelText, Composite parent) {
+ init(name, labelText);
+ createControl(parent);
+ }
+
+ /*
+ * (non-Javadoc) Method declared on FieldEditor.
+ */
+ protected void adjustForNumColumns(int numColumns) {
+ Control control = getLabelControl();
+ if (control != null) {
+ ((GridData) control.getLayoutData()).horizontalSpan = numColumns;
+ ((GridData) getTreeControl().getLayoutData()).horizontalSpan = numColumns;
+ } else {
+ ((GridData) getTreeControl().getLayoutData()).horizontalSpan = numColumns;
+ }
+ }
+
+ /*
+ * (non-Javadoc) Method declared on FieldEditor.
+ */
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ doFillLabelIntoGrid(parent, numColumns);
+ doFillBoxIntoGrid(parent, numColumns);
+ }
+
+ protected void doFillLabelIntoGrid(Composite parent, int numColumns) {
+ String text = getLabelText();
+ if (text != null && text.length() > 0) {
+ Control control = getLabelControl(parent);
+ GridData gd = new GridData();
+ gd.horizontalSpan = numColumns;
+ control.setLayoutData(gd);
+ }
+ }
+
+ protected void doFillBoxIntoGrid(Composite parent, int numColumns) {
+ GridData gd;
+ Control list = createListControl(parent);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.verticalAlignment = GridData.FILL;
+ gd.horizontalSpan = numColumns;
+ gd.grabExcessHorizontalSpace = true;
+ gd.grabExcessVerticalSpace = true;
+ list.setLayoutData(gd);
+ }
+
+ /*
+ * (non-Javadoc) Method declared on FieldEditor.
+ */
+ protected void doLoad() {
+ if (getTreeControl() != null) {
+ String s = getPreferenceStore().getString(getPreferenceName());
+ getViewer().setInput(modelFromString(s));
+ }
+ }
+
+ /**
+ * @param s
+ * @return
+ */
+ protected abstract Object modelFromString(String s);
+
+ Control getTreeControl() {
+ if (treeViewer == null)
+ return null;
+ return treeViewer.getControl();
+ }
+
+ public CheckboxTreeViewer getTreeViewer() {
+ return treeViewer;
+ }
+
+ /**
+ * @Override
+ * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
+ */
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ Object element = event.getElement();
+ treeViewer.setGrayed(element, false);
+ treeViewer.setSubtreeChecked(element, event.getChecked());
+ Object parent = getContentProvider().getParent(element);
+ if (parent != null) {
+ updateCheckedState(parent);
+ treeViewer.setParentsGrayed(parent, true);
+ }
+ refreshValidState();
+ }
+
+ private ITreeContentProvider getContentProvider() {
+ return ((ITreeContentProvider) treeViewer.getContentProvider());
+ }
+
+ /**
+ * @param parent
+ * @param event
+ */
+ private void updateCheckedState(Object parent) {
+ Object[] children = getContentProvider().getChildren(parent);
+ int i, count = 0;
+ for (i = 0; i < children.length; i++) {
+ Object object = children[i];
+ if (treeViewer.getChecked(object)) {
+ count++;
+ }
+ }
+ if (count > 0) {
+ treeViewer.setChecked(parent, true);
+ }
+ if (count == 0) {
+ treeViewer.setGrayed(parent, false);
+ treeViewer.setChecked(parent, false);
+ return;
+ }
+ if (count < i) {
+ treeViewer.setGrayed(parent, true);
+ }
+ }
+
+ /*
+ * (non-Javadoc) Method declared on FieldEditor.
+ */
+ protected void doLoadDefault() {
+ if (getTreeControl() != null) {
+ String s = getPreferenceStore().getDefaultString(
+ getPreferenceName());
+ getViewer().setInput(modelFromString(s));
+ }
+ }
+
+ /*
+ * (non-Javadoc) Method declared on FieldEditor.
+ */
+ protected void doStore() {
+ String s = modelToString(getViewer().getInput());
+ if (s != null) {
+ getPreferenceStore().setValue(getPreferenceName(), s);
+ }
+ }
+
+ /**
+ * Returns this field editor's list control.
+ *
+ * @param parent
+ * the parent control
+ * @return the list control
+ */
+ public Tree createListControl(Composite parent) {
+ Tree table = (Tree) getTreeControl();
+ if (table == null) {
+ listParent = parent;
+ treeViewer = new CheckboxTreeViewer(parent, SWT.BORDER | SWT.MULTI
+ | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
+ table = treeViewer.getTree();
+ table.setFont(parent.getFont());
+ treeViewer.addCheckStateListener(this);
+ } else {
+ checkParent(table, parent);
+ }
+ return table;
+ }
+
+ public StructuredViewer getViewer() {
+ return treeViewer;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on FieldEditor.
+ */
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ /**
+ * Returns this field editor's shell.
+ * <p>
+ * This method is internal to the framework; subclassers should not call
+ * this method.
+ * </p>
+ *
+ * @return the shell
+ */
+ protected Shell getShell() {
+ return treeViewer.getControl().getShell();
+ }
+
+ /*
+ * (non-Javadoc) Method declared on FieldEditor.
+ */
+ public void setFocus() {
+ if (getTreeControl() != null) {
+ getTreeControl().setFocus();
+ }
+ }
+
+ /*
+ * @see FieldEditor.setEnabled(boolean,Composite).
+ */
+ public void setEnabled(boolean enabled, Composite parent) {
+ super.setEnabled(enabled, parent);
+ createListControl(parent).setEnabled(enabled);
+ }
+
+ /**
+ * Combines the given list of items into a single string. This method is the
+ * converse of <code>parseString</code>.
+ * <p>
+ * Subclasses may implement this method.
+ * </p>
+ *
+ * @return the combined string
+ * @see #stringToModel
+ */
+ protected abstract String modelToString(Object model);
+
+ protected void createControl(Composite parent) {
+ GridLayout ly = (GridLayout) parent.getLayout();
+ doFillIntoGrid(parent, ly.numColumns);
+ }
+
+ /**
+ * @param b
+ */
+ public void setEnabled(boolean b) {
+ setEnabled(b, listParent);
+ }
+
+ public Composite getTreeParent() {
+ return listParent;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on FieldEditor.
+ */
+ public boolean isValid() {
+ return isValid;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on FieldEditor.
+ */
+ protected void refreshValidState() {
+ isValid = checkState();
+ }
+
+ protected boolean checkState() {
+ if (!emptySelectionAllowed) {
+ Object[] checkedElements = getTreeViewer().getCheckedElements();
+ if (checkedElements.length == 0) {
+ showErrorMessage("Selection cannot be empty");
+ return false;
+ }
+ }
+ clearErrorMessage();
+ return true;
+ }
+
+ public final boolean isEmptySelectionAllowed() {
+ return emptySelectionAllowed;
+ }
+
+ public final void setEmptySelectionAllowed(boolean emptySelectionAllowed) {
+ this.emptySelectionAllowed = emptySelectionAllowed;
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java
new file mode 100644
index 0000000..35b9a8f
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.ui.preferences;
+
+import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.cdt.codan.core.CodanRuntime;
+import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
+import org.eclipse.cdt.codan.core.model.IProblemProfile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+
+/**
+ * This class represents a preference page that is contributed to the
+ * Preferences dialog. By subclassing <samp>FieldEditorPreferencePage</samp>, we
+ * can use the field support built into JFace that allows us to create a page
+ * that is small and knows how to save, restore and apply itself.
+ * <p>
+ * This page is used to modify preferences only. They are stored in the
+ * preference store that belongs to the main plug-in class. That way,
+ * preferences can be accessed directly via the preference store.
+ */
+public class CodanPreferencePage extends FieldEditorOverlayPage implements
+ IWorkbenchPreferencePage {
+ private IProblemProfile profile;
+
+ public CodanPreferencePage() {
+ super(GRID);
+ setPreferenceStore(new ScopedPreferenceStore(new InstanceScope(),
+ CodanCorePlugin.PLUGIN_ID));
+ setDescription("Code Analyzers Preference Page");
+ }
+
+ protected String getPageId() {
+ return "org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage";
+ }
+
+ /**
+ * Creates the field editors. Field editors are abstractions of the common
+ * GUI blocks needed to manipulate various types of preferences. Each field
+ * editor knows how to save and restore itself.
+ */
+ public void createFieldEditors() {
+ profile = isPropertyPage() ? getRegistry()
+ .getResourceProfileWorkingCopy((IResource) getElement())
+ : getRegistry().getWorkspaceProfile();
+ CheckedTreeEditor checkedTreeEditor = new ProblemsTreeEditor(
+ getFieldEditorParent(), profile);
+ addField(checkedTreeEditor);
+ }
+
+ /**
+ * @return
+ */
+ protected ICheckersRegistry getRegistry() {
+ return CodanRuntime.getInstance().getChechersRegistry();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#performApply()
+ */
+ @Override
+ public boolean performOk() {
+ if (isPropertyPage())
+ getRegistry().updateProfile((IResource) getElement(), null);
+ return super.performOk();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FieldEditorOverlayPage.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FieldEditorOverlayPage.java
new file mode 100644
index 0000000..e617a75
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FieldEditorOverlayPage.java
@@ -0,0 +1,363 @@
+/*******************************************************************************
+ * Copyright (c) 2003 Berthold Daum.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Berthold Daum
+ *******************************************************************************/
+package org.eclipse.cdt.codan.internal.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.cdt.codan.core.PreferenceConstants;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.preference.PreferenceNode;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+
+/**
+ * @author Berthold Daum
+ */
+public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
+ implements IWorkbenchPropertyPage {
+ // Stores all created field editors
+ private List editors = new ArrayList();
+ // Stores owning element of properties
+ private IAdaptable element;
+ // Additional buttons for property pages
+ private Button useWorkspaceSettingsButton, useProjectSettingsButton,
+ configureButton;
+ // Overlay preference store for property pages
+ private IPreferenceStore overlayStore;
+ // The image descriptor of this pages title image
+ private ImageDescriptor image;
+ // Cache for page id
+ private String pageId;
+
+ /**
+ * Constructor
+ *
+ * @param style
+ * - layout style
+ */
+ public FieldEditorOverlayPage(int style) {
+ super(style);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param title
+ * - title string
+ * @param style
+ * - layout style
+ */
+ public FieldEditorOverlayPage(String title, int style) {
+ super(title, style);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param title
+ * - title string
+ * @param image
+ * - title image
+ * @param style
+ * - layout style
+ */
+ public FieldEditorOverlayPage(String title, ImageDescriptor image, int style) {
+ super(title, image, style);
+ this.image = image;
+ }
+
+ /**
+ * Returns the id of the current preference page as defined in plugin.xml
+ * Subclasses must implement.
+ *
+ * @return - the qualifier
+ */
+ protected abstract String getPageId();
+
+ /**
+ * Receives the object that owns the properties shown in this property page.
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
+ */
+ public void setElement(IAdaptable element) {
+ this.element = element;
+ }
+
+ /**
+ * Delivers the object that owns the properties shown in this property page.
+ *
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
+ */
+ public IAdaptable getElement() {
+ return element;
+ }
+
+ /**
+ * Returns true if this instance represents a property page
+ *
+ * @return - true for property pages, false for preference pages
+ */
+ public boolean isPropertyPage() {
+ return getElement() != null;
+ }
+
+ /**
+ * We override the addField method. This allows us to store each field
+ * editor added by subclasses in a list for later processing.
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#addField(org.eclipse.jface.preference.FieldEditor)
+ */
+ protected void addField(FieldEditor editor) {
+ editors.add(editor);
+ super.addField(editor);
+ }
+
+ /**
+ * We override the createControl method. In case of property pages we create
+ * a new PropertyStore as local preference store. After all control have
+ * been create, we enable/disable these controls.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createControl()
+ */
+ public void createControl(Composite parent) {
+ // Special treatment for property pages
+ if (isPropertyPage()) {
+ // Cache the page id
+ pageId = getPageId();
+ // Create an overlay preference store and fill it with properties
+ ProjectScope ps = new ProjectScope((IProject) getElement());
+ ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps,
+ CodanCorePlugin.PLUGIN_ID);
+ scoped.setSearchContexts(new IScopeContext[] { ps,
+ new InstanceScope() });
+ overlayStore = scoped;
+ // Set overlay store as current preference store
+ }
+ super.createControl(parent);
+ // Update state of all subclass controls
+ if (isPropertyPage())
+ updateFieldEditors();
+ }
+
+ /**
+ * We override the createContents method. In case of property pages we
+ * insert two radio buttons at the top of the page.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ if (isPropertyPage())
+ createSelectionGroup(parent);
+ return super.createContents(parent);
+ }
+
+ /**
+ * Creates and initializes a selection group with two choice buttons and one
+ * push button.
+ *
+ * @param parent
+ * - the parent composite
+ */
+ private void createSelectionGroup(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ comp.setLayout(layout);
+ comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Composite radioGroup = new Composite(comp, SWT.NONE);
+ radioGroup.setLayout(new GridLayout());
+ radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
+ useProjectSettingsButton = createRadioButton(radioGroup, Messages
+ .getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
+ configureButton = new Button(comp, SWT.PUSH);
+ configureButton.setText(Messages
+ .getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
+ configureButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ configureWorkspaceSettings();
+ }
+ });
+ // Set workspace/project radio buttons
+ try {
+ Boolean useWorkspace = getPreferenceStore().getBoolean(
+ PreferenceConstants.P_USE_PARENT);
+ if (useWorkspace) {
+ useWorkspaceSettingsButton.setSelection(true);
+ } else {
+ useProjectSettingsButton.setSelection(true);
+ configureButton.setEnabled(false);
+ }
+ } catch (Exception e) {
+ useWorkspaceSettingsButton.setSelection(true);
+ }
+ }
+
+ /**
+ * Convenience method creating a radio button
+ *
+ * @param parent
+ * - the parent composite
+ * @param label
+ * - the button label
+ * @return - the new button
+ */
+ private Button createRadioButton(Composite parent, String label) {
+ final Button button = new Button(parent, SWT.RADIO);
+ button.setText(label);
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ configureButton
+ .setEnabled(button == useWorkspaceSettingsButton);
+ updateFieldEditors();
+ }
+ });
+ return button;
+ }
+
+ /**
+ * Returns in case of property pages the overlay store, in case of
+ * preference pages the standard preference store
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore()
+ */
+ public IPreferenceStore getPreferenceStore() {
+ if (isPropertyPage())
+ return overlayStore;
+ return super.getPreferenceStore();
+ }
+
+ /*
+ * Enables or disables the field editors and buttons of this page
+ */
+ private void updateFieldEditors() {
+ // We iterate through all field editors
+ boolean enabled = useProjectSettingsButton.getSelection();
+ updateFieldEditors(enabled);
+ }
+
+ /**
+ * Enables or disables the field editors and buttons of this page Subclasses
+ * may override.
+ *
+ * @param enabled
+ * - true if enabled
+ */
+ protected void updateFieldEditors(boolean enabled) {
+ Composite parent = getFieldEditorParent();
+ Iterator it = editors.iterator();
+ while (it.hasNext()) {
+ FieldEditor editor = (FieldEditor) it.next();
+ editor.setEnabled(enabled, parent);
+ }
+ }
+
+ /**
+ * We override the performOk method. In case of property pages we copy the
+ * values in the overlay store into the property values of the selected
+ * project. We also save the state of the radio buttons.
+ *
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ boolean result = super.performOk();
+ if (result && isPropertyPage()) {
+ // Save state of radiobuttons in project properties
+ getPreferenceStore().setValue(PreferenceConstants.P_USE_PARENT,
+ !useProjectSettingsButton.getSelection());
+ }
+ return result;
+ }
+
+ /**
+ * We override the performDefaults method. In case of property pages we
+ * switch back to the workspace settings and disable the field editors.
+ *
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+ if (isPropertyPage()) {
+ useWorkspaceSettingsButton.setSelection(true);
+ useProjectSettingsButton.setSelection(false);
+ configureButton.setEnabled(true);
+ updateFieldEditors();
+ }
+ super.performDefaults();
+ }
+
+ /**
+ * Creates a new preferences page and opens it
+ */
+ protected void configureWorkspaceSettings() {
+ try {
+ // create a new instance of the current class
+ IPreferencePage page = (IPreferencePage) this.getClass()
+ .newInstance();
+ page.setTitle(getTitle());
+ page.setImageDescriptor(image);
+ // and show it
+ showPreferencePage(pageId, page);
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Show a single preference pages
+ *
+ * @param id
+ * - the preference page identification
+ * @param page
+ * - the preference page
+ */
+ protected void showPreferencePage(String id, IPreferencePage page) {
+ final IPreferenceNode targetNode = new PreferenceNode(id, page);
+ PreferenceManager manager = new PreferenceManager();
+ manager.addToRoot(targetNode);
+ final PreferenceDialog dialog = new PreferenceDialog(getControl()
+ .getShell(), manager);
+ BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
+ public void run() {
+ dialog.create();
+ dialog.setMessage(targetNode.getLabelText());
+ dialog.open();
+ }
+ });
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.java
new file mode 100644
index 0000000..4ef5f89
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2003 Berthold Daum.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Berthold Daum
+ *******************************************************************************/
+
+package org.eclipse.cdt.codan.internal.ui.preferences;
+
+import java.util.ResourceBundle;
+
+
+public class Messages {
+
+ private final static String RESOURCE_BUNDLE = "org.eclipse.cdt.codan.internal.ui.preferences.Messages";//$NON-NLS-1$
+
+ private static ResourceBundle fgResourceBundle = null;
+
+ private static boolean notRead = true;
+
+ public Messages() {
+ }
+ public static ResourceBundle getResourceBundle() {
+ if (notRead) {
+ notRead = false;
+ try {
+ fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ }
+ catch (Exception e) {
+ }
+ }
+
+ return fgResourceBundle;
+ }
+ public static String getString(String key) {
+ try {
+ return getResourceBundle().getString(key);
+ } catch (Exception e) {
+ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
+}
+
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.properties b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.properties
new file mode 100644
index 0000000..689b7ee
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.properties
@@ -0,0 +1,4 @@
+OverlayPage.Use_Workspace_Settings=Use &workspace settings
+OverlayPage.Use_Project_Settings=Use pr&oject settings
+OverlayPage.Configure_Workspace_Settings=&Configure Workspace Settings ...
+PropertyStore.Cannot_write_resource_property=Cannot write resource property
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/PreferenceInitializer.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/PreferenceInitializer.java
new file mode 100644
index 0000000..4362098
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/PreferenceInitializer.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.ui.preferences;
+
+import org.eclipse.cdt.codan.core.PreferenceConstants;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Class used to initialize default preference values.
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = org.eclipse.cdt.codan.ui.Activator
+ .getDefault().getPreferenceStore();
+ store.setDefault(PreferenceConstants.P_RUN_ON_BUILD, false);
+ }
+
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java
new file mode 100644
index 0000000..6ba82c6
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * 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.ui.preferences;
+
+import org.eclipse.cdt.codan.core.CodanPreferencesLoader;
+import org.eclipse.cdt.codan.core.PreferenceConstants;
+import org.eclipse.cdt.codan.core.model.CodanSeverity;
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemCategory;
+import org.eclipse.cdt.codan.core.model.IProblemProfile;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.ICheckStateProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+
+public class ProblemsTreeEditor extends CheckedTreeEditor {
+ private CodanPreferencesLoader codanPreferencesLoader = new CodanPreferencesLoader();
+
+ public ProblemsTreeEditor() {
+ super();
+ }
+
+ class ProblemsCheckStateProvider implements ICheckStateProvider {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ICheckStateProvider#isChecked(java.lang
+ * .Object)
+ */
+ public boolean isChecked(Object element) {
+ if (element instanceof IProblem) {
+ IProblem p = (IProblem) element;
+ return p.isEnabled();
+ }
+ if (element instanceof IProblemCategory) {
+ // checked if at least one is checked (buy grayed)
+ IProblemCategory p = (IProblemCategory) element;
+ Object[] children = p.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Object object = children[i];
+ if (isChecked(object)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ICheckStateProvider#isGrayed(java.lang.
+ * Object)
+ */
+ public boolean isGrayed(Object element) {
+ if (element instanceof IProblem) {
+ return false;
+ }
+ if (element instanceof IProblemCategory) {
+ // checked if at least one is checked (buy grayed)
+ IProblemCategory p = (IProblemCategory) element;
+ Object[] children = p.getChildren();
+ boolean all_checked = true;
+ boolean all_unchecked = true;
+ for (int i = 0; i < children.length; i++) {
+ Object object = children[i];
+ if (isChecked(object)) {
+ all_unchecked = false;
+ } else {
+ all_checked = false;
+ }
+ }
+ if (all_checked || all_unchecked)
+ return false;
+ return true;
+ }
+ return false;
+ }
+ }
+
+ class ProblemsContentProvider implements IContentProvider,
+ ITreeContentProvider {
+ public void dispose() {
+ // TODO Auto-generated method stub
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof Object[])
+ return (Object[]) parentElement;
+ if (parentElement instanceof IProblemCategory) {
+ return ((IProblemCategory) parentElement).getChildren();
+ }
+ if (parentElement instanceof IProblemProfile) {
+ return ((IProblemProfile) parentElement).getRoot()
+ .getChildren();
+ }
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+ }
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ Object element = event.getElement();
+ if (element instanceof IProblem) {
+ ((IProblem) element).setEnabled(event.getChecked());
+ }
+ }
+
+ class ProblemsLabelProvider extends BaseLabelProvider implements
+ IBaseLabelProvider, ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof IProblem) {
+ IProblem p = (IProblem) element;
+ if (columnIndex == 0)
+ return p.getName();
+ if (columnIndex == 1)
+ return p.getSeverity().toString();
+ }
+ if (element instanceof IProblemCategory) {
+ IProblemCategory p = (IProblemCategory) element;
+ if (columnIndex == 0)
+ return p.getName();
+ }
+ return null;
+ }
+ }
+
+ public ProblemsTreeEditor(Composite parent, IProblemProfile profile) {
+ super(PreferenceConstants.P_PROBLEMS, "Problems", parent);
+ setEmptySelectionAllowed(true);
+ getTreeViewer().getTree().setHeaderVisible(true);
+ // getTreeViewer().getTree().
+ getTreeViewer().setContentProvider(new ProblemsContentProvider());
+ getTreeViewer().setCheckStateProvider(new ProblemsCheckStateProvider());
+ // column Name
+ TreeViewerColumn column1 = new TreeViewerColumn(getTreeViewer(),
+ SWT.NONE);
+ column1.getColumn().setWidth(300);
+ column1.getColumn().setText("Name");
+ column1.setLabelProvider(new ColumnLabelProvider() {
+ public String getText(Object element) {
+ if (element instanceof IProblem) {
+ IProblem p = (IProblem) element;
+ return p.getName();
+ }
+ if (element instanceof IProblemCategory) {
+ IProblemCategory p = (IProblemCategory) element;
+ return p.getName();
+ }
+ return null;
+ }
+ });
+ // column Severity
+ TreeViewerColumn column2 = new TreeViewerColumn(getTreeViewer(),
+ SWT.NONE);
+ column2.getColumn().setWidth(100);
+ column2.getColumn().setText("Severity");
+ column2.setLabelProvider(new ColumnLabelProvider() {
+ public String getText(Object element) {
+ if (element instanceof IProblem) {
+ IProblem p = (IProblem) element;
+ return p.getSeverity().toString();
+ }
+ return null;
+ }
+ });
+ column2.setEditingSupport(new EditingSupport(getTreeViewer()) {
+ protected boolean canEdit(Object element) {
+ return element instanceof IProblem;
+ }
+
+ protected CellEditor getCellEditor(Object element) {
+ return new ComboBoxCellEditor(getTreeViewer().getTree(),
+ CodanSeverity.stringValues());
+ }
+
+ protected Object getValue(Object element) {
+ return ((IProblem) element).getSeverity().intValue();
+ }
+
+ protected void setValue(Object element, Object value) {
+ int index = ((Integer) value).intValue();
+ CodanSeverity val = CodanSeverity.values()[index];
+ ((IProblem) element).setSeverity(val);
+ getTreeViewer().update(element, null);
+ }
+ });
+ getTreeViewer().setAutoExpandLevel(2);
+ codanPreferencesLoader.setInput(profile);
+ getViewer().setInput(profile);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.internal.ui.preferences.CheckedTreeEditor#doLoad()
+ */
+ @Override
+ protected void doLoad() {
+ if (getTreeControl() != null) {
+ IProblem[] probs = codanPreferencesLoader.getProblems();
+ for (int i = 0; i < probs.length; i++) {
+ String id = probs[i].getId();
+ String s = getPreferenceStore().getString(id);
+ codanPreferencesLoader.setProperty(id, s);
+ }
+ getViewer().setInput(codanPreferencesLoader.getInput());
+ }
+ }
+
+ @Override
+ protected void doLoadDefault() {
+ if (getTreeControl() != null) {
+ IProblem[] probs = codanPreferencesLoader.getProblems();
+ for (int i = 0; i < probs.length; i++) {
+ String id = probs[i].getId();
+ String s = getPreferenceStore().getDefaultString(id);
+ codanPreferencesLoader.setProperty(id, s);
+ }
+ getViewer().setInput(codanPreferencesLoader.getInput());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.internal.ui.preferences.CheckedTreeEditor#doStore()
+ */
+ @Override
+ protected void doStore() {
+ codanPreferencesLoader.setInput(getViewer().getInput());
+ IProblem[] probs = codanPreferencesLoader.getProblems();
+ for (int i = 0; i < probs.length; i++) {
+ String id = probs[i].getId();
+ String s = codanPreferencesLoader.getProperty(id);
+ getPreferenceStore().setValue(id, s);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.cdt.codan.internal.ui.preferences.CheckedTreeEditor#
+ * modelFromString(java.lang.String)
+ */
+ @Override
+ protected Object modelFromString(String s) {
+ return codanPreferencesLoader.getInput();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.internal.ui.preferences.CheckedTreeEditor#modelToString
+ * (java.lang.Object)
+ */
+ @Override
+ protected String modelToString(Object model) {
+ return "";
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Activator.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Activator.java
new file mode 100644
index 0000000..849993a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Activator.java
@@ -0,0 +1,98 @@
+package org.eclipse.cdt.codan.ui;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.codan.ui";
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#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 Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in
+ * relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ /**
+ * 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.ui/src/org/eclipse/cdt/codan/ui/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Entries
new file mode 100644
index 0000000..4387fb2
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Entries
@@ -0,0 +1,4 @@
+/Activator.java/1.2/Fri Apr 24 12:49:44 2009//
+/CodanCReconciler.java/1.3/Sat Aug 22 21:16:50 2009//
+/Startup.java/1.1/Fri Apr 24 12:49:44 2009//
+D/actions////
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Repository
new file mode 100644
index 0000000..c0c10ac
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanCReconciler.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanCReconciler.java
new file mode 100644
index 0000000..5bec1c1
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanCReconciler.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.ui;
+
+import org.eclipse.cdt.codan.core.CodanRuntime;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.internal.ui.editor.CEditor;
+import org.eclipse.cdt.internal.ui.text.ICReconcilingListener;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * @author Alena
+ *
+ */
+public class CodanCReconciler implements ICReconcilingListener {
+ void install(ITextEditor editor) {
+ if (editor instanceof CEditor) {
+ initialize();
+ ((CEditor) editor).addReconcileListener(this);
+ }
+ }
+
+ void uninstall(ITextEditor editor) {
+ if (editor instanceof CEditor) {
+ initialize();
+ ((CEditor) editor).removeReconcileListener(this);
+ }
+ }
+
+ /**
+ *
+ */
+ private void initialize() {
+ // TODO Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.internal.ui.text.ICReconcilingListener#aboutToBeReconciled
+ * ()
+ */
+ public void aboutToBeReconciled() {
+ // TODO Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.internal.ui.text.ICReconcilingListener#reconciled(org
+ * .eclipse.cdt.core.dom.ast.IASTTranslationUnit, boolean,
+ * org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void reconciled(IASTTranslationUnit ast, boolean force,
+ IProgressMonitor progressMonitor) {
+ CodanRuntime.getInstance().getAstQuickBuilder().reconcileAst(ast,
+ progressMonitor);
+ // System.err.println("ast reconsiled");
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Startup.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Startup.java
new file mode 100644
index 0000000..41fbf89
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Startup.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.ui;
+
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * @author Alena
+ *
+ */
+public class Startup implements IStartup {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IStartup#earlyStartup()
+ */
+ public void earlyStartup() {
+ registerListeners();
+ }
+
+ /**
+ * Register part listener for editor to install c ast reconcile listener
+ */
+ private void registerListeners() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ workbench.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchWindow active = workbench.getActiveWorkbenchWindow();
+ final IWorkbenchPage page = active.getActivePage();
+ IPartListener2 partListener = new IPartListener2() {
+ CodanCReconciler reconsiler = new CodanCReconciler();
+
+ public void partActivated(IWorkbenchPartReference partRef) {
+ }
+
+ public void partDeactivated(IWorkbenchPartReference partRef) {
+ }
+
+ public void partOpened(IWorkbenchPartReference partRef) {
+ IWorkbenchPart editor = partRef.getPart(false);
+ if (editor instanceof ITextEditor) {
+ reconsiler.install((ITextEditor) editor);
+ }
+ }
+
+ public void partHidden(IWorkbenchPartReference partRef) {
+ }
+
+ public void partVisible(IWorkbenchPartReference partRef) {
+ }
+
+ public void partClosed(IWorkbenchPartReference partRef) {
+ IWorkbenchPart part = partRef.getPart(false);
+ if (part instanceof ITextEditor) {
+ reconsiler.uninstall((ITextEditor) part);
+ }
+ }
+
+ public void partBroughtToTop(IWorkbenchPartReference partRef) {
+ }
+
+ public void partInputChanged(IWorkbenchPartReference partRef) {
+ }
+ };
+ page.addPartListener(partListener);
+ // check current open editors
+ IEditorReference[] editorReferences = page
+ .getEditorReferences();
+ for (int i = 0; i < editorReferences.length; i++) {
+ IEditorReference ref = editorReferences[i];
+ partListener.partOpened(ref);
+ }
+ }
+ });
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Entries
new file mode 100644
index 0000000..30cf7ec
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Entries
@@ -0,0 +1,2 @@
+/RunCodeAnalysis.java/1.3/Sat Aug 22 21:16:50 2009//
+/ToggleNatureAction.java/1.2/Sat Aug 22 21:16:50 2009//
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Repository
new file mode 100644
index 0000000..09c1aeb
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/RunCodeAnalysis.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/RunCodeAnalysis.java
new file mode 100644
index 0000000..01d7c25
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/RunCodeAnalysis.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.ui.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.cdt.codan.core.CodanRuntime;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class RunCodeAnalysis implements IObjectActionDelegate {
+ private ISelection sel;
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ // nothing
+ }
+
+ public void run(IAction action) {
+ Job job = new Job("Running Code Analysis") {
+ @SuppressWarnings("unchecked")
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ IStructuredSelection ss = (IStructuredSelection) sel;
+ int count = ss.size();
+ monitor.beginTask(getName(), count * 100);
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ for (Iterator iterator = ss.iterator(); iterator.hasNext();) {
+ Object o = iterator.next();
+ if (o instanceof IResource) {
+ IResource res = (IResource) o;
+ SubProgressMonitor subMon = new SubProgressMonitor(
+ monitor, 100);
+ CodanRuntime.getInstance().getBuilder()
+ .processResource(res, subMon);
+ if (subMon.isCanceled())
+ return Status.CANCEL_STATUS;
+ }
+ if (monitor.isCanceled())
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setUser(true);
+ job.schedule();
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.sel = selection;
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/ToggleNatureAction.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/ToggleNatureAction.java
new file mode 100644
index 0000000..3993621
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/ToggleNatureAction.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * 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.ui.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class ToggleNatureAction implements IObjectActionDelegate {
+ private ISelection selection;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ if (selection instanceof IStructuredSelection) {
+ for (Iterator it = ((IStructuredSelection) selection).iterator(); it
+ .hasNext();) {
+ Object element = it.next();
+ IProject project = null;
+ if (element instanceof IProject) {
+ project = (IProject) element;
+ } else if (element instanceof IAdaptable) {
+ project = (IProject) ((IAdaptable) element)
+ .getAdapter(IProject.class);
+ }
+ if (project != null) {
+ toggleNature(project, !hasCodanNature(project));
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
+ * .IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
+ * action.IAction, org.eclipse.ui.IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ public boolean hasCodanNature(IProject project) {
+ IProjectDescription description;
+ try {
+ description = project.getDescription();
+ String[] natures = description.getNatureIds();
+ for (int i = 0; i < natures.length; ++i) {
+ if (CodanCorePlugin.NATURE_ID.equals(natures[i])) {
+ return true;
+ }
+ }
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ /**
+ * Toggles sample nature on a project
+ *
+ * @param project
+ * to have sample nature added or removed
+ */
+ public void toggleNature(IProject project, boolean add) {
+ try {
+ IProjectDescription description = project.getDescription();
+ String[] natures = description.getNatureIds();
+ for (int i = 0; i < natures.length; ++i) {
+ if (CodanCorePlugin.NATURE_ID.equals(natures[i])) {
+ if (add == false) {
+ // Remove the nature
+ String[] newNatures = new String[natures.length - 1];
+ System.arraycopy(natures, 0, newNatures, 0, i);
+ System.arraycopy(natures, i + 1, newNatures, i,
+ natures.length - i - 1);
+ description.setNatureIds(newNatures);
+ project.setDescription(description, null);
+ return;
+ } else {
+ // already there no need to add
+ add = false;
+ break;
+ }
+ }
+ }
+ if (add) {
+ // Add the nature
+ String[] newNatures = new String[natures.length + 1];
+ System.arraycopy(natures, 0, newNatures, 0, natures.length);
+ newNatures[natures.length] = CodanCorePlugin.NATURE_ID;
+ description.setNatureIds(newNatures);
+ project.setDescription(description, null);
+ }
+ } catch (CoreException e) {
+ }
+ }
+}