1 11 package org.eclipse.jdt.internal.ui.preferences; 12 13 import org.eclipse.core.resources.IProject; 14 15 import org.eclipse.swt.SWT; 16 import org.eclipse.swt.layout.GridData; 17 import org.eclipse.swt.layout.GridLayout; 18 import org.eclipse.swt.widgets.Composite; 19 import org.eclipse.swt.widgets.Control; 20 import org.eclipse.swt.widgets.Label; 21 22 import org.eclipse.jface.dialogs.IDialogSettings; 23 24 import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; 25 26 import org.eclipse.ui.forms.widgets.ExpandableComposite; 27 28 import org.eclipse.jdt.core.JavaCore; 29 30 import org.eclipse.jdt.internal.ui.JavaPlugin; 31 import org.eclipse.jdt.internal.ui.dialogs.StatusInfo; 32 import org.eclipse.jdt.internal.ui.util.PixelConverter; 33 import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener; 34 35 37 public class ProblemSeveritiesConfigurationBlock extends OptionsConfigurationBlock { 38 39 private static final String SETTINGS_SECTION_NAME= "ProblemSeveritiesConfigurationBlock"; 41 private static final Key PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD= getJDTCoreKey(JavaCore.COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD); 43 private static final Key PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME= getJDTCoreKey(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME); 44 private static final Key PREF_PB_DEPRECATION= getJDTCoreKey(JavaCore.COMPILER_PB_DEPRECATION); 45 private static final Key PREF_PB_DEPRECATION_IN_DEPRECATED_CODE=getJDTCoreKey(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE); 46 private static final Key PREF_PB_DEPRECATION_WHEN_OVERRIDING= getJDTCoreKey(JavaCore.COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD); 47 48 private static final Key PREF_PB_HIDDEN_CATCH_BLOCK= getJDTCoreKey(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK); 49 private static final Key PREF_PB_UNUSED_LOCAL= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_LOCAL); 50 private static final Key PREF_PB_UNUSED_PARAMETER= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PARAMETER); 51 private static final Key PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE); 52 private static final Key PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE); 53 private static final Key PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT); 54 private static final Key PREF_PB_SYNTHETIC_ACCESS_EMULATION= getJDTCoreKey(JavaCore.COMPILER_PB_SYNTHETIC_ACCESS_EMULATION); 55 private static final Key PREF_PB_NON_EXTERNALIZED_STRINGS= getJDTCoreKey(JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL); 56 private static final Key PREF_PB_UNUSED_IMPORT= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_IMPORT); 57 private static final Key PREF_PB_UNUSED_PRIVATE= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER); 58 private static final Key PREF_PB_STATIC_ACCESS_RECEIVER= getJDTCoreKey(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER); 59 private static final Key PREF_PB_NO_EFFECT_ASSIGNMENT= getJDTCoreKey(JavaCore.COMPILER_PB_NO_EFFECT_ASSIGNMENT); 60 private static final Key PREF_PB_CHAR_ARRAY_IN_CONCAT= getJDTCoreKey(JavaCore.COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION); 61 private static final Key PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT= getJDTCoreKey(JavaCore.COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT); 62 private static final Key PREF_PB_LOCAL_VARIABLE_HIDING= getJDTCoreKey(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING); 63 private static final Key PREF_PB_FIELD_HIDING= getJDTCoreKey(JavaCore.COMPILER_PB_FIELD_HIDING); 64 private static final Key PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD= getJDTCoreKey(JavaCore.COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD); 65 private static final Key PREF_PB_INDIRECT_STATIC_ACCESS= getJDTCoreKey(JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS); 66 private static final Key PREF_PB_EMPTY_STATEMENT= getJDTCoreKey(JavaCore.COMPILER_PB_EMPTY_STATEMENT); 67 private static final Key PREF_PB_UNNECESSARY_ELSE= getJDTCoreKey(JavaCore.COMPILER_PB_UNNECESSARY_ELSE); 68 private static final Key PREF_PB_UNNECESSARY_TYPE_CHECK= getJDTCoreKey(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK); 69 private static final Key PREF_PB_INCOMPATIBLE_INTERFACE_METHOD= getJDTCoreKey(JavaCore.COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD); 70 private static final Key PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION); 71 private static final Key PREF_PB_MISSING_SERIAL_VERSION= getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION); 72 private static final Key PREF_PB_UNDOCUMENTED_EMPTY_BLOCK= getJDTCoreKey(JavaCore.COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK); 73 private static final Key PREF_PB_FINALLY_BLOCK_NOT_COMPLETING= getJDTCoreKey(JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING); 74 private static final Key PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING); 75 private static final Key PREF_PB_UNQUALIFIED_FIELD_ACCESS= getJDTCoreKey(JavaCore.COMPILER_PB_UNQUALIFIED_FIELD_ACCESS); 76 private static final Key PREF_PB_MISSING_DEPRECATED_ANNOTATION= getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION); 77 private static final Key PREF_PB_FORBIDDEN_REFERENCE= getJDTCoreKey(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE); 78 private static final Key PREF_PB_DISCOURRAGED_REFERENCE= getJDTCoreKey(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE); 79 private static final Key PREF_PB_UNUSED_LABEL= getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_LABEL); 80 private static final Key PREF_PB_PARAMETER_ASSIGNMENT= getJDTCoreKey(JavaCore.COMPILER_PB_PARAMETER_ASSIGNMENT); 81 private static final Key PREF_PB_FALLTHROUGH_CASE= getJDTCoreKey(JavaCore.COMPILER_PB_FALLTHROUGH_CASE); 82 83 private static final Key PREF_PB_NULL_REFERENCE= getJDTCoreKey(JavaCore.COMPILER_PB_NULL_REFERENCE); 84 private static final Key PREF_PB_POTENTIAL_NULL_REFERENCE= getJDTCoreKey(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE); 85 private static final Key PREF_PB_REDUNDANT_NULL_CHECK= getJDTCoreKey(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK); 86 87 private static final Key PREF_15_PB_UNCHECKED_TYPE_OPERATION= getJDTCoreKey(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION); 88 private static final Key PREF_15_PB_FINAL_PARAM_BOUND= getJDTCoreKey(JavaCore.COMPILER_PB_FINAL_PARAMETER_BOUND); 89 private static final Key PREF_15_PB_VARARGS_ARGUMENT_NEED_CAST= getJDTCoreKey(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST); 90 private static final Key PREF_15_PB_AUTOBOXING_PROBLEM= getJDTCoreKey(JavaCore.COMPILER_PB_AUTOBOXING); 91 92 private static final Key PREF_15_PB_MISSING_OVERRIDE_ANNOTATION= getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION); 93 private static final Key PREF_15_PB_ANNOTATION_SUPER_INTERFACE= getJDTCoreKey(JavaCore.COMPILER_PB_ANNOTATION_SUPER_INTERFACE); 94 private static final Key PREF_15_PB_TYPE_PARAMETER_HIDING= getJDTCoreKey(JavaCore.COMPILER_PB_TYPE_PARAMETER_HIDING); 95 private static final Key PREF_15_PB_INCOMPLETE_ENUM_SWITCH= getJDTCoreKey(JavaCore.COMPILER_PB_INCOMPLETE_ENUM_SWITCH); 96 private static final Key PREF_15_PB_RAW_TYPE_REFERENCE= getJDTCoreKey(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE); 97 98 private static final Key PREF_PB_SUPPRESS_WARNINGS= getJDTCoreKey(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS); 99 private static final Key PREF_PB_UNHANDLED_WARNING_TOKEN= getJDTCoreKey(JavaCore.COMPILER_PB_UNHANDLED_WARNING_TOKEN); 100 private static final Key PREF_PB_FATAL_OPTIONAL_ERROR= getJDTCoreKey(JavaCore.COMPILER_PB_FATAL_OPTIONAL_ERROR); 101 102 103 private static final String ERROR= JavaCore.ERROR; 105 private static final String WARNING= JavaCore.WARNING; 106 private static final String IGNORE= JavaCore.IGNORE; 107 108 private static final String ENABLED= JavaCore.ENABLED; 109 private static final String DISABLED= JavaCore.DISABLED; 110 111 112 private PixelConverter fPixelConverter; 113 114 public ProblemSeveritiesConfigurationBlock(IStatusChangeListener context, IProject project, IWorkbenchPreferenceContainer container) { 115 super(context, project, getKeys(), container); 116 117 if (ENABLED.equals(getValue(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT))) { 119 setValue(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING, ENABLED); 120 } 121 } 122 123 private static Key[] getKeys() { 124 return new Key[] { 125 PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, 126 PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME, PREF_PB_DEPRECATION, PREF_PB_HIDDEN_CATCH_BLOCK, PREF_PB_UNUSED_LOCAL, 127 PREF_PB_UNUSED_PARAMETER, PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE, 128 PREF_PB_SYNTHETIC_ACCESS_EMULATION, PREF_PB_NON_EXTERNALIZED_STRINGS, 129 PREF_PB_UNUSED_IMPORT, PREF_PB_UNUSED_LABEL, 130 PREF_PB_STATIC_ACCESS_RECEIVER, PREF_PB_DEPRECATION_IN_DEPRECATED_CODE, 131 PREF_PB_NO_EFFECT_ASSIGNMENT, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD, 132 PREF_PB_UNUSED_PRIVATE, PREF_PB_CHAR_ARRAY_IN_CONCAT, PREF_PB_UNNECESSARY_ELSE, 133 PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, PREF_PB_LOCAL_VARIABLE_HIDING, PREF_PB_FIELD_HIDING, 134 PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD, PREF_PB_INDIRECT_STATIC_ACCESS, 135 PREF_PB_EMPTY_STATEMENT, PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING, PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT, 136 PREF_PB_UNNECESSARY_TYPE_CHECK, PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, PREF_PB_UNQUALIFIED_FIELD_ACCESS, 137 PREF_PB_UNDOCUMENTED_EMPTY_BLOCK, PREF_PB_FINALLY_BLOCK_NOT_COMPLETING, PREF_PB_DEPRECATION_WHEN_OVERRIDING, 138 PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING, PREF_PB_MISSING_SERIAL_VERSION, 139 PREF_PB_PARAMETER_ASSIGNMENT, PREF_PB_NULL_REFERENCE, PREF_PB_POTENTIAL_NULL_REFERENCE, 140 PREF_PB_REDUNDANT_NULL_CHECK, PREF_PB_FALLTHROUGH_CASE, 141 PREF_15_PB_UNCHECKED_TYPE_OPERATION, PREF_15_PB_FINAL_PARAM_BOUND, PREF_15_PB_VARARGS_ARGUMENT_NEED_CAST, 142 PREF_15_PB_AUTOBOXING_PROBLEM, PREF_15_PB_MISSING_OVERRIDE_ANNOTATION, PREF_15_PB_ANNOTATION_SUPER_INTERFACE, 143 PREF_15_PB_TYPE_PARAMETER_HIDING, PREF_15_PB_INCOMPLETE_ENUM_SWITCH, PREF_PB_MISSING_DEPRECATED_ANNOTATION, 144 PREF_15_PB_RAW_TYPE_REFERENCE, PREF_PB_FATAL_OPTIONAL_ERROR, 145 PREF_PB_FORBIDDEN_REFERENCE, PREF_PB_DISCOURRAGED_REFERENCE, PREF_PB_SUPPRESS_WARNINGS, PREF_PB_UNHANDLED_WARNING_TOKEN 146 }; 147 } 148 149 152 protected Control createContents(Composite parent) { 153 fPixelConverter= new PixelConverter(parent); 154 setShell(parent.getShell()); 155 156 Composite mainComp= new Composite(parent, SWT.NONE); 157 mainComp.setFont(parent.getFont()); 158 GridLayout layout= new GridLayout(); 159 layout.marginHeight= 0; 160 layout.marginWidth= 0; 161 mainComp.setLayout(layout); 162 163 Composite commonComposite= createStyleTabContent(mainComp); 164 GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true); 165 gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20); 166 commonComposite.setLayoutData(gridData); 167 168 validateSettings(null, null, null); 169 170 return mainComp; 171 } 172 173 private Composite createStyleTabContent(Composite folder) { 174 String [] errorWarningIgnore= new String [] { ERROR, WARNING, IGNORE }; 175 176 String [] errorWarningIgnoreLabels= new String [] { 177 PreferencesMessages.ProblemSeveritiesConfigurationBlock_error, 178 PreferencesMessages.ProblemSeveritiesConfigurationBlock_warning, 179 PreferencesMessages.ProblemSeveritiesConfigurationBlock_ignore 180 }; 181 182 String [] enabledDisabled= new String [] { ENABLED, DISABLED }; 183 184 int nColumns= 3; 185 186 final ScrolledPageContent sc1 = new ScrolledPageContent(folder); 187 188 Composite composite= sc1.getBody(); 189 GridLayout layout= new GridLayout(nColumns, false); 190 layout.marginHeight= 0; 191 layout.marginWidth= 0; 192 composite.setLayout(layout); 193 194 Label description= new Label(composite, SWT.LEFT | SWT.WRAP); 195 description.setFont(description.getFont()); 196 description.setText(PreferencesMessages.ProblemSeveritiesConfigurationBlock_common_description); 197 description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, nColumns - 1, 1)); 198 199 int indentStep= fPixelConverter.convertWidthInCharsToPixels(1); 200 201 int defaultIndent= indentStep * 0; 202 int extraIndent= indentStep * 2; 203 String label; 204 ExpandableComposite excomposite; 205 Composite inner; 206 207 209 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_code_style; 210 excomposite= createStyleSection(composite, label, nColumns); 211 212 inner= new Composite(excomposite, SWT.NONE); 213 inner.setFont(composite.getFont()); 214 inner.setLayout(new GridLayout(nColumns, false)); 215 excomposite.setClient(inner); 216 217 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_static_access_receiver_label; 218 addComboBox(inner, label, PREF_PB_STATIC_ACCESS_RECEIVER, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 219 220 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_indirect_access_to_static_label; 221 addComboBox(inner, label, PREF_PB_INDIRECT_STATIC_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 222 223 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unqualified_field_access_label; 224 addComboBox(inner, label, PREF_PB_UNQUALIFIED_FIELD_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 225 226 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_undocumented_empty_block_label; 227 addComboBox(inner, label, PREF_PB_UNDOCUMENTED_EMPTY_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 228 229 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_synth_access_emul_label; 230 addComboBox(inner, label, PREF_PB_SYNTHETIC_ACCESS_EMULATION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 231 232 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_method_naming_label; 233 addComboBox(inner, label, PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 234 235 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_parameter_assignment; 236 addComboBox(inner, label, PREF_PB_PARAMETER_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 237 238 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_non_externalized_strings_label; 239 addComboBox(inner, label, PREF_PB_NON_EXTERNALIZED_STRINGS, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 240 241 243 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_potential_programming_problems; 244 excomposite= createStyleSection(composite, label, nColumns); 245 246 inner= new Composite(excomposite, SWT.NONE); 247 inner.setFont(composite.getFont()); 248 inner.setLayout(new GridLayout(nColumns, false)); 249 excomposite.setClient(inner); 250 251 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_missing_serial_version_label; 252 addComboBox(inner, label, PREF_PB_MISSING_SERIAL_VERSION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 253 254 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_no_effect_assignment_label; 255 addComboBox(inner, label, PREF_PB_NO_EFFECT_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 256 257 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_accidential_assignement_label; 258 addComboBox(inner, label, PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 259 260 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_finally_block_not_completing_label; 261 addComboBox(inner, label, PREF_PB_FINALLY_BLOCK_NOT_COMPLETING, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 262 263 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_empty_statement_label; 264 addComboBox(inner, label, PREF_PB_EMPTY_STATEMENT, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 265 266 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_char_array_in_concat_label; 267 addComboBox(inner, label, PREF_PB_CHAR_ARRAY_IN_CONCAT, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 268 269 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_hidden_catchblock_label; 270 addComboBox(inner, label, PREF_PB_HIDDEN_CATCH_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 271 272 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_inexact_vararg_label; 273 addComboBox(inner, label, PREF_15_PB_VARARGS_ARGUMENT_NEED_CAST, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 274 275 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_autoboxing_problem_label; 276 addComboBox(inner, label, PREF_15_PB_AUTOBOXING_PROBLEM, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 277 278 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_incomplete_enum_switch_label; 279 addComboBox(inner, label, PREF_15_PB_INCOMPLETE_ENUM_SWITCH, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 280 281 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_fall_through_case; 282 addComboBox(inner, label, PREF_PB_FALLTHROUGH_CASE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 283 284 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_null_reference; 285 addComboBox(inner, label, PREF_PB_NULL_REFERENCE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 286 287 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_potential_null_reference; 288 addComboBox(inner, label, PREF_PB_POTENTIAL_NULL_REFERENCE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 289 290 292 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_name_shadowing; 293 excomposite= createStyleSection(composite, label, nColumns); 294 295 inner= new Composite(excomposite, SWT.NONE); 296 inner.setFont(composite.getFont()); 297 inner.setLayout(new GridLayout(nColumns, false)); 298 excomposite.setClient(inner); 299 300 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_field_hiding_label; 301 addComboBox(inner, label, PREF_PB_FIELD_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 302 303 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_local_variable_hiding_label; 304 addComboBox(inner, label, PREF_PB_LOCAL_VARIABLE_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 305 306 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_special_param_hiding_label; 307 addCheckBox(inner, label, PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD, enabledDisabled, extraIndent); 308 309 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_type_parameter_hiding_label; 310 addComboBox(inner, label, PREF_15_PB_TYPE_PARAMETER_HIDING, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 311 312 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_overriding_pkg_dflt_label; 313 addComboBox(inner, label, PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 314 315 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_incompatible_interface_method_label; 316 addComboBox(inner, label, PREF_PB_INCOMPATIBLE_INTERFACE_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 317 318 320 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_deprecations; 321 excomposite= createStyleSection(composite, label, nColumns); 322 323 inner= new Composite(excomposite, SWT.NONE); 324 inner.setFont(composite.getFont()); 325 inner.setLayout(new GridLayout(nColumns, false)); 326 excomposite.setClient(inner); 327 328 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_deprecation_label; 329 addComboBox(inner, label, PREF_PB_DEPRECATION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 330 331 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_deprecation_in_deprecation_label; 332 addCheckBox(inner, label, PREF_PB_DEPRECATION_IN_DEPRECATED_CODE, enabledDisabled, extraIndent); 333 334 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_deprecation_when_overriding_label; 335 addCheckBox(inner, label, PREF_PB_DEPRECATION_WHEN_OVERRIDING, enabledDisabled, extraIndent); 336 337 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_forbidden_reference_label; 338 addComboBox(inner, label, PREF_PB_FORBIDDEN_REFERENCE, errorWarningIgnore, errorWarningIgnoreLabels, 0); 339 340 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_discourraged_reference_label; 341 addComboBox(inner, label, PREF_PB_DISCOURRAGED_REFERENCE, errorWarningIgnore, errorWarningIgnoreLabels, 0); 342 343 344 346 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_unnecessary_code; 347 excomposite= createStyleSection(composite, label, nColumns); 348 349 inner= new Composite(excomposite, SWT.NONE); 350 inner.setFont(composite.getFont()); 351 inner.setLayout(new GridLayout(nColumns, false)); 352 excomposite.setClient(inner); 353 354 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_local_label; 355 addComboBox(inner, label, PREF_PB_UNUSED_LOCAL, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 356 357 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_parameter_label; 358 addComboBox(inner, label, PREF_PB_UNUSED_PARAMETER, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 359 360 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_signal_param_in_overriding_label; 361 addCheckBox(inner, label, PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING, enabledDisabled, extraIndent); 362 363 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_ignore_documented_unused_parameters; 364 addCheckBox(inner, label, PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE, enabledDisabled, extraIndent); 365 366 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_imports_label; 367 addComboBox(inner, label, PREF_PB_UNUSED_IMPORT, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 368 369 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_private_label; 370 addComboBox(inner, label, PREF_PB_UNUSED_PRIVATE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 371 372 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_redundant_null_check; 373 addComboBox(inner, label, PREF_PB_REDUNDANT_NULL_CHECK, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 374 375 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unnecessary_else_label; 376 addComboBox(inner, label, PREF_PB_UNNECESSARY_ELSE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 377 378 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unnecessary_type_check_label; 379 addComboBox(inner, label, PREF_PB_UNNECESSARY_TYPE_CHECK, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 380 381 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_throwing_exception_label; 382 addComboBox(inner, label, PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 383 384 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_throwing_exception_when_overriding_label; 385 addCheckBox(inner, label, PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING, enabledDisabled, extraIndent); 386 387 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_label_label; 388 addComboBox(inner, label, PREF_PB_UNUSED_LABEL, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 389 390 391 393 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_generics; 394 excomposite= createStyleSection(composite, label, nColumns); 395 396 397 inner= new Composite(excomposite, SWT.NONE); 398 inner.setFont(composite.getFont()); 399 inner.setLayout(new GridLayout(nColumns, false)); 400 excomposite.setClient(inner); 401 402 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unsafe_type_op_label; 403 addComboBox(inner, label, PREF_15_PB_UNCHECKED_TYPE_OPERATION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 404 405 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_raw_type_reference; 406 addComboBox(inner, label, PREF_15_PB_RAW_TYPE_REFERENCE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 407 408 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_final_param_bound_label; 409 addComboBox(inner, label, PREF_15_PB_FINAL_PARAM_BOUND, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 410 411 412 414 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_annotations; 415 excomposite= createStyleSection(composite, label, nColumns); 416 417 418 inner= new Composite(excomposite, SWT.NONE); 419 inner.setFont(composite.getFont()); 420 inner.setLayout(new GridLayout(nColumns, false)); 421 excomposite.setClient(inner); 422 423 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_missing_override_annotation_label; 424 addComboBox(inner, label, PREF_15_PB_MISSING_OVERRIDE_ANNOTATION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 425 426 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_missing_deprecated_annotation_label; 427 addComboBox(inner, label, PREF_PB_MISSING_DEPRECATED_ANNOTATION, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 428 429 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_annotation_super_interface_label; 430 addComboBox(inner, label, PREF_15_PB_ANNOTATION_SUPER_INTERFACE, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 431 432 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unhandled_surpresswarning_tokens; 433 addComboBox(inner, label, PREF_PB_UNHANDLED_WARNING_TOKEN, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent); 434 435 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_enable_surpresswarning_annotation; 436 addCheckBox(inner, label, PREF_PB_SUPPRESS_WARNINGS, enabledDisabled, 0); 437 438 new Label(composite, SWT.NONE); 439 440 String [] enableDisableValues= new String [] { ENABLED, DISABLED }; 441 label= PreferencesMessages.ProblemSeveritiesConfigurationBlock_treat_optional_as_fatal; 442 addCheckBox(composite, label, PREF_PB_FATAL_OPTIONAL_ERROR, enableDisableValues, 0); 443 444 445 IDialogSettings section= JavaPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME); 446 restoreSectionExpansionStates(section); 447 448 return sc1; 449 } 450 451 455 protected void validateSettings(Key changedKey, String oldValue, String newValue) { 456 if (!areSettingsEnabled()) { 457 return; 458 } 459 460 if (changedKey != null) { 461 if (PREF_PB_UNUSED_PARAMETER.equals(changedKey) || 462 PREF_PB_DEPRECATION.equals(changedKey) || 463 PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey) || 464 PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION.equals(changedKey)) { 465 updateEnableStates(); 466 } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING.equals(changedKey)) { 467 setValue(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT, newValue); 469 } else { 470 return; 471 } 472 } else { 473 updateEnableStates(); 474 } 475 fContext.statusChanged(new StatusInfo()); 476 } 477 478 private void updateEnableStates() { 479 boolean enableUnusedParams= !checkValue(PREF_PB_UNUSED_PARAMETER, IGNORE); 480 getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(enableUnusedParams); 481 getCheckBox(PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE).setEnabled(enableUnusedParams); 482 483 boolean enableDeprecation= !checkValue(PREF_PB_DEPRECATION, IGNORE); 484 getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(enableDeprecation); 485 getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(enableDeprecation); 486 487 boolean enableThrownExceptions= !checkValue(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, IGNORE); 488 getCheckBox(PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING).setEnabled(enableThrownExceptions); 489 490 boolean enableHiding= !checkValue(PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE); 491 getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(enableHiding); 492 } 493 494 protected String [] getFullBuildDialogStrings(boolean workspaceSettings) { 495 String title= PreferencesMessages.ProblemSeveritiesConfigurationBlock_needsbuild_title; 496 String message; 497 if (workspaceSettings) { 498 message= PreferencesMessages.ProblemSeveritiesConfigurationBlock_needsfullbuild_message; 499 } else { 500 message= PreferencesMessages.ProblemSeveritiesConfigurationBlock_needsprojectbuild_message; 501 } 502 return new String [] { title, message }; 503 } 504 505 508 public void dispose() { 509 IDialogSettings section= JavaPlugin.getDefault().getDialogSettings().addNewSection(SETTINGS_SECTION_NAME); 510 storeSectionExpansionStates(section); 511 super.dispose(); 512 } 513 514 } 515 | Popular Tags |