### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.ui Index: ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java,v retrieving revision 1.124 diff -u -r1.124 PreferencesMessages.java --- ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java 13 Jan 2010 19:43:00 -0000 1.124 +++ ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java 26 Feb 2010 14:34:29 -0000 @@ -397,6 +397,7 @@ public static String ProblemSeveritiesConfigurationBlock_pb_unused_local_label; public static String ProblemSeveritiesConfigurationBlock_pb_unused_parameter_label; public static String ProblemSeveritiesConfigurationBlock_pb_signal_param_in_overriding_label; + public static String ProblemSeveritiesConfigurationBlock_pb_suppress_optional_errors_label; public static String ProblemSeveritiesConfigurationBlock_pb_unused_private_label; public static String ProblemSeveritiesConfigurationBlock_pb_non_externalized_strings_label; public static String ProblemSeveritiesConfigurationBlock_pb_dead_code; Index: ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties,v retrieving revision 1.499 diff -u -r1.499 PreferencesMessages.properties --- ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties 19 Feb 2010 10:23:47 -0000 1.499 +++ ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties 26 Feb 2010 14:34:29 -0000 @@ -351,7 +351,7 @@ JavaBuildConfigurationBlock_needsbuild_title=Building Settings Changed JavaBuildConfigurationBlock_needsfullbuild_message=The Building settings have changed. A full rebuild is required for changes to take effect. Do the full build now? -ProblemSeveritiesConfigurationBlock_treat_optional_as_fatal=Treat errors like &fatal compiler errors (make compiled code not executable) +ProblemSeveritiesConfigurationBlock_treat_optional_as_fatal=Treat optional errors like &fatal compiler errors (make compiled code not executable) JavaBuildConfigurationBlock_needsprojectbuild_message=The Building settings have changed. A rebuild of the project is required for changes to take effect. Build the project now? JavaBuildConfigurationBlock_resource_filter_description=Filtered resources are not copied to the output folder during a build. List is comma separated (e.g. '*.doc, plugin.xml, scripts/') @@ -424,6 +424,7 @@ ProblemSeveritiesConfigurationBlock_pb_unused_local_label=&Local variable is never read: ProblemSeveritiesConfigurationBlock_pb_unused_parameter_label=Parameter is never read: ProblemSeveritiesConfigurationBlock_pb_signal_param_in_overriding_label=Ignore in overriding and implementing methods +ProblemSeveritiesConfigurationBlock_pb_suppress_optional_errors_label=Suppress optional errors with '@SuppressWarnings' ProblemSeveritiesConfigurationBlock_pb_unused_private_label=Unused local or private member: ProblemSeveritiesConfigurationBlock_pb_parameter_assignment=Parameter assignment: ProblemSeveritiesConfigurationBlock_pb_redundant_null_check=Redundant null check: Index: ui/org/eclipse/jdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java,v retrieving revision 1.57 diff -u -r1.57 ProblemSeveritiesConfigurationBlock.java --- ui/org/eclipse/jdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java 13 Jan 2010 19:43:00 -0000 1.57 +++ ui/org/eclipse/jdt/internal/ui/preferences/ProblemSeveritiesConfigurationBlock.java 26 Feb 2010 14:34:29 -0000 @@ -103,6 +103,7 @@ private static final Key PREF_15_PB_RAW_TYPE_REFERENCE= getJDTCoreKey(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE); private static final Key PREF_PB_SUPPRESS_WARNINGS= getJDTCoreKey(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS); + private static final Key PREF_PB_SUPPRESS_OPTIONAL_ERRORS= getJDTCoreKey(JavaCore.COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS); private static final Key PREF_PB_UNHANDLED_WARNING_TOKEN= getJDTCoreKey(JavaCore.COMPILER_PB_UNHANDLED_WARNING_TOKEN); private static final Key PREF_PB_FATAL_OPTIONAL_ERROR= getJDTCoreKey(JavaCore.COMPILER_PB_FATAL_OPTIONAL_ERROR); @@ -156,7 +157,9 @@ PREF_15_PB_ANNOTATION_SUPER_INTERFACE, PREF_15_PB_TYPE_PARAMETER_HIDING, PREF_15_PB_INCOMPLETE_ENUM_SWITCH, PREF_PB_MISSING_DEPRECATED_ANNOTATION, PREF_15_PB_RAW_TYPE_REFERENCE, PREF_PB_FATAL_OPTIONAL_ERROR, - PREF_PB_FORBIDDEN_REFERENCE, PREF_PB_DISCOURRAGED_REFERENCE, PREF_PB_SUPPRESS_WARNINGS, PREF_PB_UNHANDLED_WARNING_TOKEN, + PREF_PB_FORBIDDEN_REFERENCE, PREF_PB_DISCOURRAGED_REFERENCE, + PREF_PB_SUPPRESS_WARNINGS, PREF_PB_SUPPRESS_OPTIONAL_ERRORS, + PREF_PB_UNHANDLED_WARNING_TOKEN, PREF_PB_COMPARING_IDENTICAL, PREF_PB_MISSING_SYNCHRONIZED_ON_INHERITED_METHOD, PREF_PB_MISSING_HASHCODE_METHOD, PREF_PB_DEAD_CODE, PREF_PB_UNUSED_OBJECT_ALLOCATION }; @@ -216,7 +219,7 @@ int indentStep= fPixelConverter.convertWidthInCharsToPixels(1); int defaultIndent= indentStep * 0; - int extraIndent= indentStep * 2; + int extraIndent= indentStep * 3; String label; ExpandableComposite excomposite; Composite inner; @@ -475,12 +478,15 @@ label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unhandled_surpresswarning_tokens; addComboBox(inner, label, PREF_PB_UNHANDLED_WARNING_TOKEN, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_unused_suppresswarnings_token; - addComboBox(inner, label, PREF_PB_UNUSED_WARNING_TOKEN, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); - label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_enable_surpresswarning_annotation; addCheckBox(inner, label, PREF_PB_SUPPRESS_WARNINGS, enabledDisabled, 0); + label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_unused_suppresswarnings_token; + addComboBox(inner, label, PREF_PB_UNUSED_WARNING_TOKEN, errorWarningIgnore, errorWarningIgnoreLabels, extraIndent); + + label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_suppress_optional_errors_label; + addCheckBox(inner, label, PREF_PB_SUPPRESS_OPTIONAL_ERRORS, enabledDisabled, extraIndent); + new Label(composite, SWT.NONE); String[] enableDisableValues= new String[] { ENABLED, DISABLED }; @@ -508,7 +514,8 @@ PREF_PB_DEPRECATION.equals(changedKey) || PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey) || PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey) || - PREF_15_PB_MISSING_OVERRIDE_ANNOTATION.equals(changedKey)) { + PREF_15_PB_MISSING_OVERRIDE_ANNOTATION.equals(changedKey) || + PREF_PB_SUPPRESS_WARNINGS.equals(changedKey)) { updateEnableStates(); } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) { // merging the two options @@ -541,6 +548,10 @@ boolean enablemissingOverrideAnnotation= !checkValue(PREF_15_PB_MISSING_OVERRIDE_ANNOTATION, IGNORE); getCheckBox(PREF_16_PB_MISSING_OVERRIDE_ANNOTATION_FOR_INTERFACE_METHOD_IMPLEMENTATION).setEnabled(enablemissingOverrideAnnotation); + + boolean enableSuppressWarnings= checkValue(PREF_PB_SUPPRESS_WARNINGS, ENABLED); + getCheckBox(PREF_PB_SUPPRESS_OPTIONAL_ERRORS).setEnabled(enableSuppressWarnings); + setComboEnabled(PREF_PB_UNUSED_WARNING_TOKEN, enableSuppressWarnings); } protected String[] getFullBuildDialogStrings(boolean workspaceSettings) { Index: ui/org/eclipse/jdt/internal/ui/text/correction/SuppressWarningsSubProcessor.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/SuppressWarningsSubProcessor.java,v retrieving revision 1.14 diff -u -r1.14 SuppressWarningsSubProcessor.java --- ui/org/eclipse/jdt/internal/ui/text/correction/SuppressWarningsSubProcessor.java 24 Sep 2009 14:39:30 -0000 1.14 +++ ui/org/eclipse/jdt/internal/ui/text/correction/SuppressWarningsSubProcessor.java 26 Feb 2010 14:34:29 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 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 @@ -84,7 +84,7 @@ public static void addSuppressWarningsProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { - if (problem.isError()) { + if (problem.isError() && ! JavaCore.ENABLED.equals(context.getCompilationUnit().getJavaProject().getOption(JavaCore.COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS, true))) { return; } if (JavaCore.DISABLED.equals(context.getCompilationUnit().getJavaProject().getOption(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, true))) {