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 aj...@apache.org on 2005/06/20 05:29:06 UTC

svn commit: r191384 [1/2] - in /webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen: ./ eclipse/ eclipse/plugin/ eclipse/ui/ eclipse/util/ resource/

Author: ajith
Date: Sun Jun 19 20:29:04 2005
New Revision: 191384

URL: http://svn.apache.org/viewcvs?rev=191384&view=rev
Log:
Adding the java2wsdl tool part. This is still the Axis 1.X thing. The existing wizards has also being modified to be better reusable.
However this needs more work!

Added:
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/WSDL2JavaGenerator.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/AbstractWizardPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/ToolSelectionPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/util/SettingsConstants.java
Modified:
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/plugin/CodegenWizardPlugin.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OptionsPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OutputPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/resource/Codegen.properties

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java?rev=191384&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java Sun Jun 19 20:29:04 2005
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.tool.codegen;
+
+import org.apache.axis.utils.ClassUtils;
+import org.apache.axis.wsdl.fromJava.Emitter;
+
+/**
+ * @author Ajith
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class Java2WSDLGenerator {
+
+    public void emit(String classPath, 
+            String implementationClassName,
+            String serviceLocationUrl,
+            String inputWsdlName,
+            String bindingName,
+            String portypeName,
+            String style,
+            String outputFileName,
+            int mode) throws Throwable{
+        try {
+
+            ClassUtils.setDefaultClassLoader(ClassUtils.createClassLoader(
+                    classPath, this.getClass().getClassLoader()));
+
+            // Instantiate the emitter
+            Emitter emitter = new Emitter();
+
+            //implementation class
+            emitter.setCls(implementationClassName);
+
+            //service location
+            if (serviceLocationUrl !=null && !serviceLocationUrl.trim().equals(""))
+                emitter.setLocationUrl(serviceLocationUrl);
+            
+            //input wsdl
+            if (inputWsdlName != null && !inputWsdlName.trim().equals(""))
+                emitter.setInputWSDL(inputWsdlName);
+            
+            //portype name
+            if (portypeName!=null && !portypeName.trim().equals(""))
+                emitter.setPortTypeName(portypeName);
+            
+            //Style
+            if (style!=null && !style.trim().equals(""))
+                emitter.setStyle(style);
+            
+            if (mode!= Emitter.MODE_ALL &&
+                    mode!= Emitter.MODE_IMPLEMENTATION &&
+                    mode!= Emitter.MODE_INTERFACE)
+                mode = Emitter.MODE_ALL; // Default to all in unknown case
+            
+           emitter.emit(outputFileName,mode);
+
+        } catch (Throwable t) {
+            throw t;
+
+        }
+    }
+}

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/WSDL2JavaGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/WSDL2JavaGenerator.java?rev=191384&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/WSDL2JavaGenerator.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/WSDL2JavaGenerator.java Sun Jun 19 20:29:04 2005
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.tool.codegen;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.wsdl.WSDLException;
+
+import org.apache.axis.tool.codegen.eclipse.util.UIConstants;
+import org.apache.axis.wsdl.builder.WOMBuilderFactory;
+import org.apache.axis.wsdl.codegen.CommandLineOption;
+import org.apache.axis.wsdl.codegen.CommandLineOptionConstants;
+import org.apache.wsdl.WSDLDescription;
+
+
+public class WSDL2JavaGenerator {
+    
+    /**
+     * Maps a string containing the name of a language to a constant defined in CommandLineOptionConstants.LanguageNames
+     * 
+     * @param UILangValue a string containg a language, e.g. "java", "cs", "cpp" or "vb"
+     * @return a normalized string constant
+     */
+    private String mapLanguagesWithCombo(String UILangValue)
+    {
+       if (UIConstants.JAVA.equals(UILangValue))
+       {
+          return CommandLineOptionConstants.LanguageNames.JAVA;
+       }
+       else if (UIConstants.C_SHARP.equals(UILangValue))
+       {
+          return CommandLineOptionConstants.LanguageNames.C_SHARP;
+       }
+       else if (UIConstants.C_PLUS_PLUS.equals(UILangValue))
+       {
+          return CommandLineOptionConstants.LanguageNames.C_PLUS_PLUS;
+       }
+       else
+       {
+          return null;
+       }
+    }
+    /**
+     * Creates a list of parameters for the code generator based on the decisions made by the user on the OptionsPage
+     * (page2). For each setting, there is a Command-Line option for the Axis2 code generator.
+     * 
+     * @return a Map with keys from CommandLineOptionConstants with the values entered by the user on the Options Page.
+     */
+    public Map fillOptionMap(boolean isAyncOnly,
+            		  boolean isSyncOnly,
+            		  boolean isServerSide,
+            		  boolean isServerXML,
+            		  boolean isTestCase,
+            		  String WSDLFileName,
+            		  String packageName,
+            		  String selectedLanguage,
+            		  String outputLocation
+            		  )
+    {
+       Map optionMap = new HashMap();
+       //WSDL file name
+       optionMap.put(CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION, new CommandLineOption(
+          CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION, getStringArray(WSDLFileName)));
+       
+       //Async only
+       if (isAyncOnly)
+       {
+          optionMap.put(CommandLineOptionConstants.CODEGEN_ASYNC_ONLY_OPTION, new CommandLineOption(
+             CommandLineOptionConstants.CODEGEN_ASYNC_ONLY_OPTION, new String[0]));
+       }
+       //sync only
+       if (isSyncOnly)
+       {
+          optionMap.put(CommandLineOptionConstants.CODEGEN_SYNC_ONLY_OPTION, new CommandLineOption(
+             CommandLineOptionConstants.CODEGEN_SYNC_ONLY_OPTION, new String[0]));
+       }
+       //serverside
+       if (isServerSide)
+       {
+          optionMap.put(CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION, new CommandLineOption(
+             CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION, new String[0]));
+          //server xml
+          if (isServerXML)
+          {
+             optionMap.put(CommandLineOptionConstants.GENERATE_SERVICE_DESCRIPTION_OPTION, new CommandLineOption(
+                CommandLineOptionConstants.GENERATE_SERVICE_DESCRIPTION_OPTION, new String[0]));
+          }
+       }
+       //test case
+       if (isTestCase)
+       {
+          optionMap.put(CommandLineOptionConstants.GENERATE_TEST_CASE_OPTION, new CommandLineOption(
+             CommandLineOptionConstants.GENERATE_TEST_CASE_OPTION, new String[0]));
+       }
+       //package name
+       optionMap.put(CommandLineOptionConstants.PACKAGE_OPTION, new CommandLineOption(
+          CommandLineOptionConstants.PACKAGE_OPTION, getStringArray(packageName)));
+       //selected language
+       optionMap.put(CommandLineOptionConstants.STUB_LANGUAGE_OPTION, new CommandLineOption(
+          CommandLineOptionConstants.STUB_LANGUAGE_OPTION, getStringArray(mapLanguagesWithCombo(selectedLanguage))));
+       //output location
+       optionMap.put(CommandLineOptionConstants.OUTPUT_LOCATION_OPTION, new CommandLineOption(
+          CommandLineOptionConstants.OUTPUT_LOCATION_OPTION, getStringArray(outputLocation)));
+       
+       // System.out.println(page3.getOutputLocation());
+       return optionMap;
+    }
+    /**
+     * Reads the WSDL Object Model from the given location.
+     * 
+     * @param wsdlLocation the filesystem location (full path) of the WSDL file to read in.
+     * @return the WSDLDescription object containing the WSDL Object Model of the given WSDL file
+     * @throws WSDLException when WSDL File is invalid
+     * @throws IOException on errors reading the WSDL file
+     */
+    public WSDLDescription getWOM(String wsdlLocation) throws WSDLException, IOException
+    {
+       InputStream in = new FileInputStream(new File(wsdlLocation));
+       return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in);
+    }
+
+    /**
+     * Converts a single String into a String Array
+     * 
+     * @param value a single string
+     * @return an array containing only one element
+     */
+    private String[] getStringArray(String value)
+    {
+       String[] values = new String[1];
+       values[0] = value;
+       return values;
+    }
+}

Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java?rev=191384&r1=191383&r2=191384&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java Sun Jun 19 20:29:04 2005
@@ -1,32 +1,30 @@
 
 package org.apache.axis.tool.codegen.eclipse;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
 import java.util.Map;
 
-import javax.wsdl.WSDLException;
-
+import org.apache.axis.tool.codegen.Java2WSDLGenerator;
+import org.apache.axis.tool.codegen.WSDL2JavaGenerator;
+import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.apache.axis.tool.codegen.eclipse.ui.AbstractWizardPage;
+import org.apache.axis.tool.codegen.eclipse.ui.JavaSourceSelectionPage;
+import org.apache.axis.tool.codegen.eclipse.ui.JavaWSDLOptionsPage;
+import org.apache.axis.tool.codegen.eclipse.ui.JavaWSDLOutputLocationPage;
 import org.apache.axis.tool.codegen.eclipse.ui.OptionsPage;
 import org.apache.axis.tool.codegen.eclipse.ui.OutputPage;
+import org.apache.axis.tool.codegen.eclipse.ui.ToolSelectionPage;
 import org.apache.axis.tool.codegen.eclipse.ui.WSDLFileSelectionPage;
-import org.apache.axis.tool.codegen.eclipse.util.UIConstants;
-import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
-import org.apache.axis.wsdl.builder.WOMBuilderFactory;
+import org.apache.axis.tool.codegen.eclipse.util.SettingsConstants;
 import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis.wsdl.codegen.CodeGenerationEngine;
-import org.apache.axis.wsdl.codegen.CommandLineOption;
-import org.apache.axis.wsdl.codegen.CommandLineOptionConstants;
 import org.apache.wsdl.WSDLDescription;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.ui.INewWizard;
 import org.eclipse.ui.IWorkbench;
@@ -39,14 +37,16 @@
 
 public class CodeGenWizard extends Wizard implements INewWizard
 {
-   private WSDLFileSelectionPage page1;
-
-   private OptionsPage page2;
-
-   private OutputPage page3;
-
+   private ToolSelectionPage toolSelectionPage;  
+   private WSDLFileSelectionPage wsdlSelectionPage;
+   private OptionsPage optionsPage;
+   private OutputPage outputPage;
+   private JavaWSDLOptionsPage java2wsdlOptionsPage;
+   private JavaSourceSelectionPage javaSourceSelectionPage;
+   private JavaWSDLOutputLocationPage java2wsdlOutputLocationPage;
+   
+   private int selectedWizardType=SettingsConstants.WSDL_2_JAVA_TYPE;//TODO change this
    private ISelection selection;
-
    private boolean canFinish = false;
 
    /**
@@ -66,15 +66,59 @@
 
    public void addPages()
    {
-      page1 = new WSDLFileSelectionPage(selection);
-      addPage(page1);
-      page2 = new OptionsPage();
-      addPage(page2);
-      page3 = new OutputPage();
-      addPage(page3);
+      toolSelectionPage = new ToolSelectionPage();
+      addPage(toolSelectionPage);
+      
+      //add the wsdl2java wizard pages
+      wsdlSelectionPage = new WSDLFileSelectionPage();
+      addPage(wsdlSelectionPage);
+      optionsPage = new OptionsPage();
+      addPage(optionsPage);
+      outputPage = new OutputPage();
+      addPage(outputPage);
+      
+      //add java2wsdl wizard pages
+      javaSourceSelectionPage = new JavaSourceSelectionPage();
+      addPage(javaSourceSelectionPage);
+      java2wsdlOptionsPage = new JavaWSDLOptionsPage();
+      addPage(java2wsdlOptionsPage);
+      java2wsdlOutputLocationPage = new JavaWSDLOutputLocationPage();
+      addPage(java2wsdlOutputLocationPage);
+      
+
+      
 
    }
 
+   
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.wizard.IWizard#canFinish()
+     */
+    public boolean canFinish() {
+       IWizardPage[] pages = getPages();
+       AbstractWizardPage wizardPage = null;
+		for (int i = 0; i < pages.length; i++) {
+		    wizardPage = (AbstractWizardPage)pages[i];
+		    if (wizardPage.getPageType()==this.selectedWizardType){
+		        if (!(wizardPage.isPageComplete()))
+		            return false;
+		    	}
+		}
+		return true;
+    }
+   public IWizardPage getNextPage(IWizardPage page) {
+       AbstractWizardPage currentPage=(AbstractWizardPage)page;
+       AbstractWizardPage pageout = (AbstractWizardPage)super.getNextPage(page);
+       
+       while (pageout!=null && selectedWizardType!=pageout.getPageType()){
+           AbstractWizardPage temp = pageout;
+           pageout = (AbstractWizardPage)super.getNextPage(currentPage);
+           currentPage = temp;
+           
+       }
+       return pageout;
+    }
+  
    /**
     * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using
     * wizard as execution context.
@@ -83,12 +127,15 @@
    {
       try
       {
-         // getContainer().run(true, false, op);
-         doFinish();
+        switch (selectedWizardType){
+         case SettingsConstants.WSDL_2_JAVA_TYPE:doFinishWSDL2Java();break;
+         case SettingsConstants.JAVA_2_WSDL_TYPE:doFinishJava2WSDL();break;
+         case SettingsConstants.UNSPECIFIED_TYPE:break; //Do nothing
+         default:throw new RuntimeException("Invalid state!");
+        }
       }
       catch (Exception e)
       {
-         e.printStackTrace();
          MessageDialog.openError(getShell(), CodegenWizardPlugin.getResourceString("general.Error"), e.getMessage());
          return false;
       }
@@ -100,7 +147,7 @@
    /**
     * The worker method, generates the code itself.
     */
-   private void doFinish()
+   private void doFinishWSDL2Java()
    {
 
       WorkspaceModifyOperation op = new WorkspaceModifyOperation()
@@ -124,12 +171,23 @@
                 * or give a (custom) progress monitor to the generate() method, so
                 * we will be informed by Axis2 about the progress of code generation.  
                 */
+               WSDL2JavaGenerator generator = new WSDL2JavaGenerator(); 
                monitor.subTask(CodegenWizardPlugin.getResourceString("generator.readingWOM"));
-               WSDLDescription wom = getWOM(page1.getFileName());
+               WSDLDescription wom = generator.getWOM(wsdlSelectionPage.getFileName());
                monitor.worked(1);
-               Map optionsMap = fillOptionMap();
+               
+               Map optionsMap = generator.fillOptionMap(optionsPage.isAsyncOnlyOn(),
+                       									optionsPage.isSyncOnlyOn(),
+                       									optionsPage.isServerside(),
+                       									optionsPage.isServerXML(),
+                       									optionsPage.isGenerateTestCase(),
+                       									wsdlSelectionPage.getFileName(),
+                       									optionsPage.getPackageName(),
+                       									optionsPage.getSelectedLanguage(),
+                       									outputPage.getOutputLocation());
                CodeGenConfiguration codegenConfig = new CodeGenConfiguration(wom, optionsMap);
                monitor.worked(1);
+               
                monitor.subTask(CodegenWizardPlugin.getResourceString("generator.generating"));
                new CodeGenerationEngine(codegenConfig).generate();
                monitor.worked(1);
@@ -154,96 +212,78 @@
       }
       catch (InvocationTargetException e1)
       {
-         e1.printStackTrace();
+          throw new RuntimeException(e1);
       }
       catch (InterruptedException e1)
       {
-         /*
-          * Thrown when the user aborts the progress
-          */
-         e1.printStackTrace();
+         throw new RuntimeException("User Aborted!");
       }
       catch (Exception e)
       {
          throw new RuntimeException(e);
       }
    }
-
-   /**
-    * Creates a list of parameters for the code generator based on the decisions made by the user on the OptionsPage
-    * (page2). For each setting, there is a Command-Line option for the Axis2 code generator.
-    * 
-    * @return a Map with keys from CommandLineOptionConstants with the values entered by the user on the Options Page.
-    */
-   private Map fillOptionMap()
-   {
-      Map optionMap = new HashMap();
-
-      optionMap.put(CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION, new CommandLineOption(
-         CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION, getStringArray(page1.getFileName())));
-
-      if (page2.isAsyncOnlyOn())
-      {
-         optionMap.put(CommandLineOptionConstants.CODEGEN_ASYNC_ONLY_OPTION, new CommandLineOption(
-            CommandLineOptionConstants.CODEGEN_ASYNC_ONLY_OPTION, new String[0]));
-      }
-      if (page2.isSyncOnlyOn())
-      {
-         optionMap.put(CommandLineOptionConstants.CODEGEN_SYNC_ONLY_OPTION, new CommandLineOption(
-            CommandLineOptionConstants.CODEGEN_SYNC_ONLY_OPTION, new String[0]));
-      }
-      optionMap.put(CommandLineOptionConstants.PACKAGE_OPTION, new CommandLineOption(
-         CommandLineOptionConstants.PACKAGE_OPTION, getStringArray(page2.getPackageName())));
-      optionMap.put(CommandLineOptionConstants.STUB_LANGUAGE_OPTION, new CommandLineOption(
-         CommandLineOptionConstants.STUB_LANGUAGE_OPTION, getStringArray(mapLanguagesWithCombo(page2
-            .getSelectedLanguage()))));
-      optionMap.put(CommandLineOptionConstants.OUTPUT_LOCATION_OPTION, new CommandLineOption(
-         CommandLineOptionConstants.OUTPUT_LOCATION_OPTION, getStringArray(page3.getOutputLocation())));
-      if (page2.isServerside())
-      {
-         optionMap.put(CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION, new CommandLineOption(
-            CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION, new String[0]));
-
-         if (page2.isServerXML())
-         {
-            optionMap.put(CommandLineOptionConstants.GENERATE_SERVICE_DESCRIPTION_OPTION, new CommandLineOption(
-               CommandLineOptionConstants.GENERATE_SERVICE_DESCRIPTION_OPTION, new String[0]));
-         }
-      }
-      if (page2.isGenerateTestCase())
-      {
-         optionMap.put(CommandLineOptionConstants.GENERATE_TEST_CASE_OPTION, new CommandLineOption(
-            CommandLineOptionConstants.GENERATE_TEST_CASE_OPTION, new String[0]));
-      }
-      // System.out.println(page3.getOutputLocation());
-      return optionMap;
+   
+   private void doFinishJava2WSDL() throws Exception{
+           
+           WorkspaceModifyOperation op = new WorkspaceModifyOperation()
+           {
+              protected void execute(IProgressMonitor monitor)
+              {
+                 if (monitor == null)
+                    monitor = new NullProgressMonitor();
+
+                 /*
+                  * "2" is the total amount of steps, see below monitor.worked(amount)
+                  */
+                 monitor.beginTask(CodegenWizardPlugin.getResourceString("generator.generating"), 2);
+
+                 try
+                 {
+                     monitor.worked(1);
+                     
+                     new Java2WSDLGenerator().emit(
+                             javaSourceSelectionPage.getClassLocation(),
+                             javaSourceSelectionPage.getClassName(),
+                             java2wsdlOptionsPage.getLocationURL(),
+                             java2wsdlOptionsPage.getInputWSDLName(),
+                             java2wsdlOptionsPage.getBindingName(),
+                             java2wsdlOptionsPage.getPortypeName(),
+                             java2wsdlOptionsPage.getStyle(),
+                             java2wsdlOutputLocationPage.getFullFileName(),
+                             java2wsdlOptionsPage.getMode()
+                     );
+                     monitor.worked(1);
+                 }
+                 catch (Throwable e)
+                 {
+                    throw new RuntimeException(e);
+                 }
+
+                 monitor.done();
+              }
+           };
+         
+           try
+           {
+              getContainer().run(false, true, op);
+           }
+           catch (InvocationTargetException e1)
+           {
+               throw new RuntimeException(e1);
+           }
+           catch (InterruptedException e1)
+           {
+              throw new RuntimeException("User Aborted!");
+           }
+           catch (Exception e)
+           {
+              throw new RuntimeException(e);
+           } 
+   
    }
 
-   /**
-    * Maps a string containing the name of a language to a constant defined in CommandLineOptionConstants.LanguageNames
-    * 
-    * @param UILangValue a string containg a language, e.g. "java", "cs", "cpp" or "vb"
-    * @return a normalized string constant
-    */
-   private String mapLanguagesWithCombo(String UILangValue)
-   {
-      if (UIConstants.JAVA.equals(UILangValue))
-      {
-         return CommandLineOptionConstants.LanguageNames.JAVA;
-      }
-      else if (UIConstants.C_SHARP.equals(UILangValue))
-      {
-         return CommandLineOptionConstants.LanguageNames.C_SHARP;
-      }
-      else if (UIConstants.C_PLUS_PLUS.equals(UILangValue))
-      {
-         return CommandLineOptionConstants.LanguageNames.C_PLUS_PLUS;
-      }
-      else
-      {
-         return null;
-      }
-   }
+  
 
    /**
     * We will accept the selection in the workbench to see if we can initialize from it.
@@ -255,30 +295,19 @@
       this.selection = selection;
    }
 
-   /**
-    * Reads the WSDL Object Model from the given location.
-    * 
-    * @param wsdlLocation the filesystem location (full path) of the WSDL file to read in.
-    * @return the WSDLDescription object containing the WSDL Object Model of the given WSDL file
-    * @throws WSDLException when WSDL File is invalid
-    * @throws IOException on errors reading the WSDL file
-    */
-   private WSDLDescription getWOM(String wsdlLocation) throws WSDLException, IOException
-   {
-      InputStream in = new FileInputStream(new File(wsdlLocation));
-      return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in);
-   }
-
-   /**
-    * Converts a single String into a String Array
-    * 
-    * @param value a single string
-    * @return an array containing only one element
-    */
-   private String[] getStringArray(String value)
-   {
-      String[] values = new String[1];
-      values[0] = value;
-      return values;
-   }
+   
+   
+   
+/**
+ * @return Returns the selectedWizardType.
+ */
+public int getSelectedWizardType() {
+    return selectedWizardType;
+}
+/**
+ * @param selectedWizardType The selectedWizardType to set.
+ */
+public void setSelectedWizardType(int selectedWizardType) {
+    this.selectedWizardType = selectedWizardType;
+}
 }

Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/plugin/CodegenWizardPlugin.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/plugin/CodegenWizardPlugin.java?rev=191384&r1=191383&r2=191384&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/plugin/CodegenWizardPlugin.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/plugin/CodegenWizardPlugin.java Sun Jun 19 20:29:04 2005
@@ -1,9 +1,11 @@
 package org.apache.axis.tool.codegen.eclipse.plugin;
 
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
 import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.*;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
-import java.util.*;
 
 /**
  * The main plugin class to be used in the desktop.

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/AbstractWizardPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/AbstractWizardPage.java?rev=191384&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/AbstractWizardPage.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/AbstractWizardPage.java Sun Jun 19 20:29:04 2005
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.tool.codegen.eclipse.ui;
+
+import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.apache.axis.tool.codegen.eclipse.util.SettingsConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.wizard.WizardPage;
+
+public abstract class AbstractWizardPage extends WizardPage implements SettingsConstants {
+    
+    protected IDialogSettings settings;
+    protected boolean restoredFromPreviousSettings = false;
+    
+    public AbstractWizardPage(String pageName){
+        super(pageName+".name");
+        init(pageName);
+    }
+    
+    protected void init(String pageName){
+        setTitle(CodegenWizardPlugin.getResourceString(pageName+".title"));
+        setDescription(CodegenWizardPlugin.getResourceString(pageName+".desc"));
+        setImageDescriptor(CodegenWizardPlugin.getWizardImageDescriptor());
+        
+        /*
+         * Get the settings for this page. If there is no section in the
+         * Plugin's settings for this OptionsPage, create a new section
+         */
+        IDialogSettings rootSettings = CodegenWizardPlugin.getDefault()
+                .getDialogSettings();
+        IDialogSettings section = rootSettings.getSection(this.getClass()
+                .getName());
+        if (section == null) {
+            settings = rootSettings.addNewSection(this.getClass().getName());
+            restoredFromPreviousSettings = false;
+            initializeDefaultSettings();
+        } else {
+            restoredFromPreviousSettings=true;
+            settings = section;
+        }
+    }
+
+    protected void updateStatus(String message) {
+        setErrorMessage(message);
+        setPageComplete(message == null);
+    }
+
+    protected abstract void initializeDefaultSettings(); 
+   
+    public abstract int getPageType() ;
+}

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java?rev=191384&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java Sun Jun 19 20:29:04 2005
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.axis.tool.codegen.eclipse.ui;
+
+import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class JavaSourceSelectionPage extends AbstractWizardPage{
+
+   
+    private Text javaClassFileLocationBox;
+    private Text javaClassNameBox;
+
+
+    public JavaSourceSelectionPage() {  
+        super("page4");
+    }
+
+    protected void initializeDefaultSettings() {
+        settings.put(JAVA_CLASS_NAME, "");
+        settings.put(JAVA_CLASS_LOCATION_NAME, "");
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+     */
+    public int getPageType() {
+        return JAVA_2_WSDL_TYPE;
+    }
+
+    /*
+     * (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(CodegenWizardPlugin
+                .getResourceString("page4.javafilelocation.label"));
+
+        javaClassFileLocationBox = new Text(container, SWT.BORDER);
+        javaClassFileLocationBox.setLayoutData(gd);
+        javaClassFileLocationBox.setText(settings.get(JAVA_CLASS_LOCATION_NAME));
+        javaClassFileLocationBox.addModifyListener(new ModifyListener(){
+            public void modifyText(ModifyEvent e){
+               handleLocationTextChange(); 
+            }
+        });
+        
+
+        Button browseButton = new Button(container, SWT.PUSH);
+        browseButton.setText(CodegenWizardPlugin
+                .getResourceString("general.browse"));
+        browseButton.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                handleDirectoryBrowse();
+            }
+        });
+        
+        label = new Label(container, SWT.NULL);
+        label.setText(CodegenWizardPlugin
+                .getResourceString("page4.classname.label"));
+        
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        javaClassNameBox = new Text(container,SWT.BORDER);
+        javaClassNameBox.setLayoutData(gd);
+        javaClassNameBox.setText(settings.get(JAVA_CLASS_NAME));
+        javaClassNameBox.addModifyListener(new ModifyListener(){
+            public void modifyText(ModifyEvent e){
+                handleClassNameTextChange();
+             }
+         });
+        
+        Button searchButton = new Button(container, SWT.PUSH);
+        searchButton.setText(CodegenWizardPlugin
+                .getResourceString("general.search"));
+        searchButton.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                //handleDirectoryBrowse();
+            }
+        });
+        searchButton.setEnabled(false);
+        
+        setPageComplete(false);
+        
+        if (restoredFromPreviousSettings){
+            handleLocationTextChange();
+            handleClassNameTextChange();
+        }
+        
+        setControl(container);
+
+    }
+
+    /**
+     * Pops up the file browse dialog box
+     *  
+     */
+    private void handleDirectoryBrowse() {
+        DirectoryDialog fileDialog = new DirectoryDialog(this.getShell());
+        String dirName = fileDialog.open();
+        if (dirName != null) {
+            javaClassFileLocationBox.setText(dirName);
+        }
+
+    }
+    
+    private void handleLocationTextChange(){
+        String locationText = javaClassFileLocationBox.getText();
+        settings.put(JAVA_CLASS_LOCATION_NAME,locationText);
+        if (locationText==null || "".equals(locationText.trim())){
+            updateStatus("Class file location needs to be specified!");
+        }else{
+            updateStatus(null);
+        }
+    }
+    
+    private void handleClassNameTextChange(){
+        String className = javaClassNameBox.getText();
+        settings.put(JAVA_CLASS_NAME,className);
+        if (className==null || "".equals(className.trim())){
+            updateStatus("Fully qualified class name needs to be specified!");
+        }else if(className.endsWith(".")){
+            updateStatus("Class name is not properly terminated!");
+        }else{
+            updateStatus(null);
+        }
+    }
+    
+    public String getClassName(){
+        return javaClassNameBox.getText();
+    }
+    
+    public String getClassLocation(){
+        return javaClassFileLocationBox.getText();
+    }
+}

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java?rev=191384&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java Sun Jun 19 20:29:04 2005
@@ -0,0 +1,272 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.tool.codegen.eclipse.ui;
+
+import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.apache.axis.wsdl.fromJava.Emitter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * -I, --input <argument>input WSDL filename -o, --output <argument>output
+ * WSDL filename -l, --location <argument>service location url -P,
+ * --portTypeName <argument>portType name (obtained from class-of-portType if
+ * not specif ied) -b, --bindingName <argument>binding name (--servicePortName
+ * value + "SOAPBinding" if not specified) -S, --serviceElementName <argument>
+ * service element name (defaults to --servicePortName value + "Service") -s,
+ * --servicePortName <argument>service port name (obtained from --location if
+ * not specified ) -n, --namespace <argument>target namespace -p, --PkgtoNS
+ * <argument>= <value>package=namespace, name value pairs -m, --methods
+ * <argument>space or comma separated list of methods to export -a, --all look
+ * for allowed methods in inherited class -w, --outputWsdlMode <argument>output
+ * WSDL mode: All, Interface, Implementation -L, --locationImport <argument>
+ * location of interface wsdl -N, --namespaceImpl <argument>target namespace
+ * for implementation wsdl -O, --outputImpl <argument>output Implementation
+ * WSDL filename, setting this causes --o utputWsdlMode to be ignored -i,
+ * --implClass <argument>optional class that contains implementation of methods
+ * in cl ass-of-portType. The debug information in the class is used to obtain
+ * the method parameter names, which are used to set the WSDL part names. -x,
+ * --exclude <argument>space or comma separated list of methods not to export
+ * -c, --stopClasses <argument>space or comma separated list of class names
+ * which will stop inheritance search if --all switch is given -T,
+ * --typeMappingVersion <argument>indicate 1.1 or 1.2. The default is 1.1 (SOAP
+ * 1.1 JAX-RPC c ompliant 1.2 indicates SOAP 1.1 encoded.) -A, --soapAction
+ * <argument>value of the operation's soapAction field. Values are DEFAUL T,
+ * OPERATION or NONE. OPERATION forces soapAction to the nam e of the operation.
+ * DEFAULT causes the soapAction to be set according to the operation's meta
+ * data (usually ""). NONE forces the soapAction to "". The default is DEFAULT.
+ * -y, --style <argument>The style of binding in the WSDL, either DOCUMENT,
+ * RPC, or W RAPPED. -u, --use <argument>The use of items in the binding,
+ * either LITERAL or ENCODED -e, --extraClasses <argument>A space or comma
+ * separated list of class names to be added t o the type section. -C,
+ * --importSchema A file or URL to an XML Schema that should be physically imp
+ * orted into the generated WSDL -X, --classpath additional classpath elements
+ */
+public class JavaWSDLOptionsPage extends AbstractWizardPage {
+
+    private Text inputWSDLNameTextBox;
+
+    private Text serviceLocationURLTextBox;
+
+    private Text portTypeNameTextBox;
+
+    private Text bindingTextBox;
+
+    private Combo modeSelectionCombo;
+    
+    private Combo styleSelectionCombo;
+
+    //TODO need more here
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axis.tool.codegen.eclipse.ui.AbstractWizardPage#initializeDefaultSettings()
+     */
+    protected void initializeDefaultSettings() {
+       settings.put(PREF_JAVA_INPUT_WSDL_NAME,"");
+       settings.put(PREF_JAVA_LOCATION,"http://localhost:8080");
+       settings.put(PREF_JAVA_BINDING_NAME,"");
+       settings.put(PREF_JAVA_PORTYPE_NAME,"");
+       settings.put(PREF_JAVA_MODE_INDEX,0);
+       settings.put(PREF_JAVA_STYLE_INDEX,0);
+    }
+
+    /**
+     * @param pageName
+     */
+    public JavaWSDLOptionsPage() {
+        super("page5");
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+     */
+    public int getPageType() {
+        return JAVA_2_WSDL_TYPE;
+    }
+
+    /*
+     * (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 = 2;
+        layout.verticalSpacing = 9;
+
+        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+        Label label = new Label(container, SWT.NULL);
+        label.setText(CodegenWizardPlugin
+                .getResourceString("page5.inputwsdl.label"));
+
+        inputWSDLNameTextBox = new Text(container, SWT.BORDER | SWT.SINGLE);
+        inputWSDLNameTextBox.setLayoutData(gd);
+        inputWSDLNameTextBox.setText(settings.get(PREF_JAVA_INPUT_WSDL_NAME));
+        inputWSDLNameTextBox.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                settings.put(PREF_JAVA_INPUT_WSDL_NAME, inputWSDLNameTextBox.getText());
+                //dialogChanged();
+            }
+        });
+
+        label = new Label(container, SWT.NULL);
+        label.setText(CodegenWizardPlugin
+                .getResourceString("page5.servicelocation.label"));
+
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        serviceLocationURLTextBox = new Text(container, SWT.BORDER);
+        serviceLocationURLTextBox.setLayoutData(gd);
+        serviceLocationURLTextBox.setText(settings.get(PREF_JAVA_LOCATION));
+        serviceLocationURLTextBox.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                settings.put(PREF_JAVA_LOCATION, serviceLocationURLTextBox.getText());
+                //dialogChanged();
+            }
+        });
+        
+        label = new Label(container, SWT.NULL);
+        label.setText(CodegenWizardPlugin
+                .getResourceString("page5.binding.label"));
+
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        bindingTextBox = new Text(container, SWT.BORDER);
+        bindingTextBox.setLayoutData(gd);
+        bindingTextBox.setText(settings.get(PREF_JAVA_BINDING_NAME));
+        bindingTextBox.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                settings.put(PREF_JAVA_BINDING_NAME, bindingTextBox.getText());
+                //dialogChanged();
+            }
+        });
+        
+        label = new Label(container, SWT.NULL);
+        label.setText(CodegenWizardPlugin
+                .getResourceString("page5.porttype.label"));
+
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        portTypeNameTextBox = new Text(container, SWT.BORDER);
+        portTypeNameTextBox.setLayoutData(gd);
+        portTypeNameTextBox.setText(settings.get(PREF_JAVA_PORTYPE_NAME));
+        portTypeNameTextBox.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                settings.put(PREF_JAVA_PORTYPE_NAME, portTypeNameTextBox.getText());
+                //dialogChanged();
+            }
+        });
+
+        // #####################################################
+        label = new Label(container, SWT.NULL);
+        label
+                .setText(CodegenWizardPlugin
+                        .getResourceString("page5.mode.label"));
+
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        modeSelectionCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
+        modeSelectionCombo.setLayoutData(gd);
+       // modeSelectionCombo.
+        populateModeCombo();
+        modeSelectionCombo.addSelectionListener(new SelectionListener(){
+            public void widgetSelected(SelectionEvent e){
+                settings.put(PREF_JAVA_MODE_INDEX,modeSelectionCombo.getSelectionIndex());
+            }
+            public void widgetDefaultSelected(SelectionEvent e){}
+        });
+        
+        // #####################################################
+        label = new Label(container, SWT.NULL);
+        label
+                .setText(CodegenWizardPlugin
+                        .getResourceString("page5.style.label"));
+
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        styleSelectionCombo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
+        styleSelectionCombo.setLayoutData(gd);
+        populateStyleCombo();
+        styleSelectionCombo.addSelectionListener(new SelectionListener(){
+            public void widgetSelected(SelectionEvent e){
+                settings.put(PREF_JAVA_STYLE_INDEX,styleSelectionCombo.getSelectionIndex());
+            }
+            public void widgetDefaultSelected(SelectionEvent e){}
+        });
+        
+        
+        setControl(container);
+
+    }
+
+    private void populateModeCombo() {
+        modeSelectionCombo.add(WSDL_ALL);
+        modeSelectionCombo.add(WSDL_INTERFACE_ONLY);
+        modeSelectionCombo.add(WSDL_IMPLEMENTATION_ONLY);
+
+        modeSelectionCombo.select(settings.getInt(PREF_JAVA_MODE_INDEX));
+    }
+
+    private void populateStyleCombo() {
+        styleSelectionCombo.add(WSDL_STYLE_DOCUMENT);
+        styleSelectionCombo.add(WSDL_STYLE_RPC);
+        styleSelectionCombo.add(WSDL_STYLE_WRAPPED);
+
+        styleSelectionCombo.select(settings.getInt(PREF_JAVA_STYLE_INDEX));
+    }
+    public int getMode(){
+        String selectedOption = modeSelectionCombo.getItem(modeSelectionCombo.getSelectionIndex());
+        if (WSDL_ALL.equals(selectedOption)){
+            return Emitter.MODE_ALL;
+        }else if (WSDL_INTERFACE_ONLY.equals(selectedOption)){
+            return Emitter.MODE_INTERFACE;
+        }else if (WSDL_IMPLEMENTATION_ONLY.equals(selectedOption)){
+            return Emitter.MODE_IMPLEMENTATION;
+        }else{
+            throw new RuntimeException("Unknown Exception");
+        }
+    }
+    
+    public String getStyle(){
+        return this.styleSelectionCombo.getItem(styleSelectionCombo.getSelectionIndex()).toUpperCase();
+    }
+    public String getLocationURL() {
+        return this.serviceLocationURLTextBox.getText();
+    }
+
+    public String getInputWSDLName() {
+        return this.inputWSDLNameTextBox.getText();
+    }
+
+    public String getPortypeName() {
+        return this.portTypeNameTextBox.getText();
+    }
+
+    public String getBindingName() {
+        return this.bindingTextBox.getText();
+    }
+}

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java?rev=191384&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java Sun Jun 19 20:29:04 2005
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.tool.codegen.eclipse.ui;
+
+import java.io.File;
+
+import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Ajith
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class JavaWSDLOutputLocationPage extends AbstractWizardPage {
+    
+    private Text outputFolderTextBox;
+    private Text outputFileNameTextBox;
+
+    /**
+     * @param pageName
+     */
+    public JavaWSDLOutputLocationPage() {
+        super("page6");
+    }
+    /* (non-Javadoc)
+     * @see org.apache.axis.tool.codegen.eclipse.ui.AbstractWizardPage#initializeDefaultSettings()
+     */
+    protected void initializeDefaultSettings() {
+        settings.put(PREF_JAVA_OUTPUT_WSDL_LOCATION,System.getProperty("user.dir"));
+        settings.put(JAVA_OUTPUT_WSDL_NAME,"service.wsdl");
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.axis.tool.codegen.eclipse.ui.AbstractWizardPage#getPageType()
+     */
+    public int getPageType() {
+         return JAVA_2_WSDL_TYPE;
+    }
+
+    /* (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(CodegenWizardPlugin
+                .getResourceString("page6.output.label"));
+
+        outputFolderTextBox = new Text(container,SWT.BORDER);
+        outputFolderTextBox.setLayoutData(gd);
+        outputFolderTextBox.setText(settings.get(PREF_JAVA_OUTPUT_WSDL_LOCATION));
+        outputFolderTextBox.addModifyListener(new ModifyListener(){
+            public void modifyText(ModifyEvent e){
+                handleFolderTextChange();
+            }
+        });
+        
+        Button  browseButton = new Button(container,SWT.PUSH);
+        browseButton.setText(CodegenWizardPlugin
+                .getResourceString("general.browse"));
+        browseButton.addSelectionListener(new SelectionListener(){
+            public void widgetSelected(SelectionEvent e){
+               handleBrowse(); 
+            }
+            public void widgetDefaultSelected(SelectionEvent e){}
+        });
+        
+        label = new Label(container, SWT.NULL);
+        label.setText(CodegenWizardPlugin
+                .getResourceString("page6.outputname.label"));
+        
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        outputFileNameTextBox = new Text(container,SWT.BORDER);
+        outputFileNameTextBox.setLayoutData(gd);
+        outputFileNameTextBox.setText(settings.get(JAVA_OUTPUT_WSDL_NAME));
+        outputFileNameTextBox.addModifyListener(new ModifyListener(){
+            public void modifyText(ModifyEvent e){
+               handleFileNameTextChange();
+            }
+        });
+        
+        if(restoredFromPreviousSettings){
+            handleFolderTextChange();
+            handleFolderTextChange();
+        }
+        
+        setControl(container);
+
+    }
+    
+    private void handleFolderTextChange(){
+        String outputFolder = outputFolderTextBox.getText();
+        settings.put(PREF_JAVA_OUTPUT_WSDL_LOCATION,outputFolder);
+        if ("".equals(outputFolder.trim())){
+            updateStatus("Input a proper location for the output");
+        }else{
+            updateStatus(null);
+        }
+    }
+    
+    private void handleFileNameTextChange(){
+        String outFileName = outputFileNameTextBox .getText();
+        settings.put(JAVA_OUTPUT_WSDL_NAME,outFileName);
+        if ("".equals(outFileName.trim())){
+            updateStatus("Input a file name");
+        }else if (outFileName.matches("\\W")){
+            updateStatus("Input a valid file name");
+        }else{
+            updateStatus(null); 
+        }
+    }
+    
+    private void handleBrowse(){
+        DirectoryDialog fileDialog = new DirectoryDialog(this.getShell());
+        String dirName = fileDialog.open();
+        if (dirName != null) {
+            outputFolderTextBox.setText(dirName);
+        }
+
+    }
+    
+    public String getFullFileName(){
+        String folder =this.outputFolderTextBox.getText();
+        String fileName = this.outputFileNameTextBox.getText();
+        if (!fileName.endsWith(".wsdl")){
+            fileName = fileName + ".wsdl";
+        }
+        return folder + File.separator +fileName;
+    }
+    
+    public String getOutputWSDLName(){
+        return this.outputFileNameTextBox.getText();
+    }
+    
+    public String getOutputLocation(){
+        return this.outputFolderTextBox.getText();
+    }
+
+}

Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OptionsPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OptionsPage.java?rev=191384&r1=191383&r2=191384&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OptionsPage.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OptionsPage.java Sun Jun 19 20:29:04 2005
@@ -16,8 +16,6 @@
 import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
 import org.apache.axis.tool.codegen.eclipse.util.UIConstants;
 import org.apache.axis.wsdl.util.URLProcessor;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -36,48 +34,9 @@
  * CodeGenWizard.
  * 
  */
-public class OptionsPage extends WizardPage implements UIConstants
+public class OptionsPage extends AbstractWizardPage implements UIConstants
 {
-   /**
-    * Position in the combox for choosing the target programming language. Default is 0
-    */
-   private static final String PREF_LANGUAGE_INDEX = "PREF_LANGUAGE_INDEX";
-
-   /**
-    * Three radio buttons: Generate Code for Sync calls, Async and Both. Both is default.
-    */
-   private static final String PREF_RADIO_SYNC_AND_ASYNC = "PREF_RADIO_SYNC_AND_ASYNC";
-
-   /**
-    * Three radio buttons: Generate Code for Sync calls, Async and Both. Both is default.
-    */
-   private static final String PREF_RADIO_SYNC_ONLY = "PREF_RADIO_SYNC_ONLY";
-
-   /**
-    * Three radio buttons: Generate Code for Sync calls, Async and Both. Both is default.
-    */
-   private static final String PREF_RADIO_ASYNC_ONLY = "PREF_RADIO_ASYNC_ONLY";
-
-   /**
-    * Specifies the full qualified package name for the generated source code.
-    */
-   private static final String PREF_PACKAGE_NAME = "PREF_PACKAGE_NAME";
-
-   /**
-    * A boolean value whether JUnit test classes are generated or not.
-    */
-   private static final String PREF_CHECK_GENERATE_TESTCASE = "PREF_CHECK_GENERATE_TESTCASE";
-
-   /**
-    * A boolean value whether the server-side skeletons are generated or not
-    */
-   private static final String PREF_CHECK_GENERATE_SERVERSIDE = "PREF_CHECK_GENERATE_SERVERSIDE";
-
-   /**
-    * A boolean value whether the server-side configuration file for Axis2 (server.xml) will be generated or not.
-    */
-   private static final String PREF_CHECK_GENERATE_SERVERCONFIG = "PREF_CHECK_GENERATE_SERVERCONFIG";
-
+  
    /**
     * Selection list for target languages
     */
@@ -119,37 +78,14 @@
     */
    private Button serverXMLCheckBoxButton;
 
-   /**
-    * Saves the settings in the plugin's default store, so the user doesn't have to type them in all over again next
-    * time he uses the wizard
-    */
-   private IDialogSettings settings;
-
+  
    /**
     * Creates the page and initialize some settings
     */
    public OptionsPage()
    {
-      super(CodegenWizardPlugin.getResourceString("page2.name"));
-      setTitle(org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin.getResourceString("page2.title"));
-      setDescription(CodegenWizardPlugin.getResourceString("page2.desc"));
-      setImageDescriptor(CodegenWizardPlugin.getWizardImageDescriptor());
-
-      /*
-       * Get the settings for this page. If there is no section in the Plugin's settings for this OptionsPage, create a
-       * new section
-       */
-      IDialogSettings rootSettings = CodegenWizardPlugin.getDefault().getDialogSettings();
-      IDialogSettings section = rootSettings.getSection(this.getClass().getName());
-      if (section == null)
-      {
-         settings = rootSettings.addNewSection(this.getClass().getName());
-         initializeDefaultSettings();
-      }
-      else
-      {
-         settings = section;
-      }
+      super("page2");
+      
    }
 
    /**
@@ -157,16 +93,16 @@
     * 
     * @param settings2 the settings store to save the values to
     */
-   private void initializeDefaultSettings()
+   protected void initializeDefaultSettings()
    {
-      settings.put(OptionsPage.PREF_CHECK_GENERATE_SERVERCONFIG, false);
-      settings.put(OptionsPage.PREF_CHECK_GENERATE_SERVERSIDE, false);
-      settings.put(OptionsPage.PREF_CHECK_GENERATE_TESTCASE, false);
-      settings.put(OptionsPage.PREF_LANGUAGE_INDEX, 0);
-      settings.put(OptionsPage.PREF_PACKAGE_NAME, "org.example.webservice");
-      settings.put(OptionsPage.PREF_RADIO_ASYNC_ONLY, false);
-      settings.put(OptionsPage.PREF_RADIO_SYNC_AND_ASYNC, true);
-      settings.put(OptionsPage.PREF_RADIO_SYNC_ONLY, false);
+      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);
    }
 
    /*
@@ -442,4 +378,12 @@
    {
       return this.testCaseCheckBoxButton.getSelection();
    }
+   
+   
+    /* (non-Javadoc)
+     * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+     */
+    public int getPageType() {
+          return WSDL_2_JAVA_TYPE;
+    }
 }

Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OutputPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OutputPage.java?rev=191384&r1=191383&r2=191384&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OutputPage.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/OutputPage.java Sun Jun 19 20:29:04 2005
@@ -1,23 +1,23 @@
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
  */
 
 package org.apache.axis.tool.codegen.eclipse.ui;
 
-import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
@@ -32,184 +32,140 @@
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.dialogs.ContainerSelectionDialog;
 
-public class OutputPage extends WizardPage
-{
-   /**
-    * The key to store the output location in the settings
-    * 
-    */
-   private static final String PREF_OUTPUT_LOCATION = "PREF_OUTPUT_LOCATION";
-   private Text outputLocation;
-   private Button browseButton;
-   private Button locationSelectCheckBox;
+public class OutputPage extends AbstractWizardPage {
    
-   /**
-    * The dialog settings of this page, which are stored in the plugin's meta
-    * folder.
-    */
-   private IDialogSettings settings;
-
-   /**
-    * 
-    */
-   public OutputPage()
-   {
-      super(CodegenWizardPlugin.getResourceString("page3.name"));
-      setTitle(CodegenWizardPlugin.getResourceString("page3.title"));
-      setDescription(org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin.getResourceString("page3.desc"));
-      setImageDescriptor(org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin.getWizardImageDescriptor());
-      // set the page complete status to false at initilaization
-      setPageComplete(false);
-
-      /*
-       * Get the settings for this page. If there is no section in the Plugin's settings for this OptionsPage, create a
-       * new section
-       */
-      IDialogSettings rootSettings = CodegenWizardPlugin.getDefault().getDialogSettings();
-      IDialogSettings section = rootSettings.getSection(this.getClass().getName());
-      if (section == null)
-      {
-         settings = rootSettings.addNewSection(this.getClass().getName());
-         initializeDefaultSettings();
-      }
-      else
-      {
-         settings = section;
-      }
-
-
-   }
-
-
-   /**
-    * Creates some initial values for the settings. On the output page, this
-    * is not very much.
-    */
-   private 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.axis.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.axis.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, because we could have get a valid path from
-       * the settings store.
-       */
-      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.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin
-            .getResourceString("page3.error.nolocation"));
-         return;
-      }
-      updateStatus(null);
-   }
-
-   /**
-    * Updates the wizard page error messages
-    * 
-    * @param message an error message to display in the dialog
-    */
-   private void updateStatus(String message)
-   {
-      setErrorMessage(message);
-      setPageComplete(message == 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.axis.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());
+    private Text outputLocation;
+
+    private Button browseButton;
+
+    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, "");
+    }
+
+    /*
+     * (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.axis.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.axis.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.axis.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.axis.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.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+     */
+    public int getPageType() {
+        return WSDL_2_JAVA_TYPE;
+    }
 }

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/ToolSelectionPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/ToolSelectionPage.java?rev=191384&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/ToolSelectionPage.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/ToolSelectionPage.java Sun Jun 19 20:29:04 2005
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis.tool.codegen.eclipse.ui;
+
+import org.apache.axis.tool.codegen.eclipse.CodeGenWizard;
+import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Ajith
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class ToolSelectionPage extends AbstractWizardPage {
+   
+    private Button java2WSDLRadioButton;
+    private Button wsdl2JavaRadioButton;
+    public ToolSelectionPage() {
+        super("page0");
+       
+    }
+    
+    /**
+     * Creates a default value for the settings on this page
+     */
+    protected void initializeDefaultSettings() {
+        settings.put(PREF_TOOL_SELECTION_JAVA2WSDL, false);
+        settings.put(PREF_TOOL_SELECTION_WSDL2JAVA, 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 = 1;
+        layout.verticalSpacing = 9;
+
+        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+        
+        Label label = new Label(container, SWT.NULL);
+        label.setText(CodegenWizardPlugin.getResourceString("page0.options.desc"));
+             
+        wsdl2JavaRadioButton = new Button(container,SWT.RADIO);
+        wsdl2JavaRadioButton.setText(CodegenWizardPlugin.getResourceString("page0.wsdl2java.caption"));
+        wsdl2JavaRadioButton.setToolTipText(CodegenWizardPlugin.getResourceString("page0.wsdl2java.desc"));
+        wsdl2JavaRadioButton.setSelection(settings.getBoolean(PREF_TOOL_SELECTION_WSDL2JAVA));
+        wsdl2JavaRadioButton.addSelectionListener(new SelectionAdapter(){
+           public void widgetSelected(SelectionEvent e)
+           {
+              handleCheckboxSelection();
+           }
+        });
+        
+        java2WSDLRadioButton = new Button(container,SWT.RADIO);
+        java2WSDLRadioButton.setText(CodegenWizardPlugin.getResourceString("page0.java2wsdl.caption"));
+        java2WSDLRadioButton.setToolTipText(CodegenWizardPlugin.getResourceString("page0.java2wsdl.desc"));
+        java2WSDLRadioButton.setSelection(settings.getBoolean(PREF_TOOL_SELECTION_JAVA2WSDL));
+        java2WSDLRadioButton.addSelectionListener(new SelectionAdapter(){
+           public void widgetSelected(SelectionEvent e)
+           {
+              handleCheckboxSelection();
+           }
+        });
+        
+        handleCheckboxSelection();
+        setControl(container);
+
+    }
+
+	private void handleCheckboxSelection(){
+	    CodeGenWizard wizard = (CodeGenWizard)this.getWizard();
+	    if (wsdl2JavaRadioButton.getSelection()){
+	        settings.put(PREF_TOOL_SELECTION_WSDL2JAVA,true);
+	        settings.put(PREF_TOOL_SELECTION_JAVA2WSDL,false);
+	       wizard.setSelectedWizardType(WSDL_2_JAVA_TYPE); 
+	    }else if (java2WSDLRadioButton.getSelection()){
+	        settings.put(PREF_TOOL_SELECTION_WSDL2JAVA,false);
+	        settings.put(PREF_TOOL_SELECTION_JAVA2WSDL,true);
+	        wizard.setSelectedWizardType(JAVA_2_WSDL_TYPE); 
+	    }
+	}
+	
+	
+    /* (non-Javadoc)
+     * @see org.apache.axis.tool.codegen.eclipse.ui.CodegenPage#getPageType()
+     */
+    public int getPageType() {
+         return UNSPECIFIED_TYPE;
+    }
+    
+        
+}