KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > tool > codegen > eclipse > ui > ToolSelectionPage


1 /*
2  * Copyright 2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis.tool.codegen.eclipse.ui;
17
18 import org.apache.axis.tool.codegen.eclipse.CodeGenWizard;
19 import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
20 import org.eclipse.swt.SWT;
21 import org.eclipse.swt.events.SelectionAdapter;
22 import org.eclipse.swt.events.SelectionEvent;
23 import org.eclipse.swt.layout.GridData;
24 import org.eclipse.swt.layout.GridLayout;
25 import org.eclipse.swt.widgets.Button;
26 import org.eclipse.swt.widgets.Composite;
27 import org.eclipse.swt.widgets.Label;
28
29 /**
30  * @author Ajith
31  *
32  * TODO To change the template for this generated type comment go to
33  * Window - Preferences - Java - Code Style - Code Templates
34  */

35 public class ToolSelectionPage extends AbstractWizardPage {
36    
37     private Button java2WSDLRadioButton;
38     private Button wsdl2JavaRadioButton;
39     public ToolSelectionPage() {
40         super("page0");
41        
42     }
43     
44     /**
45      * Creates a default value for the settings on this page
46      */

47     protected void initializeDefaultSettings() {
48         settings.put(PREF_TOOL_SELECTION_JAVA2WSDL, false);
49         settings.put(PREF_TOOL_SELECTION_WSDL2JAVA, true);
50     }
51
52     /* (non-Javadoc)
53      * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
54      */

55 public void createControl(Composite parent) {
56         
57         Composite container = new Composite(parent, SWT.NULL);
58         GridLayout layout = new GridLayout();
59         container.setLayout(layout);
60         layout.numColumns = 1;
61         layout.verticalSpacing = 9;
62
63         GridData gd = new GridData(GridData.FILL_HORIZONTAL);
64         
65         Label label = new Label(container, SWT.NULL);
66         label.setText(CodegenWizardPlugin.getResourceString("page0.options.desc"));
67              
68         wsdl2JavaRadioButton = new Button(container,SWT.RADIO);
69         wsdl2JavaRadioButton.setText(CodegenWizardPlugin.getResourceString("page0.wsdl2java.caption"));
70         wsdl2JavaRadioButton.setToolTipText(CodegenWizardPlugin.getResourceString("page0.wsdl2java.desc"));
71         wsdl2JavaRadioButton.setSelection(settings.getBoolean(PREF_TOOL_SELECTION_WSDL2JAVA));
72         wsdl2JavaRadioButton.addSelectionListener(new SelectionAdapter(){
73            public void widgetSelected(SelectionEvent e)
74            {
75               handleCheckboxSelection();
76            }
77         });
78         
79         java2WSDLRadioButton = new Button(container,SWT.RADIO);
80         java2WSDLRadioButton.setText(CodegenWizardPlugin.getResourceString("page0.java2wsdl.caption"));
81         java2WSDLRadioButton.setToolTipText(CodegenWizardPlugin.getResourceString("page0.java2wsdl.desc"));
82         java2WSDLRadioButton.setSelection(settings.getBoolean(PREF_TOOL_SELECTION_JAVA2WSDL));
83         java2WSDLRadioButton.addSelectionListener(new SelectionAdapter(){
84            public void widgetSelected(SelectionEvent e)
85            {
86               handleCheckboxSelection();
87            }
88         });
89         
90         handleCheckboxSelection();
91         setControl(container);
92
93     }
94
95     private void handleCheckboxSelection(){
96         CodeGenWizard wizard = (CodeGenWizard)this.getWizard();
97         if (wsdl2JavaRadioButton.getSelection()){
98             settings.put(PREF_TOOL_SELECTION_WSDL2JAVA,true);
99             settings.put(PREF_TOOL_SELECTION_JAVA2WSDL,false);
100            wizard.setSelectedWizardType(WSDL_2_JAVA_TYPE);
101         }else if (java2WSDLRadioButton.getSelection()){
102             settings.put(PREF_TOOL_SELECTION_WSDL2JAVA,false);
103             settings.put(PREF_TOOL_SELECTION_JAVA2WSDL,true);
104             wizard.setSelectedWizardType(JAVA_2_WSDL_TYPE);
105         }
106     }
107     
108     
109     /* (non-Javadoc)
110      * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
111      */

112     public int getPageType() {
113          return UNSPECIFIED_TYPE;
114     }
115     
116         
117 }
118
Popular Tags