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 org.apache.axis2.tool.codegen.eclipse.CodeGenWizard;
022: import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
023: import org.eclipse.swt.SWT;
024: import org.eclipse.swt.events.SelectionAdapter;
025: import org.eclipse.swt.events.SelectionEvent;
026: import org.eclipse.swt.layout.GridLayout;
027: import org.eclipse.swt.widgets.Button;
028: import org.eclipse.swt.widgets.Composite;
029: import org.eclipse.swt.widgets.Label;
030:
031: public class ToolSelectionPage extends AbstractWizardPage {
032:
033: private Button java2WSDLRadioButton;
034: private Button wsdl2JavaRadioButton;
035:
036: public ToolSelectionPage() {
037: super ("page0");
038:
039: }
040:
041: /**
042: * Creates a default value for the settings on this page
043: */
044: protected void initializeDefaultSettings() {
045: settings.put(PREF_TOOL_SELECTION_JAVA2WSDL, false);
046: settings.put(PREF_TOOL_SELECTION_WSDL2JAVA, true);
047: }
048:
049: /* (non-Javadoc)
050: * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
051: */
052: public void createControl(Composite parent) {
053:
054: Composite container = new Composite(parent, SWT.NULL);
055: GridLayout layout = new GridLayout();
056: container.setLayout(layout);
057: layout.numColumns = 1;
058: layout.verticalSpacing = 9;
059:
060: Label label = new Label(container, SWT.NULL);
061: label.setText(CodegenWizardPlugin
062: .getResourceString("page0.options.desc"));
063:
064: wsdl2JavaRadioButton = new Button(container, SWT.RADIO);
065: wsdl2JavaRadioButton.setText(CodegenWizardPlugin
066: .getResourceString("page0.wsdl2java.caption"));
067: wsdl2JavaRadioButton.setToolTipText(CodegenWizardPlugin
068: .getResourceString("page0.wsdl2java.desc"));
069: wsdl2JavaRadioButton.setSelection(settings
070: .getBoolean(PREF_TOOL_SELECTION_WSDL2JAVA));
071: wsdl2JavaRadioButton
072: .addSelectionListener(new SelectionAdapter() {
073: public void widgetSelected(SelectionEvent e) {
074: handleCheckboxSelection();
075: }
076: });
077:
078: java2WSDLRadioButton = new Button(container, SWT.RADIO);
079: java2WSDLRadioButton.setText(CodegenWizardPlugin
080: .getResourceString("page0.java2wsdl.caption"));
081: java2WSDLRadioButton.setToolTipText(CodegenWizardPlugin
082: .getResourceString("page0.java2wsdl.desc"));
083: java2WSDLRadioButton.setSelection(settings
084: .getBoolean(PREF_TOOL_SELECTION_JAVA2WSDL));
085: java2WSDLRadioButton
086: .addSelectionListener(new SelectionAdapter() {
087: public void widgetSelected(SelectionEvent e) {
088: handleCheckboxSelection();
089: }
090: });
091:
092: Label fillLabel = new Label(container, SWT.NULL);
093: fillLabel.setText(CodegenWizardPlugin
094: .getResourceString("general.empty"));
095:
096: Label hintLabel = new Label(container, SWT.NULL);
097: hintLabel.setText(CodegenWizardPlugin
098: .getResourceString("page0.hint.desc"));
099:
100: ///////////////////////////////////////
101: //java2WSDLRadioButton.setEnabled(false);
102: //////////////////////////////////////
103:
104: handleCheckboxSelection();
105: setControl(container);
106:
107: }
108:
109: private void handleCheckboxSelection() {
110: CodeGenWizard wizard = (CodeGenWizard) this .getWizard();
111: if (wsdl2JavaRadioButton.getSelection()) {
112: settings.put(PREF_TOOL_SELECTION_WSDL2JAVA, true);
113: settings.put(PREF_TOOL_SELECTION_JAVA2WSDL, false);
114: wizard.setSelectedWizardType(WSDL_2_JAVA_TYPE);
115: } else if (java2WSDLRadioButton.getSelection()) {
116: settings.put(PREF_TOOL_SELECTION_WSDL2JAVA, false);
117: settings.put(PREF_TOOL_SELECTION_JAVA2WSDL, true);
118: wizard.setSelectedWizardType(JAVA_2_WSDL_TYPE);
119: }
120: }
121:
122: /* (non-Javadoc)
123: * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
124: */
125: public int getPageType() {
126: return UNSPECIFIED_TYPE;
127: }
128:
129: }
|