axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r170318 - in /webservices/axis/trunk/java/modules/tool: resources/ resources/codegen/ resources/codegen/icons/ src/org/apache/axis/tool/codegen/ src/org/apache/axis/tool/codegen/eclipse/ src/org/apache/axis/tool/codegen/eclipse/pages/ src/org/apache/axis/tool/codegen/eclipse/util/ src/org/apache/axis/tool/codegen/resources/
Date Mon, 16 May 2005 06:04:33 GMT
Author: ajith
Date: Sun May 15 23:04:32 2005
New Revision: 170318

URL: http://svn.apache.org/viewcvs?rev=170318&view=rev
Log:
Adding the eclipse plugin code of the code generator wizard.
After this addition the tools module will not be a functioning module unless a custom build
is performed since the eclipse classes need the eclipse jars for compiling. Hence the tools
module is permanently excluded from the main build.
The resources such as plugin.xml are in the resources folder

Added:
    webservices/axis/trunk/java/modules/tool/resources/
    webservices/axis/trunk/java/modules/tool/resources/codegen/
    webservices/axis/trunk/java/modules/tool/resources/codegen/build.properties
    webservices/axis/trunk/java/modules/tool/resources/codegen/icons/
    webservices/axis/trunk/java/modules/tool/resources/codegen/icons/sample.gif   (with props)
    webservices/axis/trunk/java/modules/tool/resources/codegen/plugin.xml
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/
    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/CodegenWizardPlugin.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OptionsPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OutputPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/WSDLFileSelectionPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/util/
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/util/UIConstants.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/resources/
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/resources/Codegen.properties

Added: webservices/axis/trunk/java/modules/tool/resources/codegen/build.properties
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/resources/codegen/build.properties?rev=170318&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/resources/codegen/build.properties (added)
+++ webservices/axis/trunk/java/modules/tool/resources/codegen/build.properties Sun May 15
23:04:32 2005
@@ -0,0 +1,6 @@
+source.Axis2CodegenWizard.jar = src/
+output.Axis2CodegenWizard.jar = bin/
+bin.includes = plugin.xml,\
+               Axis2CodegenWizard.jar,\
+               icons/,\
+               lib/

Added: webservices/axis/trunk/java/modules/tool/resources/codegen/icons/sample.gif
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/resources/codegen/icons/sample.gif?rev=170318&view=auto
==============================================================================
Binary file - no diff available.

Propchange: webservices/axis/trunk/java/modules/tool/resources/codegen/icons/sample.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: webservices/axis/trunk/java/modules/tool/resources/codegen/plugin.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/resources/codegen/plugin.xml?rev=170318&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/resources/codegen/plugin.xml (added)
+++ webservices/axis/trunk/java/modules/tool/resources/codegen/plugin.xml Sun May 15 23:04:32
2005
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+   id="Axis2_Codegen_Wizard"
+   name="Axis2 Codegen Wizard Plug-in"
+   version="1.0.0"
+   provider-name="Apache Software Foundation"
+   class="org.apache.axis.tool.codegen.eclipse.CodegenWizardPlugin">
+
+   <runtime>
+      <library name="Axis2CodegenWizard.jar">
+         <export name="*"/>
+      </library>
+      <library name="lib/Axis2-WSDL.jar">
+         <export name="*"/>
+      </library>
+      <library name="lib/Axis2-XML.jar">
+         <export name="*"/>
+      </library>
+      <library name="lib/axis-wsdl4j-1.2-RC3.jar">
+         <export name="*"/>
+      </library>
+      <library name="lib/stax-api-1.0.jar">
+         <export name="*"/>
+      </library>
+   </runtime>
+
+   <requires>
+      <import plugin="org.eclipse.ui"/>
+      <import plugin="org.eclipse.core.runtime"/>
+      <import plugin="org.eclipse.core.resources"/>
+      <import plugin="org.eclipse.ui.ide"/>
+   </requires>
+
+   <extension
+         point="org.eclipse.ui.newWizards">
+      <category
+            name="Axis2 Wizards"
+            id="Axis2_Codegen_Wizards">
+      </category>
+      <wizard
+            name="Axis2 Code Generator"
+            icon="icons/sample.gif"
+            category="Axis2_Codegen_Wizards"
+            class="org.apache.axis.tool.codegen.eclipse.CodeGenWizard"
+            id="org.apache.axis.tool.codegen.eclipse.CodeGenWizard">
+      </wizard>
+   </extension>
+
+</plugin>

Added: 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=170318&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java
(added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java
Sun May 15 23:04:32 2005
@@ -0,0 +1,190 @@
+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.util.HashMap;
+import java.util.Map;
+
+import javax.wsdl.WSDLException;
+
+import org.apache.axis.tool.codegen.eclipse.pages.OptionsPage;
+import org.apache.axis.tool.codegen.eclipse.pages.OutputPage;
+import org.apache.axis.tool.codegen.eclipse.pages.WSDLFileSelectionPage;
+import org.apache.axis.tool.codegen.eclipse.util.UIConstants;
+import org.apache.axis.wsdl.builder.WOMBuilderFactory;
+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.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+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.ide.IDE;
+
+/**
+ *  
+ */
+
+public class CodeGenWizard extends Wizard implements INewWizard {
+    private WSDLFileSelectionPage page1;
+
+    private OptionsPage page2;
+
+    private OutputPage page3;
+
+    private ISelection selection;
+
+    /**
+     * Constructor for CodeGenWizard.
+     */
+    public CodeGenWizard() {
+        super();
+        setNeedsProgressMonitor(true);
+    }
+
+    /**
+     * Adding the page to the wizard.
+     */
+
+    public void addPages() {
+        page1 = new WSDLFileSelectionPage(selection);
+        addPage(page1);
+        page2 = new OptionsPage();
+        addPage(page2);
+        page3 = new OutputPage();
+        addPage(page3);
+    }
+
+    /**
+     * 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 {
+           // getContainer().run(true, false, op);
+            doFinish();
+        } catch (Exception e) {
+            e.printStackTrace();
+            MessageDialog.openError(getShell(), CodegenWizardPlugin
+                    .getResourceString("general.Error"), e
+                    .getMessage());
+            return false;
+        }
+        MessageDialog.openInformation(this.getShell(),
+                CodegenWizardPlugin.getResourceString("genearal.name"),
+                CodegenWizardPlugin.getResourceString("wizard.success")
+                );
+        return true;
+    }
+
+    /**
+     * The worker method.
+     */
+
+    private void doFinish() {
+
+        try {
+                   
+            WSDLDescription wom = this.getWOM(page1.getFileName());
+            Map optionsMap = fillOptionMap();
+            CodeGenConfiguration codegenConfig = new CodeGenConfiguration(wom,
+                    optionsMap);
+            new CodeGenerationEngine(codegenConfig).generate();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+    } 
+
+    /**
+     *  
+     */
+    private Map fillOptionMap() {
+        Map optionMap = new HashMap();
+        
+        optionMap.put(CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
+                new CommandLineOption(
+                        CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
+                        getStringArray(page1.getFileName())));
+        
+        optionMap.put(CommandLineOptionConstants.ADVANCED_CODEGEN_OPTION,
+                new CommandLineOption(
+                        CommandLineOptionConstants.ADVANCED_CODEGEN_OPTION,
+                        new String[0]));
+        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())));
+        //System.out.println(page3.getOutputLocation());
+        return optionMap;
+    }
+
+   
+
+    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.
+     * 
+     * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+     */
+    public void init(IWorkbench workbench, IStructuredSelection selection) {
+        this.selection = selection;
+    }
+
+    private WSDLDescription getWOM(String wsdlLocation) throws WSDLException,
+            IOException {
+        InputStream in = new FileInputStream(new File(wsdlLocation));
+        return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in);
+    }
+    
+    private String[] getStringArray(String value){
+        String[] values = new String[1];
+        values[0]=value;
+        return values;
+    }
+}
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodegenWizardPlugin.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodegenWizardPlugin.java?rev=170318&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodegenWizardPlugin.java
(added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodegenWizardPlugin.java
Sun May 15 23:04:32 2005
@@ -0,0 +1,69 @@
+package org.apache.axis.tool.codegen.eclipse;
+
+import org.eclipse.ui.plugin.*;
+import org.osgi.framework.BundleContext;
+import java.util.*;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class CodegenWizardPlugin extends AbstractUIPlugin {
+	//The shared instance.
+	private static CodegenWizardPlugin plugin;
+	//Resource bundle.
+	private ResourceBundle resourceBundle;
+	
+	/**
+	 * The constructor.
+	 */
+	public CodegenWizardPlugin() {
+		super();
+		plugin = this;
+		try {
+			resourceBundle = ResourceBundle.getBundle("org.apache.axis.tool.codegen.resources.Codegen");
+		} catch (MissingResourceException x) {
+			resourceBundle = null;
+		}
+	}
+
+	/**
+	 * This method is called upon plug-in activation
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/**
+	 * This method is called when the plug-in is stopped
+	 */
+	public void stop(BundleContext context) throws Exception {
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance.
+	 */
+	public static CodegenWizardPlugin getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns the string from the plugin's resource bundle,
+	 * or 'key' if not found.
+	 */
+	public static String getResourceString(String key) {
+		ResourceBundle bundle = CodegenWizardPlugin.getDefault().getResourceBundle();
+		try {
+			return (bundle != null) ? bundle.getString(key) : key;
+		} catch (MissingResourceException e) {
+			return key;
+		}
+	}
+
+	/**
+	 * Returns the plugin's resource bundle,
+	 */
+	public ResourceBundle getResourceBundle() {
+		return resourceBundle;
+	}
+}

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OptionsPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OptionsPage.java?rev=170318&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OptionsPage.java
(added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OptionsPage.java
Sun May 15 23:04:32 2005
@@ -0,0 +1,114 @@
+/*
+ * 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.pages;
+
+import org.apache.axis.tool.codegen.eclipse.CodegenWizardPlugin;
+import org.apache.axis.tool.codegen.eclipse.util.UIConstants;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+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.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class OptionsPage extends WizardPage implements UIConstants {
+    
+    private Combo languageSelectionComboBox;
+    private Button syncOnlyRadioButton;
+    private Button asyncOnlyRadioButton;
+    private Text packageText;
+    /**
+     * @param pageName
+     */
+    public OptionsPage() {
+        super(CodegenWizardPlugin.getResourceString("page2.name"));
+		setTitle(CodegenWizardPlugin.getResourceString("page2.title"));
+		setDescription(CodegenWizardPlugin.getResourceString("page2.desc"));
+        
+    }
+
+    /*
+     * (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("page2.language.caption"));
+
+		languageSelectionComboBox = new Combo(container, SWT.DROP_DOWN |SWT.BORDER |SWT.READ_ONLY);
+		//fill the combo
+		this.fillLanguageCombo();
+		languageSelectionComboBox.setLayoutData(gd);
+		syncOnlyRadioButton = new Button(container,SWT.RADIO);
+		syncOnlyRadioButton.setText(CodegenWizardPlugin.getResourceString("page2.sync.caption"));
+		
+		asyncOnlyRadioButton = new Button(container,SWT.RADIO);
+		asyncOnlyRadioButton.setText(CodegenWizardPlugin.getResourceString("page2.async.caption"));
+		
+		
+		label = new Label(container, SWT.NULL);
+		label.setText(CodegenWizardPlugin.getResourceString("page2.package.caption"));
+		packageText = new Text(container,SWT.BORDER);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		packageText.setLayoutData(gd);
+		packageText.setText("default");
+		
+		setControl(container);
+		setPageComplete(true);
+
+    }
+    
+    private void fillLanguageCombo(){
+        
+        languageSelectionComboBox.add(JAVA);
+        languageSelectionComboBox.add(C_SHARP);
+        languageSelectionComboBox.add(C_PLUS_PLUS);
+        
+        languageSelectionComboBox.setText(languageSelectionComboBox.getItem(0));
+    }
+    
+    /**
+     * 
+     * @return
+     */
+    public String getSelectedLanguage(){
+        return languageSelectionComboBox.getItem(languageSelectionComboBox.getSelectionIndex());
+    }
+
+    public boolean isAsyncOnlyOn(){
+        return asyncOnlyRadioButton.getSelection();
+    }
+    
+    public boolean isSyncOnlyOn(){
+        return syncOnlyRadioButton.getSelection();
+    }
+    
+    public String getPackageName(){
+       return this.packageText.getText();
+    }
+}

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OutputPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OutputPage.java?rev=170318&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OutputPage.java
(added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/OutputPage.java
Sun May 15 23:04:32 2005
@@ -0,0 +1,142 @@
+/*
+ * 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.pages;
+
+import org.apache.axis.tool.codegen.eclipse.CodegenWizardPlugin;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.wizard.WizardPage;
+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;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+
+public class OutputPage extends WizardPage {
+    private Text outputLocation;
+
+    private Button browseButton;
+
+    private Button locationSelectCheckBox;
+
+    /**
+     * @param pageName
+     */
+    public OutputPage() {
+        super(CodegenWizardPlugin.getResourceString("page3.name"));
+        setTitle(CodegenWizardPlugin.getResourceString("page3.title"));
+        setDescription(CodegenWizardPlugin.getResourceString("page3.desc"));
+
+    }
+
+    /*
+     * (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("page3.output.caption"));
+
+        outputLocation = new Text(container, SWT.BORDER);
+        outputLocation.setLayoutData(gd);
+        outputLocation.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                handleModifyEvent();
+            }
+        });
+
+        browseButton = new Button(container, SWT.PUSH);
+        browseButton.setText(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);
+        this.setPageComplete(true);
+
+    }
+
+    public String getOutputLocation() {
+        return outputLocation.getText();
+    }
+
+    private void handleModifyEvent() {
+        String text = this.outputLocation.getText();
+        if ((text == null) || (text.trim().equals(""))) {
+            updateStatus(CodegenWizardPlugin
+                    .getResourceString("page3.error.nolocation"));
+            return;
+        }
+        updateStatus(null);
+    }
+
+    /**
+     * Updates the wizard page messages
+     * 
+     * @param message
+     */
+    private void updateStatus(String message) {
+        setErrorMessage(message);
+        setPageComplete(message == null);
+    }
+
+    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,
+    				"Select new file container");
+    		if (dialog.open() == ContainerSelectionDialog.OK) {
+    			Object[] result = dialog.getResult();
+    			if (result.length == 1) {
+    				outputLocation.setText(((Path)result[0]).toOSString());
+    			}
+    		}
+        }
+    }
+}

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/WSDLFileSelectionPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/WSDLFileSelectionPage.java?rev=170318&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/WSDLFileSelectionPage.java
(added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/pages/WSDLFileSelectionPage.java
Sun May 15 23:04:32 2005
@@ -0,0 +1,116 @@
+package org.apache.axis.tool.codegen.eclipse.pages;
+
+import org.apache.axis.tool.codegen.eclipse.CodegenWizardPlugin;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.jface.viewers.*;
+
+/**
+ * The first page of the code generator wizrad. 
+ * Asks for the WSDL file Name
+ */
+
+public class WSDLFileSelectionPage extends WizardPage {
+	
+	private Text fileText;
+	private ISelection selection;
+
+	/**
+	 * 
+	 * @param pageName
+	 */
+	public WSDLFileSelectionPage(ISelection selection) {
+		super(CodegenWizardPlugin.getResourceString("page1.name"));
+		setTitle(CodegenWizardPlugin.getResourceString("page1.title"));
+		setDescription(CodegenWizardPlugin.getResourceString("page1.desc"));
+		this.selection = selection;
+	}
+
+	/**
+	 * @see IDialogPage#createControl(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("page1.fileselection.label"));
+
+		fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		fileText.setLayoutData(gd);
+		fileText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				dialogChanged();
+			}
+		});
+		
+		Button button = new Button(container, SWT.PUSH);
+		button.setText(CodegenWizardPlugin.getResourceString("page1.fileselection.browse"));
+		button.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				handleBrowse();
+			}
+		});
+		setControl(container);
+	}
+	
+	/**
+	 * Handle the dialog change event. Basically evaluates the file name
+	 * and sets the error message accordingly 
+	 */
+	private void dialogChanged() {
+	    
+	    String fileName = getFileName();
+	    
+	    if (fileName.length() == 0) {
+			updateStatus(CodegenWizardPlugin.getResourceString("page1.error.filemissingerror"));
+			return;
+		}
+	    
+		int dotLoc = fileName.lastIndexOf('.');
+		
+		if (dotLoc != -1) {
+			String ext = fileName.substring(dotLoc + 1);
+			if (ext.equalsIgnoreCase("wsdl") == false) {
+				updateStatus(CodegenWizardPlugin.getResourceString("File extension must be wsdl"));
+				return;
+			}
+		}  
+	    updateStatus(null);
+	}
+	
+	/**
+	 * Pops up the file browse dialog box
+	 *
+	 */
+	private void handleBrowse(){
+	    FileDialog fileDialog = new FileDialog(this.getShell());
+	    fileDialog.setFilterExtensions(new String[]{"*.wsdl"});
+	    String fileName = fileDialog.open();
+	    if (fileName!=null){
+	        fileText.setText(fileName);
+	    }
+	   
+	}
+	
+	/**
+	 * Updates the wizard page messages
+	 * @param message
+	 */
+	private void updateStatus(String message) {
+		setErrorMessage(message);
+		setPageComplete(message == null);
+	}
+
+	public String getFileName() {
+		return fileText.getText();
+	}
+}
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/util/UIConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/util/UIConstants.java?rev=170318&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/util/UIConstants.java
(added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/util/UIConstants.java
Sun May 15 23:04:32 2005
@@ -0,0 +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
+ *
+ *      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.util;
+
+public interface UIConstants {
+    public static final String JAVA = "Java" ;
+    public static final String C_SHARP = "C#" ;
+    public static final String C_PLUS_PLUS = "C++" ;
+
+}

Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/resources/Codegen.properties
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/resources/Codegen.properties?rev=170318&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/resources/Codegen.properties
(added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/resources/Codegen.properties
Sun May 15 23:04:32 2005
@@ -0,0 +1,48 @@
+#############################################################################
+################### Property file for the Axis2 Code generator ##############
+#############################################################################
+##
+#General
+general.Error=Error
+genearal.name=Axis2 Codegen Wizard
+#WSDL selection page 
+#WSDL selection page name
+page1.name=Axis2 Code generation wizard
+#WSDL selection page title
+page1.title=WSDL selection page
+#WSDL selection page Description
+page1.desc=Welcome to the Axis2 code generator wizard. Select the WSDL file
+#WSDL file selection label caption
+page1.fileselection.label=&WSDL file:
+#WSDL browse button caption
+page1.fileselection.browse=Browse...
+#Errors
+page1.error.filemissingerror=File name should be specified
+page1.error.wrongextension=File extension must be wsdl
+#
+###################################################################
+#Options page
+#Options selection page
+page2.name=Axis2 Code generation wizard
+page2.title=Options
+page2.desc=Set the options for the code generator
+#labels
+page2.language.caption=Select the output language
+page2.sync.caption=Generate sync style only
+page2.async.caption=Generate async style only
+page2.package.caption=Set the package name
+####################################################################### 
+#Output Page3  
+page3.name=Axis2 Code generation wizard
+page3.title=Output
+page3.desc=Set the output project for the generated code
+#lables
+page3.output.caption=Output path
+page3.outselection.browse=Browse...
+#errors
+page3.error.nolocation=output location needs to be specified
+#
+##########################################################################
+# Wizard
+#Success message
+wizard.success=Code generation successful!



Mime
View raw message