summaryrefslogtreecommitdiffstats
path: root/org.eclipse.cdt.codan.ui
diff options
context:
space:
mode:
authorElliott Baron <ebaron@fedoraproject.org>2010-06-26 22:27:34 -0400
committerElliott Baron <ebaron@fedoraproject.org>2010-06-26 22:27:34 -0400
commit4e112eca7750a4f530c986be55c178c43c16d3ea (patch)
treedb140c4fe4db9945502398e4869707ca0346353e /org.eclipse.cdt.codan.ui
parentaa73b3f2503808e4b4029a73368a75b258d6f0dc (diff)
downloadcodan-4e112eca7750a4f530c986be55c178c43c16d3ea.tar.gz
codan-4e112eca7750a4f530c986be55c178c43c16d3ea.tar.xz
codan-4e112eca7750a4f530c986be55c178c43c16d3ea.zip
Update codan plugins to CDT 7.0.HEADmaster
* org.eclipse.cdt.codan.checkers.ui: Updated. * org.eclipse.cdt.codan.checkers: Updated. * org.eclipse.cdt.codan.core: Updated. * org.eclipse.cdt.codan.ui: Updated. * org.eclipse.cdt.codan.core.cxx: Added. * org.eclipse.cdt.codan.extension/META-INF/MANIFEST.MF: Import org.eclipse.cdt.codan.core.cxx.model. * org.eclipse.cdt.codan.extension/src/org/eclipse/cdt/codan/extension/checkers/AbstractPropSimChecker.java: Superclass moved.
Diffstat (limited to 'org.eclipse.cdt.codan.ui')
-rw-r--r--org.eclipse.cdt.codan.ui/.project6
-rw-r--r--org.eclipse.cdt.codan.ui/.settings/.api_filters12
-rw-r--r--org.eclipse.cdt.codan.ui/.settings/CVS/Entries4
-rw-r--r--org.eclipse.cdt.codan.ui/.settings/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs65
-rw-r--r--org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.ui.prefs55
-rw-r--r--org.eclipse.cdt.codan.ui/CVS/Entries12
-rw-r--r--org.eclipse.cdt.codan.ui/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/META-INF/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.ui/META-INF/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF28
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Root (renamed from org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root)0
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Template (renamed from org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Template)0
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Template (renamed from org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Template)0
-rw-r--r--org.eclipse.cdt.codan.ui/OSGI-INF/l10n/bundle.properties22
-rw-r--r--org.eclipse.cdt.codan.ui/about.html24
-rw-r--r--org.eclipse.cdt.codan.ui/build.properties16
-rw-r--r--org.eclipse.cdt.codan.ui/icons/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/icons/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/icons/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/icons/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/icons/problemDetails.gifbin0 -> 910 bytes
-rw-r--r--org.eclipse.cdt.codan.ui/plugin.xml103
-rw-r--r--org.eclipse.cdt.codan.ui/schema/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.ui/schema/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/schema/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/schema/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/schema/codanMarkerResolution.exsd132
-rw-r--r--org.eclipse.cdt.codan.ui/schema/codanProblemDetails.exsd127
-rw-r--r--org.eclipse.cdt.codan.ui/src/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Entries8
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java145
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIActivator.java (renamed from org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Activator.java)48
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.java85
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Template0
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/RunCodeAnalysis.java (renamed from org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/RunCodeAnalysis.java)7
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/ToggleNatureAction.java (renamed from org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/ToggleNatureAction.java)18
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Template0
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CustomizeProblemDialog.java87
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/ExclusionInclusionEntryDialog.java284
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/messages.properties85
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java45
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Entries15
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CheckedTreeEditor.java5
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java210
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FieldEditorOverlayPage.java34
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FileScopePreferencePage.java312
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.java47
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.properties4
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/PreferenceInitializer.java13
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/ProblemsTreeEditor.java100
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Entries3
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/GenericCodanProblemDetailsProvider.java23
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetails.java169
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetailsExtensions.java138
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/BasicElementLabels.java157
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Entries4
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Repository1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CustomizeProblemComposite.java86
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/FileScopeComposite.java100
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/ParametersComposite.java261
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstarctCodanCMarkerResolution.java91
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanProblemDetailsProvider.java114
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Entries8
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanCReconciler.java71
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanEditorUtility.java111
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Startup.java93
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Entries2
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Entries1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Repository (renamed from org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Repository)2
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Root1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/RunCodanCommand.java37
101 files changed, 3302 insertions, 375 deletions
diff --git a/org.eclipse.cdt.codan.ui/.project b/org.eclipse.cdt.codan.ui/.project
index 1a97756..f51fbc8 100644
--- a/org.eclipse.cdt.codan.ui/.project
+++ b/org.eclipse.cdt.codan.ui/.project
@@ -20,9 +20,15 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>
diff --git a/org.eclipse.cdt.codan.ui/.settings/.api_filters b/org.eclipse.cdt.codan.ui/.settings/.api_filters
new file mode 100644
index 0000000..2d910f4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/.settings/.api_filters
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.cdt.codan.ui" version="2">
+ <resource path="src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java" type="org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage">
+ <filter id="640712815">
+ <message_arguments>
+ <message_argument value="ICheckersRegistry"/>
+ <message_argument value="CodanPreferencePage"/>
+ <message_argument value="updateProfile(IResource, IProblemProfile)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/org.eclipse.cdt.codan.ui/.settings/CVS/Entries b/org.eclipse.cdt.codan.ui/.settings/CVS/Entries
index e7a8ed5..f5857d6 100644
--- a/org.eclipse.cdt.codan.ui/.settings/CVS/Entries
+++ b/org.eclipse.cdt.codan.ui/.settings/CVS/Entries
@@ -1 +1,3 @@
-/org.eclipse.jdt.core.prefs/1.1/Thu Apr 9 12:47:54 2009//
+/.api_filters/1.1/Mon Mar 8 19:51:30 2010//TCDT_7_0_0
+/org.eclipse.jdt.core.prefs/1.2/Wed Mar 24 03:31:59 2010//TCDT_7_0_0
+/org.eclipse.jdt.ui.prefs/1.1/Sun May 16 02:17:54 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/.settings/CVS/Tag b/org.eclipse.cdt.codan.ui/.settings/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/.settings/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
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
index 57703d3..f7e128a 100644
--- a/org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,71 @@
-#Fri Apr 03 21:34:42 EDT 2009
+#Thu Mar 18 10:02:29 EDT 2010
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.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
diff --git a/org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..62d3d7e
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,55 @@
+#Sat May 15 20:01:30 EDT 2010
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.cdt.codan.ui/CVS/Entries b/org.eclipse.cdt.codan.ui/CVS/Entries
index f361049..af40da4 100644
--- a/org.eclipse.cdt.codan.ui/CVS/Entries
+++ b/org.eclipse.cdt.codan.ui/CVS/Entries
@@ -1,7 +1,11 @@
-/.classpath/1.1/Thu Apr 9 12:47:54 2009//
-/.project/1.1/Thu Apr 9 12:47:54 2009//
+/.classpath/1.1/Thu Apr 9 12:47:54 2009//TCDT_7_0_0
+/.project/1.2/Wed Mar 24 03:31:59 2010//TCDT_7_0_0
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/OSGI-INF////
+/about.html/1.1/Mon Jun 14 18:35:43 2010//TCDT_7_0_0
+/build.properties/1.7/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+D/icons////
+/plugin.xml/1.14/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+D/schema////
D/src////
diff --git a/org.eclipse.cdt.codan.ui/CVS/Tag b/org.eclipse.cdt.codan.ui/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/META-INF/CVS/Entries b/org.eclipse.cdt.codan.ui/META-INF/CVS/Entries
index a9833bb..0f1fcea 100644
--- a/org.eclipse.cdt.codan.ui/META-INF/CVS/Entries
+++ b/org.eclipse.cdt.codan.ui/META-INF/CVS/Entries
@@ -1 +1 @@
-/MANIFEST.MF/1.2/Fri Apr 24 12:49:44 2009//
+/MANIFEST.MF/1.12/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/META-INF/CVS/Tag b/org.eclipse.cdt.codan.ui/META-INF/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/META-INF/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF b/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF
index 9d5357d..7192ca6 100644
--- a/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF
@@ -1,18 +1,28 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Code Analyzers Framework
+Bundle-Name: %Bundle-Name
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
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.cdt.codan.internal.ui.CodanUIActivator
+Bundle-Vendor: %Bundle-Vendor
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"
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.ui.editors,
+ org.eclipse.cdt.codan.core,
+ org.eclipse.jface.text,
+ org.eclipse.ui.ide,
+ org.eclipse.cdt.ui,
+ org.eclipse.cdt.core
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.cdt.codan.internal.ui;x-friends:="org.eclipse.cdt.codan.ui.cxx",
+ org.eclipse.cdt.codan.internal.ui.actions;x-friends:="org.eclipse.cdt.codan.ui.cxx",
+ org.eclipse.cdt.codan.internal.ui.dialogs;x-friends:="org.eclipse.cdt.codan.ui.cxx",
+ org.eclipse.cdt.codan.internal.ui.preferences;x-friends:="org.eclipse.cdt.codan.ui.cxx",
+ org.eclipse.cdt.codan.internal.ui.views;x-internal:=true,
+ org.eclipse.cdt.codan.internal.ui.widgets;x-internal:=true,
+ org.eclipse.cdt.codan.ui,
+ org.eclipse.cdt.codan.ui.handlers
diff --git a/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Entries b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Entries
new file mode 100644
index 0000000..2928641
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Entries
@@ -0,0 +1 @@
+D/l10n////
diff --git a/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Repository b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Repository
new file mode 100644
index 0000000..4afee4d
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/OSGI-INF
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Root
index 04efa23..04efa23 100644
--- a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Root
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Root
diff --git a/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Tag b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Tag
new file mode 100644
index 0000000..3cd1ca4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Tag
@@ -0,0 +1 @@
+TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Template b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Template
index e69de29..e69de29 100644
--- a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Template
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/CVS/Template
diff --git a/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Entries b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Entries
new file mode 100644
index 0000000..81f8f25
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Entries
@@ -0,0 +1 @@
+/bundle.properties/1.7/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Repository b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Repository
new file mode 100644
index 0000000..31447ef
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/OSGI-INF/l10n
diff --git a/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Root b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Tag b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Template b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Template
index e69de29..e69de29 100644
--- a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Template
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/CVS/Template
diff --git a/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/bundle.properties b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..4b8f443
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2010 Alena Laskavaia 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:
+# Alena Laskavaia - initial API and implementation
+###############################################################################
+#Properties file for org.eclipse.cdt.codan.ui
+Bundle-Vendor = Eclipse CDT
+Bundle-Name = Code Analysis UI
+CodeAnalysisAction.label = Run Code Analysis
+CodeAnalysisProperties.name = Code Analysis
+CodeAnalysisPreferences.name = Code Analysis
+CodeAnalysisPreferencesBuild.name = Launching
+category.name = Code Analysis
+command.name = Run Code Analysis
+view.name = Problem Details
+extension-point.name = Codan Problem Details
+extension-point.name.codamMarkerResolution = Codan Marker Resolution \ No newline at end of file
diff --git a/org.eclipse.cdt.codan.ui/about.html b/org.eclipse.cdt.codan.ui/about.html
new file mode 100644
index 0000000..d7c5118
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/about.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
+
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 22, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.cdt.codan.ui/build.properties b/org.eclipse.cdt.codan.ui/build.properties
index 2b0d95b..07b5ba9 100644
--- a/org.eclipse.cdt.codan.ui/build.properties
+++ b/org.eclipse.cdt.codan.ui/build.properties
@@ -1,5 +1,19 @@
+###############################################################################
+# Copyright (c) 2009, 2010 Alena Laskavaia 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:
+# Alena Laskavaia - initial API and implementation
+###############################################################################
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
- .
+ .,\
+ OSGI-INF/l10n/bundle.properties,\
+ schema/,\
+ icons/,\
+ about.html
diff --git a/org.eclipse.cdt.codan.ui/icons/CVS/Entries b/org.eclipse.cdt.codan.ui/icons/CVS/Entries
new file mode 100644
index 0000000..4b4fbf7
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/icons/CVS/Entries
@@ -0,0 +1 @@
+/problemDetails.gif/1.2/Thu Apr 29 01:49:24 2010/-kb/TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/icons/CVS/Repository b/org.eclipse.cdt.codan.ui/icons/CVS/Repository
new file mode 100644
index 0000000..0176656
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/icons/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/icons
diff --git a/org.eclipse.cdt.codan.ui/icons/CVS/Root b/org.eclipse.cdt.codan.ui/icons/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/icons/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/icons/CVS/Tag b/org.eclipse.cdt.codan.ui/icons/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/icons/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/icons/problemDetails.gif b/org.eclipse.cdt.codan.ui/icons/problemDetails.gif
new file mode 100644
index 0000000..22f1318
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/icons/problemDetails.gif
Binary files differ
diff --git a/org.eclipse.cdt.codan.ui/plugin.xml b/org.eclipse.cdt.codan.ui/plugin.xml
index eff5ea6..c1284b7 100644
--- a/org.eclipse.cdt.codan.ui/plugin.xml
+++ b/org.eclipse.cdt.codan.ui/plugin.xml
@@ -3,54 +3,45 @@
<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
+ point="org.eclipse.ui.commands">
+ <category
+ id="org.eclipse.cdt.codan.ui.commands.category"
+ name="%category.name">
+ </category>
+
</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">
+ name="%CodeAnalysisProperties.name">
</page>
</extension>
<extension
point="org.eclipse.ui.propertyPages">
<page
- name="C/C++ Code Analysis "
-
+ category="org.eclipse.cdt.ui.newui.Page_head_general"
class="org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage"
- id="org.eclipse.cdt.codan.ui.properties.codanProblemsPropertyPage">
+ id="org.eclipse.cdt.codan.ui.properties.codanProblemsPropertyPage"
+ name="%CodeAnalysisPreferences.name">
<enabledWhen>
- <instanceof
- value="org.eclipse.core.resources.IProject">
- </instanceof>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
+ </adapt>
</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">
+ name="%CodeAnalysisPreferencesBuild.name">
<enabledWhen>
- <instanceof
- value="org.eclipse.core.resources.IProject">
- </instanceof>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
+ </adapt>
</enabledWhen>
</page>
</extension>
@@ -62,9 +53,61 @@
class="org.eclipse.cdt.codan.internal.ui.preferences.PreferenceInitializer">
</initializer>
</extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.cdt.codan.ui.commands.category"
+ id="org.eclipse.cdt.codan.commands.runCodanCommand"
+ name="%command.name">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.cdt.codan.ui.handlers.RunCodanCommand"
+ commandId="org.eclipse.cdt.codan.commands.runCodanCommand">
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.eclipse.cdt.ui.views"
+ class="org.eclipse.cdt.codan.internal.ui.views.ProblemDetails"
+ icon="icons/problemDetails.gif"
+ id="org.eclipse.cdt.codan.internal.ui.views.ProblemDetails"
+ name="%view.name">
+ </view>
+ </extension>
+ <extension-point id="codanProblemDetails" name="%extension-point.name" schema="schema/codanProblemDetails.exsd"/>
+ <extension-point id="codanMarkerResolution" name="%extension-point.name.codamMarkerResolution" schema="schema/codanMarkerResolution.exsd"/>
+ <!--
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.cdt.codan.commands.runCodanCommand"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+F9">
+ </key>
+ </extension>
+ -->
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.eclipse.cdt.ui.CPerspective">
+
+ <showInPart id="org.eclipse.cdt.codan.internal.ui.views.ProblemDetails"/>
+
+ <viewShortcut id="org.eclipse.cdt.codan.internal.ui.views.ProblemDetails"/>
+ </perspectiveExtension>
+ </extension>
+
<extension
- point="org.eclipse.ui.startup">
- <startup
- class="org.eclipse.cdt.codan.ui.Startup"></startup>
+ point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ class="org.eclipse.cdt.codan.internal.ui.CodanProblemMarkerResolutionGenerator"
+ markerType="org.eclipse.cdt.codan.core.codanProblem">
+ </markerResolutionGenerator>
</extension>
</plugin>
diff --git a/org.eclipse.cdt.codan.ui/schema/CVS/Entries b/org.eclipse.cdt.codan.ui/schema/CVS/Entries
new file mode 100644
index 0000000..2d2de75
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/schema/CVS/Entries
@@ -0,0 +1,2 @@
+/codanMarkerResolution.exsd/1.1/Sun May 2 01:47:10 2010//TCDT_7_0_0
+/codanProblemDetails.exsd/1.2/Thu Apr 29 16:34:18 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/schema/CVS/Repository b/org.eclipse.cdt.codan.ui/schema/CVS/Repository
new file mode 100644
index 0000000..aae173a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/schema/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/schema
diff --git a/org.eclipse.cdt.codan.ui/schema/CVS/Root b/org.eclipse.cdt.codan.ui/schema/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/schema/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@dev.eclipse.org:/cvsroot/tools
diff --git a/org.eclipse.cdt.codan.ui/schema/CVS/Tag b/org.eclipse.cdt.codan.ui/schema/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/schema/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/schema/codanMarkerResolution.exsd b/org.eclipse.cdt.codan.ui/schema/codanMarkerResolution.exsd
new file mode 100644
index 0000000..4cdbf23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/schema/codanMarkerResolution.exsd
@@ -0,0 +1,132 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.codan.checkers.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.cdt.codan.checkers.ui" id="codanMarkerResolution" name="Codan Marker Resolution"/>
+ </appinfo>
+ <documentation>
+ Extension point to plugin quick fix for codan markers
+
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="resolution"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="resolution">
+ <annotation>
+ <documentation>
+ Contribute codan marker resolution
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Class that implement IMarkerResolution that provides a fix for the given problem
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.ui.IMarkerResolution"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="problemId" type="string" use="required">
+ <annotation>
+ <documentation>
+ Problem id of the problem for which quick fix is defined
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.cdt.codan.core.checkers/checker/problem/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="messagePattern" type="string">
+ <annotation>
+ <documentation>
+ If problem id is not enought to identity the fix messagePattern can be used to apply fix for given message
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ since 1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ &lt;extension
+ point=&quot;org.eclipse.cdt.codan.checkers.ui.codanMarkerResolution&quot;&gt;
+ &lt;resolution
+ class=&quot;org.eclipse.cdt.codan.internal.checkers.ui.quickfix.CatchByReferenceQuickFix&quot;
+ problemId=&quot;org.eclipse.cdt.codan.internal.checkers.CatchByReference&quot;&gt;
+ &lt;/resolution&gt;
+ &lt;/extension&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ Programmatically resolution can be added using CatchByReferenceQuickFix.addResolution method.
+It is not API yet.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ see CatchByReferenceQuickFix
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.cdt.codan.ui/schema/codanProblemDetails.exsd b/org.eclipse.cdt.codan.ui/schema/codanProblemDetails.exsd
new file mode 100644
index 0000000..87f6b94
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/schema/codanProblemDetails.exsd
@@ -0,0 +1,127 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.codan.checkers.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.cdt.codan.checkers.ui" id="codanProblemDetails" name="Codan Problem Details"/>
+ </appinfo>
+ <documentation>
+ This extension point provides a mechanism to add extra details for a problem, which would
+be displayed in Problem Details view. It can include extra locations, associated problems,
+help link or extenal link.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="problemDetails" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="problemDetails">
+ <annotation>
+ <documentation>
+ root element for extension.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="problemId" type="string">
+ <annotation>
+ <documentation>
+ Problem id for which extra details available.
+If ommitted provider would be called for all problem kinds.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.cdt.codan.core.checkers/checker/problem/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ &lt;extension
+ point=&quot;org.eclipse.cdt.codan.ui.codanProblemDetails&quot;&gt;
+ &lt;problemDetails
+ class=&quot;org.eclipse.cdt.codan.examples.uicontrib.FlexlintHelpLink&quot;
+ &gt;
+ &lt;/problemDetails&gt;
+ &lt;/extension&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ See
+org.eclipse.cdt.codan.examples.uicontrib.FlexlintHelpLink
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.cdt.codan.ui/src/CVS/Tag b/org.eclipse.cdt.codan.ui/src/CVS/Tag
new file mode 100644
index 0000000..3cd1ca4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/CVS/Tag
@@ -0,0 +1 @@
+TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/CVS/Tag
new file mode 100644
index 0000000..3cd1ca4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/CVS/Tag
@@ -0,0 +1 @@
+TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Tag
new file mode 100644
index 0000000..3cd1ca4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/CVS/Tag
@@ -0,0 +1 @@
+TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Tag
new file mode 100644
index 0000000..3cd1ca4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/CVS/Tag
@@ -0,0 +1 @@
+TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Tag
new file mode 100644
index 0000000..3cd1ca4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/CVS/Tag
@@ -0,0 +1 @@
+TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Tag
new file mode 100644
index 0000000..3cd1ca4
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/CVS/Tag
@@ -0,0 +1 @@
+TCDT_7_0_0
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
index f769284..089fc52 100644
--- 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
@@ -1 +1,9 @@
+/CodanProblemMarkerResolutionGenerator.java/1.3/Thu Jun 3 17:01:39 2010//TCDT_7_0_0
+/CodanUIActivator.java/1.4/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+/CodanUIMessages.java/1.5/Mon May 24 15:05:36 2010//TCDT_7_0_0
+D/actions////
+D/dialogs////
+/messages.properties/1.8/Thu Jun 3 17:01:39 2010//TCDT_7_0_0
D/preferences////
+D/views////
+D/widgets////
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java
new file mode 100644
index 0000000..690f87b
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Andrew Gvozdev
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.internal.ui;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.eclipse.cdt.codan.ui.AbstarctCodanCMarkerResolution;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolutionGenerator;
+
+public class CodanProblemMarkerResolutionGenerator implements
+ IMarkerResolutionGenerator {
+ private static final String EXTENSION_POINT_NAME = "codanMarkerResolution"; //$NON-NLS-1$
+ private static Map<String, Collection<ConditionalResolution>> resolutions = new HashMap<String, Collection<ConditionalResolution>>();
+ private static boolean resolutionsLoaded = false;
+
+ static class ConditionalResolution {
+ IMarkerResolution res;
+ String messagePattern;
+
+ public ConditionalResolution(IMarkerResolution res2,
+ String messagePattern2) {
+ res = res2;
+ messagePattern = messagePattern2;
+ }
+ }
+
+ public IMarkerResolution[] getResolutions(IMarker marker) {
+ if (resolutionsLoaded == false) {
+ readExtensions();
+ }
+ String id = marker.getAttribute(IMarker.PROBLEM, null);
+ if (id == null)
+ return new IMarkerResolution[0];
+ String message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
+ Collection<ConditionalResolution> collection = resolutions.get(id);
+ if (collection != null) {
+ ArrayList<IMarkerResolution> list = new ArrayList<IMarkerResolution>();
+ for (Iterator<ConditionalResolution> iterator = collection
+ .iterator(); iterator.hasNext();) {
+ ConditionalResolution res = iterator.next();
+ if (res.messagePattern != null) {
+ if (!message.matches(res.messagePattern))
+ continue;
+ }
+ if (res.res instanceof AbstarctCodanCMarkerResolution) {
+ if (!((AbstarctCodanCMarkerResolution)res.res).isApplicable(marker))
+ continue;
+ }
+ list.add(res.res);
+ }
+ if (list.size() > 0)
+ return list.toArray(new IMarkerResolution[list.size()]);
+ }
+ return new IMarkerResolution[0];
+ }
+
+ private static synchronized void readExtensions() {
+ IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(
+ CodanUIActivator.PLUGIN_ID, EXTENSION_POINT_NAME);
+ if (ep == null)
+ return;
+ try {
+ IConfigurationElement[] elements = ep.getConfigurationElements();
+ // process categories
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement configurationElement = elements[i];
+ processResolution(configurationElement);
+ }
+ } finally {
+ resolutionsLoaded = true;
+ }
+ }
+
+ /**
+ * @param configurationElement
+ */
+ private static void processResolution(
+ IConfigurationElement configurationElement) {
+ if (configurationElement.getName().equals("resolution")) { //$NON-NLS-1$
+ String id = configurationElement.getAttribute("problemId"); //$NON-NLS-1$
+ if (id == null) {
+ CodanUIActivator.log("Extension for " + EXTENSION_POINT_NAME //$NON-NLS-1$
+ + " problemId is not defined"); //$NON-NLS-1$
+ return;
+ }
+ IMarkerResolution res;
+ try {
+ res = (IMarkerResolution) configurationElement
+ .createExecutableExtension("class");//$NON-NLS-1$
+ } catch (CoreException e) {
+ CodanUIActivator.log(e);
+ return;
+ }
+ String messagePattern = configurationElement
+ .getAttribute("messagePattern"); //$NON-NLS-1$
+ if (messagePattern != null) {
+ try {
+ Pattern.compile(messagePattern);
+ } catch (Exception e) {
+ // bad pattern log and ignore
+ CodanUIActivator.log("Extension for " //$NON-NLS-1$
+ + EXTENSION_POINT_NAME
+ + " messagePattern is invalid: " + e.getMessage()); //$NON-NLS-1$
+ return;
+ }
+ }
+ ConditionalResolution co = new ConditionalResolution(res,
+ messagePattern);
+ addResolution(id, co);
+ }
+ }
+
+ public static void addResolution(String id, IMarkerResolution res,
+ String messagePattern) {
+ addResolution(id, new ConditionalResolution(res, messagePattern));
+ }
+
+ private static void addResolution(String id, ConditionalResolution res) {
+ Collection<ConditionalResolution> collection = resolutions.get(id);
+ if (collection == null) {
+ collection = new ArrayList<ConditionalResolution>();
+ resolutions.put(id, collection);
+ }
+ collection.add(res);
+ }
+} \ No newline at end of file
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/internal/ui/CodanUIActivator.java
index 849993a..e530269 100644
--- 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/internal/ui/CodanUIActivator.java
@@ -1,24 +1,42 @@
-package org.eclipse.cdt.codan.ui;
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class Activator extends AbstractUIPlugin {
+public class CodanUIActivator extends AbstractUIPlugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.cdt.codan.ui";
+ public static final String PLUGIN_ID = "org.eclipse.cdt.codan.ui"; //$NON-NLS-1$
// The shared instance
- private static Activator plugin;
+ private static CodanUIActivator plugin;
+ private IPreferenceStore preferenceCoreStore;
/**
* The constructor
*/
- public Activator() {
+ public CodanUIActivator() {
}
/*
@@ -50,7 +68,7 @@ public class Activator extends AbstractUIPlugin {
*
* @return the shared instance
*/
- public static Activator getDefault() {
+ public static CodanUIActivator getDefault() {
return plugin;
}
@@ -95,4 +113,22 @@ public class Activator extends AbstractUIPlugin {
public static void log(String message) {
log(new Status(IStatus.ERROR, PLUGIN_ID, 1, message, null));
}
+
+ /**
+ * @return
+ */
+ public IPreferenceStore getCorePreferenceStore() {
+ if (preferenceCoreStore == null) {
+ preferenceCoreStore = new ScopedPreferenceStore(
+ new InstanceScope(), CodanCorePlugin.PLUGIN_ID);
+ }
+ return preferenceCoreStore;
+ }
+
+ public IPreferenceStore getPreferenceStore(IProject project) {
+ ProjectScope ps = new ProjectScope(project);
+ ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, PLUGIN_ID);
+ scoped.setSearchContexts(new IScopeContext[] { ps, new InstanceScope() });
+ return scoped;
+ }
}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.java
new file mode 100644
index 0000000..5b3134e
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanUIMessages.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2009,2010 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;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Externalized messages
+ */
+public class CodanUIMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.codan.internal.ui.messages"; //$NON-NLS-1$
+ public static String BuildPropertyPage_RunAsYouType;
+ public static String BuildPropertyPage_RunWithBuild;
+ public static String CheckedTreeEditor_SelectionCannotBeEmpty;
+ public static String CodanPreferencePage_Customize;
+ public static String CodanPreferencePage_Description;
+ public static String CodanPreferencePage_HasPreferences;
+ public static String CodanPreferencePage_Info;
+ public static String CodanPreferencePage_MessageLabel;
+ public static String CodanPreferencePage_NoInfo;
+ public static String CodanPreferencePage_Parameters;
+ public static String ProblemsTreeEditor_NameColumn;
+ public static String ProblemsTreeEditor_Problems;
+ public static String ProblemsTreeEditor_SeverityColumn;
+ public static String OverlayPage_Use_Workspace_Settings;
+ public static String OverlayPage_Use_Project_Settings;
+ public static String OverlayPage_Configure_Workspace_Settings;
+ public static String PropertyStore_Cannot_write_resource_property;
+ public static String CustomizeProblemComposite_TabParameters;
+ public static String CustomizeProblemComposite_TabScope;
+ public static String CustomizeProblemDialog_Message;
+ public static String CustomizeProblemDialog_Title;
+ public static String Job_TitleRunningAnalysis;
+ public static String ParametersComposite_NewValue;
+ public static String ParametersComposite_None;
+ //
+ public static String ExclusionInclusionDialog_title;
+ public static String ExclusionInclusionDialog_description;
+ public static String ExclusionInclusionDialog_description2;
+ public static String ExclusionInclusionDialog_exclusion_pattern_label;
+ public static String ExclusionInclusionDialog_inclusion_pattern_label;
+ public static String ExclusionInclusionDialog_inclusion_pattern_add;
+ public static String ExclusionInclusionDialog_inclusion_pattern_add_multiple;
+ public static String ExclusionInclusionDialog_inclusion_pattern_remove;
+ public static String ExclusionInclusionDialog_inclusion_pattern_edit;
+ public static String ExclusionInclusionDialog_exclusion_pattern_add;
+ public static String ExclusionInclusionDialog_exclusion_pattern_add_multiple;
+ public static String ExclusionInclusionDialog_exclusion_pattern_remove;
+ public static String ExclusionInclusionDialog_exclusion_pattern_edit;
+ public static String ExclusionInclusionDialog_ChooseExclusionPattern_title;
+ public static String ExclusionInclusionDialog_ChooseExclusionPattern_description;
+ public static String ExclusionInclusionDialog_ChooseInclusionPattern_title;
+ public static String ExclusionInclusionDialog_ChooseInclusionPattern_description;
+ public static String ExclusionInclusionEntryDialog_exclude_add_title;
+ public static String ExclusionInclusionEntryDialog_exclude_edit_title;
+ public static String ExclusionInclusionEntryDialog_exclude_description;
+ public static String ExclusionInclusionEntryDialog_exclude_pattern_label;
+ public static String ExclusionInclusionEntryDialog_include_add_title;
+ public static String ExclusionInclusionEntryDialog_include_edit_title;
+ public static String ExclusionInclusionEntryDialog_include_description;
+ public static String ExclusionInclusionEntryDialog_include_pattern_label;
+ public static String ExclusionInclusionEntryDialog_pattern_button;
+ public static String ExclusionInclusionEntryDialog_error_empty;
+ public static String ExclusionInclusionEntryDialog_error_notrelative;
+ public static String ExclusionInclusionEntryDialog_error_exists;
+ public static String ExclusionInclusionEntryDialog_ChooseExclusionPattern_title;
+ public static String ExclusionInclusionEntryDialog_ChooseExclusionPattern_description;
+ public static String ExclusionInclusionEntryDialog_ChooseInclusionPattern_title;
+ public static String ExclusionInclusionEntryDialog_ChooseInclusionPattern_description;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, CodanUIMessages.class);
+ }
+
+ private CodanUIMessages() {
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Entries
new file mode 100644
index 0000000..a8f550a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Entries
@@ -0,0 +1,2 @@
+/RunCodeAnalysis.java/1.4/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+/ToggleNatureAction.java/1.2/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Repository
new file mode 100644
index 0000000..6f71b9e
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/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/internal/ui/actions/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Template b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Template
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/CVS/Template
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/internal/ui/actions/RunCodeAnalysis.java
index 01d7c25..3d1198b 100644
--- 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/internal/ui/actions/RunCodeAnalysis.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Alena Laskavaia
+ * Copyright (c) 2009, 2010 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
@@ -8,11 +8,12 @@
* Contributors:
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.codan.ui.actions;
+package org.eclipse.cdt.codan.internal.ui.actions;
import java.util.Iterator;
import org.eclipse.cdt.codan.core.CodanRuntime;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -33,7 +34,7 @@ public class RunCodeAnalysis implements IObjectActionDelegate {
}
public void run(IAction action) {
- Job job = new Job("Running Code Analysis") {
+ Job job = new Job(CodanUIMessages.Job_TitleRunningAnalysis) {
@SuppressWarnings("unchecked")
@Override
protected IStatus run(final IProgressMonitor monitor) {
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/internal/ui/actions/ToggleNatureAction.java
index 3993621..94c51f0 100644
--- 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/internal/ui/actions/ToggleNatureAction.java
@@ -8,11 +8,12 @@
* Contributors:
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.codan.ui.actions;
+package org.eclipse.cdt.codan.internal.ui.actions;
import java.util.Iterator;
import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
@@ -82,17 +83,16 @@ public class ToggleNatureAction implements IObjectActionDelegate {
}
}
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ CodanUIActivator.log(e);
}
return false;
}
/**
- * Toggles sample nature on a project
+ * Toggles codan nature on a project
*
* @param project
- * to have sample nature added or removed
+ * to have codan nature added or removed
*/
public void toggleNature(IProject project, boolean add) {
try {
@@ -109,11 +109,10 @@ public class ToggleNatureAction implements IObjectActionDelegate {
description.setNatureIds(newNatures);
project.setDescription(description, null);
return;
- } else {
- // already there no need to add
- add = false;
- break;
}
+ // already there no need to add
+ add = false;
+ break;
}
}
if (add) {
@@ -125,6 +124,7 @@ public class ToggleNatureAction implements IObjectActionDelegate {
project.setDescription(description, null);
}
} catch (CoreException e) {
+ CodanUIActivator.log(e);
}
}
}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Entries
new file mode 100644
index 0000000..87cd5d6
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Entries
@@ -0,0 +1,2 @@
+/CustomizeProblemDialog.java/1.5/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+/ExclusionInclusionEntryDialog.java/1.2/Thu Jun 3 17:01:39 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Repository
new file mode 100644
index 0000000..a829e01
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/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/dialogs/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Template b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Template
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CVS/Template
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CustomizeProblemDialog.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CustomizeProblemDialog.java
new file mode 100644
index 0000000..8b35f1d
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/CustomizeProblemDialog.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 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.dialogs;
+
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
+import org.eclipse.cdt.codan.internal.ui.widgets.CustomizeProblemComposite;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Dialog that allows to customise problems
+ *
+ */
+public class CustomizeProblemDialog extends TitleAreaDialog {
+ private CustomizeProblemComposite comp;
+ private IProblem problem;
+ private IResource resource;
+
+ /**
+ * @param parentShell
+ * @param selectedProblem
+ * @param iResource
+ */
+ public CustomizeProblemDialog(Shell parentShell, IProblem selectedProblem,
+ IResource resource) {
+ super(parentShell);
+ this.problem = selectedProblem;
+ this.resource = resource;
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ /**
+ * Stores edit values into problem working copy
+ *
+ * @param problem
+ * - problem working copy
+ */
+ public void save(IProblemWorkingCopy problem) {
+ comp.save(problem);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse
+ * .swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText(CodanUIMessages.CustomizeProblemDialog_Title);
+ setTitle(problem.getName());
+ setMessage(CodanUIMessages.CustomizeProblemDialog_Message);
+ Composite area = (Composite) super.createDialogArea(parent);
+ comp = new CustomizeProblemComposite(area, problem, resource);
+ GridData ld = new GridData(GridData.FILL_BOTH);
+ ld.minimumHeight = 300;
+ comp.setLayoutData(ld);
+ return area;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ save((IProblemWorkingCopy) problem);
+ super.okPressed();
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/ExclusionInclusionEntryDialog.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/ExclusionInclusionEntryDialog.java
new file mode 100644
index 0000000..5367e8b
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/dialogs/ExclusionInclusionEntryDialog.java
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Alena Laskavaia 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:
+ * Alena Laskavaia - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.internal.ui.dialogs;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.eclipse.cdt.codan.core.param.FileScopeProblemPreference;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
+import org.eclipse.cdt.codan.internal.ui.widgets.BasicElementLabels;
+import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
+import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+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.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.views.navigator.ResourceComparator;
+
+public class ExclusionInclusionEntryDialog extends StatusDialog {
+ private StringButtonDialogField fExclusionPatternDialog;
+ private StatusInfo fExclusionPatternStatus;
+ private IContainer fCurrSourceFolder;
+ private String fExclusionPattern;
+ private List fExistingPatterns;
+ private boolean fIsExclusion;
+
+ public ExclusionInclusionEntryDialog(Shell parent, boolean isExclusion,
+ String patternToEdit, List existingPatterns,
+ FileScopeProblemPreference entryToEdit) {
+ super(parent);
+ fIsExclusion = isExclusion;
+ fExistingPatterns = existingPatterns;
+ String title, message;
+ if (isExclusion) {
+ if (patternToEdit == null) {
+ title = CodanUIMessages.ExclusionInclusionEntryDialog_exclude_add_title;
+ } else {
+ title = CodanUIMessages.ExclusionInclusionEntryDialog_exclude_edit_title;
+ }
+ message = MessageFormat
+ .format(CodanUIMessages.ExclusionInclusionEntryDialog_exclude_pattern_label,
+ BasicElementLabels.getPathLabel(
+ entryToEdit.getPath(), false));
+ } else {
+ if (patternToEdit == null) {
+ title = CodanUIMessages.ExclusionInclusionEntryDialog_include_add_title;
+ } else {
+ title = CodanUIMessages.ExclusionInclusionEntryDialog_include_edit_title;
+ }
+ message = MessageFormat
+ .format(CodanUIMessages.ExclusionInclusionEntryDialog_include_pattern_label,
+ BasicElementLabels.getPathLabel(
+ entryToEdit.getPath(), false));
+ }
+ setTitle(title);
+ if (patternToEdit != null) {
+ fExistingPatterns.remove(patternToEdit);
+ }
+ IProject currProject = entryToEdit.getProject();
+ IWorkspaceRoot root = currProject != null ? currProject.getWorkspace()
+ .getRoot() : ResourcesPlugin.getWorkspace().getRoot();
+ IResource res = root.findMember(entryToEdit.getPath());
+ if (res instanceof IContainer) {
+ fCurrSourceFolder = (IContainer) res;
+ }
+ fExclusionPatternStatus = new StatusInfo();
+ ExclusionPatternAdapter adapter = new ExclusionPatternAdapter();
+ fExclusionPatternDialog = new StringButtonDialogField(adapter);
+ fExclusionPatternDialog.setLabelText(message);
+ fExclusionPatternDialog
+ .setButtonLabel(CodanUIMessages.ExclusionInclusionEntryDialog_pattern_button);
+ fExclusionPatternDialog.setDialogFieldListener(adapter);
+ fExclusionPatternDialog.enableButton(fCurrSourceFolder != null);
+ if (patternToEdit == null) {
+ fExclusionPatternDialog.setText(""); //$NON-NLS-1$
+ } else {
+ fExclusionPatternDialog.setText(patternToEdit.toString());
+ }
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ int widthHint = convertWidthInCharsToPixels(60);
+ Composite inner = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ inner.setLayout(layout);
+ Label description = new Label(inner, SWT.WRAP);
+ if (fIsExclusion) {
+ description
+ .setText(CodanUIMessages.ExclusionInclusionEntryDialog_exclude_description);
+ } else {
+ description
+ .setText(CodanUIMessages.ExclusionInclusionEntryDialog_include_description);
+ }
+ GridData gd = new GridData();
+ gd.horizontalSpan = 2;
+ gd.widthHint = convertWidthInCharsToPixels(80);
+ description.setLayoutData(gd);
+ fExclusionPatternDialog.doFillIntoGrid(inner, 3);
+ LayoutUtil.setWidthHint(fExclusionPatternDialog.getLabelControl(null),
+ widthHint);
+ LayoutUtil.setHorizontalSpan(
+ fExclusionPatternDialog.getLabelControl(null), 2);
+ LayoutUtil.setWidthHint(fExclusionPatternDialog.getTextControl(null),
+ widthHint);
+ LayoutUtil.setHorizontalGrabbing(fExclusionPatternDialog
+ .getTextControl(null));
+ fExclusionPatternDialog.postSetFocusOnDialogField(parent.getDisplay());
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ // -------- ExclusionPatternAdapter --------
+ private class ExclusionPatternAdapter implements IDialogFieldListener,
+ IStringButtonAdapter {
+ // -------- IDialogFieldListener
+ public void dialogFieldChanged(DialogField field) {
+ doStatusLineUpdate();
+ }
+
+ public void changeControlPressed(DialogField field) {
+ doChangeControlPressed();
+ }
+ }
+
+ protected void doChangeControlPressed() {
+ IPath pattern = chooseExclusionPattern();
+ if (pattern != null) {
+ fExclusionPatternDialog.setText(pattern.toString());
+ }
+ }
+
+ protected void doStatusLineUpdate() {
+ checkIfPatternValid();
+ updateStatus(fExclusionPatternStatus);
+ }
+
+ protected void checkIfPatternValid() {
+ String pattern = fExclusionPatternDialog.getText().trim();
+ if (pattern.length() == 0) {
+ fExclusionPatternStatus
+ .setError(CodanUIMessages.ExclusionInclusionEntryDialog_error_empty);
+ return;
+ }
+ IPath path = new Path(pattern);
+ if (path.isAbsolute() || path.getDevice() != null) {
+ fExclusionPatternStatus
+ .setError(CodanUIMessages.ExclusionInclusionEntryDialog_error_notrelative);
+ return;
+ }
+ if (fExistingPatterns.contains(pattern)) {
+ fExclusionPatternStatus
+ .setError(CodanUIMessages.ExclusionInclusionEntryDialog_error_exists);
+ return;
+ }
+ fExclusionPattern = pattern;
+ fExclusionPatternStatus.setOK();
+ }
+
+ public String getExclusionPattern() {
+ return fExclusionPattern;
+ }
+
+ /*
+ * @see org.eclipse.jface.window.Window#configureShell(Shell)
+ */
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ }
+
+ // ---------- util method ------------
+ private IPath chooseExclusionPattern() {
+ String title, message;
+ if (fIsExclusion) {
+ title = CodanUIMessages.ExclusionInclusionEntryDialog_ChooseExclusionPattern_title;
+ message = CodanUIMessages.ExclusionInclusionEntryDialog_ChooseExclusionPattern_description;
+ } else {
+ title = CodanUIMessages.ExclusionInclusionEntryDialog_ChooseInclusionPattern_title;
+ message = CodanUIMessages.ExclusionInclusionEntryDialog_ChooseInclusionPattern_description;
+ }
+ IPath initialPath = new Path(fExclusionPatternDialog.getText());
+ IPath[] res = chooseExclusionPattern(getShell(), fCurrSourceFolder,
+ title, message, initialPath, false);
+ if (res == null) {
+ return null;
+ }
+ return res[0];
+ }
+
+ public static IPath[] chooseExclusionPattern(Shell shell,
+ IContainer currentSourceFolder, String title, String message,
+ IPath initialPath, boolean multiSelection) {
+ Class[] acceptedClasses = new Class[] { IFolder.class, IFile.class,
+ IProject.class };
+ ISelectionStatusValidator validator = new TypedElementSelectionValidator(
+ acceptedClasses, multiSelection);
+ ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
+ ILabelProvider lp = new WorkbenchLabelProvider();
+ ITreeContentProvider cp = new WorkbenchContentProvider();
+ IResource initialElement = null;
+ if (initialPath != null) {
+ IContainer curr = currentSourceFolder;
+ int nSegments = initialPath.segmentCount();
+ for (int i = 0; i < nSegments; i++) {
+ IResource elem = curr.findMember(initialPath.segment(i));
+ if (elem != null) {
+ initialElement = elem;
+ }
+ if (elem instanceof IContainer) {
+ curr = (IContainer) elem;
+ } else {
+ break;
+ }
+ }
+ }
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
+ shell, lp, cp);
+ dialog.setTitle(title);
+ dialog.setValidator(validator);
+ dialog.setMessage(message);
+ dialog.addFilter(filter);
+ dialog.setInput(currentSourceFolder);
+ dialog.setInitialSelection(initialElement);
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ dialog.setHelpAvailable(false);
+ if (dialog.open() == Window.OK) {
+ Object[] objects = dialog.getResult();
+ int existingSegments = currentSourceFolder.getFullPath()
+ .segmentCount();
+ IPath[] resArr = new IPath[objects.length];
+ for (int i = 0; i < objects.length; i++) {
+ IResource currRes = (IResource) objects[i];
+ IPath path = currRes.getFullPath()
+ .removeFirstSegments(existingSegments).makeRelative();
+ if (currRes instanceof IContainer) {
+ path = path.addTrailingSeparator();
+ }
+ resArr[i] = path;
+ }
+ return resArr;
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/messages.properties b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/messages.properties
new file mode 100644
index 0000000..ff8fe4c
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/messages.properties
@@ -0,0 +1,85 @@
+###############################################################################
+# Copyright (c) 2010 Alena Laskavaia 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:
+# Alena Laskavaia - initial API and implementation
+###############################################################################
+BuildPropertyPage_RunAsYouType=Run as you &type (selected checkers)
+BuildPropertyPage_RunWithBuild=&Run with build
+CheckedTreeEditor_SelectionCannotBeEmpty=Selection cannot be empty
+CodanPreferencePage_Customize=Customize...
+CodanPreferencePage_Description=Description:
+CodanPreferencePage_HasPreferences=This problem has extra preferences
+CodanPreferencePage_Info=Info
+CodanPreferencePage_MessageLabel=Message:
+CodanPreferencePage_NoInfo=Not defined
+CodanPreferencePage_Parameters=Parameters:
+CustomizeProblemComposite_TabParameters=Preferences
+CustomizeProblemComposite_TabScope=Scope
+CustomizeProblemDialog_Message=Edit problem preferences, scope and launch options
+CustomizeProblemDialog_Title=Customize Problem...
+Job_TitleRunningAnalysis=Running Code Analysis
+ParametersComposite_NewValue=New Value
+ParametersComposite_None=No extra preferences
+ProblemsTreeEditor_NameColumn=Name
+ProblemsTreeEditor_Problems=Problems
+ProblemsTreeEditor_SeverityColumn=Severity
+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
+
+# ------- ExclusionInclusionDialog -------
+
+ExclusionInclusionDialog_title=Inclusion and Exclusion Patterns
+ExclusionInclusionDialog_description=Included and excluded resources for ''{0}''.
+ExclusionInclusionDialog_description2=Add or remove inclusion and exclusion patterns to resources for which problem is reported
+
+ExclusionInclusionDialog_exclusion_pattern_label=E&xclusion patterns:
+ExclusionInclusionDialog_inclusion_pattern_label=I&nclusion patterns:
+
+ExclusionInclusionDialog_inclusion_pattern_add=A&dd...
+ExclusionInclusionDialog_inclusion_pattern_add_multiple=Add &Multiple...
+ExclusionInclusionDialog_inclusion_pattern_remove=&Remove
+ExclusionInclusionDialog_inclusion_pattern_edit=&Edit...
+
+ExclusionInclusionDialog_exclusion_pattern_add=&Add...
+ExclusionInclusionDialog_exclusion_pattern_add_multiple=Add M&ultiple...
+ExclusionInclusionDialog_exclusion_pattern_remove=Rem&ove
+ExclusionInclusionDialog_exclusion_pattern_edit=Edi&t...
+
+ExclusionInclusionDialog_ChooseExclusionPattern_title=Exclusion Pattern Selection
+ExclusionInclusionDialog_ChooseExclusionPattern_description=&Choose folders or files to exclude:
+
+ExclusionInclusionDialog_ChooseInclusionPattern_title=Inclusion Pattern Selection
+ExclusionInclusionDialog_ChooseInclusionPattern_description=&Choose folders or files to include:
+
+# ------- ExclusionInclusionEntryDialog -------
+
+ExclusionInclusionEntryDialog_exclude_add_title=Add Exclusion Pattern
+ExclusionInclusionEntryDialog_exclude_edit_title=Edit Exclusion Pattern
+ExclusionInclusionEntryDialog_exclude_description=Enter a pattern for excluding files from the source folder. Allowed wildcards are '*', '?' and '**'. Examples: 'src/util/a*.c', 'src/util/', '**/Test*'.
+
+ExclusionInclusionEntryDialog_exclude_pattern_label=E&xclusion pattern (Path relative to ''{0}''):
+
+ExclusionInclusionEntryDialog_include_add_title=Add Inclusion Pattern
+ExclusionInclusionEntryDialog_include_edit_title=Edit Inclusion Pattern
+ExclusionInclusionEntryDialog_include_description=Enter a pattern for including files to the source folder. Allowed wildcards are '*', '?' and '**'. Examples: 'src/util/a*.c', 'src/util/', '**/Test*'.
+
+ExclusionInclusionEntryDialog_include_pattern_label=I&nclusion pattern (Path relative to ''{0}''):
+
+ExclusionInclusionEntryDialog_pattern_button=Bro&wse...
+
+ExclusionInclusionEntryDialog_error_empty=Enter a pattern.
+ExclusionInclusionEntryDialog_error_notrelative=Pattern must be a relative path.
+ExclusionInclusionEntryDialog_error_exists=Pattern already exists.
+
+ExclusionInclusionEntryDialog_ChooseExclusionPattern_title=Exclusion Pattern Selection
+ExclusionInclusionEntryDialog_ChooseExclusionPattern_description=&Choose a folder or file to exclude:
+
+ExclusionInclusionEntryDialog_ChooseInclusionPattern_title=Inclusion Pattern Selection
+ExclusionInclusionEntryDialog_ChooseInclusionPattern_description=&Choose a folder or file to include: \ No newline at end of file
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
index 95f7ff6..4155cce 100644
--- 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
@@ -1,17 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Alena Laskavaia 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:
+ * 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.PreferenceConstants;
-import org.eclipse.cdt.codan.ui.actions.ToggleNatureAction;
+import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
+import org.eclipse.cdt.codan.internal.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.jface.preference.IPreferenceStore;
import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
public class BuildPropertyPage extends FieldEditorPreferencePage implements
IWorkbenchPropertyPage {
@@ -21,8 +29,7 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements
*
*/
public BuildPropertyPage() {
- setPreferenceStore(org.eclipse.cdt.codan.ui.Activator.getDefault()
- .getPreferenceStore());
+ setPreferenceStore(CodanUIActivator.getDefault().getPreferenceStore());
}
/*
@@ -35,7 +42,9 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements
@Override
protected void createFieldEditors() {
addField(new BooleanFieldEditor(PreferenceConstants.P_RUN_ON_BUILD,
- "&Run with Build", getFieldEditorParent()));
+ CodanUIMessages.BuildPropertyPage_RunWithBuild, getFieldEditorParent()));
+ addField(new BooleanFieldEditor(PreferenceConstants.P_RUN_IN_EDITOR,
+ CodanUIMessages.BuildPropertyPage_RunAsYouType, getFieldEditorParent()));
}
@Override
@@ -70,7 +79,9 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
*/
public IAdaptable getElement() {
- return element;
+ if (element.getAdapter(IProject.class) != null)
+ return (IProject) element.getAdapter(IProject.class);
+ return null;
}
/*
@@ -82,16 +93,14 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements
*/
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);
+ if (getElement() != null) {
+ IPreferenceStore scoped = CodanUIActivator.getDefault()
+ .getPreferenceStore(((IProject) getElement()));
+ setPreferenceStore(scoped);
+ }
}
protected String getPageId() {
- return "org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage";
+ return "org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage"; //$NON-NLS-1$
}
}
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
index 980f899..f152569 100644
--- 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
@@ -1,8 +1,7 @@
-/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.8/Wed Dec 16 21:48:50 2009//
+/BuildPropertyPage.java/1.10/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+/CheckedTreeEditor.java/1.7/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+/CodanPreferencePage.java/1.16/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+/FieldEditorOverlayPage.java/1.7/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+/FileScopePreferencePage.java/1.2/Thu Jun 3 17:01:39 2010//TCDT_7_0_0
+/PreferenceInitializer.java/1.6/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
+/ProblemsTreeEditor.java/1.17/Sun Jun 27 01:30:36 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
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
index 7c98ef4..ce55a32 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.preferences;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
@@ -312,7 +313,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements
if (!emptySelectionAllowed) {
Object[] checkedElements = getTreeViewer().getCheckedElements();
if (checkedElements.length == 0) {
- showErrorMessage("Selection cannot be empty");
+ showErrorMessage(CodanUIMessages.CheckedTreeEditor_SelectionCannotBeEmpty);
return false;
}
}
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
index 35b9a8f..825e8cd 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Alena Laskavaia
+ * Copyright (c) 2009, 2010 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
@@ -10,12 +10,37 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.preferences;
+import java.text.MessageFormat;
+
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.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemProfile;
+import org.eclipse.cdt.codan.core.param.IProblemPreference;
+import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
+import org.eclipse.cdt.codan.internal.ui.dialogs.CustomizeProblemDialog;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.PixelConverter;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+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.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
@@ -33,16 +58,39 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore;
public class CodanPreferencePage extends FieldEditorOverlayPage implements
IWorkbenchPreferencePage {
private IProblemProfile profile;
+ private ISelectionChangedListener problemSelectionListener;
+ private IProblem selectedProblem;
+ private Group info;
+ private Label infoDesc;
+ private Label infoMessage;
+ private Label infoParams;
+ private Button infoButton;
+ private ProblemsTreeEditor checkedTreeEditor;
public CodanPreferencePage() {
super(GRID);
setPreferenceStore(new ScopedPreferenceStore(new InstanceScope(),
CodanCorePlugin.PLUGIN_ID));
- setDescription("Code Analyzers Preference Page");
+ // setDescription("Code Analysis Preference Page");
+ problemSelectionListener = new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (info != null) {
+ if (event.getSelection() instanceof ITreeSelection) {
+ ITreeSelection s = (ITreeSelection) event
+ .getSelection();
+ if (s.getFirstElement() instanceof IProblem)
+ setSelectedProblem((IProblem) s.getFirstElement());
+ else
+ setSelectedProblem(null);
+ }
+ }
+ }
+ };
}
+ @Override
protected String getPageId() {
- return "org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage";
+ return "org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage"; //$NON-NLS-1$
}
/**
@@ -50,13 +98,93 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements
* GUI blocks needed to manipulate various types of preferences. Each field
* editor knows how to save and restore itself.
*/
+ @Override
public void createFieldEditors() {
profile = isPropertyPage() ? getRegistry()
.getResourceProfileWorkingCopy((IResource) getElement())
: getRegistry().getWorkspaceProfile();
- CheckedTreeEditor checkedTreeEditor = new ProblemsTreeEditor(
- getFieldEditorParent(), profile);
+ checkedTreeEditor = new ProblemsTreeEditor(getFieldEditorParent(),
+ profile);
addField(checkedTreeEditor);
+ checkedTreeEditor.getTreeViewer().addSelectionChangedListener(
+ problemSelectionListener);
+ checkedTreeEditor.getTreeViewer().addDoubleClickListener(
+ new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ openCustomizeDialog();
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.internal.ui.preferences.FieldEditorOverlayPage#
+ * createContents(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite comp = (Composite) super.createContents(parent);
+ createInfoControl(comp);
+ return comp;
+ }
+
+ /**
+ * @param comp
+ */
+ private void createInfoControl(Composite comp) {
+ info = new Group(comp, SWT.NONE);
+ info.setLayoutData(new GridData(GridData.FILL_BOTH));
+ info.setLayout(new GridLayout(3, false));
+ info.setText(CodanUIMessages.CodanPreferencePage_Info);
+ GridDataFactory gdLab = GridDataFactory.swtDefaults()
+ .align(SWT.BEGINNING, SWT.BEGINNING).grab(false, false);
+ GridDataFactory gdFact = GridDataFactory.swtDefaults()
+ .align(SWT.BEGINNING, SWT.BEGINNING).grab(true, true);
+ // message
+ Label labelMessage = new Label(info, SWT.NONE);
+ labelMessage.setText(CodanUIMessages.CodanPreferencePage_MessageLabel);
+ labelMessage.setLayoutData(gdLab.create());
+ infoMessage = new Label(info, SWT.WRAP);
+ infoMessage.setLayoutData(gdFact.copy().span(2, 1).create());
+ // description
+ Label labelDesc = new Label(info, SWT.NONE);
+ labelDesc.setText(CodanUIMessages.CodanPreferencePage_Description);
+ labelDesc.setLayoutData(gdLab.create());
+ infoDesc = new Label(info, SWT.WRAP);
+ PixelConverter pixelConverter = new PixelConverter(comp);
+ infoDesc.setLayoutData(gdFact
+ .copy()
+ .span(2, 1)
+ .hint(pixelConverter.convertWidthInCharsToPixels(60),
+ pixelConverter.convertHeightInCharsToPixels(3))
+ .create());
+ // params
+ Label labelParams = new Label(info, SWT.NONE);
+ labelParams.setText(CodanUIMessages.CodanPreferencePage_Parameters);
+ labelParams.setLayoutData(gdLab.create());
+ infoParams = new Label(info, SWT.NONE);
+ infoParams.setLayoutData(gdFact.create());
+ infoButton = new Button(info, SWT.PUSH);
+ infoButton.setLayoutData(GridDataFactory.swtDefaults()
+ .align(SWT.END, SWT.BEGINNING).create());
+ infoButton.setText(CodanUIMessages.CodanPreferencePage_Customize);
+ infoButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ openCustomizeDialog();
+ }
+ });
+ restoreWidgetValues();
+ }
+
+ /**
+ * @param selection
+ */
+ protected void setSelectedProblem(IProblem problem) {
+ this.selectedProblem = problem;
+ updateProblemInfo();
}
/**
@@ -73,11 +201,70 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements
*/
@Override
public boolean performOk() {
- if (isPropertyPage())
- getRegistry().updateProfile((IResource) getElement(), null);
+ saveWidgetValues();
+ // if (isPropertyPage())
+ getRegistry().updateProfile((IResource) getElement(), null);
return super.performOk();
}
+ /**
+ *
+ */
+ private void saveWidgetValues() {
+ CodanUIActivator
+ .getDefault()
+ .getDialogSettings()
+ .put(getWidgetId(),
+ selectedProblem == null ? "" : selectedProblem.getId()); //$NON-NLS-1$
+ }
+
+ private void restoreWidgetValues() {
+ String id = CodanUIActivator.getDefault().getDialogSettings()
+ .get(getWidgetId());
+ if (id != null && id.length() > 0) {
+ checkedTreeEditor.getTreeViewer().setSelection(
+ new StructuredSelection(profile.findProblem(id)), true);
+ } else {
+ setSelectedProblem(null);
+ }
+ }
+
+ /**
+ * @return
+ */
+ protected String getWidgetId() {
+ return getPageId() + ".selection"; //$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ private void updateProblemInfo() {
+ if (selectedProblem == null) {
+ infoMessage.setText(""); //$NON-NLS-1$
+ infoDesc.setText(""); //$NON-NLS-1$
+ infoParams.setText(""); //$NON-NLS-1$
+ infoButton.setEnabled(false);
+ } else {
+ IProblemPreference pref = selectedProblem.getPreference();
+ String description = selectedProblem.getDescription();
+ if (description == null)
+ description = CodanUIMessages.CodanPreferencePage_NoInfo;
+ String messagePattern = selectedProblem.getMessagePattern();
+ String message = CodanUIMessages.CodanPreferencePage_NoInfo;
+ if (messagePattern != null) {
+ message = MessageFormat.format(messagePattern, "X", "Y", "Z"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ infoMessage.setText(message);
+ infoDesc.setText(description);
+ infoParams
+ .setText(pref == null ? CodanUIMessages.CodanPreferencePage_NoInfo
+ : CodanUIMessages.CodanPreferencePage_HasPreferences);
+ infoButton.setEnabled(true);
+ }
+ info.layout(true);
+ }
+
/*
* (non-Javadoc)
*
@@ -86,4 +273,13 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements
*/
public void init(IWorkbench workbench) {
}
+
+ /**
+ *
+ */
+ protected void openCustomizeDialog() {
+ CustomizeProblemDialog d = new CustomizeProblemDialog(getShell(),
+ selectedProblem, (IResource) getElement());
+ d.open();
+ }
} \ 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
index e617a75..714d841 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003 Berthold Daum.
+ * Copyright (c) 2003, 2010 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
@@ -16,6 +16,7 @@ import java.util.List;
import org.eclipse.cdt.codan.core.CodanCorePlugin;
import org.eclipse.cdt.codan.core.PreferenceConstants;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.IAdaptable;
@@ -121,6 +122,10 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
*/
public IAdaptable getElement() {
+ if (element == null)
+ return element;
+ if (!(element instanceof IProject))
+ return (IAdaptable) element.getAdapter(IProject.class);
return element;
}
@@ -157,12 +162,15 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
// 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;
+ IAdaptable e = getElement();
+ if (e != null) {
+ ProjectScope ps = new ProjectScope((IProject) e);
+ 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);
@@ -200,13 +208,12 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
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$
+ useWorkspaceSettingsButton = createRadioButton(radioGroup,
+ CodanUIMessages.OverlayPage_Use_Workspace_Settings);
+ useProjectSettingsButton = createRadioButton(radioGroup,
+ CodanUIMessages.OverlayPage_Use_Project_Settings);
configureButton = new Button(comp, SWT.PUSH);
- configureButton.setText(Messages
- .getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
+ configureButton.setText(CodanUIMessages.OverlayPage_Use_Workspace_Settings);
configureButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
configureWorkspaceSettings();
@@ -322,6 +329,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
/**
* Creates a new preferences page and opens it
*/
+ @SuppressWarnings("cast")
protected void configureWorkspaceSettings() {
try {
// create a new instance of the current class
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FileScopePreferencePage.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FileScopePreferencePage.java
new file mode 100644
index 0000000..149dee9
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/FileScopePreferencePage.java
@@ -0,0 +1,312 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Alena Laskavaia 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:
+ * Alena Laskavaia - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.internal.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.cdt.codan.core.param.FileScopeProblemPreference;
+import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
+import org.eclipse.cdt.codan.internal.ui.dialogs.ExclusionInclusionEntryDialog;
+import org.eclipse.cdt.codan.internal.ui.widgets.BasicElementLabels;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.IListAdapter;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
+import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+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;
+
+public class FileScopePreferencePage extends PreferencePage {
+ private ListDialogField fInclusionPatternList;
+ private ListDialogField fExclusionPatternList;
+ private FileScopeProblemPreference fCurrElement;
+ private IProject fCurrProject;
+ private IContainer fCurrSourceFolder;
+ private static final int IDX_ADD = 0;
+ private static final int IDX_ADD_MULTIPLE = 1;
+ private static final int IDX_EDIT = 2;
+ private static final int IDX_REMOVE = 4;
+
+ public FileScopePreferencePage(FileScopeProblemPreference entryToEdit) {
+ setTitle(CodanUIMessages.ExclusionInclusionDialog_title);
+ setDescription(CodanUIMessages.ExclusionInclusionDialog_description2);
+ fCurrElement = entryToEdit;
+ fCurrProject = entryToEdit.getProject();
+ IWorkspaceRoot root = fCurrProject != null ? fCurrProject
+ .getWorkspace().getRoot() : ResourcesPlugin.getWorkspace()
+ .getRoot();
+ IResource res = root.findMember(entryToEdit.getPath());
+ if (res instanceof IContainer) {
+ fCurrSourceFolder = (IContainer) res;
+ }
+ if (res == null)
+ fCurrSourceFolder = root;
+ String excLabel = CodanUIMessages.ExclusionInclusionDialog_exclusion_pattern_label;
+ ImageDescriptor excDescriptor = null; //JavaPluginImages.DESC_OBJS_EXCLUSION_FILTER_ATTRIB;
+ String[] excButtonLabels = new String[] {
+ CodanUIMessages.ExclusionInclusionDialog_exclusion_pattern_add,
+ CodanUIMessages.ExclusionInclusionDialog_exclusion_pattern_add_multiple,
+ CodanUIMessages.ExclusionInclusionDialog_exclusion_pattern_edit,
+ null,
+ CodanUIMessages.ExclusionInclusionDialog_exclusion_pattern_remove };
+ String incLabel = CodanUIMessages.ExclusionInclusionDialog_inclusion_pattern_label;
+ ImageDescriptor incDescriptor = null; //JavaPluginImages.DESC_OBJS_INCLUSION_FILTER_ATTRIB;
+ String[] incButtonLabels = new String[] {
+ CodanUIMessages.ExclusionInclusionDialog_inclusion_pattern_add,
+ CodanUIMessages.ExclusionInclusionDialog_inclusion_pattern_add_multiple,
+ CodanUIMessages.ExclusionInclusionDialog_inclusion_pattern_edit,
+ null,
+ CodanUIMessages.ExclusionInclusionDialog_inclusion_pattern_remove };
+ fExclusionPatternList = createListContents(entryToEdit,
+ FileScopeProblemPreference.EXCLUSION, excLabel, null,
+ excButtonLabels);
+ fInclusionPatternList = createListContents(entryToEdit,
+ FileScopeProblemPreference.INCLUSION, incLabel, null,
+ incButtonLabels);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite inner = new Composite(parent, SWT.NONE);
+ inner.setFont(parent.getFont());
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ inner.setLayout(layout);
+ inner.setLayoutData(new GridData(GridData.FILL_BOTH));
+ fInclusionPatternList.doFillIntoGrid(inner, 3);
+ LayoutUtil.setHorizontalSpan(
+ fInclusionPatternList.getLabelControl(null), 2);
+ LayoutUtil.setHorizontalGrabbing(fInclusionPatternList
+ .getListControl(null));
+ fExclusionPatternList.doFillIntoGrid(inner, 3);
+ LayoutUtil.setHorizontalSpan(
+ fExclusionPatternList.getLabelControl(null), 2);
+ LayoutUtil.setHorizontalGrabbing(fExclusionPatternList
+ .getListControl(null));
+ setControl(inner);
+ Dialog.applyDialogFont(inner);
+ return inner;
+ }
+
+ private static class ExclusionInclusionLabelProvider extends LabelProvider {
+ private Image fElementImage;
+
+ public ExclusionInclusionLabelProvider(String descriptorPath) {
+ if (descriptorPath != null) {
+ ImageDescriptor d = CodanUIActivator
+ .getImageDescriptor(descriptorPath);
+ }
+ fElementImage = null; // XXX
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return fElementImage;
+ }
+
+ @Override
+ public String getText(Object element) {
+ return BasicElementLabels.getFilePattern((String) element);
+ }
+ }
+
+ private ListDialogField createListContents(
+ FileScopeProblemPreference entryToEdit, String key, String label,
+ String descriptor, String[] buttonLabels) {
+ ExclusionPatternAdapter adapter = new ExclusionPatternAdapter();
+ ListDialogField patternList = new ListDialogField(adapter,
+ buttonLabels, new ExclusionInclusionLabelProvider(descriptor));
+ patternList.setDialogFieldListener(adapter);
+ patternList.setLabelText(label);
+ patternList.enableButton(IDX_EDIT, false);
+ IPath[] pattern = entryToEdit.getAttribute(key);
+ ArrayList elements = new ArrayList(pattern.length);
+ for (int i = 0; i < pattern.length; i++) {
+ String patternName = pattern[i].toString();
+ if (patternName.length() > 0)
+ elements.add(patternName);
+ }
+ patternList.setElements(elements);
+ patternList.selectFirstElement();
+ patternList.enableButton(IDX_ADD_MULTIPLE, fCurrSourceFolder != null);
+ patternList.setViewerComparator(new ViewerComparator());
+ return patternList;
+ }
+
+ protected void doCustomButtonPressed(ListDialogField field, int index) {
+ if (index == IDX_ADD) {
+ addEntry(field);
+ } else if (index == IDX_EDIT) {
+ editEntry(field);
+ } else if (index == IDX_ADD_MULTIPLE) {
+ addMultipleEntries(field);
+ } else if (index == IDX_REMOVE) {
+ field.removeElements(field.getSelectedElements());
+ }
+ updateStatus();
+ }
+
+ private void updateStatus() {
+ fCurrElement.setAttribute(FileScopeProblemPreference.INCLUSION,
+ getInclusionPattern());
+ fCurrElement.setAttribute(FileScopeProblemPreference.EXCLUSION,
+ getExclusionPattern());
+ }
+
+ protected void doDoubleClicked(ListDialogField field) {
+ editEntry(field);
+ updateStatus();
+ }
+
+ protected void doSelectionChanged(ListDialogField field) {
+ List selected = field.getSelectedElements();
+ field.enableButton(IDX_EDIT, canEdit(selected));
+ }
+
+ private boolean canEdit(List selected) {
+ return selected.size() == 1;
+ }
+
+ private void editEntry(ListDialogField field) {
+ List selElements = field.getSelectedElements();
+ if (selElements.size() != 1) {
+ return;
+ }
+ List existing = field.getElements();
+ String entry = (String) selElements.get(0);
+ ExclusionInclusionEntryDialog dialog = new ExclusionInclusionEntryDialog(
+ getShell(), isExclusion(field), entry, existing, fCurrElement);
+ if (dialog.open() == Window.OK) {
+ field.replaceElement(entry, dialog.getExclusionPattern());
+ }
+ }
+
+ private boolean isExclusion(ListDialogField field) {
+ return field == fExclusionPatternList;
+ }
+
+ private void addEntry(ListDialogField field) {
+ List existing = field.getElements();
+ ExclusionInclusionEntryDialog dialog = new ExclusionInclusionEntryDialog(
+ getShell(), isExclusion(field), null, existing, fCurrElement);
+ if (dialog.open() == Window.OK) {
+ field.addElement(dialog.getExclusionPattern());
+ }
+ }
+
+ // -------- ExclusionPatternAdapter --------
+ private class ExclusionPatternAdapter implements IListAdapter,
+ IDialogFieldListener {
+ /**
+ * @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter#customButtonPressed(org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField,
+ * int)
+ */
+ public void customButtonPressed(ListDialogField field, int index) {
+ doCustomButtonPressed(field, index);
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter#selectionChanged(org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField)
+ */
+ public void selectionChanged(ListDialogField field) {
+ doSelectionChanged(field);
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter#doubleClicked(org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField)
+ */
+ public void doubleClicked(ListDialogField field) {
+ doDoubleClicked(field);
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener#dialogFieldChanged(org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
+ */
+ public void dialogFieldChanged(DialogField field) {
+ }
+ }
+
+ protected void doStatusLineUpdate() {
+ }
+
+ protected void checkIfPatternValid() {
+ }
+
+ private IPath[] getPattern(ListDialogField field) {
+ Object[] arr = field.getElements().toArray();
+ Arrays.sort(arr);
+ IPath[] res = new IPath[arr.length];
+ for (int i = 0; i < res.length; i++) {
+ res[i] = new Path((String) arr[i]);
+ }
+ return res;
+ }
+
+ public IPath[] getExclusionPattern() {
+ return getPattern(fExclusionPatternList);
+ }
+
+ public IPath[] getInclusionPattern() {
+ return getPattern(fInclusionPatternList);
+ }
+
+ /*
+ * @see org.eclipse.jface.window.Window#configureShell(Shell)
+ */
+ protected void configureShell(Shell newShell) {
+ }
+
+ private void addMultipleEntries(ListDialogField field) {
+ String title, message;
+ if (isExclusion(field)) {
+ title = CodanUIMessages.ExclusionInclusionDialog_ChooseExclusionPattern_title;
+ message = CodanUIMessages.ExclusionInclusionDialog_ChooseExclusionPattern_description;
+ } else {
+ title = CodanUIMessages.ExclusionInclusionDialog_ChooseInclusionPattern_title;
+ message = CodanUIMessages.ExclusionInclusionDialog_ChooseInclusionPattern_description;
+ }
+ IPath[] res = ExclusionInclusionEntryDialog.chooseExclusionPattern(
+ getShell(), fCurrSourceFolder, title, message, null, true);
+ if (res != null) {
+ for (int i = 0; i < res.length; i++) {
+ field.addElement(res[i].toString());
+ }
+ }
+ }
+
+ @Override
+ public void noDefaultAndApplyButton() {
+ super.noDefaultAndApplyButton();
+ }
+}
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
deleted file mode 100644
index 4ef5f89..0000000
--- a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 689b7ee..0000000
--- a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/Messages.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-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
index 4362098..645a892 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Alena Laskavaia
+ * Copyright (c) 2009, 2010 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
@@ -11,6 +11,7 @@
package org.eclipse.cdt.codan.internal.ui.preferences;
import org.eclipse.cdt.codan.core.PreferenceConstants;
+import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -18,16 +19,16 @@ 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()
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
+ * initializeDefaultPreferences()
*/
public void initializeDefaultPreferences() {
- IPreferenceStore store = org.eclipse.cdt.codan.ui.Activator
- .getDefault().getPreferenceStore();
+ IPreferenceStore store = CodanUIActivator.getDefault()
+ .getPreferenceStore();
store.setDefault(PreferenceConstants.P_RUN_ON_BUILD, false);
+ store.setDefault(PreferenceConstants.P_RUN_IN_EDITOR, true);
}
-
}
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
index 26e433e..4547028 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Alena Laskavaia
+ * Copyright (c) 2009, 2010 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
@@ -14,24 +14,27 @@ 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.IProblemElement;
import org.eclipse.cdt.codan.core.model.IProblemProfile;
+import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
import org.eclipse.cdt.codan.internal.core.CodanPreferencesLoader;
-import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
+import org.eclipse.core.resources.IMarker;
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;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
public class ProblemsTreeEditor extends CheckedTreeEditor {
private CodanPreferencesLoader codanPreferencesLoader = new CodanPreferencesLoader();
@@ -136,39 +139,26 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
}
}
+ @Override
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();
+ if (element instanceof IProblemWorkingCopy) {
+ ((IProblemWorkingCopy) element).setEnabled(event.getChecked());
+ } else if (element instanceof IProblemCategory) {
+ IProblemCategory cat = (IProblemCategory) element;
+ IProblemElement[] children = cat.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IProblemElement pe = children[i];
+ checkStateChanged(new CheckStateChangedEvent(getTreeViewer(),
+ pe, event.getChecked()));
}
- return null;
}
+ getTreeViewer().refresh();
}
public ProblemsTreeEditor(Composite parent, IProblemProfile profile) {
- super(PreferenceConstants.P_PROBLEMS, "Problems", parent);
+ super(PreferenceConstants.P_PROBLEMS,
+ CodanUIMessages.ProblemsTreeEditor_Problems, parent);
setEmptySelectionAllowed(true);
getTreeViewer().getTree().setHeaderVisible(true);
// getTreeViewer().getTree().
@@ -178,8 +168,10 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
TreeViewerColumn column1 = new TreeViewerColumn(getTreeViewer(),
SWT.NONE);
column1.getColumn().setWidth(300);
- column1.getColumn().setText("Name");
+ column1.getColumn().setText(
+ CodanUIMessages.ProblemsTreeEditor_NameColumn);
column1.setLabelProvider(new ColumnLabelProvider() {
+ @Override
public String getText(Object element) {
if (element instanceof IProblem) {
IProblem p = (IProblem) element;
@@ -196,8 +188,31 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
TreeViewerColumn column2 = new TreeViewerColumn(getTreeViewer(),
SWT.NONE);
column2.getColumn().setWidth(100);
- column2.getColumn().setText("Severity");
+ column2.getColumn().setText(
+ CodanUIMessages.ProblemsTreeEditor_SeverityColumn);
column2.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public Image getImage(Object element) {
+ final ISharedImages images = PlatformUI.getWorkbench()
+ .getSharedImages();
+ if (element instanceof IProblem) {
+ IProblem p = (IProblem) element;
+ switch (p.getSeverity().intValue()) {
+ case IMarker.SEVERITY_INFO:
+ return images
+ .getImage(ISharedImages.IMG_OBJS_INFO_TSK);
+ case IMarker.SEVERITY_WARNING:
+ return images
+ .getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ case IMarker.SEVERITY_ERROR:
+ return images
+ .getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ }
+ }
+ return null;
+ }
+
+ @Override
public String getText(Object element) {
if (element instanceof IProblem) {
IProblem p = (IProblem) element;
@@ -207,23 +222,27 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
}
});
column2.setEditingSupport(new EditingSupport(getTreeViewer()) {
+ @Override
protected boolean canEdit(Object element) {
return element instanceof IProblem;
}
+ @Override
protected CellEditor getCellEditor(Object element) {
return new ComboBoxCellEditor(getTreeViewer().getTree(),
CodanSeverity.stringValues());
}
+ @Override
protected Object getValue(Object element) {
return ((IProblem) element).getSeverity().intValue();
}
+ @Override
protected void setValue(Object element, Object value) {
int index = ((Integer) value).intValue();
CodanSeverity val = CodanSeverity.values()[index];
- ((IProblem) element).setSeverity(val);
+ ((IProblemWorkingCopy) element).setSeverity(val);
getTreeViewer().update(element, null);
}
});
@@ -245,6 +264,9 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
for (int i = 0; i < probs.length; i++) {
String id = probs[i].getId();
String s = getPreferenceStore().getString(id);
+ if (s == null || s.length() == 0) {
+ s = codanPreferencesLoader.getProperty(id);
+ }
codanPreferencesLoader.setProperty(id, s);
}
getViewer().setInput(codanPreferencesLoader.getInput());
@@ -258,6 +280,9 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
for (int i = 0; i < probs.length; i++) {
String id = probs[i].getId();
String s = getPreferenceStore().getDefaultString(id);
+ if (s == null || s.length() == 0) {
+ s = codanPreferencesLoader.getProperty(id);
+ }
codanPreferencesLoader.setProperty(id, s);
}
getViewer().setInput(codanPreferencesLoader.getInput());
@@ -272,12 +297,17 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
*/
@Override
protected void doStore() {
- codanPreferencesLoader.setInput(getViewer().getInput());
+ codanPreferencesLoader.setInput((IProblemProfile) 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);
+ String params = codanPreferencesLoader.getPreferencesString(id);
+ if (params != null)
+ getPreferenceStore().setValue(
+ codanPreferencesLoader.getPreferencesKey(id), params);
}
}
@@ -301,6 +331,6 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
*/
@Override
protected String modelToString(Object model) {
- return "";
+ return ""; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Entries
new file mode 100644
index 0000000..58fdd77
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Entries
@@ -0,0 +1,3 @@
+/GenericCodanProblemDetailsProvider.java/1.2/Sat May 1 00:41:55 2010//TCDT_7_0_0
+/ProblemDetails.java/1.5/Wed May 5 20:48:28 2010//TCDT_7_0_0
+/ProblemDetailsExtensions.java/1.2/Sat May 1 00:41:55 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Repository
new file mode 100644
index 0000000..b01fe09
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/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/views/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/GenericCodanProblemDetailsProvider.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/GenericCodanProblemDetailsProvider.java
new file mode 100644
index 0000000..0afb53c
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/GenericCodanProblemDetailsProvider.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.views;
+
+import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider;
+
+/**
+ * This provides details for errors that do not have own details provider
+ */
+public class GenericCodanProblemDetailsProvider extends AbstractCodanProblemDetailsProvider {
+ @Override
+ public boolean isApplicable(String id) {
+ return true;
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetails.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetails.java
new file mode 100644
index 0000000..3f164af
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetails.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.views;
+
+import java.util.Collection;
+
+import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
+import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider;
+import org.eclipse.cdt.codan.ui.CodanEditorUtility;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+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.Composite;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * Problems Details view show details for selected problem marker.
+ * Other plugins can contribute to override default behaviour using
+ * codanProblemDetails extension point.
+ */
+public class ProblemDetails extends ViewPart {
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.eclipse.cdt.codan.internal.ui.views.ProblemDetails"; //$NON-NLS-1$
+ private Composite area;
+ /**
+ * Control for problem message, which can include location
+ */
+ private Link message;
+ /**
+ * Control for problem description which can include links to help or web-sites with extra info
+ */
+ private Link description;
+ private GenericCodanProblemDetailsProvider genProvider = new GenericCodanProblemDetailsProvider();
+ private AbstractCodanProblemDetailsProvider curProvider = genProvider;
+
+ /**
+ * The constructor.
+ */
+ public ProblemDetails() {
+ }
+
+ /**
+ * This is a callback that will allow us
+ * to create the area and initialize it.
+ */
+ public void createPartControl(Composite parent) {
+ final String problemsViewId = "org.eclipse.ui.views.ProblemView"; //$NON-NLS-1$
+ area = new Composite(parent, SWT.NONE);
+ area.setLayout(new GridLayout());
+ SelectionAdapter linkSelAdapter = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String link = e.text;
+ if (link == null)
+ return;
+ if (link.startsWith("http")) { //$NON-NLS-1$
+ org.eclipse.swt.program.Program.launch(e.text);
+ return;
+ }
+ // link file format example "file:/tmp/file.c#42", 42 is the line number
+ if (link.startsWith("file:")) { //$NON-NLS-1$
+ try {
+ CodanEditorUtility.openInEditor(link, curProvider.getMarker().getResource());
+ } catch (PartInitException e1) {
+ CodanUIActivator.log(e1);
+ }
+ return;
+ }
+ if (link.startsWith("help:")) { //$NON-NLS-1$
+ // open in eclipse help TODO
+ return;
+ }
+ }
+ };
+ message = new Link(area, SWT.WRAP);
+ message.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ message.addSelectionListener(linkSelAdapter);
+ description = new Link(area, SWT.WRAP);
+ description.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ description.addSelectionListener(linkSelAdapter);
+ ISelectionService ser = (ISelectionService) getSite().getService(ISelectionService.class);
+ ser.addSelectionListener(new ISelectionListener() {
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (part.getSite().getId().equals(problemsViewId)) {
+ processSelection(selection);
+ }
+ }
+ });
+ ISelection selection = ser.getSelection(problemsViewId);
+ processSelection(selection);
+ }
+
+ protected void processSelection(ISelection selection) {
+ if (selection == null || selection.isEmpty())
+ return;
+ if (selection instanceof IStructuredSelection) {
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ IMarker marker = null;
+ if (firstElement instanceof IAdaptable) {
+ marker = (IMarker) ((IAdaptable) firstElement).getAdapter(IMarker.class);
+ } else if (firstElement instanceof IMarker) {
+ marker = (IMarker) firstElement;
+ }
+ if (marker != null) {
+ queryProviders(marker);
+ area.layout();
+ }
+ }
+ }
+
+ private void queryProviders(IMarker marker) {
+ String id = marker.getAttribute(IMarker.PROBLEM, "id"); //$NON-NLS-1$
+ Collection<AbstractCodanProblemDetailsProvider> providers = ProblemDetailsExtensions.getProviders(id);
+ for (AbstractCodanProblemDetailsProvider provider : providers) {
+ synchronized (provider) {
+ provider.setMarker(marker);
+ if (provider.isApplicable(id)) {
+ applyProvider(provider);
+ return;
+ }
+ }
+ }
+ genProvider.setMarker(marker);
+ applyProvider(genProvider);
+ }
+
+ private void applyProvider(AbstractCodanProblemDetailsProvider provider) {
+ curProvider = provider;
+ setTextSafe(message, provider, provider.getStyledProblemMessage());
+ setTextSafe(description, provider, provider.getStyledProblemDescription());
+ }
+
+ protected void setTextSafe(Link control, AbstractCodanProblemDetailsProvider provider, String text) {
+ try {
+ control.setText(text);
+ } catch (Exception e) {
+ // this is debug message
+ control.setText("failed to set text: " + provider.getClass() + " " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * Passing the focus request to the area's control.
+ */
+ public void setFocus() {
+ message.setFocus();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetailsExtensions.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetailsExtensions.java
new file mode 100644
index 0000000..689d9d8
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetailsExtensions.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.views;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
+import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Class that can load extension for problemDetails
+ */
+public class ProblemDetailsExtensions {
+ public static final String ALL = "*";//$NON-NLS-1$
+ private static final String EXTENSION_POINT_NAME = "codanProblemDetails"; //$NON-NLS-1$
+ private static boolean extensionsLoaded;
+ private static HashMap<String, Collection<?>> map = new HashMap<String, Collection<?>>();
+
+ private static synchronized void readExtensions() {
+ if (extensionsLoaded) return;
+ IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(CodanUIActivator.PLUGIN_ID, EXTENSION_POINT_NAME);
+ if (ep == null)
+ return;
+ try {
+ IConfigurationElement[] elements = ep.getConfigurationElements();
+ // process categories
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement configurationElement = elements[i];
+ processDetails(configurationElement);
+ }
+ } finally {
+ extensionsLoaded = true;
+ }
+ }
+
+ /**
+ * @param configurationElement
+ */
+ private static void processDetails(IConfigurationElement configurationElement) {
+ if (configurationElement.getName().equals("problemDetails")) { //$NON-NLS-1$
+ String id = configurationElement.getAttribute("problemId"); //$NON-NLS-1$
+ if (id == null) {
+ id = ALL;
+ }
+ addExtension(id, configurationElement);
+ }
+ }
+
+ public static AbstractCodanProblemDetailsProvider resolveClass(IConfigurationElement configurationElement) {
+ AbstractCodanProblemDetailsProvider res;
+ try {
+ res = (AbstractCodanProblemDetailsProvider) configurationElement.createExecutableExtension("class");//$NON-NLS-1$
+ } catch (CoreException e) {
+ CodanUIActivator.log(e);
+ return null;
+ }
+ return res;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ private static void addExtension(String id, IConfigurationElement configurationElement) {
+ Collection collection = getCollection(id);
+ collection.add(configurationElement);
+ }
+
+ /**
+ * Remove provider from the list
+ * @param id - codan problem id or ALL
+ * @param el - details provider (class extending AbstractCodanProblemDetailsProvider) or ElementConfiguration (user internally)
+ */
+ @SuppressWarnings("rawtypes")
+ public static void removeExtension(String id, Object el) {
+ Collection collection = getCollection(id);
+ collection.remove(el);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static Collection getCollection(String id) {
+ Collection collection = map.get(id);
+ if (collection == null) {
+ collection = new ArrayList();
+ map.put(id, collection);
+ }
+ return collection;
+ }
+
+ public static Collection<AbstractCodanProblemDetailsProvider> getProviders(String id) {
+ readExtensions();
+ Collection<AbstractCodanProblemDetailsProvider> providers = new ArrayList<AbstractCodanProblemDetailsProvider>();
+ Collection<?> collection1 = getCollection(id);
+ Collection<?> collection2 = getCollection(ALL);
+ providers.addAll(resolveProviders(collection1));
+ providers.addAll(resolveProviders(collection2));
+ return providers;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public static Collection<AbstractCodanProblemDetailsProvider> resolveProviders(Collection collection) {
+ Collection res = new ArrayList(collection);
+ for (Iterator iterator = res.iterator(); iterator.hasNext();) {
+ Object object = iterator.next();
+ if (object instanceof IConfigurationElement) {
+ // resolve
+ collection.remove(object);
+ AbstractCodanProblemDetailsProvider provider = resolveClass((IConfigurationElement) object);
+ if (provider!=null)
+ collection.add(provider);
+ }
+ }
+ return collection;
+ }
+
+ /**
+ * Add extension (details provider) using API
+ * @param id - codan problem id or ALL
+ * @param provider - class extending AbstractCodanProblemDetailsProvider
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public static void addExtension(String id, AbstractCodanProblemDetailsProvider provider) {
+ Collection collection = getCollection(id);
+ collection.add(provider);
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/BasicElementLabels.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/BasicElementLabels.java
new file mode 100644
index 0000000..cc2f966
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/BasicElementLabels.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Alena Laskavaia 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:
+ * Alena Laskavaia - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.internal.ui.widgets;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.osgi.util.TextProcessor;
+import org.eclipse.ui.IWorkingSet;
+
+/**
+ * A label provider for basic elements like paths. The label provider will make
+ * sure that the labels are correctly
+ * shown in RTL environments.
+ *
+ * @since 3.4
+ */
+public class BasicElementLabels {
+ // TextProcessor delimiters
+ private static final String CODE_DELIMITERS = TextProcessor
+ .getDefaultDelimiters() + "<>()?,{}+-*!%=^|&;[]~"; //$NON-NLS-1$
+ private static final String FILE_PATTERN_DELIMITERS = TextProcessor
+ .getDefaultDelimiters() + "*.?"; //$NON-NLS-1$
+ private static final String URL_DELIMITERS = TextProcessor
+ .getDefaultDelimiters() + ":@?-"; //$NON-NLS-1$
+
+ /**
+ * Returns the label of a path.
+ *
+ * @param path
+ * the path
+ * @param isOSPath
+ * if <code>true</code>, the path represents an OS path, if
+ * <code>false</code> it is a workspace path.
+ * @return the label of the path to be used in the UI.
+ */
+ public static String getPathLabel(IPath path, boolean isOSPath) {
+ String label;
+ if (isOSPath) {
+ label = path.toOSString();
+ } else {
+ label = path.makeRelative().toString();
+ }
+ return markLTR(label);
+ }
+
+ /**
+ * Returns the label of the path of a file.
+ *
+ * @param file
+ * the file
+ * @return the label of the file path to be used in the UI.
+ */
+ public static String getPathLabel(File file) {
+ return markLTR(file.getAbsolutePath());
+ }
+
+ /**
+ * Returns the label for a file pattern like '*.java'
+ *
+ * @param name
+ * the pattern
+ * @return the label of the pattern.
+ */
+ public static String getFilePattern(String name) {
+ return markLTR(name, FILE_PATTERN_DELIMITERS);
+ }
+
+ /**
+ * Returns the label for a URL, URI or URL part. Example is
+ * 'http://www.x.xom/s.html#1'
+ *
+ * @param name
+ * the URL string
+ * @return the label of the URL.
+ */
+ public static String getURLPart(String name) {
+ return markLTR(name, URL_DELIMITERS);
+ }
+
+ /**
+ * Returns a label for a resource name.
+ *
+ * @param resource
+ * the resource
+ * @return the label of the resource name.
+ */
+ public static String getResourceName(IResource resource) {
+ return markLTR(resource.getName());
+ }
+
+ /**
+ * Returns a label for a resource name.
+ *
+ * @param resourceName
+ * the resource name
+ * @return the label of the resource name.
+ */
+ public static String getResourceName(String resourceName) {
+ return markLTR(resourceName);
+ }
+
+ /**
+ * Returns a label for Java code snippet used in a label. Example is 'Test
+ * test= new Test<? extends List>() { ...}'.
+ *
+ * @param string
+ * the Java code snippet
+ * @return the label for the Java code snippet
+ */
+ public static String getJavaCodeString(String string) {
+ return markLTR(string, CODE_DELIMITERS);
+ }
+
+ /**
+ * Returns a label for a version name. Example is '1.4.1'
+ *
+ * @param name
+ * the version string
+ * @return the version label
+ */
+ public static String getVersionName(String name) {
+ return markLTR(name);
+ }
+
+ /**
+ * Returns a label for a working set
+ *
+ * @param set
+ * the working set
+ * @return the label of the working set
+ */
+ public static String getWorkingSetLabel(IWorkingSet set) {
+ return markLTR(set.getLabel());
+ }
+
+ /**
+ * It does not do anything now, but just in case we need to do the same as
+ * JDT does (see String.markLTR in JDT)
+ */
+ private static String markLTR(String label) {
+ return label;
+ }
+
+ private static String markLTR(String label, String delim) {
+ return label;
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Entries
new file mode 100644
index 0000000..6bad80f
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Entries
@@ -0,0 +1,4 @@
+/BasicElementLabels.java/1.2/Thu Jun 3 17:01:40 2010//TCDT_7_0_0
+/CustomizeProblemComposite.java/1.2/Thu Jun 3 17:01:40 2010//TCDT_7_0_0
+/FileScopeComposite.java/1.2/Thu Jun 3 17:01:40 2010//TCDT_7_0_0
+/ParametersComposite.java/1.2/Thu Jun 3 17:01:40 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Repository b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Repository
new file mode 100644
index 0000000..905430a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Repository
@@ -0,0 +1 @@
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/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/widgets/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CustomizeProblemComposite.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CustomizeProblemComposite.java
new file mode 100644
index 0000000..32ba550
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/CustomizeProblemComposite.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 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.widgets;
+
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
+import org.eclipse.core.resources.IResource;
+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.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+
+/**
+ * Composite for problem customisable parameters
+ *
+ */
+public class CustomizeProblemComposite extends Composite {
+ private Composite parametersTab;
+ private IProblem problem;
+ private ParametersComposite problemsComposite;
+ private FileScopeComposite scopeComposite;
+ private IResource resource;
+
+ /**
+ * @param parent
+ * @param selectedProblem
+ * @param resource
+ * @param style
+ */
+ public CustomizeProblemComposite(Composite parent,
+ IProblem selectedProblem, IResource resource) {
+ super(parent, SWT.NONE);
+ this.setLayout(new GridLayout(1, false));
+ this.problem = selectedProblem;
+ this.resource = resource;
+ final TabFolder tabFolder = new TabFolder(this, SWT.TOP);
+ tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ // createMainTab(tabFolder);
+ createParamtersTab(tabFolder);
+ createScopeTab(tabFolder);
+ }
+
+ public void save(IProblemWorkingCopy problem) {
+ problemsComposite.save(problem);
+ scopeComposite.save(problem);
+ }
+
+ /**
+ * @param tabFolder
+ */
+ private void createParamtersTab(TabFolder tabFolder) {
+ TabItem tabItem1 = new TabItem(tabFolder, SWT.NULL);
+ tabItem1.setText(CodanUIMessages.CustomizeProblemComposite_TabParameters);
+ parametersTab = new Composite(tabFolder, SWT.NONE);
+ tabItem1.setControl(parametersTab);
+ parametersTab.setLayout(new GridLayout());
+ problemsComposite = new ParametersComposite(parametersTab, problem);
+ problemsComposite.setLayoutData(new GridData(SWT.BEGINNING,
+ SWT.BEGINNING, true, false));
+ }
+
+ /**
+ * @param tabFolder
+ */
+ private void createScopeTab(TabFolder tabFolder) {
+ TabItem tabItem1 = new TabItem(tabFolder, SWT.NULL);
+ tabItem1.setText(CodanUIMessages.CustomizeProblemComposite_TabScope);
+ Composite comp = new Composite(tabFolder, SWT.NONE);
+ tabItem1.setControl(comp);
+ comp.setLayout(new GridLayout());
+ scopeComposite = new FileScopeComposite(comp, problem, resource);
+ scopeComposite.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,
+ true, false));
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/FileScopeComposite.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/FileScopeComposite.java
new file mode 100644
index 0000000..1a8536c
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/FileScopeComposite.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 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.widgets;
+
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
+import org.eclipse.cdt.codan.core.param.FileScopeProblemPreference;
+import org.eclipse.cdt.codan.core.param.IProblemPreference;
+import org.eclipse.cdt.codan.core.param.MapProblemPreference;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
+import org.eclipse.cdt.codan.internal.ui.preferences.FileScopePreferencePage;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.preference.PreferenceStore;
+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.Label;
+
+/**
+ * Composite to show problem scope
+ *
+ */
+public class FileScopeComposite extends Composite {
+ private FileScopePreferencePage page;
+ private IProblem problem;
+ private PreferenceStore prefStore;
+ private FileScopeProblemPreference scope;
+
+ /**
+ * @param parent
+ * @param problem
+ * @param resource
+ * @param style
+ */
+ public FileScopeComposite(Composite parent, final IProblem problem,
+ IResource resource) {
+ super(parent, SWT.NONE);
+ if (problem == null)
+ throw new NullPointerException();
+ this.setLayout(new GridLayout(2, false));
+ this.problem = problem;
+ this.prefStore = new PreferenceStore();
+ IProblemPreference info = problem.getPreference();
+ FileScopeProblemPreference scopeIn = null;
+ if (info == null
+ || (!(info instanceof MapProblemPreference))
+ || ((scopeIn = (FileScopeProblemPreference) ((MapProblemPreference) info)
+ .getChildDescriptor(FileScopeProblemPreference.KEY)) == null)) {
+ Label label = new Label(this, 0);
+ label.setText(CodanUIMessages.ParametersComposite_None);
+ return;
+ }
+ scope = (FileScopeProblemPreference) scopeIn.clone();
+ scope.setResource(resource);
+ initPrefStore();
+ page = new FileScopePreferencePage(scope);
+ page.setPreferenceStore(prefStore);
+ page.noDefaultAndApplyButton();
+ page.createControl(parent);
+ page.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+
+ public void save(IProblemWorkingCopy problem) {
+ if (page != null)
+ page.performOk();
+ savePrefStore();
+ }
+
+ private void savePrefStore() {
+ if (scope == null)
+ return;
+ String key = scope.getQualifiedKey();
+ ((MapProblemPreference) problem.getPreference()).setChildValue(
+ FileScopeProblemPreference.KEY, scope);
+ prefStore.setValue(key, scope.exportValue());
+ }
+
+ private void initPrefStore() {
+ if (scope == null)
+ return;
+ String key = scope.getQualifiedKey();
+ prefStore.setValue(key, scope.exportValue());
+ }
+
+ /**
+ * @return the problem
+ */
+ public IProblem getProblem() {
+ return problem;
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/ParametersComposite.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/ParametersComposite.java
new file mode 100644
index 0000000..26e58fc
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/widgets/ParametersComposite.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 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.widgets;
+
+import java.io.File;
+
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
+import org.eclipse.cdt.codan.core.param.FileScopeProblemPreference;
+import org.eclipse.cdt.codan.core.param.IProblemPreference;
+import org.eclipse.cdt.codan.core.param.IProblemPreferenceCompositeDescriptor;
+import org.eclipse.cdt.codan.core.param.ListProblemPreference;
+import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.jface.preference.ListEditor;
+import org.eclipse.jface.preference.PreferenceStore;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.jface.window.Window;
+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.Label;
+
+/**
+ * Composite to show problem preferences
+ *
+ */
+public class ParametersComposite extends Composite {
+ private FieldEditorPreferencePage page;
+ private IProblem problem;
+ private PreferenceStore prefStore;
+
+ /**
+ * @param parent
+ * @param problem
+ * @param style
+ */
+ public ParametersComposite(Composite parent, final IProblem problem) {
+ super(parent, SWT.NONE);
+ if (problem == null)
+ throw new NullPointerException();
+ this.setLayout(new GridLayout(2, false));
+ this.problem = problem;
+ this.prefStore = new PreferenceStore();
+ page = new FieldEditorPreferencePage() {
+ @Override
+ protected void createFieldEditors() {
+ noDefaultAndApplyButton();
+ IProblemPreference pref = problem.getPreference();
+ createFieldEditorsForParameters(pref);
+ }
+
+ /**
+ * @param info
+ */
+ private void createFieldEditorsForParameters(
+ final IProblemPreference info) {
+ if (info == null)
+ return;
+ if (info.getKey() == FileScopeProblemPreference.KEY)
+ return; // skip the scope
+ switch (info.getType()) {
+ case TYPE_STRING: {
+ StringFieldEditor fe = new StringFieldEditor(
+ info.getQualifiedKey(), info.getLabel(),
+ getFieldEditorParent());
+ addField(fe);
+ break;
+ }
+ case TYPE_BOOLEAN: {
+ BooleanFieldEditor fe = new BooleanFieldEditor(
+ info.getQualifiedKey(), info.getLabel(),
+ getFieldEditorParent());
+ addField(fe);
+ break;
+ }
+ case TYPE_LIST:
+ ListEditor le = new ListEditor(info.getQualifiedKey(),
+ info.getLabel(), getFieldEditorParent()) {
+ @Override
+ protected String[] parseString(String stringList) {
+ ListProblemPreference list = (ListProblemPreference) info;
+ IProblemPreference[] childDescriptors = list
+ .getChildDescriptors();
+ if (childDescriptors.length == 0)
+ return new String[0];
+ String res[] = new String[childDescriptors.length];
+ for (int i = 0; i < childDescriptors.length; i++) {
+ IProblemPreference item = childDescriptors[i];
+ res[i] = String.valueOf(item.getValue());
+ }
+ return res;
+ }
+
+ @Override
+ protected String getNewInputObject() {
+ ListProblemPreference list = (ListProblemPreference) info;
+ String label = list.getChildDescriptor()
+ .getLabel();
+ InputDialog dialog = new InputDialog(
+ getShell(),
+ CodanUIMessages.ParametersComposite_NewValue,
+ label, "", null); //$NON-NLS-1$
+ if (dialog.open() == Window.OK) {
+ return dialog.getValue();
+ }
+ return null;
+ }
+
+ @Override
+ protected String createList(String[] items) {
+ ListProblemPreference list = (ListProblemPreference) info
+ .clone();
+ list.clear();
+ for (int i = 0; i < items.length; i++) {
+ String val = items[i];
+ list.addChildValue(val);
+ }
+ return list.exportValue();
+ }
+ };
+ addField(le);
+ break;
+ case TYPE_MAP:
+ IProblemPreference[] childrenDescriptor = ((IProblemPreferenceCompositeDescriptor) info)
+ .getChildDescriptors();
+ for (int i = 0; i < childrenDescriptor.length; i++) {
+ IProblemPreference desc = childrenDescriptor[i];
+ createFieldEditorsForParameters(desc);
+ }
+ break;
+ case TYPE_CUSTOM: {
+ StringFieldEditor fe = new StringFieldEditor(
+ info.getQualifiedKey(), info.getLabel(),
+ getFieldEditorParent());
+ addField(fe);
+ break;
+ }
+ case TYPE_FILE: {
+ FileFieldEditor fe = new FileFieldEditor(
+ info.getQualifiedKey(), info.getLabel(),
+ getFieldEditorParent());
+ addField(fe);
+ break;
+ }
+ default:
+ throw new UnsupportedOperationException(info.getType()
+ .toString());
+ }
+ }
+ };
+ IProblemPreference info = problem.getPreference();
+ if (info == null) {
+ Label label = new Label(this, 0);
+ label.setText(CodanUIMessages.ParametersComposite_None);
+ } else {
+ initPrefStore(info);
+ }
+ page.setPreferenceStore(prefStore);
+ page.createControl(parent);
+ page.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+
+ public void save(IProblemWorkingCopy problem) {
+ page.performOk();
+ savePrefStore(problem.getPreference());
+ }
+
+ private void savePrefStore(IProblemPreference desc) {
+ if (desc == null)
+ return;
+ String key = desc.getQualifiedKey();
+ switch (desc.getType()) {
+ case TYPE_STRING:
+ desc.setValue(prefStore.getString(key));
+ break;
+ case TYPE_BOOLEAN:
+ desc.setValue(prefStore.getBoolean(key));
+ break;
+ case TYPE_INTEGER:
+ desc.setValue(prefStore.getInt(key));
+ break;
+ case TYPE_FILE:
+ desc.setValue(new File(prefStore.getString(key)));
+ break;
+ case TYPE_LIST:
+ desc.importValue(prefStore.getString(key));
+ break;
+ case TYPE_CUSTOM:
+ desc.importValue(prefStore.getString(key));
+ break;
+ case TYPE_MAP:
+ IProblemPreference[] childrenDescriptor = ((IProblemPreferenceCompositeDescriptor) desc)
+ .getChildDescriptors();
+ for (int i = 0; i < childrenDescriptor.length; i++) {
+ IProblemPreference chi = childrenDescriptor[i];
+ savePrefStore(chi);
+ }
+ break;
+ default:
+ throw new UnsupportedOperationException(desc.getType()
+ .toString());
+ }
+ }
+
+ private void initPrefStore(IProblemPreference desc) {
+ if (desc == null)
+ return;
+ String key = desc.getQualifiedKey();
+ switch (desc.getType()) {
+ case TYPE_STRING:
+ prefStore.setValue(key, (String) desc.getValue());
+ break;
+ case TYPE_BOOLEAN:
+ prefStore.setValue(key, (Boolean) desc.getValue());
+ break;
+ case TYPE_INTEGER:
+ prefStore.setValue(key, (Integer) desc.getValue());
+ break;
+ case TYPE_FILE:
+ prefStore.setValue(key, ((File) desc.getValue()).getPath());
+ break;
+ case TYPE_LIST:
+ prefStore.setValue(key, desc.exportValue());
+ break;
+ case TYPE_CUSTOM:
+ prefStore.setValue(key, desc.exportValue());
+ break;
+ case TYPE_MAP:
+ IProblemPreference[] childrenDescriptor = ((IProblemPreferenceCompositeDescriptor) desc)
+ .getChildDescriptors();
+ for (int i = 0; i < childrenDescriptor.length; i++) {
+ IProblemPreference chi = childrenDescriptor[i];
+ initPrefStore(chi);
+ }
+ break;
+ default:
+ throw new UnsupportedOperationException(desc.getType()
+ .toString());
+ }
+ }
+
+ /**
+ * @return the problem
+ */
+ public IProblem getProblem() {
+ return problem;
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstarctCodanCMarkerResolution.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstarctCodanCMarkerResolution.java
new file mode 100644
index 0000000..6a36763
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstarctCodanCMarkerResolution.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 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.internal.ui.CodanUIActivator;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IMarkerResolution2;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Generic class for codan marker resolution (for quick fix). Use as a base
+ * class for codanMarkerResolution extension. To add specific icon and
+ * description client class should additionally implement
+ * {@link IMarkerResolution2}
+ */
+public abstract class AbstarctCodanCMarkerResolution implements IMarkerResolution {
+ /**
+ * Get position offset from marker. If CHAR_START attribute is not set for
+ * marker, line and document would be used.
+ *
+ * @param marker
+ * @param doc
+ * @return
+ */
+ public int getOffset(IMarker marker, IDocument doc) {
+ int charStart = marker.getAttribute(IMarker.CHAR_START, -1);
+ int position;
+ if (charStart > 0) {
+ position = charStart;
+ } else {
+ int line = marker.getAttribute(IMarker.LINE_NUMBER, -1) - 1;
+ try {
+ position = doc.getLineOffset(line);
+ } catch (BadLocationException e) {
+ return -1;
+ }
+ }
+ return position;
+ }
+
+ /**
+ * Runs this resolution.
+ *
+ * @param marker
+ * the marker to resolve
+ */
+ public void run(IMarker marker) {
+ IEditorPart editorPart;
+ try {
+ editorPart = CodanEditorUtility.openInEditor(marker);
+ } catch (PartInitException e) {
+ CodanUIActivator.log(e);
+ return;
+ }
+ if (editorPart instanceof ITextEditor) {
+ ITextEditor editor = (ITextEditor) editorPart;
+ IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+ apply(marker, doc);
+ }
+ }
+
+ /**
+ * Apply marker resolution for given marker in given open document.
+ *
+ * @param marker
+ * @param document
+ */
+ public abstract void apply(IMarker marker, IDocument document);
+
+ /**
+ * Override is extra checks is required to determine appicablity of marker resolution
+ * @param marker
+ * @return
+ */
+ public boolean isApplicable(IMarker marker) {
+ return true;
+ }
+}
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanProblemDetailsProvider.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanProblemDetailsProvider.java
new file mode 100644
index 0000000..4fff924
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanProblemDetailsProvider.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.codan.core.model.IProblem;
+import org.eclipse.core.resources.IMarker;
+
+/**
+ * Abstract class that provides stubs for problems details.
+ * This class intended to be extended by the users of codanProblemDetails extension point.
+ * One instance of this class would exists at runtime. To query for results, framework
+ * would synchronize on this class object, set setMarker then call other getStyled* methods
+ * to obtain data.
+ */
+public abstract class AbstractCodanProblemDetailsProvider {
+ protected IMarker marker;
+
+ public AbstractCodanProblemDetailsProvider() {
+ }
+
+ /**
+ * sets the marker, called from framework to initialize provider
+ */
+ public void setMarker(IMarker marker) {
+ this.marker = marker;
+ }
+
+ /**
+ * Get marker associated with this provider
+ * @return
+ */
+ public IMarker getMarker() {
+ return marker;
+ }
+
+ /**
+ * Convenience method to return marker message
+ * @return
+ */
+ protected String getProblemMessage() {
+ String message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
+ return message;
+ }
+
+ /**
+ * Convenience method to return codan problem id
+ * @return
+ */
+ protected String getProblemId() {
+ String id = marker.getAttribute(IMarker.PROBLEM, (String) null);
+ return id;
+ }
+
+ /**
+ * return true if provider can provide details for given marker (previously set by setMarker)
+ * @param id - id of the problem
+ * @return true if details are available for given marker
+ */
+ public abstract boolean isApplicable(String id);
+
+ /**
+ * Return styled problem message. This text would be used in Link widget.
+ * String can include <a> tags to which would be
+ * visible as hyperlinks and newline characters (\n). Default message if
+ * marker message plus location. Ampersand (&) should be escape because
+ * it is interpreted as mnemonic for control navigation (can use espaceForLink method). <br>
+ * This method intended to be overriden by the client.
+ */
+ public String getStyledProblemMessage() {
+ String message = escapeForLink(getProblemMessage());
+ String href = getLocationHRef();
+ String link = href.replaceFirst("^file:", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ link = link.replaceFirst("#(\\d+)$", ":$1"); //$NON-NLS-1$//$NON-NLS-2$
+ return "<a href=\"" + href + "\">" + link + "</a> \n" + message; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+ protected String getLocationHRef() {
+ return CodanEditorUtility.getLocationHRef(marker);
+ }
+ /**
+ * Return styled problem description. This text would be used in Link widget.
+ * String can include <a> tags to which would be
+ * visible as hyperlinks and newline characters (\n).
+ * Ampersand (&) should be escape because
+ * it is interpreted as mnemonic for control navigation (can use espaceForLink method).
+ *
+ * Default implementation return desciption of codan problem. <br>
+ * This method intended to be overriden by the client.
+ *
+ */
+ public String getStyledProblemDescription() {
+ String id = getProblemId();
+ if (id == null)
+ return ""; //$NON-NLS-1$
+ IProblem problem = CodanRuntime.getInstance().getChechersRegistry().getDefaultProfile().findProblem(id);
+ return escapeForLink(problem.getDescription());
+ }
+
+ /**
+ * Method to escape characters which are interpreted by Link swt control,
+ * such as & (mnemonic)
+ */
+ protected String escapeForLink(String text) {
+ return text.replaceAll("&", "&&"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+}
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
index 4387fb2..e02c292 100644
--- 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
@@ -1,4 +1,6 @@
-/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//
+/AbstarctCodanCMarkerResolution.java/1.4/Thu Jun 3 17:01:40 2010//TCDT_7_0_0
+/AbstractCodanProblemDetailsProvider.java/1.7/Sat May 8 01:19:46 2010//TCDT_7_0_0
+/CodanEditorUtility.java/1.1/Wed May 5 19:59:17 2010//TCDT_7_0_0
D/actions////
+D/handlers////
+D/views////
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
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
deleted file mode 100644
index 5bec1c1..0000000
--- a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanCReconciler.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * 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/CodanEditorUtility.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanEditorUtility.java
new file mode 100644
index 0000000..1cdc5ef
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/CodanEditorUtility.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * $QNXLicenseC:
+ * Copyright 2008, QNX Software Systems. All Rights Reserved.
+ *
+ * You must obtain a written license from and pay applicable license fees to QNX
+ * Software Systems before you may reproduce, modify or distribute this software,
+ * or any work that includes all or part of this software. Free development
+ * licenses are available for evaluation and non-commercial purposes. For more
+ * information visit http://licensing.qnx.com or email licensing@qnx.com.
+ *
+ * This file may contain contributions from others. Please review this entire
+ * file for other proprietary rights or license notices, as well as the QNX
+ * Development Suite License Guide at http://licensing.qnx.com/license-guide/
+ * for other information.
+ * $
+ *******************************************************************************/
+/*
+ * Created by: Elena Laskavaia
+ * Created on: 2010-05-05
+ * Last modified by: $Author: elaskavaia $
+ */
+package org.eclipse.cdt.codan.ui;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.internal.ui.util.EditorUtility;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Utility tools to open editor and highlight the line
+ */
+public class CodanEditorUtility {
+ /**
+ * @param fileUrl - file "url", like file:/tmp/a.c#22
+ * @throws PartInitException
+ * @throws BadLocationException
+ */
+ public static void openFileURL(String fileUrl, IResource markerResource) throws PartInitException, BadLocationException {
+ String file = getFileFromURL(fileUrl);
+
+ IEditorPart part = openInEditor(file, markerResource);
+ int line = getLineFromURL(fileUrl);
+ revealLine(part, line);
+ }
+
+ /**
+ * Line is the part the follows # in this URL
+ * @return -1 if not line found in URL, and line number if there is
+ */
+ public static int getLineFromURL(String fileUrl) {
+ String sline = fileUrl.replaceAll(".*#(\\d+)$", "$1"); //$NON-NLS-1$ //$NON-NLS-2$
+ int line = -1;
+ try {
+ line = Integer.parseInt(sline);
+ } catch (NumberFormatException e2) {
+ // no line
+ }
+ return line;
+ }
+
+ public static String getFileFromURL(String link) {
+ String file = link.replaceFirst("^file:", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ file = file.replaceAll("#\\d+$", ""); //$NON-NLS-1$//$NON-NLS-2$
+ return file;
+ }
+
+ public static void revealLine(IEditorPart part, int line) throws BadLocationException {
+ if (line > 0) {
+ if (part instanceof ITextEditor) {
+ ITextEditor textEditor = (ITextEditor) part;
+ IDocument document = textEditor.getDocumentProvider().getDocument(part.getEditorInput());
+ textEditor.selectAndReveal(document.getLineOffset(line - 1), 0);
+ }
+ }
+ }
+
+ @SuppressWarnings("restriction")
+ public static IEditorPart openInEditor(String file, IResource markerResource) throws PartInitException {
+ IPath pfile = new Path(file);
+ ICElement element = null;
+ if (markerResource != null)
+ CoreModel.getDefault().create(markerResource);
+ IEditorPart part = EditorUtility.openInEditor(pfile, element);
+ return part;
+ }
+
+ public static IEditorPart openInEditor(IMarker marker) throws PartInitException {
+ String href = getLocationHRef(marker);
+ String file = getFileFromURL(href);
+ return openInEditor(file, marker.getResource());
+ }
+
+ public static String getLocationHRef(IMarker marker) {
+ String loc = marker.getResource().getLocationURI().toString();
+ String loc2 = marker.getAttribute(IMarker.LOCATION, ""); //$NON-NLS-1$
+ int line = marker.getAttribute(IMarker.LINE_NUMBER, 0);
+ if (loc2.length() > 0) {
+ loc = "file:" + loc2.replaceAll("[^:]*: ", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ String href = loc + "#" + line; //$NON-NLS-1$
+ return href;
+ }
+}
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
deleted file mode 100644
index 41fbf89..0000000
--- a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/Startup.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index 30cf7ec..0000000
--- a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions/CVS/Entries
+++ /dev/null
@@ -1,2 +0,0 @@
-/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/handlers/CVS/Entries b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Entries
new file mode 100644
index 0000000..8a29f40
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Entries
@@ -0,0 +1 @@
+/RunCodanCommand.java/1.3/Thu Jun 3 17:01:40 2010//TCDT_7_0_0
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/handlers/CVS/Repository
index 09c1aeb..c8ef8af 100644
--- 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/handlers/CVS/Repository
@@ -1 +1 @@
-org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/actions
+org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Root b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Root
new file mode 100644
index 0000000..04efa23
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/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/handlers/CVS/Tag b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/RunCodanCommand.java b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/RunCodanCommand.java
new file mode 100644
index 0000000..d0999a8
--- /dev/null
+++ b/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/handlers/RunCodanCommand.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Alena Laskavaia 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:
+ * Alena Laskavaia - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.ui.handlers;
+
+import org.eclipse.cdt.codan.internal.ui.actions.RunCodeAnalysis;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Command to run code analysis on selected resources
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class RunCodanCommand extends AbstractHandler {
+
+ public RunCodanCommand() {
+ }
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+ RunCodeAnalysis action = new RunCodeAnalysis();
+ action.selectionChanged(null, currentSelection);
+ action.run(null);
+ return null;
+ }
+}