Source Code Cross Referenced for JavadocProblemsConfigurationBlock.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, 2005 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.ControlEnableState;
022:
023:        import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
024:
025:        import org.eclipse.jdt.core.JavaCore;
026:
027:        import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
028:        import org.eclipse.jdt.internal.ui.util.PixelConverter;
029:        import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
030:
031:        /**
032:         */
033:        public class JavadocProblemsConfigurationBlock extends
034:                OptionsConfigurationBlock {
035:
036:            private static final Key PREF_JAVADOC_SUPPORT = getJDTCoreKey(JavaCore.COMPILER_DOC_COMMENT_SUPPORT);
037:
038:            private static final Key PREF_PB_INVALID_JAVADOC = getJDTCoreKey(JavaCore.COMPILER_PB_INVALID_JAVADOC);
039:            private static final Key PREF_PB_INVALID_JAVADOC_TAGS = getJDTCoreKey(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS);
040:            private static final Key PREF_PB_INVALID_JAVADOC_TAGS_NOT_VISIBLE_REF = getJDTCoreKey(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS__NOT_VISIBLE_REF);
041:            private static final Key PREF_PB_INVALID_JAVADOC_TAGS_DEPRECATED_REF = getJDTCoreKey(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS__DEPRECATED_REF);
042:            private static final Key PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY = getJDTCoreKey(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY);
043:
044:            private static final Key PREF_PB_MISSING_JAVADOC_TAGS = getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS);
045:            private static final Key PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY = getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY);
046:            private static final Key PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING = getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING);
047:
048:            private static final Key PREF_PB_MISSING_JAVADOC_COMMENTS = getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS);
049:            private static final Key PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY = getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY);
050:            private static final Key PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING = getJDTCoreKey(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING);
051:
052:            // values
053:            private static final String ERROR = JavaCore.ERROR;
054:            private static final String WARNING = JavaCore.WARNING;
055:            private static final String IGNORE = JavaCore.IGNORE;
056:
057:            private static final String ENABLED = JavaCore.ENABLED;
058:            private static final String DISABLED = JavaCore.DISABLED;
059:
060:            private static final String PUBLIC = JavaCore.PUBLIC;
061:            private static final String PROTECTED = JavaCore.PROTECTED;
062:            private static final String DEFAULT = JavaCore.DEFAULT;
063:            private static final String PRIVATE = JavaCore.PRIVATE;
064:
065:            private PixelConverter fPixelConverter;
066:            private Composite fJavadocComposite;
067:
068:            private ControlEnableState fBlockEnableState;
069:
070:            public JavadocProblemsConfigurationBlock(
071:                    IStatusChangeListener context, IProject project,
072:                    IWorkbenchPreferenceContainer container) {
073:                super (context, project, getKeys(), container);
074:                fBlockEnableState = null;
075:            }
076:
077:            private static Key[] getKeys() {
078:                Key[] keys = new Key[] { PREF_JAVADOC_SUPPORT,
079:                        PREF_PB_INVALID_JAVADOC,
080:                        PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
081:                        PREF_PB_INVALID_JAVADOC_TAGS,
082:                        PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
083:                        PREF_PB_INVALID_JAVADOC_TAGS_NOT_VISIBLE_REF,
084:                        PREF_PB_INVALID_JAVADOC_TAGS_DEPRECATED_REF,
085:                        PREF_PB_MISSING_JAVADOC_TAGS,
086:                        PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY,
087:                        PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING,
088:                        PREF_PB_MISSING_JAVADOC_COMMENTS,
089:                        PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY,
090:                        PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING, };
091:                return keys;
092:            }
093:
094:            /*
095:             * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
096:             */
097:            protected Control createContents(Composite parent) {
098:                fPixelConverter = new PixelConverter(parent);
099:                setShell(parent.getShell());
100:
101:                Composite javadocComposite = createJavadocTabContent(parent);
102:
103:                validateSettings(null, null, null);
104:
105:                return javadocComposite;
106:            }
107:
108:            private Composite createJavadocTabContent(Composite folder) {
109:                String[] errorWarningIgnore = new String[] { ERROR, WARNING,
110:                        IGNORE };
111:
112:                String[] errorWarningIgnoreLabels = new String[] {
113:                        PreferencesMessages.JavadocProblemsConfigurationBlock_error,
114:                        PreferencesMessages.JavadocProblemsConfigurationBlock_warning,
115:                        PreferencesMessages.JavadocProblemsConfigurationBlock_ignore };
116:
117:                String[] enabledDisabled = new String[] { ENABLED, DISABLED };
118:
119:                String[] visibilities = new String[] { PUBLIC, PROTECTED,
120:                        DEFAULT, PRIVATE };
121:
122:                String[] visibilitiesLabels = new String[] {
123:                        PreferencesMessages.JavadocProblemsConfigurationBlock_public,
124:                        PreferencesMessages.JavadocProblemsConfigurationBlock_protected,
125:                        PreferencesMessages.JavadocProblemsConfigurationBlock_default,
126:                        PreferencesMessages.JavadocProblemsConfigurationBlock_private };
127:                int nColumns = 3;
128:
129:                final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
130:
131:                Composite outer = sc1.getBody();
132:
133:                GridLayout layout = new GridLayout();
134:                layout.numColumns = nColumns;
135:                layout.marginHeight = 0;
136:                layout.marginWidth = 0;
137:                outer.setLayout(layout);
138:
139:                String label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_javadoc_support_label;
140:                addCheckBox(outer, label, PREF_JAVADOC_SUPPORT,
141:                        enabledDisabled, 0);
142:
143:                layout = new GridLayout();
144:                layout.numColumns = nColumns;
145:                layout.marginHeight = 0;
146:                //layout.marginWidth= 0;
147:
148:                Composite composite = new Composite(outer, SWT.NONE);
149:                composite.setLayout(layout);
150:                composite.setLayoutData(new GridData(GridData.FILL,
151:                        GridData.FILL, false, true));
152:
153:                fJavadocComposite = composite;
154:
155:                Label description = new Label(composite, SWT.WRAP);
156:                description
157:                        .setText(PreferencesMessages.JavadocProblemsConfigurationBlock_javadoc_description);
158:                GridData gd = new GridData();
159:                gd.horizontalSpan = nColumns;
160:                //gd.widthHint= fPixelConverter.convertWidthInCharsToPixels(60);
161:                description.setLayoutData(gd);
162:
163:                int indent = fPixelConverter.convertWidthInCharsToPixels(2);
164:
165:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_label;
166:                addComboBox(composite, label, PREF_PB_INVALID_JAVADOC,
167:                        errorWarningIgnore, errorWarningIgnoreLabels, 0);
168:
169:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_tags_visibility_label;
170:                addComboBox(composite, label,
171:                        PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY, visibilities,
172:                        visibilitiesLabels, indent);
173:
174:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_tags_label;
175:                addCheckBox(composite, label, PREF_PB_INVALID_JAVADOC_TAGS,
176:                        enabledDisabled, indent);
177:
178:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_tags_not_visible_ref_label;
179:                addCheckBox(composite, label,
180:                        PREF_PB_INVALID_JAVADOC_TAGS_NOT_VISIBLE_REF,
181:                        enabledDisabled, indent);
182:
183:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_invalid_javadoc_tags_deprecated_label;
184:                addCheckBox(composite, label,
185:                        PREF_PB_INVALID_JAVADOC_TAGS_DEPRECATED_REF,
186:                        enabledDisabled, indent);
187:
188:                gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
189:                gd.horizontalSpan = nColumns;
190:
191:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_javadoc_label;
192:                addComboBox(composite, label, PREF_PB_MISSING_JAVADOC_TAGS,
193:                        errorWarningIgnore, errorWarningIgnoreLabels, 0);
194:
195:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_javadoc_tags_visibility_label;
196:                addComboBox(composite, label,
197:                        PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY, visibilities,
198:                        visibilitiesLabels, indent);
199:
200:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_javadoc_tags_overriding_label;
201:                addCheckBox(composite, label,
202:                        PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING,
203:                        enabledDisabled, indent);
204:
205:                gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
206:                gd.horizontalSpan = nColumns;
207:
208:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_comments_label;
209:                addComboBox(composite, label, PREF_PB_MISSING_JAVADOC_COMMENTS,
210:                        errorWarningIgnore, errorWarningIgnoreLabels, 0);
211:
212:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_comments_visibility_label;
213:                addComboBox(composite, label,
214:                        PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY,
215:                        visibilities, visibilitiesLabels, indent);
216:
217:                label = PreferencesMessages.JavadocProblemsConfigurationBlock_pb_missing_comments_overriding_label;
218:                addCheckBox(composite, label,
219:                        PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING,
220:                        enabledDisabled, indent);
221:
222:                return sc1;
223:            }
224:
225:            /* (non-javadoc)
226:             * Update fields and validate.
227:             * @param changedKey Key that changed, or null, if all changed.
228:             */
229:            protected void validateSettings(Key changedKey, String oldValue,
230:                    String newValue) {
231:                if (!areSettingsEnabled()) {
232:                    return;
233:                }
234:
235:                if (changedKey != null) {
236:                    if (PREF_PB_INVALID_JAVADOC.equals(changedKey)
237:                            || PREF_PB_MISSING_JAVADOC_TAGS.equals(changedKey)
238:                            || PREF_PB_MISSING_JAVADOC_COMMENTS
239:                                    .equals(changedKey)
240:                            || PREF_JAVADOC_SUPPORT.equals(changedKey)) {
241:                        updateEnableStates();
242:                    } else {
243:                        return;
244:                    }
245:                } else {
246:                    updateEnableStates();
247:                }
248:                fContext.statusChanged(new StatusInfo());
249:            }
250:
251:            private void updateEnableStates() {
252:                boolean enableJavadoc = checkValue(PREF_JAVADOC_SUPPORT,
253:                        ENABLED);
254:                enableConfigControls(enableJavadoc);
255:
256:                if (enableJavadoc) {
257:                    boolean enableInvalidTagsErrors = !checkValue(
258:                            PREF_PB_INVALID_JAVADOC, IGNORE);
259:                    getCheckBox(PREF_PB_INVALID_JAVADOC_TAGS).setEnabled(
260:                            enableInvalidTagsErrors);
261:                    getCheckBox(PREF_PB_INVALID_JAVADOC_TAGS_NOT_VISIBLE_REF)
262:                            .setEnabled(enableInvalidTagsErrors);
263:                    getCheckBox(PREF_PB_INVALID_JAVADOC_TAGS_DEPRECATED_REF)
264:                            .setEnabled(enableInvalidTagsErrors);
265:                    setComboEnabled(PREF_PB_INVALID_JAVADOC_TAGS_VISIBILITY,
266:                            enableInvalidTagsErrors);
267:
268:                    boolean enableMissingTagsErrors = !checkValue(
269:                            PREF_PB_MISSING_JAVADOC_TAGS, IGNORE);
270:                    getCheckBox(PREF_PB_MISSING_JAVADOC_TAGS_OVERRIDING)
271:                            .setEnabled(enableMissingTagsErrors);
272:                    setComboEnabled(PREF_PB_MISSING_JAVADOC_TAGS_VISIBILITY,
273:                            enableMissingTagsErrors);
274:
275:                    boolean enableMissingCommentsErrors = !checkValue(
276:                            PREF_PB_MISSING_JAVADOC_COMMENTS, IGNORE);
277:                    getCheckBox(PREF_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING)
278:                            .setEnabled(enableMissingCommentsErrors);
279:                    setComboEnabled(
280:                            PREF_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY,
281:                            enableMissingCommentsErrors);
282:                }
283:            }
284:
285:            protected void enableConfigControls(boolean enable) {
286:                if (enable) {
287:                    if (fBlockEnableState != null) {
288:                        fBlockEnableState.restore();
289:                        fBlockEnableState = null;
290:                    }
291:                } else {
292:                    if (fBlockEnableState == null) {
293:                        fBlockEnableState = ControlEnableState
294:                                .disable(fJavadocComposite);
295:                    }
296:                }
297:            }
298:
299:            protected String[] getFullBuildDialogStrings(
300:                    boolean workspaceSettings) {
301:                String title = PreferencesMessages.JavadocProblemsConfigurationBlock_needsbuild_title;
302:                String message;
303:                if (workspaceSettings) {
304:                    message = PreferencesMessages.JavadocProblemsConfigurationBlock_needsfullbuild_message;
305:                } else {
306:                    message = PreferencesMessages.JavadocProblemsConfigurationBlock_needsprojectbuild_message;
307:                }
308:                return new String[] { title, message };
309:            }
310:
311:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.