axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thil...@apache.org
Subject svn commit: r453307 [1/2] - in /webservices/axis2/branches/java/1_1/modules/tool: axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/ axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/ axis2-eclip...
Date Thu, 05 Oct 2006 18:24:23 GMT
Author: thilina
Date: Thu Oct  5 11:24:22 2006
New Revision: 453307

URL: http://svn.apache.org/viewvc?view=rev&rev=453307
Log:
Applying the patch http://issues.apache.org/jira/browse/AXIS2-1306
Thanks Sandakith...

Modified:
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OutputPage.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/WSDLFileSelectionPage.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/ClassFileReader.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/NamespaceFinder.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/SettingsConstants.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/UIConstants.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java
    webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/resource/Codegen.properties
    webservices/axis2/branches/java/1_1/modules/tool/conf/codegen/build.properties
    webservices/axis2/branches/java/1_1/modules/tool/conf/codegen/plugin.xml

Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java?view=diff&rev=453307&r1=453306&r2=453307
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/WSDL2JavaGenerator.java Thu Oct  5 11:24:22 2006
@@ -1,217 +1,556 @@
 /*
- * 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.axis2.tool.codegen;
+* 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.axis2.tool.codegen.eclipse;
 
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
-import org.apache.axis2.wsdl.util.CommandLineOption;
+import org.apache.axis2.tool.core.JarFileWriter;
+import org.apache.axis2.tool.codegen.WSDL2JavaGenerator;
+import org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
+import org.apache.axis2.tool.codegen.eclipse.ui.AbstractWizardPage;
+import org.apache.axis2.tool.codegen.eclipse.ui.JavaSourceSelectionPage;
+import org.apache.axis2.tool.codegen.eclipse.ui.JavaWSDLOptionsPage;
+import org.apache.axis2.tool.codegen.eclipse.ui.JavaWSDLOutputLocationPage;
+import org.apache.axis2.tool.codegen.eclipse.ui.OptionsPage;
+import org.apache.axis2.tool.codegen.eclipse.ui.OutputPage;
+import org.apache.axis2.tool.codegen.eclipse.ui.ToolSelectionPage;
+import org.apache.axis2.tool.codegen.eclipse.ui.WSDLFileSelectionPage;
+import org.apache.axis2.tool.codegen.eclipse.util.SettingsConstants;
+import org.apache.axis2.tool.codegen.eclipse.util.UIConstants;
+import org.apache.axis2.tool.core.SrcCompiler;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
 import org.apache.axis2.wsdl.util.CommandLineOptionConstants;
-
-import javax.wsdl.WSDLException;
+import org.apache.ws.java2wsdl.Java2WSDLCodegenEngine;
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+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;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
 import java.util.HashMap;
 import java.util.Map;
 
+/**
+ * The main wizard for the codegen wizard
+ */
+
+public class CodeGenWizard extends Wizard implements INewWizard,CommandLineOptionConstants.Java2WSDLConstants {
+    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
 
-public class WSDL2JavaGenerator {
+    private int selectedCodegenOptionType = SettingsConstants.CODEGEN_DEFAULT_TYPE;//TODO change this
     
+
+   
+
     /**
-     * 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
+     * Constructor for CodeGenWizard.
      */
-    private String mapLanguagesWithCombo(String UILangValue)
-    {
-       return UILangValue;
+    public CodeGenWizard() {
+        super();
+        setNeedsProgressMonitor(true);
+        this
+                .setWindowTitle(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
+                        .getResourceString("general.name"));
     }
+
     /**
-     * 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.
+     * Adding the page to the wizard.
+     */
+
+    public void addPages() {
+        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)
      * 
-     * @return a Map with keys from CommandLineOptionConstants with the values entered by the user on the Options Page.
+     * @see org.eclipse.jface.wizard.IWizard#canFinish()
      */
-    public Map fillOptionMap(boolean isAyncOnly,
-            		  boolean isSyncOnly,
-            		  boolean isServerSide,
-            		  boolean isServerXML,
-            		  boolean isTestCase,
-            		  boolean isGenerateAll,
-            		  String serviceName,
-            		  String portName,
-            		  String databindingName,
-            		  String WSDLURI,
-            		  String packageName,
-            		  String selectedLanguage,
-            		  String outputLocation,
-            		  String namespace2packageList,
-            		  boolean isServerSideInterface
-            		  )
-    {
-       Map optionMap = new HashMap();
-       //WSDL file name
-       optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION, new CommandLineOption(
-    		   CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION, getStringArray(WSDLURI)));
-       
-       //Async only
-       if (isAyncOnly)
-       {
-          optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION, new CommandLineOption(
-        		  CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION, new String[0]));
-       }
-       //sync only
-       if (isSyncOnly)
-       {
-          optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION, new CommandLineOption(
-        		  CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION, new String[0]));
-       }
-       //serverside
-       if (isServerSide)
-       {
-          optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION, new CommandLineOption(
-        		  CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION, new String[0]));
-          //server xml
-          if (isServerXML)
-          {
-             optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION, new CommandLineOption(
-            		 CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION, new String[0]));
-          }
-          if (isGenerateAll){
-              optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION, new CommandLineOption(
-            		  CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION, new String[0]));
-          }
-       }
-       //test case
-       if (isTestCase)
-       {
-          optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION, new CommandLineOption(
-        		  CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION, new String[0]));
-       }
-       //package name
-       optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION, new CommandLineOption(
-    		   CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION, getStringArray(packageName)));
-       //selected language
-       optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION, new CommandLineOption(
-    		   CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION, getStringArray(mapLanguagesWithCombo(selectedLanguage))));
-       //output location
-       optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION, new CommandLineOption(
-    		   CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION, getStringArray(outputLocation)));
-       
-      //databinding
-       optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION, new CommandLineOption(
-    		   CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION, getStringArray(databindingName)));
-       
-       //port name
-       if (portName!=null){
-	       optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION, new CommandLineOption(
-	    		   CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION, getStringArray(portName)));
-       }
-       //service name
-       if (serviceName!= null){
-	       optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION, new CommandLineOption(
-	    		   CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION, getStringArray(serviceName)));
-       }
-       //ns2pkg mapping
-       if (namespace2packageList!= null){
-	       optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION, new CommandLineOption(
-	    		   CommandLineOptionConstants.WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION, getStringArray(namespace2packageList)));
-       }
-       
-       //ns2pkg mapping
-       if (isServerSideInterface){
-	       optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION, new CommandLineOption(
-	    		   CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION, new String[0]));
-       }
-       return optionMap;
-       
-    }
-    
-    public String getBaseUri(String wsdlURI){
-    	
-    	try {
-			URL url;
-			if (wsdlURI.indexOf("://")==-1){
-				url = new URL("file","",wsdlURI);
-			}else{
-				url = new URL(wsdlURI);	
-			}
-
-			
-			String baseUri;
-			if ("file".equals(url.getProtocol())){
-				baseUri = new File(url.getFile()).getParentFile().toURL().toExternalForm();
-			}else{
-				baseUri = url.toExternalForm().substring(0,
-						url.toExternalForm().lastIndexOf("/")
-				);
-			}
-		
-			
-			return baseUri;
-		} catch (MalformedURLException e) {
-			throw new RuntimeException(e);
-		}
+    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;
     }
+
     /**
-     * Reads the WSDL Object Model from the given location.
-     * 
-     * @param wsdlURI 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 AxisService getAxisService(String wsdlURI) throws Exception{
-    	
-    		URL url;
-			if (wsdlURI.indexOf("://")==-1){
-				url = new URL("file","",wsdlURI);
-			}else{
-				url = new URL(wsdlURI);	
-			}
-
-			//FIXME @author soi - 
-		    // This quick fix assume that the wsdlURI points to a wsdl 1.1 version.
-			// A better fix should be to determine which builder to use based on the wsdl version. 
-			// The current implementation of the wsdl builder classes did not allow for this. I will suggest
-			// that the determination of which builder to use should be done in the builder classes, preferably
-			// in the parent builder class. 
-			// Accessable through a static reference to a method like getBuilderInstance(String wsdlURI) in
-			// the parent builder class or through a builder Abstract Factor or Abstract factory methods.
-			
-			WSDL11ToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(url.openConnection().getInputStream());
-					
-			builder.setBaseUri(getBaseUri(wsdlURI));
-			return builder.populateService();
+     * 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.
+     */
+    public boolean performFinish() {
+        try {
+            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(CodegenWizardPlugin.
+                		getResourceString("general.invalid.state"));
+            }
+        } catch (Exception e) {
+            MessageDialog.openError(getShell(), 
+                    CodegenWizardPlugin.getResourceString("general.Error"), 
+                    CodegenWizardPlugin.getResourceString("general.Error.prefix") +
+                    e.getMessage());
+            return false;
+        }
+        MessageDialog.openInformation(this.getShell(), 
+                 CodegenWizardPlugin
+                .getResourceString("general.name"), CodegenWizardPlugin
+                .getResourceString("wizard.success"));
+        return true;
     }
 
     /**
-     * Converts a single String into a String Array
+     * The worker method, generates the code itself.
+     */
+    private void doFinishWSDL2Java() {
+        WorkspaceModifyOperation op = new WorkspaceModifyOperation()
+        {
+           protected void execute(IProgressMonitor monitor)
+           throws CoreException, InvocationTargetException, InterruptedException{
+              if (monitor == null)
+                 monitor = new NullProgressMonitor();
+
+              /*
+               * "3" is the total amount of steps, see below monitor.worked(amount)
+               */
+              monitor.beginTask(CodegenWizardPlugin.getResourceString("generator.generating"), 3);
+
+              try
+              {
+                 /*
+                  * TODO: Introduce a progress monitor interface for CodeGenerationEngine.
+                  * Since this monitor here doesn't make much sense, we
+                  * should either remove the progress monitor from the CodeGenWizard,
+                  * 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"));
+                 AxisService service = generator.getAxisService(wsdlSelectionPage.getFileName());
+                 monitor.worked(1);
+                 
+                 Map optionsMap = generator.fillOptionMap(optionsPage.isAsyncOnlyOn(),
+                         									optionsPage.isSyncOnlyOn(),
+                         									optionsPage.isServerside(),
+                         									optionsPage.isServerXML(),
+                         									optionsPage.isGenerateTestCase(),
+                         									optionsPage.getGenerateAll(),
+                         									optionsPage.getServiceName(),
+                         									optionsPage.getPortName(),
+                         									optionsPage.getDatabinderName(),
+                         									wsdlSelectionPage.getFileName(),
+                         									optionsPage.getPackageName(),
+                         									optionsPage.getSelectedLanguage(),
+                         									outputPage.getOutputLocation(),
+                         									optionsPage.getNs2PkgMapping(),
+                         									optionsPage.getGenerateServerSideInterface());
+                 
+                 CodeGenConfiguration codegenConfig = new CodeGenConfiguration(service, optionsMap);
+                 //set the baseURI
+                 codegenConfig.setBaseURI(generator.getBaseUri(wsdlSelectionPage.getFileName()));
+                 monitor.worked(1);
+                 
+                 monitor.subTask(CodegenWizardPlugin.getResourceString("generator.generating"));
+                 
+                 new CodeGenerationEngine(codegenConfig).generate();
+                 
+                 //TODO refresh the eclipse project space to show the generated files
+                 
+                 //Add the codegen libs that are coming with the plugin to the project lib that has been created
+                 if (outputPage.getAxis2PluginLibCopyCheckBoxSelection()){ 
+                	 String eclipseHome = System.getProperty("user.dir");
+                	 String pluginLibLocation = eclipseHome+File.separator+UIConstants.PLUGINS+
+											File.separator+UIConstants.AXIS_CODEGEN_PLUGIN_FOLDER+
+											File.separator+UIConstants.LIB;
+                	 addLibsToProjectLib(pluginLibLocation, outputPage.getOutputLocation());
+                 }
+                 
+                 //Also another requirement arises 
+                 //If the codegen project was newly buided project or else the eclipse
+                 //project intended to save this generated code does not have the required libs
+                 //to compile the generated code. We need to add the relevent libs to a lib directory 
+                 //of the <code>outputPage.getOutputLocation()</code>
+                 
+                 //Add the libraries on the plugin lib directory to the created project lib
+                 if (outputPage.getAxisLibCopyCheckBoxSelection() && outputPage.oktoLoadLibs()){
+                	 String libDirectory = outputPage.getAxisHomeLocation()+File.separator+
+                	 					   UIConstants.TARGET+File.separator+UIConstants.LIB;
+                	 addLibsToProjectLib(libDirectory, outputPage.getOutputLocation());
+                 }
+                 
+                 //This will Create a jar file from the codegen results and add to the output 
+                 //locations lib directory
+                 if (outputPage.getCreateJarCheckBoxSelection()){
+                	 String tempCodegenLocation =  System.getProperty("user.dir")+File.separator+"codegen";
+                	 String tempProjectSrcLocation = tempCodegenLocation+File.separator+"codegen_temp_src_"+
+                	 								 System.currentTimeMillis();
+                	 String tempProjectClassLocation = tempCodegenLocation+File.separator+"codegen_temp_class_"+
+                	 							       System.currentTimeMillis();
+                	 File tempCodegenFile = new File(tempCodegenLocation);
+                	 File tempSrcFile = new File(tempProjectSrcLocation);
+                	 File tempClassFile = new File(tempProjectClassLocation);
+                	 tempCodegenFile.mkdir();
+                	 tempSrcFile.mkdir();
+                	 tempClassFile.mkdir();
+                	 copyDirectory(new File(outputPage.getOutputLocation()), tempSrcFile);
+                	 //Compile the source to another directory 
+                	 SrcCompiler srcCompileTool = new SrcCompiler();
+                	 srcCompileTool.compileSource(tempClassFile, tempProjectSrcLocation);
+                	 //create the jar file and add that to the lib directory
+                	 String projectLib = outputPage.getOutputLocation()+File.separator+"lib";
+                	 JarFileWriter jarFileWriter = new JarFileWriter();
+                	 String jarFileName = "CodegenResults.jar";
+                	 if (!outputPage.getJarFilename().equals("")){
+                		 jarFileName=outputPage.getJarFilename();
+                	 }
+                	 jarFileWriter.writeJarFile(new File(projectLib), jarFileName, tempClassFile);
+                	 
+                	 //Delete the temp folders
+                	 deleteDir(tempCodegenFile);
+
+                 }
+                 
+                 
+                 monitor.worked(1);
+              }
+              catch (Exception e)
+              {
+                 ///////////////////////////////
+            	  e.printStackTrace();
+            	 ///////////////////////////// 
+                 throw new InterruptedException(e.getMessage());
+              }
+
+              monitor.done();
+           }
+        };
+
+
+        /*
+         * Start the generation as new Workbench Operation, so the user
+         * can see the progress and, if needed, can stop the operation.
+         */
+        try
+        {
+           getContainer().run(false, true, op);
+        }
+        catch (InvocationTargetException e1)
+        {
+        	/////////////////////////
+        	e1.printStackTrace();
+        	////////////////////////
+            throw new RuntimeException(e1);
+        }
+        catch (InterruptedException e1)
+        {
+           throw new RuntimeException(e1);
+        }
+        catch (Exception e)
+        {
+           throw new RuntimeException(e);
+        }
+
+
+    }
+
+    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"), 3);
+
+                try {
+                    monitor.worked(1);
+                    //fill the option map
+                    Map optionsMap = new HashMap();
+                    Java2WSDLCommandLineOption option = new Java2WSDLCommandLineOption(
+                    		CLASSNAME_OPTION,new String[]{javaSourceSelectionPage.getClassName()});
+                    optionsMap.put(CLASSNAME_OPTION,option);
+                    
+                    option = new Java2WSDLCommandLineOption(
+                    		CLASSPATH_OPTION,javaSourceSelectionPage.getClassPathList());
+                    optionsMap.put(CLASSPATH_OPTION,option);
+                    
+                    option = new Java2WSDLCommandLineOption(
+                    		TARGET_NAMESPACE_OPTION,
+                    		new String[]{java2wsdlOptionsPage.getTargetNamespace()});
+                    optionsMap.put(TARGET_NAMESPACE_OPTION,option);
+                    
+                    option = new Java2WSDLCommandLineOption(
+                    		TARGET_NAMESPACE_PREFIX_OPTION,
+                    		new String[]{java2wsdlOptionsPage.getTargetNamespacePrefix()});
+                    optionsMap.put(TARGET_NAMESPACE_PREFIX_OPTION,option);
+                    
+                    option = new Java2WSDLCommandLineOption(
+                    		SCHEMA_TARGET_NAMESPACE_OPTION,
+                    		new String[]{java2wsdlOptionsPage.getSchemaTargetNamespace()});
+                    optionsMap.put(SCHEMA_TARGET_NAMESPACE_OPTION,option);
+                    
+                    option = new Java2WSDLCommandLineOption(
+                    		SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION,
+                    		new String[]{java2wsdlOptionsPage.getSchemaTargetNamespacePrefix()});
+                    optionsMap.put(SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION,option);
+                    
+                    option = new Java2WSDLCommandLineOption(
+                    		OUTPUT_LOCATION_OPTION,new String[]{java2wsdlOutputLocationPage.getOutputLocation()});
+                    optionsMap.put(OUTPUT_LOCATION_OPTION,option);
+                    
+                    option = new Java2WSDLCommandLineOption(
+                    		OUTPUT_FILENAME_OPTION,new String[]{java2wsdlOutputLocationPage.getOutputWSDLName()});
+                    optionsMap.put(OUTPUT_FILENAME_OPTION,option);
+                    
+                    
+                    monitor.worked(1);
+                    
+                    new Java2WSDLCodegenEngine(optionsMap).generate();
+                    
+                    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(CodegenWizardPlugin.
+            		getResourceString("general.useraborted.state"));
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+
+    /**
+     * We will accept the selection in the workbench to see if we can initialize
+     * from it.
      * 
-     * @param value a single string
-     * @return an array containing only one element
+     * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+     */
+    public void init(IWorkbench workbench, IStructuredSelection selection) {
+        //do nothing
+    }
+
+    /**
+     * @return Returns the selectedWizardType.
+     */
+    public int getSelectedWizardType() {
+        return selectedWizardType;
+    }    
+
+    /**
+     * @param selectedWizardType
+     *            The selectedWizardType to set.
+     */
+    public void setSelectedWizardType(int selectedWizardType) {
+        this.selectedWizardType = selectedWizardType;
+    }
+    
+    /**
+     * @return Returns the codegenOptionType.
      */
-    private String[] getStringArray(String value)
-    {
-       String[] values = new String[1];
-       values[0] = value;
-       return values;
+    public int getSelectedCodegenOptionType() {
+        return selectedCodegenOptionType;
     }
+    
+    /**
+     * @param selectedCodegenOptionType
+     *            The selectedCodegenOptionType to set.
+     */
+    public void setSelectedCodegenOptionType(int selectedCodegenOptionType) {
+        this.selectedCodegenOptionType = selectedCodegenOptionType;
+    }
+
+    /**
+     * 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.populateParamsFromWSDL();
+    }
+    
+    public void setDefaultNamespaces(String fullyQualifiedClassName){
+    	java2wsdlOptionsPage.setNamespaceDefaults(fullyQualifiedClassName);
+    }
+    
+    
+    private void addLibsToProjectLib(String libDirectory, String outputLocation){
+    	String newOutputLocation = outputLocation+File.separator+UIConstants.LIB;
+    	//Create a lib directory; all ancestor directories must exist
+    	boolean success = (new File(newOutputLocation)).mkdir();
+        if (!success) {
+            // Directory creation failed
+        }
+        try {
+			copyDirectory(new File(libDirectory),new File(newOutputLocation));
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+    }
+    
+    // Copies all files under srcDir to dstDir.
+    // If dstDir does not exist, it will be created.
+    public void copyDirectory(File srcDir, File dstDir) throws IOException {
+        if (srcDir.isDirectory()) {
+            if (!dstDir.exists()) {
+                dstDir.mkdir();
+            }
+    
+            String[] children = srcDir.list();
+            for (int i=0; i<children.length; i++) {
+                copyDirectory(new File(srcDir, children[i]),
+                                     new File(dstDir, children[i]));
+            }
+        } else {
+            copyFile(srcDir, dstDir);
+        }
+    }
+        
+    // Copies src file to dst file.
+    // If the dst file does not exist, it is created
+    private void copyFile(File src, File dst) throws IOException {
+        InputStream in = new FileInputStream(src);
+        OutputStream out = new FileOutputStream(dst);
+    
+        // Transfer bytes from in to out
+        byte[] buf = new byte[1024];
+        int len;
+        while ((len = in.read(buf)) > 0) {
+            out.write(buf, 0, len);
+        }
+        in.close();
+        out.close();
+    }
+    
+    // Deletes all files and subdirectories under dir.
+    // Returns true if all deletions were successful.
+    // If a deletion fails, the method stops attempting to delete and returns false.
+    private boolean deleteDir(File dir) {
+        if (dir.isDirectory()) {
+            String[] children = dir.list();
+            for (int i=0; i<children.length; i++) {
+                boolean success = deleteDir(new File(dir, children[i]));
+                if (!success) {
+                    return false;
+                }
+            }
+        }
+    
+        // The directory is now empty so delete it
+        return dir.delete();
+    }
+    
 }

Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java?view=diff&rev=453307&r1=453306&r2=453307
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java Thu Oct  5 11:24:22 2006
@@ -39,13 +39,13 @@
 
 public class JavaSourceSelectionPage extends AbstractWizardPage{
 
-   
+    private Composite container;
     private Text javaClassNameBox;
     private List javaClasspathList;
     private Label statusLabel;
 
     public JavaSourceSelectionPage() {  
-        super("page4");
+    	super("page4");
     }
 
     protected void initializeDefaultSettings() {
@@ -68,7 +68,7 @@
      * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
      */
     public void createControl(Composite parent) {
-        Composite container = new Composite(parent, SWT.NULL);
+        container = new Composite(parent, SWT.NULL);
         GridLayout layout = new GridLayout();
         container.setLayout(layout);
         layout.numColumns = 3;
@@ -141,7 +141,7 @@
         javaClasspathList = new List(container,SWT.READ_ONLY | SWT.BORDER);
         javaClasspathList.setLayoutData(gd);
         javaClasspathList.setItems(settings.getArray(JAVA_CLASS_PATH_ENTRIES));
-        
+        container.redraw();
         gd = new GridData(GridData.FILL_HORIZONTAL);
         Button tryLoadButton = new Button(container,SWT.PUSH);
         tryLoadButton.setLayoutData(gd);
@@ -175,12 +175,26 @@
         statusLabel = new Label(container,SWT.NULL);
         statusLabel.setLayoutData(gd);
         
+		//filling label 
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		Label fillLabel3 = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		fillLabel3.setLayoutData(gd);
+		
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3; 
+		Label hintLabel = new Label(container, SWT.NULL);
+		hintLabel
+				.setText(CodegenWizardPlugin
+						.getResourceString("page4.hint.caption"));
+		hintLabel.setLayoutData(gd);
+        
         setPageComplete(false);
         
         if (restoredFromPreviousSettings){
             handleClassNameTextChange();
         }
-        
+        javaClasspathList.redraw();
         setControl(container);
 
     }
@@ -196,8 +210,13 @@
         if (dirName != null) {
         	javaClasspathList.add(dirName);
         	updateListEntries();
+            javaClasspathList.redraw();
+            container.redraw();
         }
+        container.redraw();
         updateStatusTextField(false,"");
+        javaClasspathList.redraw();
+        container.redraw();
     }
     
     
@@ -212,6 +231,8 @@
         }
         updateListEntries();
         updateStatusTextField(false,"");
+        javaClasspathList.redraw();
+        container.redraw();
     }
     
    
@@ -228,6 +249,8 @@
         	updateListEntries();
         }
         updateStatusTextField(false,"");
+        javaClasspathList.redraw();
+        container.redraw();
 
     }
     
@@ -235,10 +258,13 @@
     	if (success){
     		getCodegenWizard().setDefaultNamespaces(javaClassNameBox.getText());
     	}
-    	statusLabel.setText(text);
+     	statusLabel.setText(text);
     }
+    
     private void updateListEntries(){
     	settings.put(JAVA_CLASS_PATH_ENTRIES,javaClasspathList.getItems());
+        javaClasspathList.redraw();
+        container.redraw();
     }
     /**
      * 

Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java?view=diff&rev=453307&r1=453306&r2=453307
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java Thu Oct  5 11:24:22 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.NamespaceFinder;
 import org.eclipse.swt.SWT;
@@ -55,8 +56,6 @@
 	 * @see org.apache.axis2.tool.codegen.eclipse.ui.AbstractWizardPage#initializeDefaultSettings()
 	 */
 	protected void initializeDefaultSettings() {
-
-		
 		settings.put(PREF_JAVA_TARGET_NS,"" );
 		settings.put(PREF_JAVA_TARGET_NS_PREF, "");
 		settings.put(PREF_JAVA_SCHEMA_TARGET_NS, "");
@@ -190,6 +189,7 @@
 		});
 
 		setControl(container);
+		
 
 	}
 

Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java?view=diff&rev=453307&r1=453306&r2=453307
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/JavaWSDLOutputLocationPage.java Thu Oct  5 11:24:22 2006
@@ -37,131 +37,193 @@
 import java.io.File;
 
 public class JavaWSDLOutputLocationPage extends AbstractWizardPage {
-    
-    private Text outputFolderTextBox;
-    private Text outputFileNameTextBox;
-    private Button locationSelectCheckBox;
-
-    /**
-     * @param pageName
-     */
-    public JavaWSDLOutputLocationPage() {
-        super("page6");
-    }
-    /* (non-Javadoc)
-     * @see org.apache.axis2.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,"services.wsdl");
-        settings.put(PREF_JAVA_OUTPUT_SELECTION,false);
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.axis2.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();
-        layout.numColumns = 3;
-        //layout.verticalSpacing = 9;
-        container.setLayout(layout);
-
-        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
-        gd.horizontalSpan = 3;
-        locationSelectCheckBox = new Button(container, SWT.CHECK);
-        locationSelectCheckBox.setText(CodegenWizardPlugin
-                .getResourceString("page6.selectOption.label"));
-        locationSelectCheckBox.setLayoutData(gd);
-        locationSelectCheckBox.addSelectionListener(new SelectionAdapter(){
-        	public void widgetSelected(SelectionEvent e) {
-        		 settings.put(PREF_JAVA_OUTPUT_SELECTION,
-        				 locationSelectCheckBox.getSelection());
-        	}
-        });
-        
-        
-        Label label = new Label(container, SWT.NULL);
-        label.setText(CodegenWizardPlugin
-                .getResourceString("page6.output.label"));
-        
-        gd = new GridData(GridData.FILL_HORIZONTAL);
-        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);
-        gd.horizontalSpan = 2;
-        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(){
-    	
-    	boolean location = locationSelectCheckBox.getSelection();
+
+	private Text outputFolderTextBox;
+
+	private Text outputFileNameTextBox;
+
+	private Button workspaceProjectOptionsButton;
+
+	private Button filesyStemOptionsButton;
+
+	private boolean workspaceSaveOption = false;
+
+	/**
+	 * @param pageName
+	 */
+	public JavaWSDLOutputLocationPage() {
+		super("page6");
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.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, "services.wsdl");
+		settings.put(PREF_JAVA_OUTPUT_FILESYATEM, true);
+		settings.put(PREF_JAVA_OUTPUT_WORKSPACE, false);
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.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();
+		layout.numColumns = 3;
+		//layout.verticalSpacing = 9;
+		container.setLayout(layout);
+
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		Label selectLabel = new Label(container, SWT.NULL);
+		selectLabel
+				.setText(CodegenWizardPlugin
+						.getResourceString("select the location where to put the output"));
+		selectLabel.setLayoutData(gd);
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		workspaceProjectOptionsButton = new Button(container, SWT.RADIO);
+		workspaceProjectOptionsButton.setLayoutData(gd);
+		workspaceProjectOptionsButton.setText(CodegenWizardPlugin
+				.getResourceString("page6.workspace.caption"));
+		workspaceProjectOptionsButton.setToolTipText(CodegenWizardPlugin
+				.getResourceString("page6.workspace.desc"));
+		workspaceProjectOptionsButton.setSelection(settings
+				.getBoolean(PREF_JAVA_OUTPUT_WORKSPACE));
+		workspaceProjectOptionsButton
+				.addSelectionListener(new SelectionAdapter() {
+					public void widgetSelected(SelectionEvent e) {
+						handleCheckboxSelection();
+					}
+				});
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		filesyStemOptionsButton = new Button(container, SWT.RADIO);
+		filesyStemOptionsButton.setLayoutData(gd);
+		filesyStemOptionsButton.setText(CodegenWizardPlugin
+				.getResourceString("page6.filesystem.caption"));
+		filesyStemOptionsButton.setToolTipText(CodegenWizardPlugin
+				.getResourceString("page6.filesystem.desc"));
+		filesyStemOptionsButton.setSelection(settings
+				.getBoolean(PREF_JAVA_OUTPUT_FILESYATEM));
+		filesyStemOptionsButton.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				handleCheckboxSelection();
+			}
+		});
+
+		Label label1 = new Label(container, SWT.NULL);
+		label1.setText(CodegenWizardPlugin
+				.getResourceString("page6.output.label"));
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		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 label = new Label(container, SWT.NULL);
+		label.setText(CodegenWizardPlugin
+				.getResourceString("page6.outputname.label"));
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		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 handleCheckboxSelection() {
+		if (workspaceProjectOptionsButton.getSelection()) {
+			settings.put(PREF_JAVA_OUTPUT_WORKSPACE, true);
+			settings.put(PREF_JAVA_OUTPUT_FILESYATEM, false);
+			workspaceSaveOption = true;
+		} else if (filesyStemOptionsButton.getSelection()) {
+			settings.put(PREF_JAVA_OUTPUT_FILESYATEM, true);
+			settings.put(PREF_JAVA_OUTPUT_WORKSPACE, false);
+			workspaceSaveOption = false;
+		}
+	}
+
+	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() {
+
+		//    	boolean location = locationSelectCheckBox.getSelection();
+		boolean location = false;
+		if(settings.getBoolean(PREF_JAVA_OUTPUT_FILESYATEM)){
+			location = false;
+		}else if(settings.getBoolean(PREF_JAVA_OUTPUT_WORKSPACE)){
+			location = true;
+		}
+		if (workspaceSaveOption) {
+			location = true;
+		}
 		if (!location) {
 			DirectoryDialog dialog = new DirectoryDialog(this.getShell());
 			String returnString = dialog.open();
@@ -170,12 +232,9 @@
 			}
 		} else {
 			IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-			
+
 			ContainerSelectionDialog dialog = new ContainerSelectionDialog(
-					getShell(),
-					root,
-					false,
-					CodegenWizardPlugin
+					getShell(), root, false, CodegenWizardPlugin
 							.getResourceString("page3.containerbox.title"));
 			if (dialog.open() == ContainerSelectionDialog.OK) {
 				Object[] result = dialog.getResult();
@@ -183,31 +242,30 @@
 					Path path = ((Path) result[0]);
 					// append to the workspace path
 					if (root.exists(path)) {
-						outputFolderTextBox.setText(root.getLocation().append(path)
-								.toFile().getAbsolutePath());
+						outputFolderTextBox.setText(root.getLocation().append(
+								path).toFile().getAbsolutePath());
 					}
 				}
 			}
 		}
-		
 
-    }
-    
-    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();
-    }
+	}
+
+	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/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java?view=diff&rev=453307&r1=453306&r2=453307
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java Thu Oct  5 11:24:22 2006
@@ -13,10 +13,16 @@
 
 package org.apache.axis2.tool.codegen.eclipse.ui;
 
+import java.util.Iterator;
+import java.util.Map;
+
+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.jface.viewers.TextCellEditor;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.TableEditor;
 import org.eclipse.swt.events.ModifyEvent;
@@ -24,25 +30,23 @@
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.swt.widgets.Text;
 
-import javax.xml.namespace.QName;
-
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 /**
  * Options Page lets the user change general settings on the code generation. It
  * is used in the CodegenWizardPlugin, CodeGenWizard.
@@ -118,22 +122,27 @@
 
 	private WSDLPropertyReader reader;
 
-	private List serviceQNameList = null;
+	private java.util.List serviceQNameList = null;
 	
-	private static final int EDITABLECOLUMN = 1;
+	private final int EDITABLECOLUMN = 1;
+	
+	private String defaultPackageName = null;
+	
+	private Combo codegenOptionSelectionComboBox;
 	
 	/**
 	 * A table to keep the namespace to 
 	 * package mappings
 	 */
 	private Table namespace2packageTable = null;
+	
+	Composite container;
 
 	/**
 	 * Creates the page and initialize some settings
 	 */
 	public OptionsPage() {
 		super("page2");
-
 	}
 
 	/**
@@ -145,7 +154,7 @@
 		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_PACKAGE_NAME, DEFAULT_PACKAGENAME);
 		settings.put(PREF_RADIO_ASYNC_ONLY, false);
 		settings.put(PREF_RADIO_SYNC_AND_ASYNC, true);
 		settings.put(PREF_RADIO_SYNC_ONLY, false);
@@ -156,6 +165,7 @@
 		settings.put(PREF_GEN_SS_INTERFACE, false);
 	}
 
+
 	/*
 	 * (non-Javadoc)
 	 * 
@@ -163,81 +173,71 @@
 	 */
 	public void createControl(Composite parent) {
 
-		Composite container = new Composite(parent, SWT.NULL);
+		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"));
+	    Label label = new Label(container, SWT.NULL);
+	    label.setText(CodegenWizardPlugin.getResourceString("page2.options.desc"));
+	    label.setLayoutData(gd);
+	    
+	        
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
 
-		languageSelectionComboBox = new Combo(container, SWT.DROP_DOWN
-				| SWT.BORDER | SWT.READ_ONLY);
+		codegenOptionSelectionComboBox = 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() {
+		this.fillCodegenOptionSelectionComboBox();
+		codegenOptionSelectionComboBox.setLayoutData(gd);
+		settings.put(PREF_CODEGEN_OPTION_INDEX, codegenOptionSelectionComboBox
+				.getSelectionIndex());
+		codegenOptionSelectionComboBox.select(settings.getInt(PREF_CODEGEN_OPTION_INDEX));
+		codegenOptionSelectionComboBox.addSelectionListener(new SelectionListener() {
 			public void widgetSelected(SelectionEvent e) {
-				settings.put(PREF_LANGUAGE_INDEX, languageSelectionComboBox
+				settings.put(PREF_CODEGEN_OPTION_INDEX, codegenOptionSelectionComboBox
 						.getSelectionIndex());
+				if (codegenOptionSelectionComboBox
+						.getSelectionIndex() == 0 ){
+					disableControls();
+					
+				}else if (codegenOptionSelectionComboBox
+						.getSelectionIndex() == 1){
+					enableControls();
+				}
 			}
 
 			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());
-			}
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
 
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-		});
+		Label label1 = new Label(container, SWT.NULL);
+		label1.setText(CodegenWizardPlugin
+				.getResourceString("page2.language.caption"));
 
-		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() {
+		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_RADIO_ASYNC_ONLY, asyncOnlyRadioButton
-						.getSelection());
+				settings.put(PREF_LANGUAGE_INDEX, languageSelectionComboBox
+						.getSelectionIndex());
 			}
 
 			public void widgetDefaultSelected(SelectionEvent e) {
 			}
 		});
-
+		
 		// service name
 		label = new Label(container, SWT.NULL);
 		label.setText(CodegenWizardPlugin
@@ -281,7 +281,30 @@
 			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) {
+			};
+		});
+		
 		// package name
 		label = new Label(container, SWT.NULL);
 		label.setText(CodegenWizardPlugin
@@ -293,11 +316,17 @@
 		packageText.setLayoutData(gd);
 		String packageName;
 		String storedPackageName = settings.get(PREF_PACKAGE_NAME);
+		this.defaultPackageName = storedPackageName;
 		if (storedPackageName.equals("")) {
 			packageName = URLProcessor.makePackageName("");
 		} else {
 			packageName = storedPackageName;
 		}
+		
+		//if the package name somehow turned out to be null set it to 
+		//default package
+		if (packageName==null)packageName=URLProcessor.DEFAULT_PACKAGE;
+		
 		packageText.setText(packageName); // get this text from the
 		// URLProcessor
 		packageText.addModifyListener(new ModifyListener() {
@@ -305,7 +334,8 @@
 				settings.put(PREF_PACKAGE_NAME, packageText.getText());
 			}
 		});
-
+		
+		// generate test case option
 		gd = new GridData(GridData.FILL_HORIZONTAL);
 		gd.horizontalSpan = 3;
 		testCaseCheckBoxButton = new Button(container, SWT.CHECK);
@@ -324,6 +354,87 @@
 			public void widgetDefaultSelected(SelectionEvent e) {
 			}
 		});
+		
+		//filling label 
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		Label fillLabel = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		fillLabel.setLayoutData(gd);
+
+		//cleint side label 
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		Label lblClientside = new Label(container, SWT.NONE);
+		lblClientside.setText(CodegenWizardPlugin
+				.getResourceString("page2.clientside.caption"));
+		lblClientside.setLayoutData(gd);
+
+		//client side buttons
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 1;
+		syncAndAsyncRadioButton = new Button(container, SWT.RADIO);
+		syncAndAsyncRadioButton.setLayoutData(gd);
+		syncAndAsyncRadioButton.setText(CodegenWizardPlugin
+				.getResourceString("page2.syncAsync.caption"));
+		syncAndAsyncRadioButton.setSelection(settings
+				.getBoolean(PREF_RADIO_SYNC_AND_ASYNC));
+		syncAndAsyncRadioButton.setVisible(true);
+		syncAndAsyncRadioButton.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				settings.put(PREF_RADIO_SYNC_AND_ASYNC, syncAndAsyncRadioButton
+						.getSelection());
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+		
+		
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 1;
+		syncOnlyRadioButton = new Button(container, SWT.RADIO);
+		syncOnlyRadioButton.setLayoutData(gd);
+		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) {
+			}
+		});
+
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 1;
+		asyncOnlyRadioButton = new Button(container, SWT.RADIO);
+		asyncOnlyRadioButton.setLayoutData(gd);
+		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) {
+			}
+		});
+		
+		//filling label 
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		Label fillLabel1 = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		fillLabel1.setLayoutData(gd);
+		
+		
 		// Server side check box
 		gd = new GridData(GridData.FILL_HORIZONTAL);
 		gd.horizontalSpan = 3;
@@ -401,30 +512,13 @@
 		});
 		
 		
-		// Databinding
-		label = new Label(container, SWT.NULL);
-		label.setText(CodegenWizardPlugin
-				.getResourceString("page2.databindingCheck.caption"));
-
+		//filling label 
 		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) {
-			};
-		});
+		gd.horizontalSpan = 3;
+		Label fillLabel2 = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		fillLabel2.setLayoutData(gd);
 
-//		 Databinding
+		//		 Databinding
 		label = new Label(container, SWT.NULL);
 		label.setText(CodegenWizardPlugin
 				.getResourceString("page2.namespace2Pkg.caption"));
@@ -434,14 +528,14 @@
         gd.horizontalSpan = 3;
         gd.verticalSpan = 5;
         
-        namespace2packageTable = new Table(container,SWT.SINGLE|SWT.FULL_SELECTION);
+        namespace2packageTable = new Table(container,SWT.BORDER|SWT.MULTI);
         namespace2packageTable.setLinesVisible(true);
         namespace2packageTable.setHeaderVisible(true); 
         namespace2packageTable.setEnabled(true);
         namespace2packageTable.setLayoutData(gd);
        
         declareColumn(namespace2packageTable,
-        		200, //a default width until we adjust
+        		350, //a default width until we adjust
         		CodegenWizardPlugin
 				.getResourceString("page2.namespace.caption"));
         declareColumn(namespace2packageTable,
@@ -453,30 +547,64 @@
         
         // add the table editor
         final TableEditor editor = new TableEditor(namespace2packageTable);
-        namespace2packageTable.addSelectionListener(new SelectionAdapter() {
-    		public void widgetSelected(SelectionEvent e) {
-    			// Clean up any previous editor control
-    			Control oldEditor = editor.getEditor();
-    			if (oldEditor != null) oldEditor.dispose();
-    	
-    			// Identify the selected row
-    			TableItem item = (TableItem)e.item;
-    			if (item == null) return;
-    	
-    			// The control that will be the editor must be a child of the Table
-    			Text newEditor = new Text(namespace2packageTable, SWT.NONE);
-    			newEditor.setText(item.getText(EDITABLECOLUMN));
-    			newEditor.addModifyListener(new ModifyListener() {
-    				public void modifyText(ModifyEvent me) {
-    					Text text = (Text)editor.getEditor();
-    					editor.getItem().setText(EDITABLECOLUMN, text.getText());
-    				}
-    			});
-    			newEditor.selectAll();
-    			newEditor.setFocus();
-    			editor.setEditor(newEditor, item, EDITABLECOLUMN);
-    		}
-    	});
+        editor.setColumn(1);
+        editor.horizontalAlignment = SWT.LEFT;
+        editor.grabHorizontal = true;
+        //This is the cute way of making the namespaces columns editable
+        namespace2packageTable.addListener(SWT.MouseDown, new Listener() {
+            public void handleEvent(Event event) {
+              Rectangle clientArea = namespace2packageTable.getClientArea();
+              Point pt = new Point(event.x, event.y);
+              int index = namespace2packageTable.getTopIndex();
+              while (index < namespace2packageTable.getItemCount()) {
+                boolean visible = false;
+                final TableItem item = namespace2packageTable.getItem(index);
+                for (int i = 0; i < namespace2packageTable.getColumnCount(); i++) {
+                  Rectangle rect = item.getBounds(i);
+                  if (rect.contains(pt)) {
+                    final int column = i;
+                    final Text text = new Text(namespace2packageTable, SWT.NONE);
+                    Listener textListener = new Listener() {
+                      public void handleEvent(final Event e) {
+                        switch (e.type) {
+                        case SWT.FocusOut:
+                          item.setText(column, text.getText());
+                          text.dispose();
+                          break;
+                        case SWT.Traverse:
+                          switch (e.detail) {
+                          case SWT.TRAVERSE_RETURN:
+                            item
+                                .setText(column, text
+                                    .getText());
+                          // FALL THROUGH
+                          case SWT.TRAVERSE_ESCAPE:
+                            text.dispose();
+                            e.doit = false;
+                          }
+                          break;
+                        }
+                      }
+                    };
+                    text.addListener(SWT.FocusOut, textListener);
+                    text.addListener(SWT.Traverse, textListener);
+                    editor.setEditor(text, item, i);
+                    text.setText(item.getText(i));
+                    text.selectAll();
+                    text.setFocus();
+                    return;
+                  }
+                  if (!visible && rect.intersects(clientArea)) {
+                    visible = true;
+                  }
+                }
+                if (!visible)
+                  return;
+                index++;
+              }
+            }
+          });
+       
         
         //adjust the width
         //adjustColumnWidth(namespace2packageTable);
@@ -494,17 +622,21 @@
 			populateParamsFromWSDL();
 			selectDefaults();
 		}
-
+		
+		//first appearence Disable all the controls 
+		disableControls();
+		
+		
 		setControl(container);
 
 		setPageComplete(true);
 
 	}
 
-	/**
-	 * Adjust the column widths
-	 * @param table
-	 */
+//	/**
+//	 * Adjust the column widths
+//	 * @param table
+//	 */
 //	private void adjustColumnWidth(Table table){
 //		 Point p = namespace2packageTable.computeSize(SWT.DEFAULT, SWT.DEFAULT);
 //	     int columns = table.getColumnCount();
@@ -522,8 +654,6 @@
         TableColumn column = new TableColumn(table,SWT.NONE);
         column.setWidth(width);
         column.setText(colName);
-        
-        
     }
 	
 	private void selectDefaults() {
@@ -598,7 +728,7 @@
 	private void loadPortNames() {
 		int selectionIndex = serviceNameCombo.getSelectionIndex();
 		if (selectionIndex != -1) {
-			List ports = reader.getPortNameList((QName) serviceQNameList
+			java.util.List ports = reader.getPortNameList((QName) serviceQNameList
 					.get(selectionIndex));
 			if (!ports.isEmpty()) {
 				portNameCombo.removeAll();
@@ -630,12 +760,17 @@
 		Iterator namespaces = namespaceMap.values().iterator();
 		namespace2packageTable.removeAll();
         TableItem[] items = new TableItem[namespaceMap.size()]; // An item for each field
+        
         int i = 0;
         while(namespaces.hasNext()){
-           items[i] = new TableItem(namespace2packageTable, SWT.NONE);
-           items[i].setText(0,(String)namespaces.next());
+        	
+           items[i] = new TableItem(namespace2packageTable, SWT.NULL);
+           String namespace = (String)namespaces.next();
+           items[i].setText(0,namespace);
+           items[i].setText(1,getPackageFromNamespace(namespace));
            i++;
         }
+
         namespace2packageTable.setVisible(true);
 		
 	}
@@ -667,6 +802,17 @@
 
 		languageSelectionComboBox.select(0);
 	}
+	
+	/**
+	 * Fill the combo with properoption selection
+	 * 
+	 */
+	private void fillCodegenOptionSelectionComboBox() {
+		codegenOptionSelectionComboBox.add(DEFAULT);
+		codegenOptionSelectionComboBox.add(CUSTOM);
+		codegenOptionSelectionComboBox.select(0);
+	}
+
 
 	/**
 	 * Validates the status of the server-side checkbox, and enables/disables
@@ -678,6 +824,11 @@
 			this.generateAllCheckBoxButton.setEnabled(true);
 			this.generateServerSideInterfaceCheckBoxButton.setEnabled(true);
 		} else {
+			//added this to increase the UI features (this will deselct all the selected features)
+			this.serverXMLCheckBoxButton.setSelection(false);
+			this.generateAllCheckBoxButton.setSelection(false);
+			this.generateServerSideInterfaceCheckBoxButton.setSelection(false);
+			//earlier existing code (This only set focus false)
 			this.serverXMLCheckBoxButton.setEnabled(false);
 			this.generateAllCheckBoxButton.setEnabled(false);
 			this.generateServerSideInterfaceCheckBoxButton.setEnabled(false);
@@ -718,6 +869,12 @@
 	 * @return a string containing the package name to use for code generation
 	 */
 	public String getPackageName() {
+		if ("".equals(packageText.getText().trim())){
+			//we do not allow the packaging to be empty
+			//if the user sets it to empty we set it to
+			//the default
+			return URLProcessor.DEFAULT_PACKAGE;
+		}
 		return this.packageText.getText();
 	}
 
@@ -839,5 +996,58 @@
 			
 		}
 		return "".equals(returnList)?null:returnList;
+	}
+	
+	
+	private void disableControls(){
+		this.codegenOptionSelectionComboBox.select(0);
+		this.testCaseCheckBoxButton.setEnabled(false);
+        this.testCaseCheckBoxButton.setSelection(false);
+        this.databindingTypeCombo.setEnabled(false);
+        this.databindingTypeCombo.select(0);
+        this.generateAllCheckBoxButton.setEnabled(false);
+        this.generateAllCheckBoxButton.setSelection(false);
+        this.generateServerSideInterfaceCheckBoxButton.setEnabled(false);
+        this.generateServerSideInterfaceCheckBoxButton.setSelection(false);
+        this.languageSelectionComboBox.setEnabled(false);
+        this.namespace2packageTable.setEnabled(false);
+        this.packageText.setEditable(false);
+        this.portNameCombo.setEnabled(false);
+        this.portNameCombo.select(0);        
+        this.serverSideCheckBoxButton.setEnabled(false);
+        this.serverSideCheckBoxButton.setSelection(false);
+        this.serverXMLCheckBoxButton.setEnabled(false);
+        this.serverXMLCheckBoxButton.setSelection(false);
+        this.serviceNameCombo.setEnabled(false);
+        this.serviceNameCombo.select(0);
+        this.syncOnlyRadioButton.setEnabled(false);
+        this.syncOnlyRadioButton.setSelection(false);
+        this.asyncOnlyRadioButton.setEnabled(false);
+        this.asyncOnlyRadioButton.setSelection(false);
+        this.syncAndAsyncRadioButton.setEnabled(false);
+        this.syncAndAsyncRadioButton.setSelection(true);
+        this.packageText.setEnabled(false);
+	}
+	
+	private void enableControls(){
+        this.testCaseCheckBoxButton.setEnabled(true);
+        this.databindingTypeCombo.setEnabled(true);
+        this.languageSelectionComboBox.setEnabled(true);
+        this.namespace2packageTable.setEnabled(true);
+        this.packageText.setEditable(true);
+        this.portNameCombo.setEnabled(true);
+        this.serverSideCheckBoxButton.setEnabled(true);
+        this.serviceNameCombo.setEnabled(true);
+        this.syncOnlyRadioButton.setEnabled(true);
+        this.asyncOnlyRadioButton.setEnabled(true);
+        this.syncAndAsyncRadioButton.setEnabled(true);
+        this.packageText.setEnabled(true);
+	}
+	
+	/**
+	 * get the package derived by  Namespace
+	 */
+	public String getPackageFromNamespace(String namespace){
+		return  URLProcessor.makePackageName(namespace);
 	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message