You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2005/06/22 11:32:07 UTC

svn commit: r191786 - in /webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen: Java2WSDLGenerator.java eclipse/CodeGenWizard.java eclipse/ui/JavaSourceSelectionPage.java eclipse/ui/JavaWSDLOptionsPage.java

Author: ajith
Date: Wed Jun 22 02:32:06 2005
New Revision: 191786

URL: http://svn.apache.org/viewcvs?rev=191786&view=rev
Log:
Making a slight change to the options

Modified:
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java
    webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java

Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java?rev=191786&r1=191785&r2=191786&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/Java2WSDLGenerator.java Wed Jun 22 02:32:06 2005
@@ -15,6 +15,9 @@
  */
 package org.apache.axis.tool.codegen;
 
+
+import java.util.Vector;
+
 import org.apache.axis.utils.ClassUtils;
 import org.apache.axis.wsdl.fromJava.Emitter;
 
@@ -34,7 +37,8 @@
             String portypeName,
             String style,
             String outputFileName,
-            int mode) throws Throwable{
+            int mode,
+            Vector listOfIncludedMethods) throws Throwable{
         try {
 
             ClassUtils.setDefaultClassLoader(ClassUtils.createClassLoader(
@@ -61,6 +65,8 @@
             //Style
             if (style!=null && !style.trim().equals(""))
                 emitter.setStyle(style);
+            if (listOfIncludedMethods!=null)
+                emitter.setAllowedMethods(listOfIncludedMethods);
             
             if (mode!= Emitter.MODE_ALL &&
                     mode!= Emitter.MODE_IMPLEMENTATION &&

Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java?rev=191786&r1=191785&r2=191786&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/CodeGenWizard.java Wed Jun 22 02:32:06 2005
@@ -251,7 +251,8 @@
                              java2wsdlOptionsPage.getPortypeName(),
                              java2wsdlOptionsPage.getStyle(),
                              java2wsdlOutputLocationPage.getFullFileName(),
-                             java2wsdlOptionsPage.getMode()
+                             java2wsdlOptionsPage.getMode(),
+                             javaSourceSelectionPage.getSelectedMethods()
                      );
                      monitor.worked(1);
                  }

Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java?rev=191786&r1=191785&r2=191786&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaSourceSelectionPage.java Wed Jun 22 02:32:06 2005
@@ -15,18 +15,29 @@
  */
 package org.apache.axis.tool.codegen.eclipse.ui;
 
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Vector;
+
 import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.swt.widgets.Text;
 
 public class JavaSourceSelectionPage extends AbstractWizardPage{
@@ -34,7 +45,11 @@
    
     private Text javaClassFileLocationBox;
     private Text javaClassNameBox;
-
+    private Button searchDeclaredMethodsCheckBox;
+    
+    private Table table;
+    
+    private boolean dirty;
 
     public JavaSourceSelectionPage() {  
         super("page4");
@@ -110,10 +125,35 @@
                 .getResourceString("general.search"));
         searchButton.addSelectionListener(new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
-                //handleDirectoryBrowse();
+                updateTable();
+            }
+        });
+        //searchButton.setEnabled(false);
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 3;
+        
+        searchDeclaredMethodsCheckBox = new Button(container,SWT.CHECK);
+        searchDeclaredMethodsCheckBox.setLayoutData(gd);
+        searchDeclaredMethodsCheckBox.setText("List Declared Methods Only");
+        searchDeclaredMethodsCheckBox.addSelectionListener(new SelectionListener(){
+            public void widgetSelected(SelectionEvent e){
+                updateDirtyStatus(true);//dirty
             }
+            public void widgetDefaultSelected(SelectionEvent e){} 
         });
-        searchButton.setEnabled(false);
+        
+        gd = new GridData(GridData.FILL_BOTH);
+        gd.horizontalSpan=3;
+        gd.verticalSpan=5;
+        table = new Table(container,SWT.SINGLE|SWT.FULL_SELECTION|SWT.CHECK);
+        table.setLinesVisible(true);
+        table.setHeaderVisible(true); 
+        table.setLayoutData(gd);
+        declareColumn(table,20,"");
+        declareColumn(table,100,"Method Name");
+        declareColumn(table,100,"Return Type");
+        declareColumn(table,100,"Parameter Count");
+        table.setVisible(false);
         
         setPageComplete(false);
         
@@ -126,6 +166,11 @@
 
     }
 
+    private void declareColumn(Table table, int width,String colName){
+        TableColumn column = new TableColumn(table,SWT.NONE);
+        column.setWidth(width);
+        column.setText(colName);
+    }
     /**
      * Pops up the file browse dialog box
      *  
@@ -167,5 +212,66 @@
     
     public String getClassLocation(){
         return javaClassFileLocationBox.getText();
+    }
+    
+    public Vector getSelectedMethods(){
+        Vector list = new Vector();
+        TableItem[] items = table.getItems();
+        int itemLength = items.length;
+        for(int i=0;i<itemLength;i++){
+           if(items[i].getChecked()){
+               list.add(items[i].getText(1));//get the selected method name only
+           }
+        }
+        return list;
+    }
+    
+    private void updateTable() {
+        //get a URL from the class file location
+        try {
+            String classFileLocation = this.getClassLocation();
+            URL classFileURL = new File(classFileLocation).toURL();
+            ClassLoader loader = new URLClassLoader(new URL[] { classFileURL });
+
+            Class clazz = loader.loadClass(getClassName());
+            Method[] methods = null;
+            
+            if (searchDeclaredMethodsCheckBox.getSelection()){
+                methods = clazz.getDeclaredMethods();
+            }else{
+                methods = clazz.getMethods();
+            }
+
+            int methodCount = methods.length;
+            if (methodCount > 0) {
+                table.removeAll();
+                TableItem[] items = new TableItem[methodCount]; // An item for each field
+                for (int i = 0 ; i < methodCount; i++){
+                   items[i] = new TableItem(table, SWT.NONE);
+                   items[i].setText(1,methods[i].getName());
+                   items[i].setText(2,methods[i].getReturnType().getName());
+                   items[i].setText(3,methods[i].getParameterTypes().length+"");
+                   items[i].setChecked(true);//check them all by default
+                }
+                table.setVisible(true);
+                
+                //update the dirty variable
+               updateDirtyStatus(false);
+               updateStatus(null);
+            }
+
+        } catch (MalformedURLException e) {
+           updateStatus("Error : invalid location " +e.getMessage());
+        } catch (ClassNotFoundException e) {
+           updateStatus("Error : Class not found " + e.getMessage());
+        }
+    }
+    
+    private void updateDirtyStatus(boolean status){
+        dirty = status;
+        if (table.isVisible()){
+            table.setEnabled(!status);
+        }
+        setPageComplete(!status);
     }
 }

Modified: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java?rev=191786&r1=191785&r2=191786&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java (original)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/codegen/eclipse/ui/JavaWSDLOptionsPage.java Wed Jun 22 02:32:06 2005
@@ -78,6 +78,7 @@
     
     private Combo styleSelectionCombo;
 
+
     //TODO need more here
 
     /*
@@ -251,6 +252,8 @@
         }
     }
     
+
+    
     public String getStyle(){
         return this.styleSelectionCombo.getItem(styleSelectionCombo.getSelectionIndex()).toUpperCase();
     }
@@ -269,4 +272,11 @@
     public String getBindingName() {
         return this.bindingTextBox.getText();
     }
+    
+   private String getgetClassFileLocation(){
+       return null;
+   }
+    
+   
+ 
 }