diff options
author | Elliott Baron <ebaron@fedoraproject.org> | 2009-08-25 21:01:56 -0400 |
---|---|---|
committer | Elliott Baron <ebaron@fedoraproject.org> | 2009-08-25 21:01:56 -0400 |
commit | 0c290ae7eabb8cb32e1eb28f55cceb9e6350d596 (patch) | |
tree | ca8dda9f30ed2be55b5f06cbf59c3d29e82a8832 /org.eclipse.cdt.codan.ui | |
download | codan-0c290ae7eabb8cb32e1eb28f55cceb9e6350d596.tar.gz codan-0c290ae7eabb8cb32e1eb28f55cceb9e6350d596.tar.xz codan-0c290ae7eabb8cb32e1eb28f55cceb9e6350d596.zip |
Initial commit: New file.
* .gitignore: New file.
* org.eclipse.cdt.codan.checkers.ui/.classpath: New file.
* org.eclipse.cdt.codan.checkers.ui/.project: New file.
* org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/.settings/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/.settings/org.eclipse.jdt.core.prefs: New file.
* org.eclipse.cdt.codan.checkers.ui/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/CVS/Template: New file.
* org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/META-INF/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/META-INF/MANIFEST.MF: New file.
* org.eclipse.cdt.codan.checkers.ui/build.properties: New file.
* org.eclipse.cdt.codan.checkers.ui/plugin.xml: New file.
* org.eclipse.cdt.codan.checkers.ui/src/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/src/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/src/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/CheckersUiActivator.java: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/CodanProblemMarkerResolutionGenerator.java: New file.
* org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/checkers/ui/quickfix/QuickFixAssignmentInCondition.java: New file.
* org.eclipse.cdt.codan.checkers/.classpath: New file.
* org.eclipse.cdt.codan.checkers/.project: New file.
* org.eclipse.cdt.codan.checkers/.settings/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/.settings/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/.settings/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/.settings/org.eclipse.jdt.core.prefs: New file.
* org.eclipse.cdt.codan.checkers/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/CVS/Template: New file.
* org.eclipse.cdt.codan.checkers/META-INF/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/META-INF/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/META-INF/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/META-INF/MANIFEST.MF: New file.
* org.eclipse.cdt.codan.checkers/build.properties: New file.
* org.eclipse.cdt.codan.checkers/plugin.xml: New file.
* org.eclipse.cdt.codan.checkers/src/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/src/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/src/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/src/org/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/src/org/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/src/org/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/Activator.java: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CloseOpenedFilesChecker.java: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/AssignmentInConditionChecker.java: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Entries: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Repository: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/CVS/Root: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/NonVirtualDestructor.java: New file.
* org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/sample/StatementHasNoEffectChecker.java: New file.
* org.eclipse.cdt.codan.core/.classpath: New file.
* org.eclipse.cdt.codan.core/.project: New file.
* org.eclipse.cdt.codan.core/.settings/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/.settings/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/.settings/CVS/Root: New file.
* org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs: New file.
* org.eclipse.cdt.codan.core/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/CVS/Root: New file.
* org.eclipse.cdt.codan.core/CVS/Template: New file.
* org.eclipse.cdt.codan.core/META-INF/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/META-INF/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/META-INF/CVS/Root: New file.
* org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF: New file.
* org.eclipse.cdt.codan.core/build.properties: New file.
* org.eclipse.cdt.codan.core/plugin.xml: New file.
* org.eclipse.cdt.codan.core/schema/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/schema/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/schema/CVS/Root: New file.
* org.eclipse.cdt.codan.core/schema/checkers.exsd: New file.
* org.eclipse.cdt.codan.core/src/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/org/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/org/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanApplication.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanCorePlugin.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanPreferencesLoader.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/CodanRuntime.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractIndexAstChecker.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanSeverity.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICAstChecker.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IChecker.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICheckersRegistry.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanAstReconciler.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ICodanBuilder.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblem.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemCategory.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemElement.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemReporter.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemLocation.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfile.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodeAnlysisNature.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Repository: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Root: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java: New file.
* org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java: New file.
* org.eclipse.cdt.codan.ui/.classpath: New file.
* org.eclipse.cdt.codan.ui/.project: New file.
* org.eclipse.cdt.codan.ui/.settings/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/.settings/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/.settings/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs: New file.
* org.eclipse.cdt.codan.ui/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/CVS/Template: New file.
* org.eclipse.cdt.codan.ui/META-INF/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/META-INF/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/META-INF/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF: New file.
* org.eclipse.cdt.codan.ui/build.properties: New file.
* org.eclipse.cdt.codan.ui/plugin.xml: New file.
* org.eclipse.cdt.codan.ui/src/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/org/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/org/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CheckedTreeEditor.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FieldEditorOverlayPage.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.properties: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/PreferenceInitializer.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Activator.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanCReconciler.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Startup.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Entries: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Repository: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/RunCodeAnalysis.java: New file.
* org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/ToggleNatureAction.java: New file.
Diffstat (limited to 'org.eclipse.cdt.codan.ui')
59 files changed, 1923 insertions, 0 deletions
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) { + } + } +} |