1 16 package org.apache.axis.tool.codegen.eclipse.ui; 17 18 import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin; 19 import org.apache.axis.wsdl.fromJava.Emitter; 20 import org.eclipse.swt.SWT; 21 import org.eclipse.swt.events.ModifyEvent; 22 import org.eclipse.swt.events.ModifyListener; 23 import org.eclipse.swt.events.SelectionEvent; 24 import org.eclipse.swt.events.SelectionListener; 25 import org.eclipse.swt.layout.GridData; 26 import org.eclipse.swt.layout.GridLayout; 27 import org.eclipse.swt.widgets.Combo; 28 import org.eclipse.swt.widgets.Composite; 29 import org.eclipse.swt.widgets.Label; 30 import org.eclipse.swt.widgets.Text; 31 32 67 public class JavaWSDLOptionsPage extends AbstractWizardPage { 68 69 private Text inputWSDLNameTextBox; 70 71 private Text serviceLocationURLTextBox; 72 73 private Text portTypeNameTextBox; 74 75 private Text bindingTextBox; 76 77 private Combo modeSelectionCombo; 78 79 private Combo styleSelectionCombo; 80 81 82 84 89 protected void initializeDefaultSettings() { 90 settings.put(PREF_JAVA_INPUT_WSDL_NAME,""); 91 settings.put(PREF_JAVA_LOCATION,"http://localhost:8080"); 92 settings.put(PREF_JAVA_BINDING_NAME,""); 93 settings.put(PREF_JAVA_PORTYPE_NAME,""); 94 settings.put(PREF_JAVA_MODE_INDEX,0); 95 settings.put(PREF_JAVA_STYLE_INDEX,0); 96 } 97 98 101 public JavaWSDLOptionsPage() { 102 super("page5"); 103 104 } 105 106 111 public int getPageType() { 112 return JAVA_2_WSDL_TYPE; 113 } 114 115 120 public void createControl(Composite parent) { 121 Composite container = new Composite(parent, SWT.NULL); 122 GridLayout layout = new GridLayout(); 123 container.setLayout(layout); 124 layout.numColumns = 2; 125 layout.verticalSpacing = 9; 126 127 GridData gd = new GridData(GridData.FILL_HORIZONTAL); 128 Label label = new Label(container, SWT.NULL); 129 label.setText(CodegenWizardPlugin 130 .getResourceString("page5.inputwsdl.label")); 131 132 inputWSDLNameTextBox = new Text(container, SWT.BORDER | SWT.SINGLE); 133 inputWSDLNameTextBox.setLayoutData(gd); 134 inputWSDLNameTextBox.setText(settings.get(PREF_JAVA_INPUT_WSDL_NAME)); 135 inputWSDLNameTextBox.addModifyListener(new ModifyListener() { 136 public void modifyText(ModifyEvent e) { 137 settings.put(PREF_JAVA_INPUT_WSDL_NAME, inputWSDLNameTextBox.getText()); 138 } 140 }); 141 142 label = new Label(container, SWT.NULL); 143 label.setText(CodegenWizardPlugin 144 .getResourceString("page5.servicelocation.label")); 145 146 gd = new GridData(GridData.FILL_HORIZONTAL); 147 serviceLocationURLTextBox = new Text(container, SWT.BORDER); 148 serviceLocationURLTextBox.setLayoutData(gd); 149 serviceLocationURLTextBox.setText(settings.get(PREF_JAVA_LOCATION)); 150 serviceLocationURLTextBox.addModifyListener(new ModifyListener() { 151 public void modifyText(ModifyEvent e) { 152 settings.put(PREF_JAVA_LOCATION, serviceLocationURLTextBox.getText()); 153 } 155 }); 156 157 label = new Label(container, SWT.NULL); 158 label.setText(CodegenWizardPlugin 159 .getResourceString("page5.binding.label")); 160 161 gd = new GridData(GridData.FILL_HORIZONTAL); 162 bindingTextBox = new Text(container, SWT.BORDER); 163 bindingTextBox.setLayoutData(gd); 164 bindingTextBox.setText(settings.get(PREF_JAVA_BINDING_NAME)); 165 bindingTextBox.addModifyListener(new ModifyListener() { 166 public void modifyText(ModifyEvent e) { 167 settings.put(PREF_JAVA_BINDING_NAME, bindingTextBox.getText()); 168 } 170 }); 171 172 label = new Label(container, SWT.NULL); 173 label.setText(CodegenWizardPlugin 174 .getResourceString("page5.porttype.label")); 175 176 gd = new GridData(GridData.FILL_HORIZONTAL); 177 portTypeNameTextBox = new Text(container, SWT.BORDER); 178 portTypeNameTextBox.setLayoutData(gd); 179 portTypeNameTextBox.setText(settings.get(PREF_JAVA_PORTYPE_NAME)); 180 portTypeNameTextBox.addModifyListener(new ModifyListener() { 181 public void modifyText(ModifyEvent e) { 182 settings.put(PREF_JAVA_PORTYPE_NAME, portTypeNameTextBox.getText()); 183 } 185 }); 186 187 label = new Label(container, SWT.NULL); 189 label 190 .setText(CodegenWizardPlugin 191 .getResourceString("page5.mode.label")); 192 193 gd = new GridData(GridData.FILL_HORIZONTAL); 194 modeSelectionCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY); 195 modeSelectionCombo.setLayoutData(gd); 196 populateModeCombo(); 198 modeSelectionCombo.addSelectionListener(new SelectionListener(){ 199 public void widgetSelected(SelectionEvent e){ 200 settings.put(PREF_JAVA_MODE_INDEX,modeSelectionCombo.getSelectionIndex()); 201 } 202 public void widgetDefaultSelected(SelectionEvent e){} 203 }); 204 205 label = new Label(container, SWT.NULL); 207 label 208 .setText(CodegenWizardPlugin 209 .getResourceString("page5.style.label")); 210 211 gd = new GridData(GridData.FILL_HORIZONTAL); 212 styleSelectionCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY); 213 styleSelectionCombo.setLayoutData(gd); 214 populateStyleCombo(); 215 styleSelectionCombo.addSelectionListener(new SelectionListener(){ 216 public void widgetSelected(SelectionEvent e){ 217 settings.put(PREF_JAVA_STYLE_INDEX,styleSelectionCombo.getSelectionIndex()); 218 } 219 public void widgetDefaultSelected(SelectionEvent e){} 220 }); 221 222 223 setControl(container); 224 225 } 226 227 private void populateModeCombo() { 228 modeSelectionCombo.add(WSDL_ALL); 229 modeSelectionCombo.add(WSDL_INTERFACE_ONLY); 230 modeSelectionCombo.add(WSDL_IMPLEMENTATION_ONLY); 231 232 modeSelectionCombo.select(settings.getInt(PREF_JAVA_MODE_INDEX)); 233 } 234 235 private void populateStyleCombo() { 236 styleSelectionCombo.add(WSDL_STYLE_DOCUMENT); 237 styleSelectionCombo.add(WSDL_STYLE_RPC); 238 styleSelectionCombo.add(WSDL_STYLE_WRAPPED); 239 240 styleSelectionCombo.select(settings.getInt(PREF_JAVA_STYLE_INDEX)); 241 } 242 public int getMode(){ 243 String selectedOption = modeSelectionCombo.getItem(modeSelectionCombo.getSelectionIndex()); 244 if (WSDL_ALL.equals(selectedOption)){ 245 return Emitter.MODE_ALL; 246 }else if (WSDL_INTERFACE_ONLY.equals(selectedOption)){ 247 return Emitter.MODE_INTERFACE; 248 }else if (WSDL_IMPLEMENTATION_ONLY.equals(selectedOption)){ 249 return Emitter.MODE_IMPLEMENTATION; 250 }else{ 251 throw new RuntimeException ("Unknown Exception"); 252 } 253 } 254 255 256 257 public String getStyle(){ 258 return this.styleSelectionCombo.getItem(styleSelectionCombo.getSelectionIndex()).toUpperCase(); 259 } 260 public String getLocationURL() { 261 return this.serviceLocationURLTextBox.getText(); 262 } 263 264 public String getInputWSDLName() { 265 return this.inputWSDLNameTextBox.getText(); 266 } 267 268 public String getPortypeName() { 269 return this.portTypeNameTextBox.getText(); 270 } 271 272 public String getBindingName() { 273 return this.bindingTextBox.getText(); 274 } 275 276 private String getgetClassFileLocation(){ 277 return null; 278 } 279 280 281 282 } 283 | Popular Tags |