Source Code Cross Referenced for FixAllImports.java in  » IDE-Netbeans » java » org » netbeans » jellytools » modules » java » 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 Netbeans » java » org.netbeans.jellytools.modules.java 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * Portions Copyrighted 2007 Sun Microsystems, Inc.
027:         */
028:        package org.netbeans.jellytools.modules.java;
029:
030:        import java.awt.Container;
031:        import java.util.HashMap;
032:        import java.util.Map;
033:        import javax.swing.JDialog;
034:        import javax.swing.JLabel;
035:        import org.netbeans.jemmy.operators.*;
036:        import org.netbeans.jemmy.util.NameComponentChooser;
037:
038:        /** Class implementing all necessary methods for handling "Fix All Imports" NbDialog.
039:         *
040:         * @author Jiri Prox Jiri.Prox@Sun.COM
041:         * @version 1.0
042:         */
043:        public class FixAllImports extends JDialogOperator {
044:
045:            /** Creates new FixAllImports that can handle it.
046:             */
047:            public FixAllImports() {
048:                super (waitFixImportDialog());
049:            }
050:
051:            private static JDialog waitFixImportDialog() {
052:                JDialogOperator candidate = new JDialogOperator(TITLE);
053:                return (JDialog) candidate.getSource();
054:            }
055:
056:            public static final String TITLE = "Fix All Imports";
057:            private JLabelOperator _lblHtmlSelectTheFullyQualifiedNameToUseInTheImportStatementHtml;
058:            private JComboBoxOperator _cbo;
059:            public static final String ITEM_COMSUNXMLINTERNALBINDV2SCHEMAGENXMLSCHEMALIST = "com.sun.xml.internal.bind.v2.schemagen.xmlschema.List";
060:            public static final String ITEM_JAVAAWTLIST = "java.awt.List";
061:            public static final String ITEM_JAVAUTILLIST = "java.util.List";
062:            private JLabelOperator _lblVector;
063:            private JComboBoxOperator _cboVector;
064:            public static final String ITEM_JAVAUTILVECTOR = "java.util.Vector";
065:            private JButtonOperator _btMetalScrollButton;
066:            private JButtonOperator _btMetalScrollButton2;
067:            private JButtonOperator _btMetalScrollButton3;
068:            private JButtonOperator _btMetalScrollButton4;
069:            private JCheckBoxOperator _cbRemoveUnusedImports;
070:            private JLabelOperator _lblImportStatements;
071:            private JButtonOperator _btOK;
072:            private JButtonOperator _btCancel;
073:            private JLabelOperator _lblNothingToFix;
074:
075:            //******************************
076:            // Subcomponents definition part
077:            //******************************
078:
079:            /** Tries to find "<html>Select the fully qualified name to use in the import statement.</html>" JLabel in this dialog.
080:             * @return JLabelOperator
081:             */
082:            public JLabelOperator lblHtmlSelectTheFullyQualifiedNameToUseInTheImportStatementHtml() {
083:                if (_lblHtmlSelectTheFullyQualifiedNameToUseInTheImportStatementHtml == null) {
084:                    _lblHtmlSelectTheFullyQualifiedNameToUseInTheImportStatementHtml = new JLabelOperator(
085:                            this ,
086:                            "<html>Select the fully qualified name to use in the import statement.</html>");
087:                }
088:                return _lblHtmlSelectTheFullyQualifiedNameToUseInTheImportStatementHtml;
089:            }
090:
091:            /** Tries to find null JComboBox in this dialog.
092:             * @return JComboBoxOperator
093:             */
094:
095:            private Map<Integer, JComboBoxOperator> operators = new HashMap<Integer, JComboBoxOperator>();
096:
097:            public JComboBoxOperator cbo(int index) {
098:                Integer i = new Integer(index);
099:                JComboBoxOperator _cbo = operators.get(i);
100:                if (_cbo == null) {
101:                    _cbo = new JComboBoxOperator(this , index);
102:                    operators.put(i, _cbo);
103:                }
104:                return _cbo;
105:            }
106:
107:            public JComboBoxOperator get(int key) {
108:                return operators.get(key);
109:            }
110:
111:            private Map<Integer, JLabelOperator> labelOperators = new HashMap<Integer, JLabelOperator>();
112:
113:            public JLabelOperator lo(int index) {
114:                Integer i = new Integer(index);
115:                JLabelOperator _lo = labelOperators.get(i);
116:                if (_lo == null) {
117:                    _lo = new JLabelOperator(this , index + 2);
118:                    labelOperators.put(i, _lo);
119:                }
120:                return _lo;
121:            }
122:
123:            public JLabelOperator getLo(int key) {
124:                return labelOperators.get(key);
125:            }
126:
127:            /** Tries to find "Remove unused imports" JCheckBox in this dialog.
128:             * @return JCheckBoxOperator
129:             */
130:            public JCheckBoxOperator cbRemoveUnusedImports() {
131:                if (_cbRemoveUnusedImports == null) {
132:                    _cbRemoveUnusedImports = new JCheckBoxOperator(this ,
133:                            "Remove unused imports");
134:                }
135:                return _cbRemoveUnusedImports;
136:            }
137:
138:            /** Tries to find "Import Statements:" JLabel in this dialog.
139:             * @return JLabelOperator
140:             */
141:            public JLabelOperator lblImportStatements() {
142:                if (_lblImportStatements == null) {
143:                    _lblImportStatements = new JLabelOperator(this ,
144:                            "Import Statements:");
145:                }
146:                return _lblImportStatements;
147:            }
148:
149:            public JLabelOperator lblNothingToFix() {
150:                if (_lblNothingToFix == null) {
151:                    _lblNothingToFix = new JLabelOperator(this ,
152:                            "<nothing to fix>");
153:                }
154:                return _lblNothingToFix;
155:            }
156:
157:            /** Tries to find "OK" JButton in this dialog.
158:             * @return JButtonOperator
159:             */
160:            public JButtonOperator btOK() {
161:                if (_btOK == null) {
162:                    _btOK = new JButtonOperator(this , "OK");
163:                }
164:                return _btOK;
165:            }
166:
167:            /** Tries to find "Cancel" JButton in this dialog.
168:             * @return JButtonOperator
169:             */
170:            public JButtonOperator btCancel() {
171:                if (_btCancel == null) {
172:                    _btCancel = new JButtonOperator(this , "Cancel");
173:                }
174:                return _btCancel;
175:            }
176:
177:            //****************************************
178:            // Low-level functionality definition part
179:            //****************************************
180:
181:            /** returns selected item for cboList
182:             * @return String item
183:             */
184:            public String getSelectedList(int index) {
185:                return cbo(index).getSelectedItem().toString();
186:            }
187:
188:            /** checks or unchecks given JCheckBox
189:             * @param state boolean requested state
190:             */
191:            public void checkRemoveUnusedImports(boolean state) {
192:                if (cbRemoveUnusedImports().isSelected() != state) {
193:                    cbRemoveUnusedImports().push();
194:                }
195:            }
196:
197:            /** clicks on "OK" JButton
198:             */
199:            public void ok() {
200:                btOK().push();
201:            }
202:
203:            /** clicks on "Cancel" JButton
204:             */
205:            public void cancel() {
206:                btCancel().push();
207:            }
208:
209:            //*****************************************
210:            // High-level functionality definition part
211:            //*****************************************
212:
213:            /** Performs verification of FixAllImports by accessing all its components.
214:             */
215:            public void verify() {
216:                lblHtmlSelectTheFullyQualifiedNameToUseInTheImportStatementHtml();
217:                cbRemoveUnusedImports();
218:                lblImportStatements();
219:                btOK();
220:                btCancel();
221:            }
222:
223:            /** Performs simple test of FixAllImports
224:             * @param args the command line arguments
225:             */
226:            public static void main(String args[]) {
227:                new FixAllImports().verify();
228:                System.out.println("FixAllImports verification finished.");
229:            }
230:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.