### Eclipse Workspace Patch 1.0 #P org.eclipse.jst.ws.axis.consumption.ui Index: plugin.xml =================================================================== RCS file: /cvsroot/webtools/jst/components/ws/plugins/org.eclipse.jst.ws.axis.consumption.ui/plugin.xml,v retrieving revision 1.17 diff -u -r1.17 plugin.xml --- plugin.xml 7 Dec 2005 19:00:25 -0000 1.17 +++ plugin.xml 23 Mar 2006 17:59:54 -0000 @@ -41,4 +41,14 @@ property="JavaWSDLParam" transform="org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParamModifier"/> + + + + + \ No newline at end of file Index: plugin.properties =================================================================== RCS file: /cvsroot/webtools/jst/components/ws/plugins/org.eclipse.jst.ws.axis.consumption.ui/plugin.properties,v retrieving revision 1.3 diff -u -r1.3 plugin.properties --- plugin.properties 21 Jul 2005 22:37:34 -0000 1.3 +++ plugin.properties 23 Mar 2006 17:59:54 -0000 @@ -18,3 +18,8 @@ WEBSERVICECLIENTTYPE_NAME_JAVA_AXIS=Java proxy LABEL_RUNTIME_AXIS_11=Apache Axis DESC_RUNTIME_AXIS_11=Apache Axis +# +# Web Services Preferance Pages +# +# Categories +PREFERENCE_CATEGORY_AXIS_EMITTER=Axis Emitter Index: src/org/eclipse/jst/ws/internal/axis/consumption/ui/AxisConsumptionUI.properties =================================================================== RCS file: /cvsroot/webtools/jst/components/ws/plugins/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/AxisConsumptionUI.properties,v retrieving revision 1.2 diff -u -r1.2 AxisConsumptionUI.properties --- src/org/eclipse/jst/ws/internal/axis/consumption/ui/AxisConsumptionUI.properties 22 Feb 2006 01:14:16 -0000 1.2 +++ src/org/eclipse/jst/ws/internal/axis/consumption/ui/AxisConsumptionUI.properties 23 Mar 2006 17:59:54 -0000 @@ -80,4 +80,23 @@ # MSG_ERROR_XML_FILE_OVERWRITE_DISABLED=IWAB0532E Do you want to overwrite the Apache Axis deployment descriptor? +# Messages for Axis Emitter Preference Page +TOOLTIP_PPAE_PAGE=Set preferences that control Axis Emitter. +TOOLTIP_PPAE_CHECKBOX_ALL_ELEMENTS=By default, code is generated only for referenced elements. Call bGenerateAll(true) and WSDL2Java will generate code for all elements in the scope regardless of whether they are referenced. Scope means: by default, all WSDL files; if generateImports(false), then only the immediate WSDL file. +TOOLTIP_PPAE_CHECKBOX_HELPER_GENERATE=emits separate Helper classes for meta data. +TOOLTIP_PPAE_CHECKBOX_WRAP_ARRAYS=Prefers building beans to straight arrays for wrapped XML array types. +TOOLTIP_PPAE_CHECKBOX_ALL_METHODS=If this option is selected, the Java2WSDL parser will look into extended classes to determine the list of methods to export into the WSDL file. +TOOLTIP_PPAE_COMBO_DEPLOY_SCOPE=add scope to deploy.wsdd +TOOLTIP_PPAE_FIELD_TIME_OUT=Timeout in seconds. +BUTTON_ALL_ELEMENTS=Generate code for &all elements, even unreferenced ones. +BUTTON_HELPER_GENERATE=Emits separate &Helper classes for meta data. +BUTTON_WRAP_ARRAYS=Prefers building beans to straight arrays for &wrapped XML array types. +BUTTON_ALL_METHODS=Look for allowed &methods in inherited class +LABEL_DEPLOY_SCOPE=Add scope to deploy.wsdd: +LABEL_TIME_OUT=Timeout in seconds: +DEPLOY_SCOPE_APPLICATION=Application +DEPLOY_SCOPE_REQUEST=Request +DEPLOY_SCOPE_SESSION=session +MSG_ERROR_INVALID_TIME_OUT=Invalid Time out! Time out should be -1 or positive integer + Index: src/org/eclipse/jst/ws/internal/axis/consumption/ui/AxisConsumptionUIMessages.java =================================================================== RCS file: /cvsroot/webtools/jst/components/ws/plugins/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/AxisConsumptionUIMessages.java,v retrieving revision 1.1 diff -u -r1.1 AxisConsumptionUIMessages.java --- src/org/eclipse/jst/ws/internal/axis/consumption/ui/AxisConsumptionUIMessages.java 8 Nov 2005 17:56:12 -0000 1.1 +++ src/org/eclipse/jst/ws/internal/axis/consumption/ui/AxisConsumptionUIMessages.java 23 Mar 2006 17:59:54 -0000 @@ -47,7 +47,23 @@ public static String LABEL_EXPLORE_MAPPINGS_XML2BEAN; public static String TOOLTIP_N2P_SHOW_MAPPINGS; public static String MSG_ERROR_XML_FILE_OVERWRITE_DISABLED; - + public static String TOOLTIP_PPAE_PAGE; + public static String TOOLTIP_PPAE_CHECKBOX_ALL_ELEMENTS; + public static String TOOLTIP_PPAE_CHECKBOX_HELPER_GENERATE; + public static String TOOLTIP_PPAE_CHECKBOX_WRAP_ARRAYS; + public static String TOOLTIP_PPAE_CHECKBOX_ALL_METHODS; + public static String TOOLTIP_PPAE_COMBO_DEPLOY_SCOPE; + public static String TOOLTIP_PPAE_FIELD_TIME_OUT; + public static String BUTTON_ALL_ELEMENTS; + public static String BUTTON_HELPER_GENERATE; + public static String BUTTON_WRAP_ARRAYS; + public static String BUTTON_ALL_METHODS; + public static String LABEL_DEPLOY_SCOPE; + public static String LABEL_TIME_OUT; + public static String DEPLOY_SCOPE_APPLICATION; + public static String DEPLOY_SCOPE_REQUEST; + public static String DEPLOY_SCOPE_SESSION; + public static String MSG_ERROR_INVALID_TIME_OUT; static { NLS.initializeMessages(BUNDLE_NAME, AxisConsumptionUIMessages.class); } Index: src/org/eclipse/jst/ws/internal/axis/consumption/ui/preferences/AxisEmitterPreferencePage.java =================================================================== RCS file: src/org/eclipse/jst/ws/internal/axis/consumption/ui/preferences/AxisEmitterPreferencePage.java diff -N src/org/eclipse/jst/ws/internal/axis/consumption/ui/preferences/AxisEmitterPreferencePage.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/jst/ws/internal/axis/consumption/ui/preferences/AxisEmitterPreferencePage.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,322 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.ws.internal.axis.consumption.ui.preferences; + +import java.text.MessageFormat; + + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jst.ws.internal.axis.consumption.core.context.AxisEmitterContext; +import org.eclipse.jst.ws.internal.axis.consumption.core.context.AxisEmitterDefaults; +import org.eclipse.jst.ws.internal.axis.consumption.core.plugin.WebServiceAxisConsumptionCorePlugin; +import org.eclipse.jst.ws.internal.axis.consumption.ui.AxisConsumptionUIMessages; +import org.eclipse.jst.ws.internal.axis.consumption.ui.plugin.WebServiceAxisConsumptionUIPlugin; +//import org.eclipse.jst.ws.internal.ui.WSUIPluginMessages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.help.IWorkbenchHelpSystem; + + + +public class AxisEmitterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage +{ + /*CONTEXT_ID PPAE0001 for the Axis Emitter Preference Page*/ + private String INFOPOP_PPAE_PAGE = WebServiceAxisConsumptionUIPlugin.ID + ".PPAE0001"; + // + private Button allElements; + /*CONTEXT_ID PPAE0002 for the file overwrite check box on the Resource Management Preference Page*/ + private String INFOPOP_PPAE_CHECKBOX_ALL_ELEMENTS = WebServiceAxisConsumptionUIPlugin.ID + ".PPAE0002"; + // + private Button helperGenerate; + /*CONTEXT_ID PPAE0003 for the create folders check box on the Resource Management Preference Page*/ + private String INFOPOP_PPAE_CHECKBOX_HELPER_GENERATE = WebServiceAxisConsumptionUIPlugin.ID + ".PPAE0003"; + // + private Button wrapArrays; + /*CONTEXT_ID PPAE0004 for the checkout files check box on the Resource Management Preference Page*/ + private String INFOPOP_PPAE_CHECKBOX_WRAP_ARRAYS = WebServiceAxisConsumptionUIPlugin.ID + ".PPAE0004"; + + private Label deployScopeLabel; + private Combo deployScopeTypes; + //*CONTEXT_ID PPAE0005 for the WS-I AP type combo box on the Profile Compliance and Validation page*/ + private String INFOPOP_PPAE_COMBO_DEPLOY_SCOPE_TYPE = WebServiceAxisConsumptionUIPlugin.ID + ".PPAE0005"; + + private Label timeOutLabel; + private Text timeOutField; + int timeOut; + String wsdl2JavaTimeoutProperty = System.getProperty("AxisWsdl2JavaTimeout"); + + private Label timeOutPropertyLabel; + /*CONTEXT_ID PPAE0006 for the WS-I AP type combo box on the Profile Compliance and Validation page*/ + private String INFOPOP_PPAE_FIELD_TIME_OUT = WebServiceAxisConsumptionUIPlugin.ID + ".PPAE0006"; + + private Button allMethods; + /*CONTEXT_ID PPAE0006 for the WS-I AP type combo box on the Profile Compliance and Validation page*/ + private String INFOPOP_PPAE_CHECKBOX_ALL_METHODS = WebServiceAxisConsumptionUIPlugin.ID + ".PPAE0007"; + + // private ModifyListener numberFieldListener = new ModifyListener() { +// public void modifyText(ModifyEvent e) { +// numberFieldChanged((Text) e.widget); +// } +// }; + /** + * Creates preference page controls on demand. + * @param parent the parent for the preference page + */ + protected Control createContents(Composite superparent) + { + IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem(); + + Composite parent = new Composite( superparent, SWT.NONE ); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + parent.setLayout( layout ); + parent.setToolTipText(AxisConsumptionUIMessages.TOOLTIP_PPAE_PAGE); + helpSystem.setHelp(parent, INFOPOP_PPAE_PAGE); + + allElements = createCheckBox(parent, AxisConsumptionUIMessages.BUTTON_ALL_ELEMENTS); + allElements.setToolTipText(AxisConsumptionUIMessages.TOOLTIP_PPAE_CHECKBOX_ALL_ELEMENTS); + helpSystem.setHelp(allElements, INFOPOP_PPAE_CHECKBOX_ALL_ELEMENTS); + + helperGenerate = createCheckBox(parent, AxisConsumptionUIMessages.BUTTON_HELPER_GENERATE); + helperGenerate.setToolTipText(AxisConsumptionUIMessages.TOOLTIP_PPAE_CHECKBOX_HELPER_GENERATE); + helpSystem.setHelp(helperGenerate, INFOPOP_PPAE_CHECKBOX_HELPER_GENERATE); + + wrapArrays = createCheckBox(parent, AxisConsumptionUIMessages.BUTTON_WRAP_ARRAYS); + wrapArrays.setToolTipText(AxisConsumptionUIMessages.TOOLTIP_PPAE_CHECKBOX_WRAP_ARRAYS); + helpSystem.setHelp(wrapArrays, INFOPOP_PPAE_CHECKBOX_WRAP_ARRAYS); + + Label seperateLabel1 = new Label(parent, SWT.NONE); + deployScopeLabel = new Label(parent, SWT.NONE); + deployScopeLabel.setText(AxisConsumptionUIMessages.LABEL_DEPLOY_SCOPE); + deployScopeLabel.setToolTipText(AxisConsumptionUIMessages.TOOLTIP_PPAE_COMBO_DEPLOY_SCOPE); + + deployScopeTypes = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); + deployScopeTypes.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); + deployScopeTypes.setToolTipText(AxisConsumptionUIMessages.TOOLTIP_PPAE_COMBO_DEPLOY_SCOPE); + helpSystem.setHelp(deployScopeTypes,INFOPOP_PPAE_COMBO_DEPLOY_SCOPE_TYPE); + + deployScopeTypes.add(AxisConsumptionUIMessages.DEPLOY_SCOPE_APPLICATION); + deployScopeTypes.add(AxisConsumptionUIMessages.DEPLOY_SCOPE_REQUEST); + deployScopeTypes.add(AxisConsumptionUIMessages.DEPLOY_SCOPE_SESSION); + //deployScopeTypes.add("Application"); + //deployScopeTypes.add("Request"); + //deployScopeTypes.add("Session"); + + //deployScopeTypes.addSelectionListener(this); + Label seperateLabel2 = new Label(parent, SWT.NONE); + + timeOutPropertyLabel = new Label(parent, SWT.NONE); + timeOutLabel = new Label(parent, SWT.NONE); + timeOutLabel.setText(AxisConsumptionUIMessages.LABEL_TIME_OUT); + timeOutLabel.setToolTipText(AxisConsumptionUIMessages.TOOLTIP_PPAE_FIELD_TIME_OUT); + timeOutField = createTextField(parent); + helpSystem.setHelp(timeOutLabel, INFOPOP_PPAE_FIELD_TIME_OUT); + + Label seperateLabel3 = new Label(parent, SWT.NONE); + allMethods = createCheckBox(parent, AxisConsumptionUIMessages.BUTTON_ALL_METHODS); + allMethods.setToolTipText(AxisConsumptionUIMessages.TOOLTIP_PPAE_CHECKBOX_ALL_METHODS); + helpSystem.setHelp(allElements, INFOPOP_PPAE_CHECKBOX_ALL_METHODS); + + initializeValues(); + org.eclipse.jface.dialogs.Dialog.applyDialogFont(superparent); + + return parent; + } + + private Button createCheckBox( Composite parent, String text ) + { + Button button = new Button( parent, SWT.CHECK ); + button.setText( text ); + return button; + } + + private Text createTextField(Composite parent) + { + Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); + GridData data = new GridData(); + data.verticalAlignment = GridData.FILL; + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + text.setLayoutData(data); + text.addModifyListener( new ModifyListener() { + public void modifyText(ModifyEvent e) { + numberFieldChanged((Text) e.widget); + } + } + ); + return text; + } + + /** + * Does anything necessary because the default button has been pressed. + */ + protected void performDefaults() + { + super.performDefaults(); + initializeDefaults(); + } + + /** + * Do anything necessary because the OK button has been pressed. + * @return whether it is okay to close the preference page + */ + public boolean performOk() + { + if(validateNumber(timeOutField.getText()).isOK()) + storeValues(); + return true; + } + + protected void performApply() + { + performOk(); + } + + /** + * @see IWorkbenchPreferencePage + */ + public void init(IWorkbench workbench) { } + + /** + * Initializes states of the controls using default values + * in the preference store. + */ + private void initializeDefaults() + { + allElements.setSelection( AxisEmitterDefaults.getAllElementsDefault()); + helperGenerate.setSelection( AxisEmitterDefaults.getHelperGenerateDefault()); + wrapArrays.setSelection( AxisEmitterDefaults.getWrapArraysDefault()); + deployScopeTypes.select(AxisEmitterDefaults.getDeployScopeDefault()); + timeOutField.setText("" + AxisEmitterDefaults.getTimeOutDefault()); + allMethods.setSelection(AxisEmitterDefaults.getAllMethodsDefault()); + } + + /** + * Initializes states of the controls from the preference store. + */ + private void initializeValues() + { + // get the persistent context from the plugin + AxisEmitterContext context = WebServiceAxisConsumptionCorePlugin.getInstance().getAxisEmitterContext(); + allElements.setSelection( context.isAllElementsEnabled()); + helperGenerate.setSelection( context.isHelperGenerateEnabled()); + wrapArrays.setSelection( context.isWrapArraysEnabled()); + deployScopeTypes.select(context.getDeployScopeType()); + allMethods.setSelection( context.isAllMethodsEnabled()); + if (wsdl2JavaTimeoutProperty != null) + { + long timeOutProperty = new Integer(wsdl2JavaTimeoutProperty).longValue(); + timeOut = (int)timeOutProperty/1000; + timeOutField.setEnabled(false); + timeOutPropertyLabel.setText("You are using the value of time out from JVM arguments"); + } + else + { + timeOut = context.getTimeOut(); + } + timeOutField.setText(""+ timeOut); + } + + /** + * Stores the values of the controls back to the preference store. + */ + private void storeValues() + { + // get the persistent context from the plugin + AxisEmitterContext context = WebServiceAxisConsumptionCorePlugin.getInstance().getAxisEmitterContext(); + context.setAllElementsEnabled( allElements.getSelection() ); + context.setHelperGenerateEnabled( helperGenerate.getSelection() ); + context.setWrapArraysEnabled( wrapArrays.getSelection() ); + context.selectDeployScopeType(deployScopeTypes.getSelectionIndex()); + timeOut = Integer.parseInt(timeOutField.getText().trim()); + context.setTimeOut(timeOut); + context.setAllMethodsEnabled( allMethods.getSelection() ); + } + + private void numberFieldChanged(Text textControl) { + IStatus status = validateNumber(textControl.getText()); + setValid(!status.matches(IStatus.ERROR)); + applyToStatusLine(this,status); + } + + private IStatus validateNumber(String numberString) + { + IStatus status; + try + { + int number = Integer.parseInt(numberString); + if (number <= 0 && number != -1) + { + status = new Status(IStatus.ERROR, WebServiceAxisConsumptionUIPlugin.ID, IStatus.ERROR, + AxisConsumptionUIMessages.MSG_ERROR_INVALID_TIME_OUT, null); + } + else + { timeOut = number; + status = Status.OK_STATUS; + status = new Status(IStatus.OK, WebServiceAxisConsumptionUIPlugin.ID, IStatus.OK, "",null); + } + } + catch + (NumberFormatException e) + { + status = new Status(IStatus.ERROR, WebServiceAxisConsumptionUIPlugin.ID, IStatus.ERROR, + AxisConsumptionUIMessages.MSG_ERROR_INVALID_TIME_OUT, null); + } + return status; + } + + private void applyToStatusLine(DialogPage page, IStatus status) { + String message= status.getMessage(); + switch (status.getSeverity()) { + case IStatus.OK: + page.setMessage(null, IMessageProvider.NONE); + page.setErrorMessage(null); + break; + case IStatus.WARNING: + page.setMessage(message, IMessageProvider.WARNING); + page.setErrorMessage(null); + break; + case IStatus.INFO: + page.setMessage(message, IMessageProvider.INFORMATION); + page.setErrorMessage(null); + break; + default: + if (message.length() == 0) { + message= null; + } + page.setMessage(null); + page.setErrorMessage(message); + break; + } + } +} +