Source Code Cross Referenced for AdvancedFactoryPathOptionsDialog.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » apt » ui » internal » 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.apt.ui.internal.preferences 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2005, 2007 BEA Systems, Inc.
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:         *   wharley@bea.com - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jdt.apt.ui.internal.preferences;
011:
012:        import java.io.IOException;
013:        import java.util.Map.Entry;
014:
015:        import org.eclipse.jdt.apt.core.internal.util.FactoryContainer;
016:        import org.eclipse.jdt.apt.core.internal.util.FactoryPath;
017:        import org.eclipse.jdt.apt.ui.internal.util.ExceptionHandler;
018:        import org.eclipse.jdt.apt.ui.internal.util.IAptHelpContextIds;
019:        import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
020:        import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
021:        import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
022:        import org.eclipse.jface.dialogs.Dialog;
023:        import org.eclipse.jface.viewers.ListViewer;
024:        import org.eclipse.swt.SWT;
025:        import org.eclipse.swt.layout.GridData;
026:        import org.eclipse.swt.widgets.Composite;
027:        import org.eclipse.swt.widgets.Control;
028:        import org.eclipse.swt.widgets.Label;
029:        import org.eclipse.swt.widgets.Shell;
030:        import org.eclipse.ui.PlatformUI;
031:
032:        /**
033:         * Dialog to display "advanced options" on a FactoryPathEntry,
034:         * typically in the context of the factory path config UI.
035:         * Advanced options are those which do not normally need to
036:         * be configured, and which may require deeper-than-usual
037:         * understanding of the annotation processing architecture.
038:         */
039:        public class AdvancedFactoryPathOptionsDialog extends Dialog {
040:
041:            private final static int LIST_WIDTH = 70; // width (in chars) of factory list
042:            private final static int LIST_HEIGHT = 10; // number of lines in factory list
043:
044:            private class FieldAdapter implements  IDialogFieldListener {
045:                public void dialogFieldChanged(DialogField field) {
046:                }
047:            }
048:
049:            // shallow copies, because they are not changed by this code
050:            private final FactoryContainer _fc;
051:            private final FactoryPath.Attributes _attr;
052:
053:            // Dialog controls
054:            private SelectionButtonDialogField _batchModeField;
055:            private ListViewer _contentsField;
056:
057:            public AdvancedFactoryPathOptionsDialog(Shell parent,
058:                    FactoryContainer fc, FactoryPath.Attributes attr) {
059:                super (parent);
060:                setShellStyle(getShellStyle() | SWT.RESIZE);
061:                _fc = fc;
062:                _attr = attr;
063:            }
064:
065:            protected void configureShell(Shell shell) {
066:                super .configureShell(shell);
067:                shell
068:                        .setText(Messages.AdvancedFactoryPathOptionsDialog_advancedOptions);
069:                PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
070:                        IAptHelpContextIds.ADVANCED_FACTORYPATH_OPTIONS_DIALOG);
071:            }
072:
073:            protected Control createDialogArea(Composite parent) {
074:                Composite dlgArea = (Composite) super .createDialogArea(parent);
075:
076:                // Set up "batch mode" checkbox.
077:                FieldAdapter adapter = new FieldAdapter();
078:                _batchModeField = new SelectionButtonDialogField(SWT.CHECK);
079:                _batchModeField.setSelection(_attr.runInBatchMode());
080:                _batchModeField
081:                        .setLabelText(Messages.AdvancedFactoryPathOptionsDialog_batchMode);
082:                _batchModeField.setDialogFieldListener(adapter);
083:                _batchModeField.doFillIntoGrid(dlgArea, 2);
084:                // Plugins can't run in APT compatibility mode.
085:                boolean isPlugin = _fc.getType() == FactoryContainer.FactoryType.PLUGIN;
086:                _batchModeField.setEnabled(!isPlugin);
087:
088:                DialogField.createEmptySpace(dlgArea, 1);
089:
090:                // Set up label for processor contents list
091:                Label description = new Label(dlgArea, SWT.WRAP);
092:                description
093:                        .setText(Messages.AdvancedFactoryPathOptionsDialog_label_processorsInThisContainer);
094:                GridData gdLabel = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
095:                gdLabel.horizontalSpan = 2;
096:                description.setLayoutData(gdLabel);
097:
098:                // Set up processor contents list
099:                _contentsField = new ListViewer(dlgArea, SWT.SINGLE
100:                        | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
101:                GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
102:                data.heightHint = convertHeightInCharsToPixels(LIST_HEIGHT);
103:                data.widthHint = convertWidthInCharsToPixels(LIST_WIDTH);
104:                _contentsField.getList().setLayoutData(data);
105:                _contentsField.getList().setFont(parent.getFont());
106:                try {
107:                    for (Entry<String, String> entry : _fc.getFactoryNames()
108:                            .entrySet()) {
109:                        String name = entry.getKey();
110:                        _contentsField.add(name);
111:                        //TODO: display the processor type (i.e., entry.getValue())
112:                    }
113:                } catch (IOException e) {
114:                    final String message = "Unable to load factory names from container [" + _fc.getId() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
115:                    ExceptionHandler.log(e, message);
116:                }
117:                _contentsField.setSelection(null, false);
118:
119:                applyDialogFont(dlgArea);
120:                return dlgArea;
121:            }
122:
123:            /**
124:             * Return a new Attributes representing the original value updated
125:             * with any changes made by the user.  Changes will be included even
126:             * if the dialog was cancelled, so this should only be called if the
127:             * dialog returned OK.
128:             */
129:            public FactoryPath.Attributes getResult() {
130:                boolean batchMode = _batchModeField.isSelected();
131:                return new FactoryPath.Attributes(_attr.isEnabled(), batchMode);
132:            }
133:        }
w_w___w_.__jav_a_2s___._c__o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.