You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2008/07/04 14:13:59 UTC
svn commit: r674026 - in
/webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen:
./ eclipse/ eclipse/ui/
Author: sandakith
Date: Fri Jul 4 05:13:58 2008
New Revision: 674026
URL: http://svn.apache.org/viewvc?rev=674026&view=rev
Log:
Applying patch by saminda wijerathne. This patch will add the missing features of codegen tools which are available in the command line tool
Added:
webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/WSDLJavaAdvanceDialog.java
Modified:
webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java
webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java
webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java
Modified: webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java?rev=674026&r1=674025&r2=674026&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java Fri Jul 4 05:13:58 2008
@@ -31,6 +31,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
@@ -66,7 +67,8 @@
String selectedLanguage,
String outputLocation,
String namespace2packageList,
- boolean isServerSideInterface
+ boolean isServerSideInterface,
+ HashMap advanceOptions
)
{
Map optionMap = new HashMap();
@@ -143,6 +145,19 @@
optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION, new CommandLineOption(
CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION, new String[0]));
}
+
+ if (advanceOptions != null) {
+ for (Iterator iterator = advanceOptions.keySet().iterator(); iterator
+ .hasNext();) {
+ String type = (String) iterator.next();
+ String[] parameters;
+ if (advanceOptions.get(type) == null)
+ parameters = new String[0];
+ else
+ parameters = (String[]) advanceOptions.get(type);
+ optionMap.put(type, new CommandLineOption(type, parameters));
+ }
+ }
return optionMap;
}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java?rev=674026&r1=674025&r2=674026&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java Fri Jul 4 05:13:58 2008
@@ -248,7 +248,8 @@
optionsPage.getSelectedLanguage(),
outputPage.getOutputLocation(),
optionsPage.getNs2PkgMapping(),
- isGenerateServerSideInterface);
+ isGenerateServerSideInterface,
+ optionsPage.getAdvanceOptions());
//Fix for the CodeGenConfiguration Contructor Change
//CodeGenConfiguration codegenConfig = new CodeGenConfiguration(service, optionsMap);
Modified: webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java?rev=674026&r1=674025&r2=674026&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java Fri Jul 4 05:13:58 2008
@@ -22,11 +22,13 @@
import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
import org.apache.axis2.tool.codegen.eclipse.util.UIConstants;
import org.apache.axis2.tool.codegen.eclipse.util.WSDLPropertyReader;
+import org.apache.axis2.util.CommandLineOptionConstants;
import org.apache.axis2.util.URLProcessor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
@@ -46,6 +48,8 @@
import javax.wsdl.WSDLException;
import javax.xml.namespace.QName;
+
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -127,6 +131,8 @@
* Text box to have the service name
*/
private Combo serviceNameCombo;
+
+ private Button advanceOptionsButton;
private WSDLPropertyReader reader;
@@ -143,6 +149,8 @@
*/
private Table namespace2packageTable = null;
+ private HashMap advanceOptions;
+
Composite container;
/**
@@ -150,8 +158,14 @@
*/
public OptionsPage() {
super("page2");
+ advanceOptions=getInitialisedAdvanceOptions();
}
+ private HashMap getInitialisedAdvanceOptions(){
+ HashMap advanceOptions=new HashMap();
+ advanceOptions.put(CommandLineOptionConstants.WSDL2JavaConstants.UNPACK_CLASSES_OPTION, new String[0]);
+ return advanceOptions;
+ }
/**
* Sets the default values for the Options page
*
@@ -645,7 +659,22 @@
}
});
-
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ Label fillLabel4 = new Label(container, SWT.NULL);
+ fillLabel4.setLayoutData(gd);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 1;
+ advanceOptionsButton= new Button(container, SWT.NULL);
+ advanceOptionsButton.setText("Advance Options");
+ advanceOptionsButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ handleAdvanceButtonClick();
+ }
+ });
+ advanceOptionsButton.setLayoutData(gd);
+
//adjust the width
//adjustColumnWidth(namespace2packageTable);
@@ -673,6 +702,15 @@
}
+ private void handleAdvanceButtonClick(){
+ WSDLJavaAdvanceDialog javaAdvanceDialog = new WSDLJavaAdvanceDialog(getShell(),advanceOptions);
+ javaAdvanceDialog.create();
+ javaAdvanceDialog.getShell().setSize(700, 950);
+ javaAdvanceDialog.open();
+ if (javaAdvanceDialog.getReturnCode() == org.eclipse.jface.window.Window.OK){
+ advanceOptions=javaAdvanceDialog.getAdvanceOptions();
+ }
+ }
// /**
// * Adjust the column widths
// * @param table
@@ -1179,6 +1217,7 @@
this.clientSideCheckBoxButton.setEnabled(false);
this.clientSideCheckBoxButton.setSelection(true);
this.generateAllCheckBoxButton.setEnabled(false);
+ this.advanceOptionsButton.setEnabled(false);
}
private void enableControls(){
@@ -1196,7 +1235,8 @@
this.packageText.setEnabled(true);
this.clientSideCheckBoxButton.setEnabled(true);
this.generateAllCheckBoxButton.setEnabled(true);
- }
+ this.advanceOptionsButton.setEnabled(true);
+ }
/**
* get the package derived by Namespace
@@ -1232,4 +1272,11 @@
settings.put(PREF_GEN_ALL, generateAllCheckBoxButton.getSelection());
}
+
+ public HashMap getAdvanceOptions(){
+ if (advanceOptionsButton.getEnabled())
+ return advanceOptions;
+ else
+ return getInitialisedAdvanceOptions();
+ }
}
Added: webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/WSDLJavaAdvanceDialog.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/WSDLJavaAdvanceDialog.java?rev=674026&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/WSDLJavaAdvanceDialog.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/WSDLJavaAdvanceDialog.java Fri Jul 4 05:13:58 2008
@@ -0,0 +1,378 @@
+package org.apache.axis2.tool.codegen.eclipse.ui;
+
+import java.util.HashMap;
+import java.util.regex.Pattern;
+
+import org.apache.axis2.util.CommandLineOptionConstants;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+public class WSDLJavaAdvanceDialog extends Dialog {
+
+ private Button tmpCheckBox;
+ private Text tmpTextBox;
+ private HashMap advanceOptions;
+ private boolean isEditAdvanceOptions=false;
+ private Combo wsdlVersionCombo;
+ private Button packageRemoveButton;
+ private Table packageNameList;
+ private Button packageAddButton;
+ private Text addNewExcludePackageName;
+
+ protected WSDLJavaAdvanceDialog(Shell shell, HashMap advanceOptions) {
+ super(shell);
+ isEditAdvanceOptions=(advanceOptions!=null);
+ if (isEditAdvanceOptions)
+ this.advanceOptions=(HashMap) advanceOptions.clone();
+ else
+ this.advanceOptions=new HashMap();
+ }
+
+ private Button addCheckBox(Composite container,
+ final Button tmpCheckBox,String caption,final String parameterType){
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ //tmpCheckBox = new Button(container, SWT.CHECK);
+ tmpCheckBox.setLayoutData(gd);
+ tmpCheckBox.setText(caption);
+ if (isEditAdvanceOptions)
+ tmpCheckBox.setSelection(advanceOptions.containsKey(parameterType));
+ tmpCheckBox.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ setCheckBoxState(parameterType, tmpCheckBox.getSelection());
+ }
+ });
+ return tmpCheckBox;
+ }
+
+ private Text addTextBox(Composite container,Label lblCaption,
+ final Text tmpTextBox, String caption,final String parameterType,boolean isBrowseFolder){
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 1;
+ gd.widthHint=200;
+ lblCaption.setLayoutData(gd);
+ lblCaption.setText(caption);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ if (isBrowseFolder)
+ gd.horizontalSpan = 1;
+ else
+ gd.horizontalSpan = 2;
+ tmpTextBox.setLayoutData(gd);
+ if (isEditAdvanceOptions)
+ if (advanceOptions.containsKey(parameterType))
+ tmpTextBox.setText(((String[])advanceOptions.get(parameterType))[0]);
+ tmpTextBox.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ setTextBoxValue(parameterType, tmpTextBox.getText());
+ }
+ });
+ if (isBrowseFolder){
+ Button browse=new Button(container,SWT.NULL);
+ browse.setText("Browse");
+ browse.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ String returnString = dialog.open();
+ if (returnString != null) {
+ tmpTextBox.setText(returnString);
+ }
+ }
+ });
+ }
+ return tmpTextBox;
+ }
+
+ protected Control createDialogArea(final Composite parent) {
+ Composite container = (Composite) super.createDialogArea(parent);
+ //FontUtil fontUtil = FontUtil.getInstance(container.getDisplay());
+
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 3;
+ layout.verticalSpacing = 10;
+
+ GridData gd;
+
+ addTextBox(container,new Label(container,SWT.NULL), new Text(container,SWT.BORDER),
+ "Specify a repository against which code is generated.",
+ CommandLineOptionConstants.WSDL2JavaConstants.REPOSITORY_PATH_OPTION,true);
+ addTextBox(container,new Label(container,SWT.NULL), new Text(container,SWT.BORDER),
+ "Specify a directory path for generated source",
+ CommandLineOptionConstants.WSDL2JavaConstants.SOURCE_FOLDER_NAME_OPTION,true);
+ addTextBox(container,new Label(container,SWT.NULL), new Text(container,SWT.BORDER),
+ "Specify a directory path for generated resources",
+ CommandLineOptionConstants.WSDL2JavaConstants.RESOURCE_FOLDER_OPTION,true);
+ addTextBox(container,new Label(container,SWT.NULL), new Text(container,SWT.BORDER),
+ "Proxy host address if you are behind a firewall",
+ CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG,false);
+ addTextBox(container,new Label(container,SWT.NULL), new Text(container,SWT.BORDER),
+ "Proxy port address if you are behind a firewall",
+ CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG,false);
+ addTextBox(container,new Label(container,SWT.NULL), new Text(container,SWT.BORDER),
+ "Skelton interface name",
+ CommandLineOptionConstants.WSDL2JavaConstants.SKELTON_INTERFACE_NAME_OPTION,false);
+ addTextBox(container,new Label(container,SWT.NULL), new Text(container,SWT.BORDER),
+ "Skelton class name",
+ CommandLineOptionConstants.WSDL2JavaConstants.SKELTON_CLASS_NAME_OPTION,false);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ Label fillLabel = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+ fillLabel.setLayoutData(gd);
+
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Unpacks the databinding classes",
+ CommandLineOptionConstants.WSDL2JavaConstants.UNPACK_CLASSES_OPTION);
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Flattens the generated files",
+ CommandLineOptionConstants.WSDL2JavaConstants.FLATTEN_FILES_OPTION);
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Switch on un-wrapping",
+ CommandLineOptionConstants.WSDL2JavaConstants.UNWRAP_PARAMETERS);
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Generate code for all ports",
+ CommandLineOptionConstants.WSDL2JavaConstants.All_PORTS_OPTION);
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Overwrite the existing classes",
+ CommandLineOptionConstants.WSDL2JavaConstants.OVERRIDE_OPTION);
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Generate Axis 1.x backword compatible code",
+ CommandLineOptionConstants.WSDL2JavaConstants.BACKWORD_COMPATIBILITY_OPTION);
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Suppress namespace prefixes (Optimzation that reduces size of soap request/response)",
+ CommandLineOptionConstants.WSDL2JavaConstants.SUPPRESS_PREFIXES_OPTION);
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Dont generate the build.xml in the output directory",
+ CommandLineOptionConstants.WSDL2JavaConstants.NO_BUILD_XML_OPTION_LONG);
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Dont generate WSDLs in the resources directory",
+ CommandLineOptionConstants.WSDL2JavaConstants.NO_WSDLS_OPTION_LONG);
+ tmpCheckBox=new Button(container, SWT.CHECK);addCheckBox(container,tmpCheckBox,
+ "Dont generate a MessageReceiver in the generated sources",
+ CommandLineOptionConstants.WSDL2JavaConstants.NO_MESSAGE_RECEIVER_OPTION_LONG);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ fillLabel = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+ fillLabel.setLayoutData(gd);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ gd.widthHint=400;
+ Label fillLabel1=new Label(container,SWT.NULL);
+ fillLabel1.setLayoutData(gd);
+ fillLabel1.setText("WSDL version");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ wsdlVersionCombo=new Combo(container,SWT.DROP_DOWN | SWT.BORDER| SWT.READ_ONLY);
+ wsdlVersionCombo.setLayoutData(gd);
+ fillWSDLVersionCombo();
+ String key=CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_OPTION;
+ if ((isEditAdvanceOptions) && (advanceOptions.containsKey(key)))
+ wsdlVersionCombo.select(wsdlVersionCombo.indexOf(((String[])advanceOptions.get(key))[0]));
+
+ wsdlVersionCombo.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ handleWsdlVersionComboSelected();
+
+ };
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ };
+ });
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ fillLabel = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+ fillLabel.setLayoutData(gd);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 1;
+ Label labelPackageAddCaption = new Label(container, SWT.NULL);
+ labelPackageAddCaption.setLayoutData(gd);
+ labelPackageAddCaption.setText("Excludes Packages");
+
+ addNewExcludePackageName=new Text(container,SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 1;
+ addNewExcludePackageName.setLayoutData(gd);
+ addNewExcludePackageName.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ handleNewPackageNameChange();
+ }
+ });
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 1;
+ packageAddButton= new Button(container, SWT.NULL);
+ packageAddButton.setText("Add");
+ packageAddButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ addPackageName();
+ }
+ });
+ packageAddButton.setLayoutData(gd);
+
+ packageNameList = new Table(container,
+ SWT.SINGLE|SWT.FULL_SELECTION|SWT.V_SCROLL|SWT.H_SCROLL);
+ packageNameList.setLinesVisible(true);
+ packageNameList.setHeaderVisible(true);
+ packageNameList.setLayoutData(gd);
+ TableColumn column = new TableColumn(packageNameList,SWT.NONE);
+ column.setWidth(500);
+ column.setText("Excluded packages");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ gd.heightHint = 80;
+ packageNameList.setLayoutData(gd);
+ packageNameList.setVisible(false);
+ if (isEditAdvanceOptions) updateExcludePackageList();
+ packageNameList.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ handlePackageNameListClick();
+ }
+ });
+// tableOutputMaps.addMouseListener(new MouseAdapter(){
+// public void mouseDoubleClick(MouseEvent e){
+// //handleOutputMapEditQuery();
+// }
+// });
+ packageNameList.redraw();
+ packageNameList.setVisible(true);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ Label fillLabel4 = new Label(container, SWT.NULL);
+ fillLabel4.setLayoutData(gd);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 1;
+ packageRemoveButton= new Button(container, SWT.NULL);
+ packageRemoveButton.setText("Remove");
+ packageRemoveButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ removePackageName();
+ }
+ });
+ packageRemoveButton.setLayoutData(gd);
+
+ handlePackageNameListClick();
+ handleNewPackageNameChange();
+
+ return super.createDialogArea(parent);
+ }
+
+ private void handlePackageNameListClick(){
+ packageRemoveButton.setEnabled(packageNameList.getSelectionCount()>0);
+ }
+
+ private void removePackageName(){
+ if (packageNameList.getSelectionIndex()!=-1){
+ String type=CommandLineOptionConstants.WSDL2JavaConstants.EXCLUDE_PAKAGES_OPTION;
+ String[] commaSeperatedPackageList=(String[]) advanceOptions.get(type);
+ String[] packageList=commaSeperatedPackageList[0].split(",");
+ String newList="";
+ int selectedIndex=packageNameList.getSelectionIndex();
+ String toRemove=packageNameList.getItem(selectedIndex).getText();
+ for (String s : packageList) {
+ if (!s.equalsIgnoreCase(toRemove)){
+ if (newList.equalsIgnoreCase(""))
+ newList=s;
+ else
+ newList=newList+","+s;
+ }
+ }
+ if (newList.equalsIgnoreCase(""))
+ advanceOptions.remove(type);
+ else
+ advanceOptions.put(type, new String[]{newList});
+ packageNameList.remove(selectedIndex);
+ if (selectedIndex>=packageNameList.getItemCount())
+ selectedIndex--;
+ packageNameList.select(selectedIndex);
+ }
+ packageNameList.redraw();
+ handlePackageNameListClick();
+ }
+
+ private void addPackageName(){
+ String newList;
+ String type=CommandLineOptionConstants.WSDL2JavaConstants.EXCLUDE_PAKAGES_OPTION;
+ if (packageNameList.getItemCount()>0){
+ String[] commaSeperatedPackageList=(String[]) advanceOptions.get(type);
+ newList=commaSeperatedPackageList[0]+","+addNewExcludePackageName.getText();
+ }else
+ newList=addNewExcludePackageName.getText();
+ advanceOptions.put(type,new String[]{newList});
+ addTableItem(addNewExcludePackageName.getText());
+ addNewExcludePackageName.setText("");
+ handleNewPackageNameChange();
+ }
+
+ private void updateExcludePackageList(){
+ packageNameList.clearAll();
+ String type=CommandLineOptionConstants.WSDL2JavaConstants.EXCLUDE_PAKAGES_OPTION;
+ if (advanceOptions.containsKey(type)){
+ String[] commaSeperatedPackageList=(String[]) advanceOptions.get(type);
+ String[] packageList=commaSeperatedPackageList[0].split(",");
+ for (String string : packageList) {
+ addTableItem(string);
+ }
+ }
+ }
+
+ private void addTableItem(String itemText){
+ TableItem item=new TableItem(packageNameList,SWT.None);
+ item.setText(itemText);
+ }
+
+ private void handleNewPackageNameChange(){
+ Pattern p = Pattern.compile("^[a-zA-Z_\\$][\\w\\$]*(?:\\.[a-zA-Z_\\$][\\w\\$]*)*$");
+ packageAddButton.setEnabled(p.matcher(addNewExcludePackageName.getText()).matches());
+ }
+
+ private void handleWsdlVersionComboSelected(){
+ advanceOptions.put(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_OPTION,
+ new String[]{wsdlVersionCombo.getItem(wsdlVersionCombo.getSelectionIndex())});
+ }
+
+ private void fillWSDLVersionCombo(){
+ wsdlVersionCombo.removeAll();
+ wsdlVersionCombo.add("1.1");
+ wsdlVersionCombo.add("2.0");
+ }
+ private void setCheckBoxState(String type,boolean state){
+ if (state)
+ advanceOptions.put(type, null);
+ else
+ advanceOptions.remove(type);
+ }
+
+ private void setTextBoxValue(String type,String value){
+ if (value.equalsIgnoreCase(""))
+ advanceOptions.remove(type);
+ else
+ advanceOptions.put(type, new String[]{value});
+ }
+
+ public HashMap getAdvanceOptions(){
+ return advanceOptions;
+ }
+}