Source Code Cross Referenced for JavaSourceSelectionPage.java in  » Web-Services-AXIS2 » tools » org » apache » axis2 » tool » codegen » eclipse » ui » 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 » Web Services AXIS2 » tools » org.apache.axis2.tool.codegen.eclipse.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */
019:        package org.apache.axis2.tool.codegen.eclipse.ui;
020:
021:        import java.util.ArrayList;
022:        import java.util.Iterator;
023:
024:        import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
025:        import org.apache.axis2.tool.codegen.eclipse.util.ClassFileReader;
026:        import org.eclipse.swt.SWT;
027:        import org.eclipse.swt.custom.ScrolledComposite;
028:        import org.eclipse.swt.events.ModifyEvent;
029:        import org.eclipse.swt.events.ModifyListener;
030:        import org.eclipse.swt.events.MouseAdapter;
031:        import org.eclipse.swt.events.MouseEvent;
032:        import org.eclipse.swt.layout.GridData;
033:        import org.eclipse.swt.layout.GridLayout;
034:        import org.eclipse.swt.widgets.Button;
035:        import org.eclipse.swt.widgets.Composite;
036:        import org.eclipse.swt.widgets.DirectoryDialog;
037:        import org.eclipse.swt.widgets.FileDialog;
038:        import org.eclipse.swt.widgets.Label;
039:        import org.eclipse.swt.widgets.List;
040:        import org.eclipse.swt.widgets.Text;
041:
042:        public class JavaSourceSelectionPage extends AbstractWizardPage {
043:
044:            private Composite container;
045:            private Text javaClassNameBox;
046:            private List javaClasspathList;
047:            private Label statusLabel;
048:
049:            public JavaSourceSelectionPage() {
050:                super ("page4");
051:            }
052:
053:            protected void initializeDefaultSettings() {
054:                settings.put(JAVA_CLASS_NAME, "");
055:                settings.put(JAVA_CLASS_PATH_ENTRIES, new String[] { "" });
056:            }
057:
058:            /*
059:             * (non-Javadoc)
060:             * 
061:             * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
062:             */
063:            public int getPageType() {
064:                return JAVA_2_WSDL_TYPE;
065:            }
066:
067:            /*
068:             * (non-Javadoc)
069:             * 
070:             * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
071:             */
072:            public void createControl(Composite parent) {
073:                container = new Composite(parent, SWT.NULL);
074:                GridLayout layout = new GridLayout();
075:                container.setLayout(layout);
076:                layout.numColumns = 3;
077:                layout.verticalSpacing = 9;
078:
079:                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
080:
081:                //class name  entry
082:                Label label = new Label(container, SWT.NULL);
083:                label.setText(CodegenWizardPlugin
084:                        .getResourceString("page4.classname.label"));
085:
086:                gd = new GridData(GridData.FILL_HORIZONTAL);
087:                gd.horizontalSpan = 2;
088:                javaClassNameBox = new Text(container, SWT.BORDER);
089:                javaClassNameBox.setLayoutData(gd);
090:                javaClassNameBox.setText(settings.get(JAVA_CLASS_NAME));
091:                javaClassNameBox.addModifyListener(new ModifyListener() {
092:                    public void modifyText(ModifyEvent e) {
093:                        handleClassNameTextChange();
094:                    }
095:                });
096:
097:                //class path entry
098:                gd = new GridData(GridData.FILL_HORIZONTAL);
099:                gd.horizontalSpan = 3;
100:                label = new Label(container, SWT.NULL);
101:                label.setLayoutData(gd);
102:                label.setText(CodegenWizardPlugin
103:                        .getResourceString("page4.classpath.label"));
104:
105:                gd = new GridData(GridData.FILL_HORIZONTAL);
106:                Button addDirButton = new Button(container, SWT.PUSH);
107:                addDirButton.setLayoutData(gd);
108:                addDirButton.setText(CodegenWizardPlugin
109:                        .getResourceString("page4.addDir.label"));
110:                addDirButton.addMouseListener(new MouseAdapter() {
111:                    public void mouseUp(MouseEvent e) {
112:                        handleDirectoryBrowse();
113:                    }
114:                });
115:
116:                gd = new GridData(GridData.FILL_HORIZONTAL);
117:                Button addJarButton = new Button(container, SWT.PUSH);
118:                addJarButton.setLayoutData(gd);
119:                addJarButton.setText(CodegenWizardPlugin
120:                        .getResourceString("page4.addJar.label"));
121:                addJarButton.addMouseListener(new MouseAdapter() {
122:                    public void mouseUp(MouseEvent e) {
123:                        handleFileBrowse();
124:                    }
125:                });
126:
127:                gd = new GridData(GridData.FILL_HORIZONTAL);
128:                Button removeEntryButton = new Button(container, SWT.PUSH);
129:                removeEntryButton.setLayoutData(gd);
130:                removeEntryButton.setText(CodegenWizardPlugin
131:                        .getResourceString("page4.removeEntry.label"));
132:                removeEntryButton.addMouseListener(new MouseAdapter() {
133:                    public void mouseUp(MouseEvent e) {
134:                        handleRemove();
135:                    }
136:                });
137:
138:                gd = new GridData(GridData.FILL_HORIZONTAL);
139:                gd.horizontalSpan = 3;
140:                gd.verticalSpan = 2;
141:                ScrolledComposite c2 = new ScrolledComposite(container,
142:                        SWT.V_SCROLL);
143:                c2.setExpandHorizontal(false);
144:                c2.setExpandVertical(false);
145:                c2.setLayoutData(gd);
146:                javaClasspathList = new List(c2, SWT.READ_ONLY | SWT.BORDER
147:                        | SWT.V_SCROLL);
148:                javaClasspathList.setLayoutData(gd);
149:                settings.put(JAVA_CLASS_PATH_ENTRIES, new String[] {});
150:                javaClasspathList.setItems(settings
151:                        .getArray(JAVA_CLASS_PATH_ENTRIES));
152:                javaClasspathList.setSize(600, 250);
153:                c2.setContent(javaClasspathList);
154:
155:                gd = new GridData(GridData.FILL_HORIZONTAL);
156:                Button tryLoadButton = new Button(container, SWT.PUSH);
157:                tryLoadButton.setLayoutData(gd);
158:                tryLoadButton.setText(CodegenWizardPlugin
159:                        .getResourceString("page4.tryLoad.label"));
160:                tryLoadButton.addMouseListener(new MouseAdapter() {
161:                    public void mouseUp(MouseEvent e) {
162:                        java.util.List errorListener = new ArrayList();
163:                        if (!ClassFileReader.tryLoadingClass(getClassName(),
164:                                getClassPathList(), errorListener)) {
165:                            Iterator it = errorListener.iterator();
166:                            while (it.hasNext()) {
167:                                Object nextObject = it.next();
168:                                String errorMessage = nextObject == null ? CodegenWizardPlugin
169:                                        .getResourceString("page4.unknownError.label")
170:                                        : nextObject.toString();
171:                                updateStatus(errorMessage);
172:                                updateStatusTextField(false, errorMessage);
173:                            }
174:
175:                        } else {
176:                            updateStatusTextField(
177:                                    true,
178:                                    CodegenWizardPlugin
179:                                            .getResourceString("page4.successLoading.label"));
180:                            updateStatus(null);
181:                        }
182:                    }
183:                });
184:
185:                gd = new GridData(GridData.FILL_HORIZONTAL);
186:                gd.horizontalSpan = 2;
187:                statusLabel = new Label(container, SWT.NULL);
188:                statusLabel.setLayoutData(gd);
189:
190:                //filling label 
191:                gd = new GridData(GridData.FILL_HORIZONTAL);
192:                gd.horizontalSpan = 3;
193:                Label fillLabel3 = new Label(container, SWT.HORIZONTAL
194:                        | SWT.SEPARATOR);
195:                fillLabel3.setLayoutData(gd);
196:
197:                gd = new GridData(GridData.FILL_HORIZONTAL);
198:                gd.horizontalSpan = 3;
199:                Label hintLabel = new Label(container, SWT.NULL);
200:                hintLabel.setText(CodegenWizardPlugin
201:                        .getResourceString("page4.hint.caption"));
202:                hintLabel.setLayoutData(gd);
203:                //		hintLabel.setFont(new Font(new Device() {
204:                //			public int internal_new_GC(GCData data) {return 0;}
205:                //			public void internal_dispose_GC(int handle, GCData data) {}
206:                //											},"hintFont",8,SWT.NORMAL));
207:
208:                setPageComplete(false);
209:                setControl(container);
210:
211:                if (restoredFromPreviousSettings) {
212:                    handleClassNameTextChange();
213:                }
214:
215:            }
216:
217:            /**
218:             * Pops up the file browse dialog box
219:             *  
220:             */
221:            private void handleDirectoryBrowse() {
222:                DirectoryDialog fileDialog = new DirectoryDialog(this 
223:                        .getShell());
224:                String dirName = fileDialog.open();
225:                if (dirName != null) {
226:                    if (!checkFilenameExistsInList(dirName)) {
227:                        javaClasspathList.add(dirName);
228:                        updateListEntries();
229:                    }
230:                }
231:                updateStatusTextField(false, "");
232:            }
233:
234:            /**
235:             * Pops up the file browse dialog box
236:             *  
237:             */
238:            private void handleRemove() {
239:                int[] selectionIndices = javaClasspathList
240:                        .getSelectionIndices();
241:                for (int i = 0; i < selectionIndices.length; i++) {
242:                    javaClasspathList.remove(selectionIndices[i]);
243:                }
244:                updateListEntries();
245:                updateStatusTextField(false, "");
246:            }
247:
248:            /**
249:             * Pops up the file browse dialog box
250:             *  
251:             */
252:            private void handleFileBrowse() {
253:                FileDialog fileDialog = new FileDialog(this .getShell());
254:                fileDialog.setFilterExtensions(new String[] { "*.jar" });
255:                String fileName = fileDialog.open();
256:                if (fileName != null) {
257:                    if (!checkFilenameExistsInList(fileName)) {
258:                        javaClasspathList.add(fileName);
259:                        updateListEntries();
260:                    }
261:                }
262:                updateStatusTextField(false, "");
263:            }
264:
265:            /**
266:             * Method checks the list antries and compare that to the file name 
267:             * return the results of the comparison
268:             * @param filename
269:             * @return
270:             */
271:            private boolean checkFilenameExistsInList(String filename) {
272:                String[] array = javaClasspathList.getItems();
273:
274:                for (int i = 0; i < array.length; i++) {
275:                    if (array[i].equals(filename)) {
276:                        return true;
277:                    }
278:                }
279:                return false;
280:            }
281:
282:            private void updateStatusTextField(boolean success, String text) {
283:                if (success) {
284:                    getCodegenWizard().setDefaultNamespaces(
285:                            javaClassNameBox.getText());
286:                }
287:                statusLabel.setText(text);
288:            }
289:
290:            private void updateListEntries() {
291:                settings.put(JAVA_CLASS_PATH_ENTRIES, javaClasspathList
292:                        .getItems());
293:            }
294:
295:            /**
296:             * 
297:             *
298:             */
299:            private void handleClassNameTextChange() {
300:                String className = javaClassNameBox.getText();
301:                settings.put(JAVA_CLASS_NAME, className);
302:                if (className == null || "".equals(className.trim())) {
303:                    updateStatus(CodegenWizardPlugin
304:                            .getResourceString("page4.error.invalidClassName"));
305:                } else if (className.endsWith(".")) {
306:                    updateStatus(CodegenWizardPlugin
307:                            .getResourceString("page4.error.ClassNameNotTerminated"));
308:                } else {
309:                    //just leave it
310:                    //updateStatus(null);
311:                }
312:            }
313:
314:            /**
315:             * 
316:             * @return
317:             */
318:            public String getClassName() {
319:                return javaClassNameBox.getText();
320:            }
321:
322:            /**
323:             * 
324:             * @return
325:             */
326:            public String[] getClassPathList() {
327:                return javaClasspathList.getItems();
328:            }
329:
330:        }
w___ww.j_av___a___2___s__.___co_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.