Source Code Cross Referenced for OptionsPage.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) 


0001:        /*
0002:         * Licensed to the Apache Software Foundation (ASF) under one
0003:         * or more contributor license agreements. See the NOTICE file
0004:         * distributed with this work for additional information
0005:         * regarding copyright ownership. The ASF licenses this file
0006:         * to you under the Apache License, Version 2.0 (the
0007:         * "License"); you may not use this file except in compliance
0008:         * with the License. You may obtain a copy of the License at
0009:         *
0010:         * http://www.apache.org/licenses/LICENSE-2.0
0011:         *
0012:         * Unless required by applicable law or agreed to in writing,
0013:         * software distributed under the License is distributed on an
0014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015:         * KIND, either express or implied. See the License for the
0016:         * specific language governing permissions and limitations
0017:         * under the License.
0018:         */
0019:
0020:        package org.apache.axis2.tool.codegen.eclipse.ui;
0021:
0022:        import java.util.Iterator;
0023:        import java.util.Map;
0024:
0025:        import javax.wsdl.WSDLException;
0026:        import javax.xml.namespace.QName;
0027:
0028:        import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
0029:        import org.apache.axis2.tool.codegen.eclipse.util.UIConstants;
0030:        import org.apache.axis2.tool.codegen.eclipse.util.WSDLPropertyReader;
0031:        import org.apache.axis2.util.URLProcessor;
0032:        import org.eclipse.swt.SWT;
0033:        import org.eclipse.swt.custom.TableEditor;
0034:        import org.eclipse.swt.events.ModifyEvent;
0035:        import org.eclipse.swt.events.ModifyListener;
0036:        import org.eclipse.swt.events.SelectionEvent;
0037:        import org.eclipse.swt.events.SelectionListener;
0038:        import org.eclipse.swt.graphics.Point;
0039:        import org.eclipse.swt.graphics.Rectangle;
0040:        import org.eclipse.swt.layout.GridData;
0041:        import org.eclipse.swt.layout.GridLayout;
0042:        import org.eclipse.swt.widgets.Button;
0043:        import org.eclipse.swt.widgets.Combo;
0044:        import org.eclipse.swt.widgets.Composite;
0045:        import org.eclipse.swt.widgets.Event;
0046:        import org.eclipse.swt.widgets.Label;
0047:        import org.eclipse.swt.widgets.Listener;
0048:        import org.eclipse.swt.widgets.Table;
0049:        import org.eclipse.swt.widgets.TableColumn;
0050:        import org.eclipse.swt.widgets.TableItem;
0051:        import org.eclipse.swt.widgets.Text;
0052:
0053:        /**
0054:         * Options Page lets the user change general settings on the code generation. It
0055:         * is used in the CodegenWizardPlugin, CodeGenWizard.
0056:         * 
0057:         */
0058:        public class OptionsPage extends AbstractWizardPage implements 
0059:                UIConstants {
0060:
0061:            /**
0062:             * Selection list for target languages
0063:             */
0064:            private Combo languageSelectionComboBox;
0065:
0066:            /**
0067:             * A radio button to enable/disable code generation for synchronous and
0068:             * asynchronous calls.
0069:             */
0070:            private Button syncAndAsyncRadioButton;
0071:
0072:            /**
0073:             * A radio button to choose "synchronous only" code generation
0074:             */
0075:            private Button syncOnlyRadioButton;
0076:
0077:            /**
0078:             * A radio button to choose "asynchronous only" code generation
0079:             */
0080:            private Button asyncOnlyRadioButton;
0081:
0082:            /**
0083:             * Label holding the full qualified package name for generated code
0084:             */
0085:            private Text packageText;
0086:
0087:            /**
0088:             * Checkbox to enable server-side skeleton code generation. If enabled,
0089:             * generates an empty implementation of the service
0090:             */
0091:            private Button serverSideCheckBoxButton;
0092:
0093:            /**
0094:             * Checkbox to enable client side code generation. If enabled,
0095:             * generates an empty implementation of the service
0096:             */
0097:            private Button clientSideCheckBoxButton;
0098:
0099:            /**
0100:             * Checkbox to enable the generation of test case classes for the generated
0101:             * implementation of the webservice.
0102:             */
0103:            private Button testCaseCheckBoxButton;
0104:
0105:            /**
0106:             * Checkbox to enable the generation of a default server.xml configuration
0107:             * file
0108:             */
0109:            private Button serverXMLCheckBoxButton;
0110:
0111:            /**
0112:             * Checkbox to enable the generate all classes
0113:             */
0114:            private Button generateAllCheckBoxButton;
0115:
0116:            /**
0117:             *  check box for server side interface
0118:             */
0119:            private Button generateServerSideInterfaceCheckBoxButton;
0120:
0121:            private Combo databindingTypeCombo;
0122:
0123:            /**
0124:             * Text box to have the portname
0125:             */
0126:            private Combo portNameCombo;
0127:
0128:            /**
0129:             * Text box to have the service name
0130:             */
0131:            private Combo serviceNameCombo;
0132:
0133:            private WSDLPropertyReader reader;
0134:
0135:            private java.util.List serviceQNameList = null;
0136:
0137:            private final int EDITABLECOLUMN = 1;
0138:            private String defaultPackageName = null;
0139:
0140:            private Combo codegenOptionSelectionComboBox;
0141:
0142:            /**
0143:             * A table to keep the namespace to 
0144:             * package mappings
0145:             */
0146:            private Table namespace2packageTable = null;
0147:
0148:            Composite container;
0149:
0150:            /**
0151:             * Creates the page and initialize some settings
0152:             */
0153:            public OptionsPage() {
0154:                super ("page2");
0155:            }
0156:
0157:            /**
0158:             * Sets the default values for the Options page
0159:             * 
0160:             */
0161:            protected void initializeDefaultSettings() {
0162:                settings.put(PREF_CHECK_GENERATE_SERVERCONFIG, false);
0163:                settings.put(PREF_CHECK_GENERATE_SERVERSIDE, false);
0164:                settings.put(PREF_CHECK_GENERATE_TESTCASE, false);
0165:                settings.put(PREF_LANGUAGE_INDEX, 0);
0166:                settings.put(PREF_PACKAGE_NAME, DEFAULT_PACKAGENAME);
0167:                settings.put(PREF_RADIO_ASYNC_ONLY, false);
0168:                settings.put(PREF_RADIO_SYNC_AND_ASYNC, true);
0169:                settings.put(PREF_RADIO_SYNC_ONLY, false);
0170:                settings.put(PREF_COMBO_PORTNAME_INDEX, 0);
0171:                settings.put(PREF_COMBO_SERVICENAME_INDEX, 0);
0172:                settings.put(PREF_DATABINDER_INDEX, 0);
0173:                settings.put(PREF_GEN_ALL, false);
0174:                settings.put(PREF_GEN_SS_INTERFACE, false);
0175:            }
0176:
0177:            /*
0178:             * (non-Javadoc)
0179:             * 
0180:             * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
0181:             */
0182:            public void createControl(Composite parent) {
0183:
0184:                container = new Composite(parent, SWT.NULL);
0185:                GridLayout layout = new GridLayout();
0186:                container.setLayout(layout);
0187:                layout.numColumns = 3;
0188:                GridData gd = new GridData(GridData.FILL_HORIZONTAL);
0189:
0190:                Label label = new Label(container, SWT.NULL);
0191:                label.setText(CodegenWizardPlugin
0192:                        .getResourceString("page2.options.desc"));
0193:                label.setLayoutData(gd);
0194:
0195:                gd = new GridData(GridData.FILL_HORIZONTAL);
0196:                gd.horizontalSpan = 2;
0197:
0198:                codegenOptionSelectionComboBox = new Combo(container,
0199:                        SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
0200:                // fill the combo
0201:                this .fillCodegenOptionSelectionComboBox();
0202:                codegenOptionSelectionComboBox.setLayoutData(gd);
0203:                settings.put(PREF_CODEGEN_OPTION_INDEX,
0204:                        codegenOptionSelectionComboBox.getSelectionIndex());
0205:                codegenOptionSelectionComboBox.select(settings
0206:                        .getInt(PREF_CODEGEN_OPTION_INDEX));
0207:                codegenOptionSelectionComboBox
0208:                        .addSelectionListener(new SelectionListener() {
0209:                            public void widgetSelected(SelectionEvent e) {
0210:                                settings.put(PREF_CODEGEN_OPTION_INDEX,
0211:                                        codegenOptionSelectionComboBox
0212:                                                .getSelectionIndex());
0213:                                if (codegenOptionSelectionComboBox
0214:                                        .getSelectionIndex() == 0) {
0215:                                    disableControls();
0216:
0217:                                } else if (codegenOptionSelectionComboBox
0218:                                        .getSelectionIndex() == 1) {
0219:                                    enableControls();
0220:                                }
0221:                            }
0222:
0223:                            public void widgetDefaultSelected(SelectionEvent e) {
0224:                            }
0225:                        });
0226:
0227:                gd = new GridData(GridData.FILL_HORIZONTAL);
0228:                gd.horizontalSpan = 2;
0229:
0230:                Label label1 = new Label(container, SWT.NULL);
0231:                label1.setText(CodegenWizardPlugin
0232:                        .getResourceString("page2.language.caption"));
0233:
0234:                languageSelectionComboBox = new Combo(container, SWT.DROP_DOWN
0235:                        | SWT.BORDER | SWT.READ_ONLY);
0236:                // fill the combo
0237:                this .fillLanguageCombo();
0238:                languageSelectionComboBox.setLayoutData(gd);
0239:                languageSelectionComboBox.select(settings
0240:                        .getInt(PREF_LANGUAGE_INDEX));
0241:                languageSelectionComboBox
0242:                        .addSelectionListener(new SelectionListener() {
0243:                            public void widgetSelected(SelectionEvent e) {
0244:                                settings.put(PREF_LANGUAGE_INDEX,
0245:                                        languageSelectionComboBox
0246:                                                .getSelectionIndex());
0247:                            }
0248:
0249:                            public void widgetDefaultSelected(SelectionEvent e) {
0250:                            }
0251:                        });
0252:
0253:                // service name
0254:                label = new Label(container, SWT.NULL);
0255:                label.setText(CodegenWizardPlugin
0256:                        .getResourceString("page2.serviceName.caption"));
0257:
0258:                serviceNameCombo = new Combo(container, SWT.DROP_DOWN
0259:                        | SWT.BORDER | SWT.READ_ONLY);
0260:                gd = new GridData(GridData.FILL_HORIZONTAL);
0261:                gd.horizontalSpan = 2;
0262:                serviceNameCombo.setLayoutData(gd);
0263:                // serviceNameCombo.setText(settings.get(PREF_TEXT_SERVICENAME));
0264:                serviceNameCombo.addSelectionListener(new SelectionListener() {
0265:                    public void widgetSelected(SelectionEvent e) {
0266:                        // update the settings
0267:                        settings.put(PREF_COMBO_SERVICENAME_INDEX,
0268:                                serviceNameCombo.getSelectionIndex());
0269:                        // reload the portName list
0270:                        loadPortNames();
0271:
0272:                    }
0273:
0274:                    public void widgetDefaultSelected(SelectionEvent e) {
0275:                    }
0276:                });
0277:
0278:                // port name
0279:                label = new Label(container, SWT.NULL);
0280:                label.setText(CodegenWizardPlugin
0281:                        .getResourceString("page2.portName.caption"));
0282:                portNameCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER
0283:                        | SWT.READ_ONLY);
0284:                gd = new GridData(GridData.FILL_HORIZONTAL);
0285:                gd.horizontalSpan = 2;
0286:                portNameCombo.setLayoutData(gd);
0287:
0288:                portNameCombo.addSelectionListener(new SelectionListener() {
0289:                    public void widgetSelected(SelectionEvent e) {
0290:                        // update the settings
0291:                        settings.put(PREF_COMBO_PORTNAME_INDEX, portNameCombo
0292:                                .getSelectionIndex());
0293:                    }
0294:
0295:                    public void widgetDefaultSelected(SelectionEvent e) {
0296:                    }
0297:                });
0298:
0299:                // Databinding
0300:                label = new Label(container, SWT.NULL);
0301:                label.setText(CodegenWizardPlugin
0302:                        .getResourceString("page2.databindingCheck.caption"));
0303:
0304:                gd = new GridData(GridData.FILL_HORIZONTAL);
0305:                gd.horizontalSpan = 2;
0306:                databindingTypeCombo = new Combo(container, SWT.DROP_DOWN
0307:                        | SWT.BORDER | SWT.READ_ONLY);
0308:                databindingTypeCombo.setLayoutData(gd);
0309:                fillDatabinderCombo();
0310:                databindingTypeCombo.select(settings
0311:                        .getInt(PREF_DATABINDER_INDEX));
0312:                databindingTypeCombo
0313:                        .addSelectionListener(new SelectionListener() {
0314:                            public void widgetSelected(SelectionEvent e) {
0315:                                settings.put(PREF_DATABINDER_INDEX,
0316:                                        databindingTypeCombo
0317:                                                .getSelectionIndex());
0318:
0319:                            };
0320:
0321:                            public void widgetDefaultSelected(SelectionEvent e) {
0322:                            };
0323:                        });
0324:
0325:                // package name
0326:                label = new Label(container, SWT.NULL);
0327:                label.setText(CodegenWizardPlugin
0328:                        .getResourceString("page2.package.caption"));
0329:                packageText = new Text(container, SWT.BORDER);
0330:                gd = new GridData(GridData.FILL_HORIZONTAL);
0331:                gd.horizontalSpan = 2;
0332:
0333:                packageText.setLayoutData(gd);
0334:                String packageName;
0335:                String storedPackageName = settings.get(PREF_PACKAGE_NAME);
0336:                this .defaultPackageName = storedPackageName;
0337:                if (storedPackageName.equals("")) {
0338:                    packageName = URLProcessor.makePackageName("");
0339:                } else {
0340:                    packageName = storedPackageName;
0341:                }
0342:
0343:                //if the package name somehow turned out to be null set it to 
0344:                //default package
0345:                if (packageName == null)
0346:                    packageName = URLProcessor.DEFAULT_PACKAGE;
0347:
0348:                packageText.setText(packageName); // get this text from the
0349:                // URLProcessor
0350:                packageText.addModifyListener(new ModifyListener() {
0351:                    public void modifyText(ModifyEvent e) {
0352:                        handleCustomPackageNameModifyEvent();
0353:                        settings.put(PREF_PACKAGE_NAME, packageText.getText());
0354:                    }
0355:                });
0356:
0357:                // generate test case option
0358:                gd = new GridData(GridData.FILL_HORIZONTAL);
0359:                gd.horizontalSpan = 3;
0360:                testCaseCheckBoxButton = new Button(container, SWT.CHECK);
0361:                testCaseCheckBoxButton.setLayoutData(gd);
0362:                testCaseCheckBoxButton
0363:                        .setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
0364:                                .getResourceString("page2.testcase.caption"));
0365:                testCaseCheckBoxButton.setSelection(settings
0366:                        .getBoolean(PREF_CHECK_GENERATE_TESTCASE));
0367:                testCaseCheckBoxButton
0368:                        .addSelectionListener(new SelectionListener() {
0369:                            public void widgetSelected(SelectionEvent e) {
0370:                                settings.put(PREF_CHECK_GENERATE_TESTCASE,
0371:                                        testCaseCheckBoxButton.getSelection());
0372:                            }
0373:
0374:                            public void widgetDefaultSelected(SelectionEvent e) {
0375:                            }
0376:                        });
0377:
0378:                //filling label 
0379:                gd = new GridData(GridData.FILL_HORIZONTAL);
0380:                gd.horizontalSpan = 3;
0381:                Label fillLabel = new Label(container, SWT.HORIZONTAL
0382:                        | SWT.SEPARATOR);
0383:                fillLabel.setLayoutData(gd);
0384:
0385:                //cleint side label 
0386:                //		gd = new GridData(GridData.FILL_HORIZONTAL);
0387:                //		gd.horizontalSpan = 3;
0388:                //		Label lblClientside = new Label(container, SWT.NONE);
0389:                //		lblClientside.setText(CodegenWizardPlugin
0390:                //				.getResourceString("page2.clientside.caption"));
0391:                //		lblClientside.setLayoutData(gd);
0392:
0393:                //cleint side label 
0394:                gd = new GridData(GridData.FILL_HORIZONTAL);
0395:                gd.horizontalSpan = 3;
0396:                clientSideCheckBoxButton = new Button(container, SWT.CHECK);
0397:                clientSideCheckBoxButton.setLayoutData(gd);
0398:                clientSideCheckBoxButton.setText(CodegenWizardPlugin
0399:                        .getResourceString("page2.clientside.caption"));
0400:                clientSideCheckBoxButton.setSelection(settings
0401:                        .getBoolean(PREF_CHECK_GENERATE_CLIENTSIDE));
0402:                clientSideCheckBoxButton
0403:                        .addSelectionListener(new SelectionListener() {
0404:                            public void widgetSelected(SelectionEvent e) {
0405:                                handleClientsideSelection();
0406:                                settings
0407:                                        .put(PREF_CHECK_GENERATE_CLIENTSIDE,
0408:                                                clientSideCheckBoxButton
0409:                                                        .getSelection());
0410:                            }
0411:
0412:                            public void widgetDefaultSelected(SelectionEvent e) {
0413:                            }
0414:                        });
0415:
0416:                //client side buttons
0417:                gd = new GridData(GridData.FILL_HORIZONTAL);
0418:                gd.horizontalSpan = 1;
0419:                syncAndAsyncRadioButton = new Button(container, SWT.RADIO);
0420:                syncAndAsyncRadioButton.setLayoutData(gd);
0421:                syncAndAsyncRadioButton.setText(CodegenWizardPlugin
0422:                        .getResourceString("page2.syncAsync.caption"));
0423:                syncAndAsyncRadioButton.setSelection(settings
0424:                        .getBoolean(PREF_RADIO_SYNC_AND_ASYNC));
0425:                syncAndAsyncRadioButton.setVisible(true);
0426:                syncAndAsyncRadioButton
0427:                        .addSelectionListener(new SelectionListener() {
0428:                            public void widgetSelected(SelectionEvent e) {
0429:                                settings.put(PREF_RADIO_SYNC_AND_ASYNC,
0430:                                        syncAndAsyncRadioButton.getSelection());
0431:                            }
0432:
0433:                            public void widgetDefaultSelected(SelectionEvent e) {
0434:                            }
0435:                        });
0436:
0437:                gd = new GridData(GridData.FILL_HORIZONTAL);
0438:                gd.horizontalSpan = 1;
0439:                syncOnlyRadioButton = new Button(container, SWT.RADIO);
0440:                syncOnlyRadioButton.setLayoutData(gd);
0441:                syncOnlyRadioButton.setText(CodegenWizardPlugin
0442:                        .getResourceString("page2.sync.caption"));
0443:                syncOnlyRadioButton.setSelection(settings
0444:                        .getBoolean(PREF_RADIO_SYNC_ONLY));
0445:                syncOnlyRadioButton
0446:                        .addSelectionListener(new SelectionListener() {
0447:                            public void widgetSelected(SelectionEvent e) {
0448:                                settings.put(PREF_RADIO_SYNC_ONLY,
0449:                                        syncOnlyRadioButton.getSelection());
0450:                            }
0451:
0452:                            public void widgetDefaultSelected(SelectionEvent e) {
0453:                            }
0454:                        });
0455:
0456:                gd = new GridData(GridData.FILL_HORIZONTAL);
0457:                gd.horizontalSpan = 1;
0458:                asyncOnlyRadioButton = new Button(container, SWT.RADIO);
0459:                asyncOnlyRadioButton.setLayoutData(gd);
0460:                asyncOnlyRadioButton
0461:                        .setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
0462:                                .getResourceString("page2.async.caption"));
0463:                asyncOnlyRadioButton.setSelection(settings
0464:                        .getBoolean(PREF_RADIO_ASYNC_ONLY));
0465:                asyncOnlyRadioButton
0466:                        .addSelectionListener(new SelectionListener() {
0467:                            public void widgetSelected(SelectionEvent e) {
0468:                                settings.put(PREF_RADIO_ASYNC_ONLY,
0469:                                        asyncOnlyRadioButton.getSelection());
0470:                            }
0471:
0472:                            public void widgetDefaultSelected(SelectionEvent e) {
0473:                            }
0474:                        });
0475:
0476:                //filling label 
0477:                gd = new GridData(GridData.FILL_HORIZONTAL);
0478:                gd.horizontalSpan = 3;
0479:                Label fillLabel1 = new Label(container, SWT.HORIZONTAL
0480:                        | SWT.SEPARATOR);
0481:                fillLabel1.setLayoutData(gd);
0482:
0483:                // Server side check box
0484:                gd = new GridData(GridData.FILL_HORIZONTAL);
0485:                gd.horizontalSpan = 3;
0486:                serverSideCheckBoxButton = new Button(container, SWT.CHECK);
0487:                serverSideCheckBoxButton.setLayoutData(gd);
0488:                serverSideCheckBoxButton.setText(CodegenWizardPlugin
0489:                        .getResourceString("page2.serverside.caption"));
0490:                serverSideCheckBoxButton.setSelection(settings
0491:                        .getBoolean(PREF_CHECK_GENERATE_SERVERSIDE));
0492:                serverSideCheckBoxButton
0493:                        .addSelectionListener(new SelectionListener() {
0494:                            public void widgetSelected(SelectionEvent e) {
0495:                                handleServersideSelection();
0496:                                settings
0497:                                        .put(PREF_CHECK_GENERATE_SERVERSIDE,
0498:                                                serverSideCheckBoxButton
0499:                                                        .getSelection());
0500:                            }
0501:
0502:                            public void widgetDefaultSelected(SelectionEvent e) {
0503:                            }
0504:                        });
0505:
0506:                // Server side services xml
0507:                gd = new GridData(GridData.FILL_HORIZONTAL);
0508:                gd.horizontalSpan = 1;
0509:                serverXMLCheckBoxButton = new Button(container, SWT.CHECK);
0510:                serverXMLCheckBoxButton.setLayoutData(gd);
0511:                serverXMLCheckBoxButton.setSelection(settings
0512:                        .getBoolean(PREF_CHECK_GENERATE_SERVERCONFIG));
0513:                serverXMLCheckBoxButton.setText(CodegenWizardPlugin
0514:                        .getResourceString("page2.serviceXML.caption"));
0515:                serverXMLCheckBoxButton
0516:                        .addSelectionListener(new SelectionListener() {
0517:                            public void widgetSelected(SelectionEvent e) {
0518:                                settings.put(PREF_CHECK_GENERATE_SERVERCONFIG,
0519:                                        serverXMLCheckBoxButton.getEnabled());
0520:                            }
0521:
0522:                            public void widgetDefaultSelected(SelectionEvent e) {
0523:                            }
0524:                        });
0525:
0526:                //the server side interface option
0527:                generateServerSideInterfaceCheckBoxButton = new Button(
0528:                        container, SWT.CHECK);
0529:                gd = new GridData(GridData.FILL_HORIZONTAL);
0530:                gd.horizontalSpan = 1;
0531:                generateServerSideInterfaceCheckBoxButton.setLayoutData(gd);
0532:                generateServerSideInterfaceCheckBoxButton.setSelection(settings
0533:                        .getBoolean(PREF_GEN_SS_INTERFACE));
0534:                generateServerSideInterfaceCheckBoxButton
0535:                        .setText(CodegenWizardPlugin
0536:                                .getResourceString("page2.ssInterface.caption"));
0537:                generateServerSideInterfaceCheckBoxButton
0538:                        .addSelectionListener(new SelectionListener() {
0539:                            public void widgetSelected(SelectionEvent e) {
0540:                                settings.put(PREF_GEN_SS_INTERFACE,
0541:                                        generateServerSideInterfaceCheckBoxButton
0542:                                                .getSelection());
0543:                            }
0544:
0545:                            public void widgetDefaultSelected(SelectionEvent e) {
0546:                            }
0547:                        });
0548:
0549:                //filling label 
0550:                gd = new GridData(GridData.FILL_HORIZONTAL);
0551:                gd.horizontalSpan = 3;
0552:                Label fillLabel2 = new Label(container, SWT.HORIZONTAL
0553:                        | SWT.SEPARATOR);
0554:                fillLabel2.setLayoutData(gd);
0555:
0556:                // generate all
0557:                generateAllCheckBoxButton = new Button(container, SWT.CHECK);
0558:                gd = new GridData(GridData.FILL_HORIZONTAL);
0559:                gd.horizontalSpan = 3;
0560:                generateAllCheckBoxButton.setLayoutData(gd);
0561:                generateAllCheckBoxButton.setSelection(settings
0562:                        .getBoolean(PREF_GEN_ALL));
0563:                generateAllCheckBoxButton.setText(CodegenWizardPlugin
0564:                        .getResourceString("page2.genAll.caption"));
0565:                generateAllCheckBoxButton
0566:                        .addSelectionListener(new SelectionListener() {
0567:                            public void widgetSelected(SelectionEvent e) {
0568:                                settings.put(PREF_GEN_ALL,
0569:                                        generateAllCheckBoxButton
0570:                                                .getSelection());
0571:                                handleGenerateAllSelection();
0572:                            }
0573:
0574:                            public void widgetDefaultSelected(SelectionEvent e) {
0575:                            }
0576:                        });
0577:
0578:                //filling label 
0579:                gd = new GridData(GridData.FILL_HORIZONTAL);
0580:                gd.horizontalSpan = 3;
0581:                Label fillLabel3 = new Label(container, SWT.HORIZONTAL
0582:                        | SWT.SEPARATOR);
0583:                fillLabel3.setLayoutData(gd);
0584:
0585:                //		 Databinding
0586:                label = new Label(container, SWT.NULL);
0587:                label.setText(CodegenWizardPlugin
0588:                        .getResourceString("page2.namespace2Pkg.caption"));
0589:
0590:                //add a table to set namespace to package mapping
0591:                gd = new GridData(GridData.FILL_BOTH);
0592:                gd.horizontalSpan = 3;
0593:                gd.verticalSpan = 5;
0594:
0595:                namespace2packageTable = new Table(container, SWT.BORDER
0596:                        | SWT.MULTI);
0597:                namespace2packageTable.setLinesVisible(true);
0598:                namespace2packageTable.setHeaderVisible(true);
0599:                namespace2packageTable.setEnabled(true);
0600:                namespace2packageTable.setLayoutData(gd);
0601:
0602:                declareColumn(namespace2packageTable, 350, //a default width until we adjust
0603:                        CodegenWizardPlugin
0604:                                .getResourceString("page2.namespace.caption"));
0605:                declareColumn(namespace2packageTable, 200,//a default width until we adjust
0606:                        CodegenWizardPlugin
0607:                                .getResourceString("page2.package.caption"));
0608:
0609:                namespace2packageTable.setVisible(true);
0610:
0611:                // add the table editor
0612:                final TableEditor editor = new TableEditor(
0613:                        namespace2packageTable);
0614:                editor.setColumn(1);
0615:                editor.horizontalAlignment = SWT.LEFT;
0616:                editor.grabHorizontal = true;
0617:                //This is the cute way of making the namespaces columns editable
0618:                namespace2packageTable.addListener(SWT.MouseDown,
0619:                        new Listener() {
0620:                            public void handleEvent(Event event) {
0621:                                Rectangle clientArea = namespace2packageTable
0622:                                        .getClientArea();
0623:                                Point pt = new Point(event.x, event.y);
0624:                                int index = namespace2packageTable
0625:                                        .getTopIndex();
0626:                                while (index < namespace2packageTable
0627:                                        .getItemCount()) {
0628:                                    boolean visible = false;
0629:                                    final TableItem item = namespace2packageTable
0630:                                            .getItem(index);
0631:                                    for (int i = 0; i < namespace2packageTable
0632:                                            .getColumnCount(); i++) {
0633:                                        Rectangle rect = item.getBounds(i);
0634:                                        if (rect.contains(pt)) {
0635:                                            final int column = i;
0636:                                            final Text text = new Text(
0637:                                                    namespace2packageTable,
0638:                                                    SWT.NONE);
0639:                                            Listener textListener = new Listener() {
0640:                                                public void handleEvent(
0641:                                                        final Event e) {
0642:                                                    switch (e.type) {
0643:                                                    case SWT.FocusOut:
0644:                                                        item.setText(column,
0645:                                                                text.getText());
0646:                                                        text.dispose();
0647:                                                        break;
0648:                                                    case SWT.Traverse:
0649:                                                        switch (e.detail) {
0650:                                                        case SWT.TRAVERSE_RETURN:
0651:                                                            item
0652:                                                                    .setText(
0653:                                                                            column,
0654:                                                                            text
0655:                                                                                    .getText());
0656:                                                            // FALL THROUGH
0657:                                                        case SWT.TRAVERSE_ESCAPE:
0658:                                                            text.dispose();
0659:                                                            e.doit = false;
0660:                                                        }
0661:                                                        break;
0662:                                                    }
0663:                                                }
0664:                                            };
0665:                                            text.addListener(SWT.FocusOut,
0666:                                                    textListener);
0667:                                            text.addListener(SWT.Traverse,
0668:                                                    textListener);
0669:                                            editor.setEditor(text, item, i);
0670:                                            text.setText(item.getText(i));
0671:                                            text.selectAll();
0672:                                            text.setFocus();
0673:                                            return;
0674:                                        }
0675:                                        if (!visible
0676:                                                && rect.intersects(clientArea)) {
0677:                                            visible = true;
0678:                                        }
0679:                                    }
0680:                                    if (!visible)
0681:                                        return;
0682:                                    index++;
0683:                                }
0684:                            }
0685:                        });
0686:
0687:                //adjust the width
0688:                //adjustColumnWidth(namespace2packageTable);
0689:
0690:                /*
0691:                 * Check the state of server-side selection, so we can enable/disable
0692:                 * the serverXML checkbox button.
0693:                 */
0694:                handleServersideSelection();
0695:                /*
0696:                 * try populating the combos and other information from the WSDL if this
0697:                 * is restored
0698:                 */
0699:                if (restoredFromPreviousSettings) {
0700:                    populateParamsFromWSDL();
0701:                    selectDefaults();
0702:                }
0703:
0704:                //first appearence Disable all the controls 
0705:                disableControls();
0706:
0707:                setControl(container);
0708:
0709:                setPageComplete(true);
0710:
0711:            }
0712:
0713:            //	/**
0714:            //	 * Adjust the column widths
0715:            //	 * @param table
0716:            //	 */
0717:            //	private void adjustColumnWidth(Table table){
0718:            //		 Point p = namespace2packageTable.computeSize(SWT.DEFAULT, SWT.DEFAULT);
0719:            //	     int columns = table.getColumnCount();
0720:            //	     for (int i=0;i<columns;i++){
0721:            //	    	 table.getColumn(i).setWidth(p.x/columns);
0722:            //	     }
0723:            //	}
0724:            /**
0725:             * A util method to create a new column
0726:             * @param table
0727:             * @param width
0728:             * @param colName
0729:             */
0730:            private void declareColumn(Table table, int width, String colName) {
0731:                TableColumn column = new TableColumn(table, SWT.NONE);
0732:                column.setWidth(width);
0733:                column.setText(colName);
0734:            }
0735:
0736:            private void selectDefaults() {
0737:                serviceNameCombo.select(settings
0738:                        .getInt(PREF_COMBO_SERVICENAME_INDEX));
0739:                // ports need to be renamed in order for correct default selection
0740:                loadPortNames();
0741:                portNameCombo.select(settings
0742:                        .getInt(PREF_COMBO_SERVICENAME_INDEX));
0743:            }
0744:
0745:            private void populatePackageName() {
0746:                this .packageText.setText(reader.packageFromTargetNamespace());
0747:            }
0748:
0749:            /**
0750:             * populate the service and the port from the WSDL this needs to be public
0751:             * since the WSDLselection page may call this
0752:             */
0753:            public void populateParamsFromWSDL() {
0754:                if (reader == null)
0755:                    reader = new WSDLPropertyReader();
0756:                try {
0757:                    String lname = getCodegenWizard().getWSDLname();
0758:                    if (!"".equals(lname.trim())) {
0759:
0760:                        reader.readWSDL(lname);
0761:
0762:                        // enable the combo's
0763:                        setComboBoxEnable(true);
0764:
0765:                        this .serviceQNameList = reader.getServiceList();
0766:                        if (!serviceQNameList.isEmpty()) {
0767:                            serviceNameCombo.removeAll();
0768:                            for (int i = 0; i < serviceQNameList.size(); i++) {
0769:                                // add the local part of the
0770:                                serviceNameCombo.add(((QName) serviceQNameList
0771:                                        .get(i)).getLocalPart());
0772:                            }
0773:                            ;
0774:                            // select the first one as the default
0775:                            serviceNameCombo.select(0);
0776:
0777:                            // load the ports
0778:                            loadPortNames();
0779:
0780:                            updateStatus(null);
0781:                        } else {
0782:                            // service name list being empty means we are switching to
0783:                            // the interface mode
0784:                            if (serviceNameCombo != null)
0785:                                serviceNameCombo.removeAll();
0786:                            if (portNameCombo != null)
0787:                                portNameCombo.removeAll();
0788:                            // disable the combo's
0789:                            setComboBoxEnable(false);
0790:                            //this is not an error
0791:                            updateStatus(null);
0792:
0793:                        }
0794:
0795:                        populatePackageName();
0796:
0797:                        //populate the namespacess
0798:                        loadNamespaces(reader.getDefinitionNamespaceMap());
0799:                    }
0800:                } catch (WSDLException e) {
0801:                    // disable the combo's
0802:                    setComboBoxEnable(false);
0803:                    updateStatus(CodegenWizardPlugin
0804:                            .getResourceString("page2.wsdlInvalid.message"));
0805:                } catch (Exception e) {
0806:                    // disable the combo's
0807:                    setComboBoxEnable(false);
0808:                    updateStatus(CodegenWizardPlugin
0809:                            .getResourceString("page2.wsdlNotFound.message"));
0810:                }
0811:
0812:            }
0813:
0814:            private void loadPortNames() {
0815:                int selectionIndex = serviceNameCombo.getSelectionIndex();
0816:                if (selectionIndex != -1) {
0817:                    java.util.List ports = reader
0818:                            .getPortNameList((QName) serviceQNameList
0819:                                    .get(selectionIndex));
0820:                    if (!ports.isEmpty()) {
0821:                        portNameCombo.removeAll();
0822:                        for (int i = 0; i < ports.size(); i++) {
0823:                            // add the local part of the
0824:                            portNameCombo.add(ports.get(i).toString());
0825:                        }
0826:                        updateStatus(null);
0827:                        portNameCombo.select(0);
0828:                    } else {
0829:                        updateStatus(CodegenWizardPlugin
0830:                                .getResourceString("page2.noports.message"));
0831:                    }
0832:                }
0833:            }
0834:
0835:            private void setComboBoxEnable(boolean b) {
0836:                if (serviceNameCombo != null) {
0837:                    serviceNameCombo.setEnabled(b);
0838:                    portNameCombo.setEnabled(b);
0839:                }
0840:            }
0841:
0842:            /**
0843:             * Loads the namespaces
0844:             * @param namespaceMap
0845:             */
0846:            private void loadNamespaces(Map namespaceMap) {
0847:                Iterator namespaces = namespaceMap.values().iterator();
0848:                namespace2packageTable.removeAll();
0849:                TableItem[] items = new TableItem[namespaceMap.size()]; // An item for each field
0850:
0851:                int i = 0;
0852:                while (namespaces.hasNext()) {
0853:
0854:                    items[i] = new TableItem(namespace2packageTable, SWT.NULL);
0855:                    String namespace = (String) namespaces.next();
0856:                    items[i].setText(0, namespace);
0857:                    items[i].setText(1, getPackageFromNamespace(namespace));
0858:                    i++;
0859:                }
0860:
0861:                namespace2packageTable.setVisible(true);
0862:
0863:            }
0864:
0865:            /**
0866:             * Fill the combo with proper databinding names
0867:             * 
0868:             */
0869:            private void fillDatabinderCombo() {
0870:
0871:                databindingTypeCombo.add(DATA_BINDING_ADB);
0872:                databindingTypeCombo.add(DATA_BINDING_XMLBEANS);
0873:                databindingTypeCombo.add(DATA_BINDING_JIBX);
0874:                //databindingTypeCombo.add(DATA_BINDING_JAXME);
0875:                databindingTypeCombo.add(DATA_BINDING_NONE);
0876:
0877:            }
0878:
0879:            /**
0880:             * Fill the combo with proper language names
0881:             * 
0882:             */
0883:            private void fillLanguageCombo() {
0884:
0885:                languageSelectionComboBox.add(JAVA);
0886:                //since we have not looked at C# support seriously
0887:                //for a long time, we'll just leave it out
0888:                //languageSelectionComboBox.add(C_SHARP);
0889:
0890:                languageSelectionComboBox.select(0);
0891:            }
0892:
0893:            /**
0894:             * Fill the combo with properoption selection
0895:             * 
0896:             */
0897:            private void fillCodegenOptionSelectionComboBox() {
0898:                codegenOptionSelectionComboBox.add(DEFAULT);
0899:                codegenOptionSelectionComboBox.add(CUSTOM);
0900:                codegenOptionSelectionComboBox.select(0);
0901:            }
0902:
0903:            /**
0904:             * Validates the status of the server-side checkbox, and enables/disables
0905:             * the generation checkbox for XML configuration file
0906:             */
0907:            private void handleServersideSelection() {
0908:                if (this .serverSideCheckBoxButton.getSelection()) {
0909:                    settings.put(PREF_CHECK_GENERATE_SERVERSIDE,
0910:                            serverSideCheckBoxButton.getSelection());
0911:                    this .serverXMLCheckBoxButton.setEnabled(true);
0912:                    //this.generateAllCheckBoxButton.setEnabled(true);
0913:                    this .generateServerSideInterfaceCheckBoxButton
0914:                            .setEnabled(true);
0915:                    if (clientSideCheckBoxButton.getSelection() == true
0916:                            || generateAllCheckBoxButton.getSelection() == true) {
0917:                        uncheckClientSide();
0918:                        uncheckGenerateAll();
0919:                        serverSideCheckBoxButton.setSelection(true);
0920:                        settings.put(PREF_CHECK_GENERATE_SERVERSIDE,
0921:                                serverSideCheckBoxButton.getSelection());
0922:                    }
0923:                    this .syncAndAsyncRadioButton.setSelection(false);
0924:                    this .asyncOnlyRadioButton.setSelection(false);
0925:                    this .syncOnlyRadioButton.setSelection(false);
0926:                    //earlier existing code (This only set focus false)
0927:                    this .syncAndAsyncRadioButton.setEnabled(false);
0928:                    this .asyncOnlyRadioButton.setEnabled(false);
0929:                    this .syncOnlyRadioButton.setEnabled(false);
0930:                    this .testCaseCheckBoxButton.setEnabled(false);
0931:                    this .testCaseCheckBoxButton.setSelection(false);
0932:
0933:                } else {
0934:                    //			//added this to increase the UI features (this will deselct all the selected features)
0935:                    //			this.serverXMLCheckBoxButton.setSelection(false);
0936:                    //			//this.generateAllCheckBoxButton.setSelection(false);
0937:                    //			this.generateServerSideInterfaceCheckBoxButton.setSelection(false);
0938:                    //			//earlier existing code (This only set focus false)
0939:                    //			this.serverXMLCheckBoxButton.setEnabled(false);
0940:                    //			//this.generateAllCheckBoxButton.setEnabled(false);
0941:                    //			this.generateServerSideInterfaceCheckBoxButton.setEnabled(false);
0942:                    if (clientSideCheckBoxButton.getSelection() == false
0943:                            && generateAllCheckBoxButton.getSelection() == false) {
0944:                        serverSideCheckBoxButton.setSelection(true);
0945:                        settings.put(PREF_CHECK_GENERATE_SERVERSIDE,
0946:                                serverSideCheckBoxButton.getSelection());
0947:                    }
0948:                }
0949:            }
0950:
0951:            /**
0952:             * Validates the status of the client-side checkbox, and enables/disables
0953:             * the generation checkbox for XML configuration file
0954:             */
0955:            private void handleClientsideSelection() {
0956:                if (this .clientSideCheckBoxButton.getSelection()) {
0957:                    this .syncAndAsyncRadioButton.setSelection(true);
0958:                    this .syncAndAsyncRadioButton.setEnabled(true);
0959:                    this .asyncOnlyRadioButton.setEnabled(true);
0960:                    this .syncOnlyRadioButton.setEnabled(true);
0961:                    if (serverSideCheckBoxButton.getSelection() == true
0962:                            || generateAllCheckBoxButton.getSelection() == true) {
0963:                        clientSideCheckBoxButton.setSelection(true);
0964:                        settings.put(PREF_CHECK_GENERATE_CLIENTSIDE,
0965:                                clientSideCheckBoxButton.getSelection());
0966:                        uncheckServerSide();
0967:                        uncheckGenerateAll();
0968:                    }
0969:                    this .serverXMLCheckBoxButton.setEnabled(false);
0970:                    this .serverXMLCheckBoxButton.setSelection(false);
0971:                    this .generateServerSideInterfaceCheckBoxButton
0972:                            .setEnabled(false);
0973:                    this .generateServerSideInterfaceCheckBoxButton
0974:                            .setSelection(false);
0975:                    this .testCaseCheckBoxButton.setEnabled(true);
0976:                } else {
0977:                    //added this to increase the UI features (this will deselct all the selected features)
0978:                    //			this.syncAndAsyncRadioButton.setSelection(false);
0979:                    //			this.asyncOnlyRadioButton.setSelection(false);
0980:                    //			this.syncOnlyRadioButton.setSelection(false);
0981:                    //earlier existing code (This only set focus false)
0982:                    //			this.syncAndAsyncRadioButton.setEnabled(false);
0983:                    //			this.asyncOnlyRadioButton.setEnabled(false);
0984:                    //			this.syncOnlyRadioButton.setEnabled(false);
0985:                    if (serverSideCheckBoxButton.getSelection() == false
0986:                            && generateAllCheckBoxButton.getSelection() == false) {
0987:                        clientSideCheckBoxButton.setSelection(true);
0988:                        settings.put(PREF_CHECK_GENERATE_CLIENTSIDE,
0989:                                clientSideCheckBoxButton.getSelection());
0990:                    }
0991:                }
0992:            }
0993:
0994:            private void handleGenerateAllSelection() {
0995:                if (this .generateAllCheckBoxButton.getSelection()) {
0996:                    settings.put(PREF_GEN_ALL, generateAllCheckBoxButton
0997:                            .getSelection());
0998:                    if (serverSideCheckBoxButton.getSelection() == true
0999:                            || clientSideCheckBoxButton.getSelection() == true) {
1000:                        this .serverSideCheckBoxButton.setSelection(false);
1001:                        settings.put(PREF_CHECK_GENERATE_SERVERSIDE,
1002:                                serverSideCheckBoxButton.getSelection());
1003:                        uncheckServerSide();
1004:                        uncheckClientSide();
1005:                    }
1006:                    this .syncAndAsyncRadioButton.setSelection(false);
1007:                    this .asyncOnlyRadioButton.setSelection(false);
1008:                    this .syncOnlyRadioButton.setSelection(false);
1009:                    //earlier existing code (This only set focus false)
1010:                    this .syncAndAsyncRadioButton.setEnabled(false);
1011:                    this .asyncOnlyRadioButton.setEnabled(false);
1012:                    this .syncOnlyRadioButton.setEnabled(false);
1013:
1014:                    this .serverXMLCheckBoxButton.setEnabled(false);
1015:                    this .serverXMLCheckBoxButton.setSelection(false);
1016:                    this .generateServerSideInterfaceCheckBoxButton
1017:                            .setEnabled(false);
1018:                    this .generateServerSideInterfaceCheckBoxButton
1019:                            .setSelection(false);
1020:                    this .testCaseCheckBoxButton.setEnabled(true);
1021:                } else {
1022:                    if (serverSideCheckBoxButton.getSelection() == false
1023:                            || clientSideCheckBoxButton.getSelection() == false) {
1024:                        generateAllCheckBoxButton.setSelection(true);
1025:                        settings.put(PREF_GEN_ALL, generateAllCheckBoxButton
1026:                                .getSelection());
1027:                    }
1028:                }
1029:            }
1030:
1031:            /**
1032:             * Get the selected language
1033:             * 
1034:             * @return a string containing the name of the target language
1035:             */
1036:            public String getSelectedLanguage() {
1037:                return languageSelectionComboBox
1038:                        .getItem(languageSelectionComboBox.getSelectionIndex());
1039:            }
1040:
1041:            /**
1042:             * the async only status
1043:             * 
1044:             * @return true if "Generate asynchronous code only" is checked
1045:             */
1046:            public boolean isAsyncOnlyOn() {
1047:                return asyncOnlyRadioButton.getSelection();
1048:            }
1049:
1050:            /**
1051:             * the sync only status
1052:             * 
1053:             * @return true if "Generate synchronous code only" is checked
1054:             */
1055:            public boolean isSyncOnlyOn() {
1056:                return syncOnlyRadioButton.getSelection();
1057:            }
1058:
1059:            /**
1060:             * return the package name
1061:             * 
1062:             * @return a string containing the package name to use for code generation
1063:             */
1064:            public String getPackageName() {
1065:                if ("".equals(packageText.getText().trim())) {
1066:                    //we do not allow the packaging to be empty
1067:                    //if the user sets it to empty we set it to
1068:                    //the default
1069:                    return URLProcessor.DEFAULT_PACKAGE;
1070:                }
1071:                return this .packageText.getText();
1072:            }
1073:
1074:            /**
1075:             * The serverside status
1076:             * 
1077:             * @return true if "Generate Server-Side" is checked
1078:             */
1079:            public boolean isServerside() {
1080:                return this .serverSideCheckBoxButton.getSelection();
1081:            }
1082:
1083:            /**
1084:             * 
1085:             * @return true if "Generate XML configuration file" is checked
1086:             */
1087:            public boolean isServerXML() {
1088:                if (this .serverXMLCheckBoxButton.isEnabled())
1089:                    return this .serverXMLCheckBoxButton.getSelection();
1090:                else
1091:                    return false;
1092:            }
1093:
1094:            /**
1095:             * 
1096:             * @return true if "Generate test case" is checked
1097:             */
1098:            public boolean isGenerateTestCase() {
1099:                return this .testCaseCheckBoxButton.getSelection();
1100:            }
1101:
1102:            /*
1103:             * (non-Javadoc)
1104:             * 
1105:             * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
1106:             */
1107:            public int getPageType() {
1108:                return WSDL_2_JAVA_TYPE;
1109:            }
1110:
1111:            /**
1112:             * 
1113:             * @return null if portname is empty
1114:             */
1115:            public String getPortName() {
1116:                int selectionIndex = portNameCombo.getSelectionIndex();
1117:                if (selectionIndex != -1) {
1118:                    String text = this .portNameCombo.getItem(selectionIndex);
1119:
1120:                    if (text == null || text.trim().equals("")) {
1121:                        return null;
1122:                    }
1123:                    return text;
1124:                } else {
1125:                    return null;
1126:                }
1127:            }
1128:
1129:            /**
1130:             * @return null if the text is empty
1131:             * 
1132:             */
1133:            public String getServiceName() {
1134:                int selectionIndex = serviceNameCombo.getSelectionIndex();
1135:                // cater for the scenario where the combo's can be empty
1136:                if (selectionIndex != -1) {
1137:                    String text = this .serviceNameCombo.getItem(selectionIndex);
1138:
1139:                    if (text == null || text.trim().equals("")) {
1140:                        return null;
1141:                    }
1142:                    return text;
1143:                } else {
1144:                    return null;
1145:                }
1146:            }
1147:
1148:            /**
1149:             * 
1150:             * @return
1151:             */
1152:            public String getDatabinderName() {
1153:                return this .databindingTypeCombo.getItem(databindingTypeCombo
1154:                        .getSelectionIndex());
1155:
1156:            }
1157:
1158:            /**
1159:             * 
1160:             * @return
1161:             */
1162:            public boolean getGenerateServerSideInterface() {
1163:                return this .generateServerSideInterfaceCheckBoxButton
1164:                        .getSelection();
1165:            }
1166:
1167:            /**
1168:             * 
1169:             * @return
1170:             */
1171:            public boolean getGenerateAll() {
1172:                return this .generateAllCheckBoxButton.getSelection();
1173:            }
1174:
1175:            /**
1176:             * get the package to namespace mappings
1177:             * @return
1178:             */
1179:            public String getNs2PkgMapping() {
1180:                String returnList = "";
1181:                TableItem[] items = namespace2packageTable.getItems();
1182:                String packageValue;
1183:                for (int i = 0; i < items.length; i++) {
1184:                    packageValue = items[i].getText(1);
1185:                    if (packageValue != null && !"".equals(packageValue)) {
1186:                        returnList = returnList
1187:                                + ("".equals(returnList) ? "" : ",")
1188:                                + items[i].getText(0) + "=" + packageValue;
1189:                    }
1190:
1191:                }
1192:                return "".equals(returnList) ? null : returnList;
1193:            }
1194:
1195:            private void disableControls() {
1196:                this .codegenOptionSelectionComboBox.select(0);
1197:                this .testCaseCheckBoxButton.setEnabled(false);
1198:                this .testCaseCheckBoxButton.setSelection(false);
1199:                this .databindingTypeCombo.setEnabled(false);
1200:                this .databindingTypeCombo.select(0);
1201:                this .generateAllCheckBoxButton.setEnabled(false);
1202:                this .generateAllCheckBoxButton.setSelection(false);
1203:                this .generateServerSideInterfaceCheckBoxButton
1204:                        .setEnabled(false);
1205:                this .generateServerSideInterfaceCheckBoxButton
1206:                        .setSelection(false);
1207:                this .languageSelectionComboBox.setEnabled(false);
1208:                this .namespace2packageTable.setEnabled(false);
1209:                this .packageText.setEditable(false);
1210:                this .portNameCombo.setEnabled(false);
1211:                this .portNameCombo.select(0);
1212:                this .serverSideCheckBoxButton.setEnabled(false);
1213:                this .serverSideCheckBoxButton.setSelection(false);
1214:                this .serverXMLCheckBoxButton.setEnabled(false);
1215:                this .serverXMLCheckBoxButton.setSelection(false);
1216:                this .serviceNameCombo.setEnabled(false);
1217:                this .serviceNameCombo.select(0);
1218:                this .syncOnlyRadioButton.setEnabled(false);
1219:                this .syncOnlyRadioButton.setSelection(false);
1220:                this .asyncOnlyRadioButton.setEnabled(false);
1221:                this .asyncOnlyRadioButton.setSelection(false);
1222:                this .syncAndAsyncRadioButton.setEnabled(false);
1223:                this .syncAndAsyncRadioButton.setSelection(true);
1224:                this .packageText.setEnabled(false);
1225:                this .clientSideCheckBoxButton.setEnabled(false);
1226:                this .clientSideCheckBoxButton.setSelection(true);
1227:                this .generateAllCheckBoxButton.setEnabled(false);
1228:            }
1229:
1230:            private void enableControls() {
1231:                this .testCaseCheckBoxButton.setEnabled(true);
1232:                this .databindingTypeCombo.setEnabled(true);
1233:                this .languageSelectionComboBox.setEnabled(true);
1234:                this .namespace2packageTable.setEnabled(true);
1235:                this .packageText.setEditable(true);
1236:                this .portNameCombo.setEnabled(true);
1237:                this .serverSideCheckBoxButton.setEnabled(true);
1238:                this .serviceNameCombo.setEnabled(true);
1239:                this .syncOnlyRadioButton.setEnabled(true);
1240:                this .asyncOnlyRadioButton.setEnabled(true);
1241:                this .syncAndAsyncRadioButton.setEnabled(true);
1242:                this .packageText.setEnabled(true);
1243:                this .clientSideCheckBoxButton.setEnabled(true);
1244:                this .generateAllCheckBoxButton.setEnabled(true);
1245:            }
1246:
1247:            /**
1248:             * get the package derived by  Namespace
1249:             */
1250:            public String getPackageFromNamespace(String namespace) {
1251:                return URLProcessor.makePackageName(namespace);
1252:            }
1253:
1254:            private void handleCustomPackageNameModifyEvent() {
1255:                // This method is add as a tempory fix for the Axis2-1368 
1256:                // TODO fix this permanantly.	
1257:                String text = this .packageText.getText();
1258:                if ((text == null) || (text.trim().equals(""))
1259:                        || (text.endsWith(".")) || (text.startsWith("."))) {
1260:                    updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
1261:                            .getResourceString("page2.pachage.error.nolocation"));
1262:                    return;
1263:                }
1264:                updateStatus(null);
1265:            }
1266:
1267:            private void uncheckServerSide() {
1268:                this .serverSideCheckBoxButton.setSelection(false);
1269:                settings.put(PREF_CHECK_GENERATE_SERVERSIDE,
1270:                        serverSideCheckBoxButton.getSelection());
1271:            }
1272:
1273:            private void uncheckClientSide() {
1274:                this .clientSideCheckBoxButton.setSelection(false);
1275:                settings.put(PREF_CHECK_GENERATE_CLIENTSIDE,
1276:                        clientSideCheckBoxButton.getSelection());
1277:            }
1278:
1279:            private void uncheckGenerateAll() {
1280:                this .generateAllCheckBoxButton.setSelection(false);
1281:                settings.put(PREF_GEN_ALL, generateAllCheckBoxButton
1282:                        .getSelection());
1283:
1284:            }
1285:        }
w_w__w__.__jav_a2s__._c__om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.