You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2006/01/13 18:56:13 UTC

svn commit: r368802 - in /webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen: eclipse/ eclipse/ui/ eclipse/util/ resource/

Author: ajith
Date: Fri Jan 13 09:55:38 2006
New Revision: 368802

URL: http://svn.apache.org/viewcvs?rev=368802&view=rev
Log:
1.Updated the options to have combos for service name and port name. Code was added also to autoload them from the selected WSDL.
2. Changed the output page to allow the user select an eclipse project as well (which would be a convenience)

Added:
    webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java
Modified:
    webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java
    webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java
    webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java
    webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java
    webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java
    webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java
    webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties

Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java?rev=368802&r1=368801&r2=368802&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java Fri Jan 13 09:55:38 2006
@@ -57,7 +57,7 @@
 
     private ISelection selection;
 
-    private boolean canFinish = false;
+   
 
     /**
      * Constructor for CodeGenWizard.
@@ -335,5 +335,21 @@
      */
     public void setSelectedWizardType(int selectedWizardType) {
         this.selectedWizardType = selectedWizardType;
+    }
+    
+    /**
+     * Get the selected WSDL from the WSDLselectionpage
+     * @return
+     */
+    public String getWSDLname(){
+        return wsdlSelectionPage.getFileName();	
+    }
+    
+    /**
+     * populate the options page. Usually done after reloading the WSDL
+     *
+     */
+    public void populateOptions(){
+    	optionsPage.populateServiceAndPort();
     }
 }

Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java?rev=368802&r1=368801&r2=368802&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/AbstractWizardPage.java Fri Jan 13 09:55:38 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.axis2.tool.codegen.eclipse.ui;
 
+import org.apache.axis2.tool.codegen.eclipse.CodeGenWizard;
 import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
 import org.apache.axis2.tool.codegen.eclipse.util.SettingsConstants;
 import org.eclipse.jface.dialogs.IDialogSettings;
@@ -61,4 +62,12 @@
     protected abstract void initializeDefaultSettings(); 
    
     public abstract int getPageType() ;
+    
+    /**
+     * a convenient method to get the wizard
+     * @return
+     */
+    public CodeGenWizard getCodegenWizard(){
+    	return (CodeGenWizard)getWizard();
+    }
 }

Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java?rev=368802&r1=368801&r2=368802&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java Fri Jan 13 09:55:38 2006
@@ -13,8 +13,13 @@
 
 package org.apache.axis2.tool.codegen.eclipse.ui;
 
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
 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.URLProcessor;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -30,502 +35,610 @@
 import org.eclipse.swt.widgets.Text;
 
 /**
- * Options Page lets the user change general settings on the code generation. It is used in the CodegenWizardPlugin,
- * CodeGenWizard.
+ * Options Page lets the user change general settings on the code generation. It
+ * is used in the CodegenWizardPlugin, CodeGenWizard.
  * 
  */
-public class OptionsPage extends AbstractWizardPage implements UIConstants
-{
-  
-   /**
-    * Selection list for target languages
-    */
-   private Combo languageSelectionComboBox;
-
-   /**
-    * A radio button to enable/disable code generation for synchronous and asynchronous calls.
-    */
-   private Button syncAndAsyncRadioButton;
-
-   /**
-    * A radio button to choose "synchronous only" code generation
-    */
-   private Button syncOnlyRadioButton;
-
-   /**
-    * A radio button to choose "asynchronous only" code generation
-    */
-   private Button asyncOnlyRadioButton;
-
-   /**
-    * Label holding the full qualified package name for generated code
-    */
-   private Text packageText;
-
-   /**
-    * Checkbox to enable server-side skeleton code generation. If enabled, generates an empty implementation of the
-    * service
-    */
-   private Button serverSideCheckBoxButton;
-
-   /**
-    * Checkbox to enable the generation of test case classes for the generated implementation of the webservice.
-    */
-   private Button testCaseCheckBoxButton;
-
-   /**
-    * Checkbox to enable the generation of a default server.xml configuration file
-    */
-   private Button serverXMLCheckBoxButton;
-   /**
-    * Checkbox to enable the generate all classes
-    */
-   private Button generateAllCheckBoxButton;
-   
-   private Combo databindingTypeCombo;
-   
-   /**
-    * Text box to have the portname
-    */
-   private Text portNameText;
-   
-   /**
-    * Text box to have the service name
-    */
-   private Text serviceNameText;
-  
-   /**
-    * Creates the page and initialize some settings
-    */
-   public OptionsPage()
-   {
-      super("page2");
-      
-   }
-
-   /**
-    * Sets the default values for the Options page
-    * 
-    */
-   protected void initializeDefaultSettings()
-   {
-      settings.put(PREF_CHECK_GENERATE_SERVERCONFIG, false);
-      settings.put(PREF_CHECK_GENERATE_SERVERSIDE, false);
-      settings.put(PREF_CHECK_GENERATE_TESTCASE, false);
-      settings.put(PREF_LANGUAGE_INDEX, 0);
-      settings.put(PREF_PACKAGE_NAME, "org.example.webservice");
-      settings.put(PREF_RADIO_ASYNC_ONLY, false);
-      settings.put(PREF_RADIO_SYNC_AND_ASYNC, true);
-      settings.put(PREF_RADIO_SYNC_ONLY, false);
-      settings.put(PREF_TEXT_PORTNAME, "");
-      settings.put(PREF_TEXT_SERVICENAME, "");
-      settings.put(PREF_DATABINDER_INDEX,0);
-      settings.put(PREF_GEN_ALL,false);
-   }
-
-   /*
-    * (non-Javadoc)
-    * 
-    * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
-    */
-   public void createControl(Composite parent)
-   {
-
-      Composite container = new Composite(parent, SWT.NULL);
-      GridLayout layout = new GridLayout();
-      container.setLayout(layout);
-      layout.numColumns = 3;
-      layout.verticalSpacing = 9;
-
-      GridData gd = new GridData(GridData.FILL_HORIZONTAL);
-      gd.horizontalSpan = 2;
-
-      Label label = new Label(container, SWT.NULL);
-      label.setText(CodegenWizardPlugin.getResourceString("page2.language.caption"));
-
-      languageSelectionComboBox = new Combo(container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
-      // fill the combo
-      this.fillLanguageCombo();
-      languageSelectionComboBox.setLayoutData(gd);
-      languageSelectionComboBox.select(settings.getInt(PREF_LANGUAGE_INDEX));
-      languageSelectionComboBox.addSelectionListener(new SelectionListener()
-      {
-         public void widgetSelected(SelectionEvent e)
-         {
-            settings.put(PREF_LANGUAGE_INDEX, languageSelectionComboBox.getSelectionIndex());
-         }
-
-         public void widgetDefaultSelected(SelectionEvent e)
-         {
-         }
-      });
-
-      syncAndAsyncRadioButton = new Button(container, SWT.RADIO);
-      syncAndAsyncRadioButton.setText(CodegenWizardPlugin.getResourceString("page2.syncAsync.caption"));
-      syncAndAsyncRadioButton.setSelection(settings.getBoolean(PREF_RADIO_SYNC_AND_ASYNC));
-      syncAndAsyncRadioButton.addSelectionListener(new SelectionListener()
-      {
-         public void widgetSelected(SelectionEvent e)
-         {
-            settings.put(PREF_RADIO_SYNC_AND_ASYNC, syncAndAsyncRadioButton.getSelection());
-         }
-
-         public void widgetDefaultSelected(SelectionEvent e)
-         {
-         }
-      });
-
-      syncOnlyRadioButton = new Button(container, SWT.RADIO);
-      syncOnlyRadioButton.setText(CodegenWizardPlugin.getResourceString("page2.sync.caption"));
-      syncOnlyRadioButton.setSelection(settings.getBoolean(PREF_RADIO_SYNC_ONLY));
-      syncOnlyRadioButton.addSelectionListener(new SelectionListener()
-      {
-         public void widgetSelected(SelectionEvent e)
-         {
-            settings.put(PREF_RADIO_SYNC_ONLY, syncOnlyRadioButton.getSelection());
-         }
-
-         public void widgetDefaultSelected(SelectionEvent e)
-         {
-         }
-      });
-
-      asyncOnlyRadioButton = new Button(container, SWT.RADIO);
-      asyncOnlyRadioButton.setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
-         .getResourceString("page2.async.caption"));
-      asyncOnlyRadioButton.setSelection(settings.getBoolean(PREF_RADIO_ASYNC_ONLY));
-      asyncOnlyRadioButton.addSelectionListener(new SelectionListener()
-      {
-         public void widgetSelected(SelectionEvent e)
-         {
-            settings.put(PREF_RADIO_ASYNC_ONLY, asyncOnlyRadioButton.getSelection());
-         }
-
-         public void widgetDefaultSelected(SelectionEvent e)
-         {
-         }
-      });
-      
-//    service name
-      label = new Label(container, SWT.NULL);
-      label.setText(CodegenWizardPlugin.getResourceString("page2.serviceName.caption"));
-      serviceNameText = new Text(container, SWT.BORDER);
-      gd = new GridData(GridData.FILL_HORIZONTAL);
-      gd.horizontalSpan = 2;
-      serviceNameText.setLayoutData(gd);
-      serviceNameText.setText(settings.get(PREF_TEXT_SERVICENAME));
-      serviceNameText.addModifyListener(new ModifyListener(){
-          public void modifyText(ModifyEvent e){
-              settings.put(PREF_TEXT_SERVICENAME,serviceNameText.getText());
-          }
-      });
-      
-      //port name
-      label = new Label(container, SWT.NULL);
-      label.setText(CodegenWizardPlugin.getResourceString("page2.portName.caption"));
-      portNameText = new Text(container, SWT.BORDER);
-      gd = new GridData(GridData.FILL_HORIZONTAL);
-      gd.horizontalSpan = 2;
-      portNameText.setLayoutData(gd);
-      portNameText.setText(settings.get(PREF_TEXT_PORTNAME));
-      portNameText.addModifyListener(new ModifyListener(){
-          public void modifyText(ModifyEvent e){
-              settings.put(PREF_TEXT_PORTNAME,portNameText.getText());
-          }
-      });
-      
-      //package name
-      label = new Label(container, SWT.NULL);
-      label.setText(CodegenWizardPlugin.getResourceString("page2.package.caption"));
-      packageText = new Text(container, SWT.BORDER);
-      gd = new GridData(GridData.FILL_HORIZONTAL);
-      gd.horizontalSpan = 2;
-
-      packageText.setLayoutData(gd);
-      String packageName;
-      String storedPackageName = settings.get(PREF_PACKAGE_NAME);
-      if (storedPackageName.equals(""))
-      {
-         packageName = URLProcessor.makePackageName("");
-      }
-      else
-      {
-         packageName = storedPackageName;
-      }
-      packageText.setText(packageName); // get this text from the URLProcessor
-      packageText.addModifyListener(new ModifyListener()
-      {
-         public void modifyText(ModifyEvent e)
-         {
-            settings.put(PREF_PACKAGE_NAME, packageText.getText());
-         }
-      });
-
-
-      gd = new GridData(GridData.FILL_HORIZONTAL);
-      gd.horizontalSpan = 3;
-      testCaseCheckBoxButton = new Button(container, SWT.CHECK);
-      testCaseCheckBoxButton.setLayoutData(gd);
-      testCaseCheckBoxButton.setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
-         .getResourceString("page2.testcase.caption"));
-      testCaseCheckBoxButton.setSelection(settings.getBoolean(PREF_CHECK_GENERATE_TESTCASE));
-      testCaseCheckBoxButton.addSelectionListener(new SelectionListener()
-      {
-         public void widgetSelected(SelectionEvent e)
-         {
-            settings.put(PREF_CHECK_GENERATE_TESTCASE, testCaseCheckBoxButton.getEnabled());
-         }
-
-         public void widgetDefaultSelected(SelectionEvent e)
-         {
-         }
-      });
-      // Server side check box
-      serverSideCheckBoxButton = new Button(container, SWT.CHECK);
-      serverSideCheckBoxButton.setText(CodegenWizardPlugin.getResourceString("page2.serverside.caption"));
-      serverSideCheckBoxButton.setSelection(settings.getBoolean(PREF_CHECK_GENERATE_SERVERSIDE));
-      serverSideCheckBoxButton.addSelectionListener(new SelectionListener()
-      {
-         public void widgetSelected(SelectionEvent e)
-         {
-            handleServersideSelection();
-            settings.put(PREF_CHECK_GENERATE_SERVERSIDE, serverSideCheckBoxButton.getEnabled());
-         }
-
-         public void widgetDefaultSelected(SelectionEvent e)
-         {
-         }
-      });
-      
-      //Server side services xml
-      gd = new GridData(GridData.FILL_HORIZONTAL);
-      gd.horizontalSpan = 1;
-      serverXMLCheckBoxButton = new Button(container, SWT.CHECK);
-      serverXMLCheckBoxButton.setLayoutData(gd);
-      serverXMLCheckBoxButton.setSelection(settings.getBoolean(PREF_CHECK_GENERATE_SERVERCONFIG));
-      serverXMLCheckBoxButton.setText(CodegenWizardPlugin.getResourceString("page2.serviceXML.caption"));
-      serverXMLCheckBoxButton.addSelectionListener(new SelectionListener()
-      {
-         public void widgetSelected(SelectionEvent e)
-         {
-            settings.put(PREF_CHECK_GENERATE_SERVERCONFIG, serverXMLCheckBoxButton.getEnabled());
-         }
-
-         public void widgetDefaultSelected(SelectionEvent e)
-         {
-         }
-      });
-      //generate all
-      generateAllCheckBoxButton = new Button(container, SWT.CHECK);
-      gd = new GridData(GridData.FILL_HORIZONTAL);
-      gd.horizontalSpan = 1;
-      generateAllCheckBoxButton.setLayoutData(gd);
-      generateAllCheckBoxButton.setSelection(settings.getBoolean(PREF_GEN_ALL));
-      generateAllCheckBoxButton.setText(CodegenWizardPlugin.getResourceString("page2.genAll.caption"));
-      generateAllCheckBoxButton.addSelectionListener(new SelectionListener()
-      {
-         public void widgetSelected(SelectionEvent e)
-         {
-            settings.put(PREF_GEN_ALL, serverXMLCheckBoxButton.getEnabled());
-         }
-
-         public void widgetDefaultSelected(SelectionEvent e)
-         {
-         }
-      });
-
-      // Databinding
-      label = new Label(container, SWT.NULL);
-      label.setText(CodegenWizardPlugin.getResourceString("page2.databindingCheck.caption"));
-           
-      
-      gd = new GridData(GridData.FILL_HORIZONTAL);
-      gd.horizontalSpan = 2;
-      databindingTypeCombo  = new Combo(container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
-      databindingTypeCombo.setLayoutData(gd);
-      fillDatabinderCombo();
-      databindingTypeCombo.select(settings.getInt(PREF_DATABINDER_INDEX));
-      databindingTypeCombo.addSelectionListener(new SelectionListener(){
-          public void widgetSelected(SelectionEvent e){
-            settings.put(PREF_DATABINDER_INDEX,databindingTypeCombo.getSelectionIndex());    
-          
-          };
-          public void widgetDefaultSelected(SelectionEvent e){}; 
-      });
-            
-   
-      /*
-       * Check the state of server-side selection, so we can enable/disable
-       * the serverXML checkbox button.
-       */
-      handleServersideSelection();
-
-      
-      setControl(container);
-      setPageComplete(true);
-
-   }
-
-   /**
-    * Fill the combo with proper language names
-    * 
-    */
-   private void fillDatabinderCombo()
-   {
-
-     
-      databindingTypeCombo.add(DATA_BINDING_ADB);
-      databindingTypeCombo.add(DATA_BINDING_XMLBEANS);
-      databindingTypeCombo.add(DATA_BINDING_NONE);
-      
-      
-   }
-   /**
-    * Fill the combo with proper language names
-    * 
-    */
-   private void fillLanguageCombo()
-   {
-
-      languageSelectionComboBox.add(JAVA);
-      languageSelectionComboBox.add(C_SHARP);
-      
-      languageSelectionComboBox.select(0);
-   }
-
-   /**
-    * Validates the status of the server-side checkbox, and enables/disables
-    * the generation checkbox for XML configuration file
-    */
-   private void handleServersideSelection()
-   {
-      if (this.serverSideCheckBoxButton.getSelection())
-      {
-         this.serverXMLCheckBoxButton.setEnabled(true);
-         this.generateAllCheckBoxButton.setEnabled(true);
-      }
-      else
-      {
-         this.serverXMLCheckBoxButton.setEnabled(false);
-         this.generateAllCheckBoxButton.setEnabled(false);
-      }
-   }
-
-   /**
-    * Get the selected language
-    * 
-    * @return a string containing the name of the target language
-    */
-   public String getSelectedLanguage()
-   {
-      return languageSelectionComboBox.getItem(languageSelectionComboBox.getSelectionIndex());
-   }
-
-   /**
-    * the async only status
-    * 
-    * @return true if "Generate asynchronous code only" is checked
-    */
-   public boolean isAsyncOnlyOn()
-   {
-      return asyncOnlyRadioButton.getSelection();
-   }
-
-   /**
-    * the sync only status
-    * 
-    * @return true if "Generate synchronous code only" is checked
-    */
-   public boolean isSyncOnlyOn()
-   {
-      return syncOnlyRadioButton.getSelection();
-   }
-
-   /**
-    * return the package name
-    * 
-    * @return a string containing the package name to use for code generation
-    */
-   public String getPackageName()
-   {
-      return this.packageText.getText();
-   }
-
-   /**
-    * The serverside status
-    * 
-    * @return true if "Generate Server-Side" is checked
-    */
-   public boolean isServerside()
-   {
-      return this.serverSideCheckBoxButton.getSelection();
-   }
-
-   /**
-    * 
-    * @return true if "Generate XML configuration file" is checked
-    */
-   public boolean isServerXML()
-   {
-      if (this.serverXMLCheckBoxButton.isEnabled())
-         return this.serverXMLCheckBoxButton.getSelection();
-      else
-         return false;
-   }
-
-   /**
-    * 
-    * @return true if "Generate test case" is checked
-    */
-   public boolean isGenerateTestCase()
-   {
-      return this.testCaseCheckBoxButton.getSelection();
-   }
-   
-   
-    /* (non-Javadoc)
-     * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
-     */
-    public int getPageType() {
-          return WSDL_2_JAVA_TYPE;
-    }
-    
-    /**
-     * 
-     * @return null if portname is empty
-     */
-    public String getPortName(){
-        String text = this.portNameText.getText();
-        if (text==null || text.trim().equals("")){
-            return null;
-        }
-        return text;
-        
-    }
-    
-    /**
-     * @return null if the text is empty
-     * 
-     */
-    public String getServiceName(){
-        String text = this.serviceNameText.getText();
-        if (text==null || text.trim().equals("")){
-            return null;
-        }
-        return text;
-        
-    }
-    
-    /**
-     * 
-     * @return
-     */
-    public String getDatabinderName(){
-        return this.databindingTypeCombo.getItem(databindingTypeCombo.getSelectionIndex());
-        
-   }
-    
-    public boolean getGenerateAll(){
-        return this.generateAllCheckBoxButton.getSelection();
-    }
+public class OptionsPage extends AbstractWizardPage implements UIConstants {
+
+	/**
+	 * Selection list for target languages
+	 */
+	private Combo languageSelectionComboBox;
+
+	/**
+	 * A radio button to enable/disable code generation for synchronous and
+	 * asynchronous calls.
+	 */
+	private Button syncAndAsyncRadioButton;
+
+	/**
+	 * A radio button to choose "synchronous only" code generation
+	 */
+	private Button syncOnlyRadioButton;
+
+	/**
+	 * A radio button to choose "asynchronous only" code generation
+	 */
+	private Button asyncOnlyRadioButton;
+
+	/**
+	 * Label holding the full qualified package name for generated code
+	 */
+	private Text packageText;
+
+	/**
+	 * Checkbox to enable server-side skeleton code generation. If enabled,
+	 * generates an empty implementation of the service
+	 */
+	private Button serverSideCheckBoxButton;
+
+	/**
+	 * Checkbox to enable the generation of test case classes for the generated
+	 * implementation of the webservice.
+	 */
+	private Button testCaseCheckBoxButton;
+
+	/**
+	 * Checkbox to enable the generation of a default server.xml configuration
+	 * file
+	 */
+	private Button serverXMLCheckBoxButton;
+
+	/**
+	 * Checkbox to enable the generate all classes
+	 */
+	private Button generateAllCheckBoxButton;
+
+	private Combo databindingTypeCombo;
+
+	/**
+	 * Text box to have the portname
+	 */
+	private Combo portNameCombo;
+
+	/**
+	 * Text box to have the service name
+	 */
+	private Combo serviceNameCombo;
+
+	private WSDLPropertyReader reader;
+
+	private List serviceQNameList = null;
+
+	/**
+	 * Creates the page and initialize some settings
+	 */
+	public OptionsPage() {
+		super("page2");
+
+	}
+
+	/**
+	 * Sets the default values for the Options page
+	 * 
+	 */
+	protected void initializeDefaultSettings() {
+		settings.put(PREF_CHECK_GENERATE_SERVERCONFIG, false);
+		settings.put(PREF_CHECK_GENERATE_SERVERSIDE, false);
+		settings.put(PREF_CHECK_GENERATE_TESTCASE, false);
+		settings.put(PREF_LANGUAGE_INDEX, 0);
+		settings.put(PREF_PACKAGE_NAME, "org.example.webservice");
+		settings.put(PREF_RADIO_ASYNC_ONLY, false);
+		settings.put(PREF_RADIO_SYNC_AND_ASYNC, true);
+		settings.put(PREF_RADIO_SYNC_ONLY, false);
+		settings.put(PREF_COMBO_PORTNAME_INDEX, 0);
+		settings.put(PREF_COMBO_SERVICENAME_INDEX, 0);
+		settings.put(PREF_DATABINDER_INDEX, 0);
+		settings.put(PREF_GEN_ALL, false);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite parent) {
+
+		Composite container = new Composite(parent, SWT.NULL);
+		GridLayout layout = new GridLayout();
+		container.setLayout(layout);
+		layout.numColumns = 3;
+		layout.verticalSpacing = 9;
+
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+
+		Label label = new Label(container, SWT.NULL);
+		label.setText(CodegenWizardPlugin
+				.getResourceString("page2.language.caption"));
+
+		languageSelectionComboBox = new Combo(container, SWT.DROP_DOWN
+				| SWT.BORDER | SWT.READ_ONLY);
+		// fill the combo
+		this.fillLanguageCombo();
+		languageSelectionComboBox.setLayoutData(gd);
+		languageSelectionComboBox.select(settings.getInt(PREF_LANGUAGE_INDEX));
+		languageSelectionComboBox.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				settings.put(PREF_LANGUAGE_INDEX, languageSelectionComboBox
+						.getSelectionIndex());
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		syncAndAsyncRadioButton = new Button(container, SWT.RADIO);
+		syncAndAsyncRadioButton.setText(CodegenWizardPlugin
+				.getResourceString("page2.syncAsync.caption"));
+		syncAndAsyncRadioButton.setSelection(settings
+				.getBoolean(PREF_RADIO_SYNC_AND_ASYNC));
+		syncAndAsyncRadioButton.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				settings.put(PREF_RADIO_SYNC_AND_ASYNC, syncAndAsyncRadioButton
+						.getSelection());
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		syncOnlyRadioButton = new Button(container, SWT.RADIO);
+		syncOnlyRadioButton.setText(CodegenWizardPlugin
+				.getResourceString("page2.sync.caption"));
+		syncOnlyRadioButton.setSelection(settings
+				.getBoolean(PREF_RADIO_SYNC_ONLY));
+		syncOnlyRadioButton.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				settings.put(PREF_RADIO_SYNC_ONLY, syncOnlyRadioButton
+						.getSelection());
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		asyncOnlyRadioButton = new Button(container, SWT.RADIO);
+		asyncOnlyRadioButton
+				.setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+						.getResourceString("page2.async.caption"));
+		asyncOnlyRadioButton.setSelection(settings
+				.getBoolean(PREF_RADIO_ASYNC_ONLY));
+		asyncOnlyRadioButton.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				settings.put(PREF_RADIO_ASYNC_ONLY, asyncOnlyRadioButton
+						.getSelection());
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		// service name
+		label = new Label(container, SWT.NULL);
+		label.setText(CodegenWizardPlugin
+				.getResourceString("page2.serviceName.caption"));
+
+		serviceNameCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER
+				| SWT.READ_ONLY);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		serviceNameCombo.setLayoutData(gd);
+		// serviceNameCombo.setText(settings.get(PREF_TEXT_SERVICENAME));
+		serviceNameCombo.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				// update the settings
+				settings.put(PREF_COMBO_SERVICENAME_INDEX, serviceNameCombo
+						.getSelectionIndex());
+				// reload the portName list
+				loadPortNames();
+
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		// port name
+		label = new Label(container, SWT.NULL);
+		label.setText(CodegenWizardPlugin
+				.getResourceString("page2.portName.caption"));
+		portNameCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER
+				| SWT.READ_ONLY);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		portNameCombo.setLayoutData(gd);
+
+		portNameCombo.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				// do something here
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		// package name
+		label = new Label(container, SWT.NULL);
+		label.setText(CodegenWizardPlugin
+				.getResourceString("page2.package.caption"));
+		packageText = new Text(container, SWT.BORDER);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+
+		packageText.setLayoutData(gd);
+		String packageName;
+		String storedPackageName = settings.get(PREF_PACKAGE_NAME);
+		if (storedPackageName.equals("")) {
+			packageName = URLProcessor.makePackageName("");
+		} else {
+			packageName = storedPackageName;
+		}
+		packageText.setText(packageName); // get this text from the
+		// URLProcessor
+		packageText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				settings.put(PREF_PACKAGE_NAME, packageText.getText());
+			}
+		});
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		testCaseCheckBoxButton = new Button(container, SWT.CHECK);
+		testCaseCheckBoxButton.setLayoutData(gd);
+		testCaseCheckBoxButton
+				.setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+						.getResourceString("page2.testcase.caption"));
+		testCaseCheckBoxButton.setSelection(settings
+				.getBoolean(PREF_CHECK_GENERATE_TESTCASE));
+		testCaseCheckBoxButton.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				settings.put(PREF_CHECK_GENERATE_TESTCASE,
+						testCaseCheckBoxButton.getSelection());
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+		// Server side check box
+		serverSideCheckBoxButton = new Button(container, SWT.CHECK);
+		serverSideCheckBoxButton.setText(CodegenWizardPlugin
+				.getResourceString("page2.serverside.caption"));
+		serverSideCheckBoxButton.setSelection(settings
+				.getBoolean(PREF_CHECK_GENERATE_SERVERSIDE));
+		serverSideCheckBoxButton.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				handleServersideSelection();
+				settings.put(PREF_CHECK_GENERATE_SERVERSIDE,
+						serverSideCheckBoxButton.getSelection());
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		// Server side services xml
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 1;
+		serverXMLCheckBoxButton = new Button(container, SWT.CHECK);
+		serverXMLCheckBoxButton.setLayoutData(gd);
+		serverXMLCheckBoxButton.setSelection(settings
+				.getBoolean(PREF_CHECK_GENERATE_SERVERCONFIG));
+		serverXMLCheckBoxButton.setText(CodegenWizardPlugin
+				.getResourceString("page2.serviceXML.caption"));
+		serverXMLCheckBoxButton.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				settings.put(PREF_CHECK_GENERATE_SERVERCONFIG,
+						serverXMLCheckBoxButton.getEnabled());
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+		// generate all
+		generateAllCheckBoxButton = new Button(container, SWT.CHECK);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 1;
+		generateAllCheckBoxButton.setLayoutData(gd);
+		generateAllCheckBoxButton.setSelection(settings
+				.getBoolean(PREF_GEN_ALL));
+		generateAllCheckBoxButton.setText(CodegenWizardPlugin
+				.getResourceString("page2.genAll.caption"));
+		generateAllCheckBoxButton.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				settings
+						.put(PREF_GEN_ALL, generateAllCheckBoxButton.getSelection());
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		// Databinding
+		label = new Label(container, SWT.NULL);
+		label.setText(CodegenWizardPlugin
+				.getResourceString("page2.databindingCheck.caption"));
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		databindingTypeCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER
+				| SWT.READ_ONLY);
+		databindingTypeCombo.setLayoutData(gd);
+		fillDatabinderCombo();
+		databindingTypeCombo.select(settings.getInt(PREF_DATABINDER_INDEX));
+		databindingTypeCombo.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				settings.put(PREF_DATABINDER_INDEX, databindingTypeCombo
+						.getSelectionIndex());
+
+			};
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			};
+		});
+
+		/*
+		 * Check the state of server-side selection, so we can enable/disable
+		 * the serverXML checkbox button.
+		 */
+		handleServersideSelection();
+		/*
+		 * try populating the combos and other information from the WSDL if this
+		 * is restored
+		 */
+		if (restoredFromPreviousSettings) {
+			populateServiceAndPort();
+			
+			selectDefaults();
+		}
+
+		setControl(container);
+
+		setPageComplete(true);
+
+	}
+
+	private void selectDefaults() {
+		serviceNameCombo.select(settings.getInt(PREF_COMBO_SERVICENAME_INDEX));
+		//ports need to be renamed in order for correct default selection
+		loadPortNames();
+		portNameCombo.select(settings.getInt(PREF_COMBO_SERVICENAME_INDEX));
+	}
+
+	private void populatePackageName(){
+		this.packageText.setText(reader.packageFromTargetNamespace());
+	}
+	/**
+	 * populate the service and the port from the WSDL this needs to be public
+	 * since the WSDLselection page may call this
+	 */
+	public void populateServiceAndPort() {
+		if (reader == null)
+			reader = new WSDLPropertyReader();
+		try {
+			String lname = getCodegenWizard().getWSDLname();
+			if (!"".equals(lname.trim())) {
+				reader.readWSDL(lname);
+
+				// enable the combo's
+				setComboBoxEnable(true);
+
+				this.serviceQNameList = reader.getServiceList();
+				if (!serviceQNameList.isEmpty()) {
+					serviceNameCombo.removeAll();
+					for (int i = 0; i < serviceQNameList.size(); i++) {
+						// add the local part of the
+						serviceNameCombo.add(((QName) serviceQNameList.get(i))
+								.getLocalPart());
+					}
+					;
+					// select the first one as the default
+					serviceNameCombo.select(0);
+
+					// load the ports
+					loadPortNames();
+
+					updateStatus(null);
+				} else {
+					// service name list being empty means we are switching to
+					// the interface mode
+					serviceNameCombo.removeAll();
+					portNameCombo.removeAll();
+					// disable the combo's
+					setComboBoxEnable(false);
+				}
+				
+				populatePackageName();
+			}
+		} catch (Exception e) {
+			// disable the combo's
+			setComboBoxEnable(false);
+		
+			updateStatus(CodegenWizardPlugin
+					.getResourceString("page2.wsdlNotFound.message"));
+		}
+
+	}
+
+	private void loadPortNames() {
+		List ports = reader.getPortNameList((QName) serviceQNameList
+				.get(serviceNameCombo.getSelectionIndex()));
+		if (!ports.isEmpty()) {
+			portNameCombo.removeAll();
+			for (int i = 0; i < ports.size(); i++) {
+				// add the local part of the
+				portNameCombo.add(ports.get(i).toString());
+			}
+			updateStatus(null);
+			portNameCombo.select(0);
+		} else {
+			updateStatus(CodegenWizardPlugin
+					.getResourceString("page2.noports.message"));// TODO
+		}
+
+	}
+
+	private void setComboBoxEnable(boolean b) {
+		if (serviceNameCombo != null) {
+			serviceNameCombo.setEnabled(b);
+			portNameCombo.setEnabled(b);
+		}
+	}
+
+	/**
+	 * Fill the combo with proper language names
+	 * 
+	 */
+	private void fillDatabinderCombo() {
+
+		databindingTypeCombo.add(DATA_BINDING_ADB);
+		databindingTypeCombo.add(DATA_BINDING_XMLBEANS);
+		databindingTypeCombo.add(DATA_BINDING_NONE);
+
+	}
+
+	/**
+	 * Fill the combo with proper language names
+	 * 
+	 */
+	private void fillLanguageCombo() {
+
+		languageSelectionComboBox.add(JAVA);
+		languageSelectionComboBox.add(C_SHARP);
+
+		languageSelectionComboBox.select(0);
+	}
+
+	/**
+	 * Validates the status of the server-side checkbox, and enables/disables
+	 * the generation checkbox for XML configuration file
+	 */
+	private void handleServersideSelection() {
+		if (this.serverSideCheckBoxButton.getSelection()) {
+			this.serverXMLCheckBoxButton.setEnabled(true);
+			this.generateAllCheckBoxButton.setEnabled(true);
+		} else {
+			this.serverXMLCheckBoxButton.setEnabled(false);
+			this.generateAllCheckBoxButton.setEnabled(false);
+		}
+	}
+
+	/**
+	 * Get the selected language
+	 * 
+	 * @return a string containing the name of the target language
+	 */
+	public String getSelectedLanguage() {
+		return languageSelectionComboBox.getItem(languageSelectionComboBox
+				.getSelectionIndex());
+	}
+
+	/**
+	 * the async only status
+	 * 
+	 * @return true if "Generate asynchronous code only" is checked
+	 */
+	public boolean isAsyncOnlyOn() {
+		return asyncOnlyRadioButton.getSelection();
+	}
+
+	/**
+	 * the sync only status
+	 * 
+	 * @return true if "Generate synchronous code only" is checked
+	 */
+	public boolean isSyncOnlyOn() {
+		return syncOnlyRadioButton.getSelection();
+	}
+
+	/**
+	 * return the package name
+	 * 
+	 * @return a string containing the package name to use for code generation
+	 */
+	public String getPackageName() {
+		return this.packageText.getText();
+	}
+
+	/**
+	 * The serverside status
+	 * 
+	 * @return true if "Generate Server-Side" is checked
+	 */
+	public boolean isServerside() {
+		return this.serverSideCheckBoxButton.getSelection();
+	}
+
+	/**
+	 * 
+	 * @return true if "Generate XML configuration file" is checked
+	 */
+	public boolean isServerXML() {
+		if (this.serverXMLCheckBoxButton.isEnabled())
+			return this.serverXMLCheckBoxButton.getSelection();
+		else
+			return false;
+	}
+
+	/**
+	 * 
+	 * @return true if "Generate test case" is checked
+	 */
+	public boolean isGenerateTestCase() {
+		return this.testCaseCheckBoxButton.getSelection();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+	 */
+	public int getPageType() {
+		return WSDL_2_JAVA_TYPE;
+	}
+
+	/**
+	 * 
+	 * @return null if portname is empty
+	 */
+	public String getPortName() {
+		String text = this.portNameCombo.getItem(
+				portNameCombo.getSelectionIndex());
+		
+		if (text == null || text.trim().equals("")) {
+			return null;
+		}
+		return text;
+
+	}
+
+	/**
+	 * @return null if the text is empty
+	 * 
+	 */
+	public String getServiceName() {
+		String text = this.serviceNameCombo.getItem(
+				serviceNameCombo.getSelectionIndex());
+		
+		if (text == null || text.trim().equals("")) {
+			return null;
+		}
+		return text;
+
+	}
+
+	/**
+	 * 
+	 * @return
+	 */
+	public String getDatabinderName() {
+		return this.databindingTypeCombo.getItem(databindingTypeCombo
+				.getSelectionIndex());
+
+	}
+
+	public boolean getGenerateAll() {
+		return this.generateAllCheckBoxButton.getSelection();
+	}
 }

Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java?rev=368802&r1=368801&r2=368802&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java Fri Jan 13 09:55:38 2006
@@ -16,6 +16,8 @@
 
 package org.apache.axis2.tool.codegen.eclipse.ui;
 
+import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.swt.SWT;
@@ -23,6 +25,7 @@
 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;
@@ -33,139 +36,162 @@
 import org.eclipse.ui.dialogs.ContainerSelectionDialog;
 
 public class OutputPage extends AbstractWizardPage {
-   
-    private Text outputLocation;
 
-    private Button browseButton;
+	private Text outputLocation;
 
-    private Button locationSelectCheckBox;
+	private Button browseButton;
 
-   
-    /**
-     *  
-     */
-    public OutputPage() {
-        super("page3");
-    }
-
-    /**
-     * Creates some initial values for the settings. On the output page, this is
-     * not very much.
-     */
-    protected void initializeDefaultSettings() {
-        settings.put(PREF_OUTPUT_LOCATION, "");
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
-     */
-    public void createControl(Composite parent) {
-        Composite container = new Composite(parent, SWT.NULL);
-        GridLayout layout = new GridLayout();
-        container.setLayout(layout);
-        layout.numColumns = 3;
-        layout.verticalSpacing = 9;
-
-        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
-        Label label = new Label(container, SWT.NULL);
-        label
-                .setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
-                        .getResourceString("page3.output.caption"));
-
-        outputLocation = new Text(container, SWT.BORDER);
-        outputLocation.setLayoutData(gd);
-        outputLocation.setText(settings.get(PREF_OUTPUT_LOCATION));
-        outputLocation.addModifyListener(new ModifyListener() {
-            public void modifyText(ModifyEvent e) {
-                settings.put(PREF_OUTPUT_LOCATION, outputLocation.getText());
-                handleModifyEvent();
-            }
-        });
-
-        browseButton = new Button(container, SWT.PUSH);
-        browseButton
-                .setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
-                        .getResourceString("page3.outselection.browse"));
-        browseButton.addSelectionListener(new SelectionAdapter() {
-            public void widgetSelected(SelectionEvent e) {
-                handleBrowse();
-            }
-        });
-
-        // locationSelectCheckBox = new Button(container, SWT.CHECK);
-        // locationSelectCheckBox.setText("Workspace projects only");
-
-        setControl(container);
-
-        /*
-         * Update the buttons, in case this was restored from an earlier setting
-         */
-        if (restoredFromPreviousSettings){
-            	handleModifyEvent();
-        }
-    }
-
-    /**
-     * get the output location
-     * 
-     * @return a string containing the full pathname of the output location
-     */
-    public String getOutputLocation() {
-        return outputLocation.getText();
-    }
-
-    /**
-     * Worker method for handling modifications to the textbox
-     *  
-     */
-    private void handleModifyEvent() {
-        String text = this.outputLocation.getText();
-        if ((text == null) || (text.trim().equals(""))) {
-            updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
-                    .getResourceString("page3.error.nolocation"));
-            return;
-        }
-        updateStatus(null);
-    }
-
-   
-    /**
-     * Handle the browse button events: opens a dialog where the user can choose
-     * an external directory location
-     *  
-     */
-    private void handleBrowse() {
-        boolean location = false;// locationSelectCheckBox.getSelection();
-        if (!location) {
-            DirectoryDialog dialog = new DirectoryDialog(this.getShell());
-            String returnString = dialog.open();
-            if (returnString != null) {
-                outputLocation.setText(returnString);
-            }
-        } else {
-            ContainerSelectionDialog dialog = new ContainerSelectionDialog(
-                    getShell(),
-                    ResourcesPlugin.getWorkspace().getRoot(),
-                    false,
-                    org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
-                            .getResourceString("page3.containerbox.title"));
-            if (dialog.open() == ContainerSelectionDialog.OK) {
-                Object[] result = dialog.getResult();
-                if (result.length == 1) {
-                    outputLocation.setText(((Path) result[0]).toOSString());
-                }
-            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
-     */
-    public int getPageType() {
-        return WSDL_2_JAVA_TYPE;
-    }
+	private Button locationSelectCheckBox;
+
+	/**
+	 * 
+	 */
+	public OutputPage() {
+		super("page3");
+	}
+
+	/**
+	 * Creates some initial values for the settings. On the output page, this is
+	 * not very much.
+	 */
+	protected void initializeDefaultSettings() {
+		settings.put(PREF_OUTPUT_LOCATION, "");
+		settings.put(PREF_CHECK_BROWSE_PROJECTS, true);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	public void createControl(Composite parent) {
+		Composite container = new Composite(parent, SWT.NULL);
+		GridLayout layout = new GridLayout();
+		container.setLayout(layout);
+		layout.numColumns = 3;
+		layout.verticalSpacing = 9;
+
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+		locationSelectCheckBox = new Button(container, SWT.CHECK);
+		locationSelectCheckBox.setText(CodegenWizardPlugin
+				.getResourceString("page3.browseWorkspace.title")); 
+		gd.horizontalSpan = 3;
+		locationSelectCheckBox.setLayoutData(gd);
+		locationSelectCheckBox.setSelection(settings.getBoolean(PREF_CHECK_BROWSE_PROJECTS));
+		locationSelectCheckBox.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				// in any case just wipe out whatever is in the text box
+				outputLocation.setText("");
+				settings.put(PREF_CHECK_BROWSE_PROJECTS, locationSelectCheckBox.getSelection());
+			};
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			};
+		});
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		Label label = new Label(container, SWT.NULL);
+		label
+				.setText(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+						.getResourceString("page3.output.caption"));
+
+		outputLocation = new Text(container, SWT.BORDER);
+		outputLocation.setLayoutData(gd);
+		outputLocation.setText(settings.get(PREF_OUTPUT_LOCATION));
+		outputLocation.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				settings.put(PREF_OUTPUT_LOCATION, outputLocation.getText());
+				handleModifyEvent();
+			}
+		});
+
+		browseButton = new Button(container, SWT.PUSH);
+		browseButton
+				.setText(CodegenWizardPlugin
+						.getResourceString("page3.outselection.browse"));
+		browseButton.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				handleBrowse();
+			}
+		});
+
+		setControl(container);
+
+		/*
+		 * Update the buttons, in case this was restored from an earlier setting
+		 */
+		if (restoredFromPreviousSettings) {
+			handleModifyEvent();
+		}
+	}
+
+	/**
+	 * get the output location
+	 * 
+	 * @return a string containing the full pathname of the output location
+	 */
+	public String getOutputLocation() {
+		return outputLocation.getText();
+	}
+
+	/**
+	 * Worker method for handling modifications to the textbox
+	 * 
+	 */
+	private void handleModifyEvent() {
+		String text = this.outputLocation.getText();
+		if ((text == null) || (text.trim().equals(""))) {
+			updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+					.getResourceString("page3.error.nolocation"));
+			return;
+		}
+		updateStatus(null);
+	}
+
+	/**
+	 * Handle the browse button events: opens a dialog where the user can choose
+	 * an external directory location
+	 * 
+	 */
+	private void handleBrowse() {
+		boolean location = locationSelectCheckBox.getSelection();
+		if (!location) {
+			DirectoryDialog dialog = new DirectoryDialog(this.getShell());
+			String returnString = dialog.open();
+			if (returnString != null) {
+				outputLocation.setText(returnString);
+			}
+		} else {
+			IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+			
+			ContainerSelectionDialog dialog = new ContainerSelectionDialog(
+					getShell(),
+					root,
+					false,
+					CodegenWizardPlugin
+							.getResourceString("page3.containerbox.title"));
+			if (dialog.open() == ContainerSelectionDialog.OK) {
+				Object[] result = dialog.getResult();
+				if (result.length == 1) {
+					Path path = ((Path) result[0]);
+					// append to the workspace path
+					if (root.exists(path)) {
+						outputLocation.setText(root.getLocation().append(path)
+								.toFile().getAbsolutePath());
+					}
+				}
+			}
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+	 */
+	public int getPageType() {
+		return WSDL_2_JAVA_TYPE;
+	}
 }

Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java?rev=368802&r1=368801&r2=368802&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java Fri Jan 13 09:55:38 2006
@@ -104,13 +104,10 @@
                     .getResourceString("page1.error.filemissingerror"));
             return;
         }
-
-//        if (!fileName.matches(".*\\.wsdl")) {
-//            updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
-//                    .getResourceString("page1.error.wrongextension"));
-//            return;
-//        }
-
+        
+        //try populate the options
+        getCodegenWizard().populateOptions();
+        // update the status
         updateStatus(null);
 
     }
@@ -147,4 +144,6 @@
     public int getPageType() {
         return WSDL_2_JAVA_TYPE;
     }
+    
+    
 }

Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java?rev=368802&r1=368801&r2=368802&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java Fri Jan 13 09:55:38 2006
@@ -38,6 +38,7 @@
      *  
      */
     static final String PREF_OUTPUT_LOCATION = "PREF_OUTPUT_LOCATION";
+    static final String PREF_CHECK_BROWSE_PROJECTS = "PREF_CHECK_BROWSE_PROJECTS";
 
     //Options page constants
     /**
@@ -80,9 +81,9 @@
      */
     static final String PREF_CHECK_GENERATE_SERVERCONFIG = "PREF_CHECK_GENERATE_SERVERCONFIG";
     
-    static final String PREF_TEXT_PORTNAME = "PREF_TEXT_PORTNAME";
+    static final String PREF_COMBO_PORTNAME_INDEX = "PREF_TEXT_PORTNAME";
     
-    static final String PREF_TEXT_SERVICENAME = "PREF_TEXT_SERVICENAME";
+    static final String PREF_COMBO_SERVICENAME_INDEX = "PREF_TEXT_SERVICENAME";
     
     static final String PREF_DATABINDER_INDEX = "PREF_DATABINDER_INDEX";
     

Added: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java?rev=368802&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java (added)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java Fri Jan 13 09:55:38 2006
@@ -0,0 +1,88 @@
+package org.apache.axis2.tool.codegen.eclipse.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.util.URLProcessor;
+
+
+
+/**
+ * This class presents a convenient way of reading the 
+ * WSDL file(url) and producing a useful set of information
+ * It does NOT use any of the standard WSDL classes from 
+ * Axis2, rather it uses wsdl4j to read the wsdl and extract 
+ * the properties (This is meant as a convenience for the UI
+ * only. We may not need the whole conversion the WSDLpump 
+ * goes through)
+ * One would need to change this to suit a proper WSDL 
+ * @author Ajith
+ *
+ */
+public class WSDLPropertyReader {
+    private Definition wsdlDefinition = null;
+    
+	public void readWSDL(String filepath) throws Exception{
+		WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+		wsdlDefinition = reader.readWSDL(filepath); 
+	}
+	
+	//get the default package derived by the targetNamespace
+	
+	public String packageFromTargetNamespace(){
+		return  URLProcessor.makePackageName(wsdlDefinition.getTargetNamespace());
+		
+	}
+	/**
+	 * Returns a list of service names
+	 * the names are QNames
+	 * @return
+	 */
+	public List getServiceList(){
+		List returnList = new ArrayList();
+		Service service = null;
+		Map serviceMap = wsdlDefinition.getServices();
+		if(serviceMap!=null && !serviceMap.isEmpty()){
+		   Iterator serviceIterator = serviceMap.values().iterator();
+		   while(serviceIterator.hasNext()){
+			   service = (Service)serviceIterator.next();
+			   returnList.add(service.getQName());
+		   }
+		}
+		
+		return returnList;
+	}
+
+	/**
+	 * Returns a list of ports for a particular service
+	 * the names are QNames
+	 * @return
+	 */
+	public List getPortNameList(QName serviceName){
+		List returnList = new ArrayList();
+		Service service = wsdlDefinition.getService(serviceName);
+		Port port = null; 
+		if(service!=null){
+		   Map portMap = service.getPorts();
+		   if (portMap!=null && !portMap.isEmpty()){
+			   Iterator portIterator = portMap.values().iterator();
+			   while(portIterator.hasNext()){
+				 port = (Port)portIterator.next();
+				 returnList.add(port.getName());
+			   }
+		   }
+		  
+		}
+		
+		return returnList;
+	}
+}

Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties?rev=368802&r1=368801&r2=368802&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/codegen/resource/Codegen.properties Fri Jan 13 09:55:38 2006
@@ -51,7 +51,9 @@
 page2.databindingCheck.caption=Databinding Name
 page2.serviceName.caption=Service Name
 page2.portName.caption=Port Name
-page2.genAll.caption=Generate all
+page2.genAll.caption=Generate Client code
+page2.wsdlNotFound.message=specified WSDL is not found!
+page2.noports.message=No ports found in the specified service
 ####################################################################### 
 #Output location selection - Page3  
 page3.name=page3
@@ -61,6 +63,7 @@
 page3.output.caption=Output path
 page3.outselection.browse=Browse...
 page3.containerbox.title=Select new file container
+page3.browseWorkspace.title=Browse Workspace projects only
 #errors
 page3.error.nolocation=output location needs to be specified
 #