Source Code Cross Referenced for ProblemSeveritiesConfigurationBlock.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » internal » ui » preferences » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jdt » org.eclipse.jdt.internal.ui.preferences 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2007 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jdt.internal.ui.preferences;
011:
012:        import org.eclipse.core.resources.IProject;
013:
014:        import org.eclipse.swt.SWT;
015:        import org.eclipse.swt.layout.GridData;
016:        import org.eclipse.swt.layout.GridLayout;
017:        import org.eclipse.swt.widgets.Composite;
018:        import org.eclipse.swt.widgets.Control;
019:        import org.eclipse.swt.widgets.Label;
020:
021:        import org.eclipse.jface.dialogs.IDialogSettings;
022:
023:        import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
024:
025:        import org.eclipse.ui.forms.widgets.ExpandableComposite;
026:
027:        import org.eclipse.jdt.core.JavaCore;
028:
029:        import org.eclipse.jdt.internal.ui.JavaPlugin;
030:        import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
031:        import org.eclipse.jdt.internal.ui.util.PixelConverter;
032:        import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
033:
034:        /**
035:         */
036:        public class ProblemSeveritiesConfigurationBlock extends
037:                OptionsConfigurationBlock {
038:
039:            private static final String SETTINGS_SECTION_NAME = "ProblemSeveritiesConfigurationBlock"; //$NON-NLS-1$
040:
041:            // Preference store keys, see JavaCore.getOptions
042:            private static final Key PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD = getJDTCoreKey(JavaCore.COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD);
043:            private static final Key PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME = getJDTCoreKey(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME);
044:            private static final Key PREF_PB_DEPRECATION = getJDTCoreKey(JavaCore.COMPILER_PB_DEPRECATION);
045:            private static final Key PREF_PB_DEPRECATION_IN_DEPRECATED_CODE = getJDTCoreKey(JavaCore.COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE);
046:            private static final Key PREF_PB_DEPRECATION_WHEN_OVERRIDING = getJDTCoreKey(JavaCore.COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD);
047:
048:            private static final Key PREF_PB_HIDDEN_CATCH_BLOCK = getJDTCoreKey(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK);
049:            private static final Key PREF_PB_UNUSED_LOCAL = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_LOCAL);
050:            private static final Key PREF_PB_UNUSED_PARAMETER = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PARAMETER);
051:            private static final Key PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE);
052:            private static final Key PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE);
053:            private static final Key PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT);
054:            private static final Key PREF_PB_SYNTHETIC_ACCESS_EMULATION = getJDTCoreKey(JavaCore.COMPILER_PB_SYNTHETIC_ACCESS_EMULATION);
055:            private static final Key PREF_PB_NON_EXTERNALIZED_STRINGS = getJDTCoreKey(JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL);
056:            private static final Key PREF_PB_UNUSED_IMPORT = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_IMPORT);
057:            private static final Key PREF_PB_UNUSED_PRIVATE = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER);
058:            private static final Key PREF_PB_STATIC_ACCESS_RECEIVER = getJDTCoreKey(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER);
059:            private static final Key PREF_PB_NO_EFFECT_ASSIGNMENT = getJDTCoreKey(JavaCore.COMPILER_PB_NO_EFFECT_ASSIGNMENT);
060:            private static final Key PREF_PB_CHAR_ARRAY_IN_CONCAT = getJDTCoreKey(JavaCore.COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION);
061:            private static final Key PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT = getJDTCoreKey(JavaCore.COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT);
062:            private static final Key PREF_PB_LOCAL_VARIABLE_HIDING = getJDTCoreKey(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING);
063:            private static final Key PREF_PB_FIELD_HIDING = getJDTCoreKey(JavaCore.COMPILER_PB_FIELD_HIDING);
064:            private static final Key PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD = getJDTCoreKey(JavaCore.COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD);
065:            private static final Key PREF_PB_INDIRECT_STATIC_ACCESS = getJDTCoreKey(JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS);
066:            private static final Key PREF_PB_EMPTY_STATEMENT = getJDTCoreKey(JavaCore.COMPILER_PB_EMPTY_STATEMENT);
067:            private static final Key PREF_PB_UNNECESSARY_ELSE = getJDTCoreKey(JavaCore.COMPILER_PB_UNNECESSARY_ELSE);
068:            private static final Key PREF_PB_UNNECESSARY_TYPE_CHECK = getJDTCoreKey(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK);
069:            private static final Key PREF_PB_INCOMPATIBLE_INTERFACE_METHOD = getJDTCoreKey(JavaCore.COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD);
070:            private static final Key PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION);
071:            private static final Key PREF_PB_MISSING_SERIAL_VERSION = getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION);
072:            private static final Key PREF_PB_UNDOCUMENTED_EMPTY_BLOCK = getJDTCoreKey(JavaCore.COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK);
073:            private static final Key PREF_PB_FINALLY_BLOCK_NOT_COMPLETING = getJDTCoreKey(JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING);
074:            private static final Key PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING);
075:            private static final Key PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_INCLUDE_DOC_COMMENT_REFERENCE = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_INCLUDE_DOC_COMMENT_REFERENCE);
076:            private static final Key PREF_PB_UNQUALIFIED_FIELD_ACCESS = getJDTCoreKey(JavaCore.COMPILER_PB_UNQUALIFIED_FIELD_ACCESS);
077:            private static final Key PREF_PB_MISSING_DEPRECATED_ANNOTATION = getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION);
078:            private static final Key PREF_PB_FORBIDDEN_REFERENCE = getJDTCoreKey(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE);
079:            private static final Key PREF_PB_DISCOURRAGED_REFERENCE = getJDTCoreKey(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE);
080:            private static final Key PREF_PB_UNUSED_LABEL = getJDTCoreKey(JavaCore.COMPILER_PB_UNUSED_LABEL);
081:            private static final Key PREF_PB_PARAMETER_ASSIGNMENT = getJDTCoreKey(JavaCore.COMPILER_PB_PARAMETER_ASSIGNMENT);
082:            private static final Key PREF_PB_FALLTHROUGH_CASE = getJDTCoreKey(JavaCore.COMPILER_PB_FALLTHROUGH_CASE);
083:
084:            private static final Key PREF_PB_NULL_REFERENCE = getJDTCoreKey(JavaCore.COMPILER_PB_NULL_REFERENCE);
085:            private static final Key PREF_PB_POTENTIAL_NULL_REFERENCE = getJDTCoreKey(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE);
086:            private static final Key PREF_PB_REDUNDANT_NULL_CHECK = getJDTCoreKey(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK);
087:
088:            private static final Key PREF_15_PB_UNCHECKED_TYPE_OPERATION = getJDTCoreKey(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION);
089:            private static final Key PREF_15_PB_FINAL_PARAM_BOUND = getJDTCoreKey(JavaCore.COMPILER_PB_FINAL_PARAMETER_BOUND);
090:            private static final Key PREF_15_PB_VARARGS_ARGUMENT_NEED_CAST = getJDTCoreKey(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST);
091:            private static final Key PREF_15_PB_AUTOBOXING_PROBLEM = getJDTCoreKey(JavaCore.COMPILER_PB_AUTOBOXING);
092:
093:            private static final Key PREF_15_PB_MISSING_OVERRIDE_ANNOTATION = getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION);
094:            private static final Key PREF_15_PB_ANNOTATION_SUPER_INTERFACE = getJDTCoreKey(JavaCore.COMPILER_PB_ANNOTATION_SUPER_INTERFACE);
095:            private static final Key PREF_15_PB_TYPE_PARAMETER_HIDING = getJDTCoreKey(JavaCore.COMPILER_PB_TYPE_PARAMETER_HIDING);
096:            private static final Key PREF_15_PB_INCOMPLETE_ENUM_SWITCH = getJDTCoreKey(JavaCore.COMPILER_PB_INCOMPLETE_ENUM_SWITCH);
097:            private static final Key PREF_15_PB_RAW_TYPE_REFERENCE = getJDTCoreKey(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE);
098:
099:            private static final Key PREF_PB_SUPPRESS_WARNINGS = getJDTCoreKey(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS);
100:            private static final Key PREF_PB_UNHANDLED_WARNING_TOKEN = getJDTCoreKey(JavaCore.COMPILER_PB_UNHANDLED_WARNING_TOKEN);
101:            private static final Key PREF_PB_FATAL_OPTIONAL_ERROR = getJDTCoreKey(JavaCore.COMPILER_PB_FATAL_OPTIONAL_ERROR);
102:
103:            // values
104:            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:            private PixelConverter fPixelConverter;
112:
113:            public ProblemSeveritiesConfigurationBlock(
114:                    IStatusChangeListener context, IProject project,
115:                    IWorkbenchPreferenceContainer container) {
116:                super (context, project, getKeys(), container);
117:
118:                // compatibilty code for the merge of the two option PB_SIGNAL_PARAMETER: 
119:                if (ENABLED
120:                        .equals(getValue(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT))) {
121:                    setValue(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING, ENABLED);
122:                }
123:            }
124:
125:            private static Key[] getKeys() {
126:                return new Key[] {
127:                        PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD,
128:                        PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,
129:                        PREF_PB_DEPRECATION,
130:                        PREF_PB_HIDDEN_CATCH_BLOCK,
131:                        PREF_PB_UNUSED_LOCAL,
132:                        PREF_PB_UNUSED_PARAMETER,
133:                        PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE,
134:                        PREF_PB_SYNTHETIC_ACCESS_EMULATION,
135:                        PREF_PB_NON_EXTERNALIZED_STRINGS,
136:                        PREF_PB_UNUSED_IMPORT,
137:                        PREF_PB_UNUSED_LABEL,
138:                        PREF_PB_STATIC_ACCESS_RECEIVER,
139:                        PREF_PB_DEPRECATION_IN_DEPRECATED_CODE,
140:                        PREF_PB_NO_EFFECT_ASSIGNMENT,
141:                        PREF_PB_INCOMPATIBLE_INTERFACE_METHOD,
142:                        PREF_PB_UNUSED_PRIVATE,
143:                        PREF_PB_CHAR_ARRAY_IN_CONCAT,
144:                        PREF_PB_UNNECESSARY_ELSE,
145:                        PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT,
146:                        PREF_PB_LOCAL_VARIABLE_HIDING,
147:                        PREF_PB_FIELD_HIDING,
148:                        PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD,
149:                        PREF_PB_INDIRECT_STATIC_ACCESS,
150:                        PREF_PB_EMPTY_STATEMENT,
151:                        PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING,
152:                        PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT,
153:                        PREF_PB_UNNECESSARY_TYPE_CHECK,
154:                        PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION,
155:                        PREF_PB_UNQUALIFIED_FIELD_ACCESS,
156:                        PREF_PB_UNDOCUMENTED_EMPTY_BLOCK,
157:                        PREF_PB_FINALLY_BLOCK_NOT_COMPLETING,
158:                        PREF_PB_DEPRECATION_WHEN_OVERRIDING,
159:                        PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING,
160:                        PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_INCLUDE_DOC_COMMENT_REFERENCE,
161:                        PREF_PB_MISSING_SERIAL_VERSION,
162:                        PREF_PB_PARAMETER_ASSIGNMENT, PREF_PB_NULL_REFERENCE,
163:                        PREF_PB_POTENTIAL_NULL_REFERENCE,
164:                        PREF_PB_REDUNDANT_NULL_CHECK, PREF_PB_FALLTHROUGH_CASE,
165:                        PREF_15_PB_UNCHECKED_TYPE_OPERATION,
166:                        PREF_15_PB_FINAL_PARAM_BOUND,
167:                        PREF_15_PB_VARARGS_ARGUMENT_NEED_CAST,
168:                        PREF_15_PB_AUTOBOXING_PROBLEM,
169:                        PREF_15_PB_MISSING_OVERRIDE_ANNOTATION,
170:                        PREF_15_PB_ANNOTATION_SUPER_INTERFACE,
171:                        PREF_15_PB_TYPE_PARAMETER_HIDING,
172:                        PREF_15_PB_INCOMPLETE_ENUM_SWITCH,
173:                        PREF_PB_MISSING_DEPRECATED_ANNOTATION,
174:                        PREF_15_PB_RAW_TYPE_REFERENCE,
175:                        PREF_PB_FATAL_OPTIONAL_ERROR,
176:                        PREF_PB_FORBIDDEN_REFERENCE,
177:                        PREF_PB_DISCOURRAGED_REFERENCE,
178:                        PREF_PB_SUPPRESS_WARNINGS,
179:                        PREF_PB_UNHANDLED_WARNING_TOKEN };
180:            }
181:
182:            /*
183:             * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
184:             */
185:            protected Control createContents(Composite parent) {
186:                fPixelConverter = new PixelConverter(parent);
187:                setShell(parent.getShell());
188:
189:                Composite mainComp = new Composite(parent, SWT.NONE);
190:                mainComp.setFont(parent.getFont());
191:                GridLayout layout = new GridLayout();
192:                layout.marginHeight = 0;
193:                layout.marginWidth = 0;
194:                mainComp.setLayout(layout);
195:
196:                Composite commonComposite = createStyleTabContent(mainComp);
197:                GridData gridData = new GridData(GridData.FILL, GridData.FILL,
198:                        true, true);
199:                gridData.heightHint = fPixelConverter
200:                        .convertHeightInCharsToPixels(20);
201:                commonComposite.setLayoutData(gridData);
202:
203:                validateSettings(null, null, null);
204:
205:                return mainComp;
206:            }
207:
208:            private Composite createStyleTabContent(Composite folder) {
209:                String[] errorWarningIgnore = new String[] { ERROR, WARNING,
210:                        IGNORE };
211:
212:                String[] errorWarningIgnoreLabels = new String[] {
213:                        PreferencesMessages.ProblemSeveritiesConfigurationBlock_error,
214:                        PreferencesMessages.ProblemSeveritiesConfigurationBlock_warning,
215:                        PreferencesMessages.ProblemSeveritiesConfigurationBlock_ignore };
216:
217:                String[] enabledDisabled = new String[] { ENABLED, DISABLED };
218:
219:                int nColumns = 3;
220:
221:                final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
222:
223:                Composite composite = sc1.getBody();
224:                GridLayout layout = new GridLayout(nColumns, false);
225:                layout.marginHeight = 0;
226:                layout.marginWidth = 0;
227:                composite.setLayout(layout);
228:
229:                Label description = new Label(composite, SWT.LEFT | SWT.WRAP);
230:                description.setFont(description.getFont());
231:                description
232:                        .setText(PreferencesMessages.ProblemSeveritiesConfigurationBlock_common_description);
233:                description.setLayoutData(new GridData(GridData.BEGINNING,
234:                        GridData.CENTER, true, false, nColumns - 1, 1));
235:
236:                int indentStep = fPixelConverter.convertWidthInCharsToPixels(1);
237:
238:                int defaultIndent = indentStep * 0;
239:                int extraIndent = indentStep * 2;
240:                String label;
241:                ExpandableComposite excomposite;
242:                Composite inner;
243:
244:                // --- style
245:
246:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_code_style;
247:                excomposite = createStyleSection(composite, label, nColumns);
248:
249:                inner = new Composite(excomposite, SWT.NONE);
250:                inner.setFont(composite.getFont());
251:                inner.setLayout(new GridLayout(nColumns, false));
252:                excomposite.setClient(inner);
253:
254:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_static_access_receiver_label;
255:                addComboBox(inner, label, PREF_PB_STATIC_ACCESS_RECEIVER,
256:                        errorWarningIgnore, errorWarningIgnoreLabels,
257:                        defaultIndent);
258:
259:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_indirect_access_to_static_label;
260:                addComboBox(inner, label, PREF_PB_INDIRECT_STATIC_ACCESS,
261:                        errorWarningIgnore, errorWarningIgnoreLabels,
262:                        defaultIndent);
263:
264:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unqualified_field_access_label;
265:                addComboBox(inner, label, PREF_PB_UNQUALIFIED_FIELD_ACCESS,
266:                        errorWarningIgnore, errorWarningIgnoreLabels,
267:                        defaultIndent);
268:
269:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_undocumented_empty_block_label;
270:                addComboBox(inner, label, PREF_PB_UNDOCUMENTED_EMPTY_BLOCK,
271:                        errorWarningIgnore, errorWarningIgnoreLabels,
272:                        defaultIndent);
273:
274:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_synth_access_emul_label;
275:                addComboBox(inner, label, PREF_PB_SYNTHETIC_ACCESS_EMULATION,
276:                        errorWarningIgnore, errorWarningIgnoreLabels,
277:                        defaultIndent);
278:
279:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_method_naming_label;
280:                addComboBox(inner, label, PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME,
281:                        errorWarningIgnore, errorWarningIgnoreLabels,
282:                        defaultIndent);
283:
284:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_parameter_assignment;
285:                addComboBox(inner, label, PREF_PB_PARAMETER_ASSIGNMENT,
286:                        errorWarningIgnore, errorWarningIgnoreLabels,
287:                        defaultIndent);
288:
289:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_non_externalized_strings_label;
290:                addComboBox(inner, label, PREF_PB_NON_EXTERNALIZED_STRINGS,
291:                        errorWarningIgnore, errorWarningIgnoreLabels,
292:                        defaultIndent);
293:
294:                // --- potential_programming_problems
295:
296:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_potential_programming_problems;
297:                excomposite = createStyleSection(composite, label, nColumns);
298:
299:                inner = new Composite(excomposite, SWT.NONE);
300:                inner.setFont(composite.getFont());
301:                inner.setLayout(new GridLayout(nColumns, false));
302:                excomposite.setClient(inner);
303:
304:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_missing_serial_version_label;
305:                addComboBox(inner, label, PREF_PB_MISSING_SERIAL_VERSION,
306:                        errorWarningIgnore, errorWarningIgnoreLabels,
307:                        defaultIndent);
308:
309:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_no_effect_assignment_label;
310:                addComboBox(inner, label, PREF_PB_NO_EFFECT_ASSIGNMENT,
311:                        errorWarningIgnore, errorWarningIgnoreLabels,
312:                        defaultIndent);
313:
314:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_accidential_assignement_label;
315:                addComboBox(inner, label,
316:                        PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT,
317:                        errorWarningIgnore, errorWarningIgnoreLabels,
318:                        defaultIndent);
319:
320:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_finally_block_not_completing_label;
321:                addComboBox(inner, label, PREF_PB_FINALLY_BLOCK_NOT_COMPLETING,
322:                        errorWarningIgnore, errorWarningIgnoreLabels,
323:                        defaultIndent);
324:
325:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_empty_statement_label;
326:                addComboBox(inner, label, PREF_PB_EMPTY_STATEMENT,
327:                        errorWarningIgnore, errorWarningIgnoreLabels,
328:                        defaultIndent);
329:
330:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_char_array_in_concat_label;
331:                addComboBox(inner, label, PREF_PB_CHAR_ARRAY_IN_CONCAT,
332:                        errorWarningIgnore, errorWarningIgnoreLabels,
333:                        defaultIndent);
334:
335:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_hidden_catchblock_label;
336:                addComboBox(inner, label, PREF_PB_HIDDEN_CATCH_BLOCK,
337:                        errorWarningIgnore, errorWarningIgnoreLabels,
338:                        defaultIndent);
339:
340:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_inexact_vararg_label;
341:                addComboBox(inner, label,
342:                        PREF_15_PB_VARARGS_ARGUMENT_NEED_CAST,
343:                        errorWarningIgnore, errorWarningIgnoreLabels,
344:                        defaultIndent);
345:
346:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_autoboxing_problem_label;
347:                addComboBox(inner, label, PREF_15_PB_AUTOBOXING_PROBLEM,
348:                        errorWarningIgnore, errorWarningIgnoreLabels,
349:                        defaultIndent);
350:
351:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_incomplete_enum_switch_label;
352:                addComboBox(inner, label, PREF_15_PB_INCOMPLETE_ENUM_SWITCH,
353:                        errorWarningIgnore, errorWarningIgnoreLabels,
354:                        defaultIndent);
355:
356:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_fall_through_case;
357:                addComboBox(inner, label, PREF_PB_FALLTHROUGH_CASE,
358:                        errorWarningIgnore, errorWarningIgnoreLabels,
359:                        defaultIndent);
360:
361:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_null_reference;
362:                addComboBox(inner, label, PREF_PB_NULL_REFERENCE,
363:                        errorWarningIgnore, errorWarningIgnoreLabels,
364:                        defaultIndent);
365:
366:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_potential_null_reference;
367:                addComboBox(inner, label, PREF_PB_POTENTIAL_NULL_REFERENCE,
368:                        errorWarningIgnore, errorWarningIgnoreLabels,
369:                        defaultIndent);
370:
371:                // --- name_shadowing
372:
373:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_name_shadowing;
374:                excomposite = createStyleSection(composite, label, nColumns);
375:
376:                inner = new Composite(excomposite, SWT.NONE);
377:                inner.setFont(composite.getFont());
378:                inner.setLayout(new GridLayout(nColumns, false));
379:                excomposite.setClient(inner);
380:
381:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_field_hiding_label;
382:                addComboBox(inner, label, PREF_PB_FIELD_HIDING,
383:                        errorWarningIgnore, errorWarningIgnoreLabels,
384:                        defaultIndent);
385:
386:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_local_variable_hiding_label;
387:                addComboBox(inner, label, PREF_PB_LOCAL_VARIABLE_HIDING,
388:                        errorWarningIgnore, errorWarningIgnoreLabels,
389:                        defaultIndent);
390:
391:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_special_param_hiding_label;
392:                addCheckBox(inner, label,
393:                        PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD,
394:                        enabledDisabled, extraIndent);
395:
396:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_type_parameter_hiding_label;
397:                addComboBox(inner, label, PREF_15_PB_TYPE_PARAMETER_HIDING,
398:                        errorWarningIgnore, errorWarningIgnoreLabels,
399:                        defaultIndent);
400:
401:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_overriding_pkg_dflt_label;
402:                addComboBox(inner, label,
403:                        PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD,
404:                        errorWarningIgnore, errorWarningIgnoreLabels,
405:                        defaultIndent);
406:
407:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_incompatible_interface_method_label;
408:                addComboBox(inner, label,
409:                        PREF_PB_INCOMPATIBLE_INTERFACE_METHOD,
410:                        errorWarningIgnore, errorWarningIgnoreLabels,
411:                        defaultIndent);
412:
413:                // --- API access rules
414:
415:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_deprecations;
416:                excomposite = createStyleSection(composite, label, nColumns);
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_deprecation_label;
424:                addComboBox(inner, label, PREF_PB_DEPRECATION,
425:                        errorWarningIgnore, errorWarningIgnoreLabels,
426:                        defaultIndent);
427:
428:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_deprecation_in_deprecation_label;
429:                addCheckBox(inner, label,
430:                        PREF_PB_DEPRECATION_IN_DEPRECATED_CODE,
431:                        enabledDisabled, extraIndent);
432:
433:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_deprecation_when_overriding_label;
434:                addCheckBox(inner, label, PREF_PB_DEPRECATION_WHEN_OVERRIDING,
435:                        enabledDisabled, extraIndent);
436:
437:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_forbidden_reference_label;
438:                addComboBox(inner, label, PREF_PB_FORBIDDEN_REFERENCE,
439:                        errorWarningIgnore, errorWarningIgnoreLabels, 0);
440:
441:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_discourraged_reference_label;
442:                addComboBox(inner, label, PREF_PB_DISCOURRAGED_REFERENCE,
443:                        errorWarningIgnore, errorWarningIgnoreLabels, 0);
444:
445:                // --- unnecessary_code
446:
447:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_unnecessary_code;
448:                excomposite = createStyleSection(composite, label, nColumns);
449:
450:                inner = new Composite(excomposite, SWT.NONE);
451:                inner.setFont(composite.getFont());
452:                inner.setLayout(new GridLayout(nColumns, false));
453:                excomposite.setClient(inner);
454:
455:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_local_label;
456:                addComboBox(inner, label, PREF_PB_UNUSED_LOCAL,
457:                        errorWarningIgnore, errorWarningIgnoreLabels,
458:                        defaultIndent);
459:
460:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_parameter_label;
461:                addComboBox(inner, label, PREF_PB_UNUSED_PARAMETER,
462:                        errorWarningIgnore, errorWarningIgnoreLabels,
463:                        defaultIndent);
464:
465:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_signal_param_in_overriding_label;
466:                addCheckBox(inner, label,
467:                        PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING,
468:                        enabledDisabled, extraIndent);
469:
470:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_ignore_documented_unused_parameters;
471:                addCheckBox(inner, label,
472:                        PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE,
473:                        enabledDisabled, extraIndent);
474:
475:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_imports_label;
476:                addComboBox(inner, label, PREF_PB_UNUSED_IMPORT,
477:                        errorWarningIgnore, errorWarningIgnoreLabels,
478:                        defaultIndent);
479:
480:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_private_label;
481:                addComboBox(inner, label, PREF_PB_UNUSED_PRIVATE,
482:                        errorWarningIgnore, errorWarningIgnoreLabels,
483:                        defaultIndent);
484:
485:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_redundant_null_check;
486:                addComboBox(inner, label, PREF_PB_REDUNDANT_NULL_CHECK,
487:                        errorWarningIgnore, errorWarningIgnoreLabels,
488:                        defaultIndent);
489:
490:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unnecessary_else_label;
491:                addComboBox(inner, label, PREF_PB_UNNECESSARY_ELSE,
492:                        errorWarningIgnore, errorWarningIgnoreLabels,
493:                        defaultIndent);
494:
495:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unnecessary_type_check_label;
496:                addComboBox(inner, label, PREF_PB_UNNECESSARY_TYPE_CHECK,
497:                        errorWarningIgnore, errorWarningIgnoreLabels,
498:                        defaultIndent);
499:
500:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_throwing_exception_label;
501:                addComboBox(inner, label,
502:                        PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION,
503:                        errorWarningIgnore, errorWarningIgnoreLabels,
504:                        defaultIndent);
505:
506:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_throwing_exception_when_overriding_label;
507:                addCheckBox(
508:                        inner,
509:                        label,
510:                        PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING,
511:                        enabledDisabled, extraIndent);
512:
513:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_ignore_documented_unused_exceptions;
514:                addCheckBox(
515:                        inner,
516:                        label,
517:                        PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_INCLUDE_DOC_COMMENT_REFERENCE,
518:                        enabledDisabled, extraIndent);
519:
520:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unused_label_label;
521:                addComboBox(inner, label, PREF_PB_UNUSED_LABEL,
522:                        errorWarningIgnore, errorWarningIgnoreLabels,
523:                        defaultIndent);
524:
525:                // --- generics
526:
527:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_generics;
528:                excomposite = createStyleSection(composite, label, nColumns);
529:
530:                inner = new Composite(excomposite, SWT.NONE);
531:                inner.setFont(composite.getFont());
532:                inner.setLayout(new GridLayout(nColumns, false));
533:                excomposite.setClient(inner);
534:
535:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unsafe_type_op_label;
536:                addComboBox(inner, label, PREF_15_PB_UNCHECKED_TYPE_OPERATION,
537:                        errorWarningIgnore, errorWarningIgnoreLabels,
538:                        defaultIndent);
539:
540:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_raw_type_reference;
541:                addComboBox(inner, label, PREF_15_PB_RAW_TYPE_REFERENCE,
542:                        errorWarningIgnore, errorWarningIgnoreLabels,
543:                        defaultIndent);
544:
545:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_final_param_bound_label;
546:                addComboBox(inner, label, PREF_15_PB_FINAL_PARAM_BOUND,
547:                        errorWarningIgnore, errorWarningIgnoreLabels,
548:                        defaultIndent);
549:
550:                // --- annotations
551:
552:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_section_annotations;
553:                excomposite = createStyleSection(composite, label, nColumns);
554:
555:                inner = new Composite(excomposite, SWT.NONE);
556:                inner.setFont(composite.getFont());
557:                inner.setLayout(new GridLayout(nColumns, false));
558:                excomposite.setClient(inner);
559:
560:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_missing_override_annotation_label;
561:                addComboBox(inner, label,
562:                        PREF_15_PB_MISSING_OVERRIDE_ANNOTATION,
563:                        errorWarningIgnore, errorWarningIgnoreLabels,
564:                        defaultIndent);
565:
566:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_missing_deprecated_annotation_label;
567:                addComboBox(inner, label,
568:                        PREF_PB_MISSING_DEPRECATED_ANNOTATION,
569:                        errorWarningIgnore, errorWarningIgnoreLabels,
570:                        defaultIndent);
571:
572:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_annotation_super _interface_label;
573:                addComboBox(inner, label,
574:                        PREF_15_PB_ANNOTATION_SUPER_INTERFACE,
575:                        errorWarningIgnore, errorWarningIgnoreLabels,
576:                        defaultIndent);
577:
578:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_unhandled_surpresswarning_tokens;
579:                addComboBox(inner, label, PREF_PB_UNHANDLED_WARNING_TOKEN,
580:                        errorWarningIgnore, errorWarningIgnoreLabels,
581:                        defaultIndent);
582:
583:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_pb_enable_surpresswarning_annotation;
584:                addCheckBox(inner, label, PREF_PB_SUPPRESS_WARNINGS,
585:                        enabledDisabled, 0);
586:
587:                new Label(composite, SWT.NONE);
588:
589:                String[] enableDisableValues = new String[] { ENABLED, DISABLED };
590:                label = PreferencesMessages.ProblemSeveritiesConfigurationBlock_treat_optional_as_fatal;
591:                addCheckBox(composite, label, PREF_PB_FATAL_OPTIONAL_ERROR,
592:                        enableDisableValues, 0);
593:
594:                IDialogSettings section = JavaPlugin.getDefault()
595:                        .getDialogSettings().getSection(SETTINGS_SECTION_NAME);
596:                restoreSectionExpansionStates(section);
597:
598:                return sc1;
599:            }
600:
601:            /* (non-javadoc)
602:             * Update fields and validate.
603:             * @param changedKey Key that changed, or null, if all changed.
604:             */
605:            protected void validateSettings(Key changedKey, String oldValue,
606:                    String newValue) {
607:                if (!areSettingsEnabled()) {
608:                    return;
609:                }
610:
611:                if (changedKey != null) {
612:                    if (PREF_PB_UNUSED_PARAMETER.equals(changedKey)
613:                            || PREF_PB_DEPRECATION.equals(changedKey)
614:                            || PREF_PB_LOCAL_VARIABLE_HIDING.equals(changedKey)
615:                            || PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION
616:                                    .equals(changedKey)) {
617:                        updateEnableStates();
618:                    } else if (PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING
619:                            .equals(changedKey)) {
620:                        // merging the two options
621:                        setValue(PREF_PB_SIGNAL_PARAMETER_IN_ABSTRACT, newValue);
622:                    } else {
623:                        return;
624:                    }
625:                } else {
626:                    updateEnableStates();
627:                }
628:                fContext.statusChanged(new StatusInfo());
629:            }
630:
631:            private void updateEnableStates() {
632:                boolean enableUnusedParams = !checkValue(
633:                        PREF_PB_UNUSED_PARAMETER, IGNORE);
634:                getCheckBox(PREF_PB_SIGNAL_PARAMETER_IN_OVERRIDING).setEnabled(
635:                        enableUnusedParams);
636:                getCheckBox(
637:                        PREF_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE)
638:                        .setEnabled(enableUnusedParams);
639:
640:                boolean enableDeprecation = !checkValue(PREF_PB_DEPRECATION,
641:                        IGNORE);
642:                getCheckBox(PREF_PB_DEPRECATION_IN_DEPRECATED_CODE).setEnabled(
643:                        enableDeprecation);
644:                getCheckBox(PREF_PB_DEPRECATION_WHEN_OVERRIDING).setEnabled(
645:                        enableDeprecation);
646:
647:                boolean enableThrownExceptions = !checkValue(
648:                        PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION, IGNORE);
649:                getCheckBox(
650:                        PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING)
651:                        .setEnabled(enableThrownExceptions);
652:                getCheckBox(
653:                        PREF_PB_UNUSED_DECLARED_THROWN_EXCEPTION_INCLUDE_DOC_COMMENT_REFERENCE)
654:                        .setEnabled(enableThrownExceptions);
655:
656:                boolean enableHiding = !checkValue(
657:                        PREF_PB_LOCAL_VARIABLE_HIDING, IGNORE);
658:                getCheckBox(PREF_PB_SPECIAL_PARAMETER_HIDING_FIELD).setEnabled(
659:                        enableHiding);
660:            }
661:
662:            protected String[] getFullBuildDialogStrings(
663:                    boolean workspaceSettings) {
664:                String title = PreferencesMessages.ProblemSeveritiesConfigurationBlock_needsbuild_title;
665:                String message;
666:                if (workspaceSettings) {
667:                    message = PreferencesMessages.ProblemSeveritiesConfigurationBlock_needsfullbuild_message;
668:                } else {
669:                    message = PreferencesMessages.ProblemSeveritiesConfigurationBlock_needsprojectbuild_message;
670:                }
671:                return new String[] { title, message };
672:            }
673:
674:            /* (non-Javadoc)
675:             * @see org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock#dispose()
676:             */
677:            public void dispose() {
678:                IDialogSettings section = JavaPlugin.getDefault()
679:                        .getDialogSettings().addNewSection(
680:                                SETTINGS_SECTION_NAME);
681:                storeSectionExpansionStates(section);
682:                super.dispose();
683:            }
684:
685:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.