You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2007/07/03 14:02:45 UTC
svn commit: r552799 [2/2] - in
/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache:
axis2/tools/bean/ axis2/tools/component/ axis2/tools/idea/
axis2/tools/java2wsdl/ axis2/tools/wizardframe/ ideaplugin/frames/
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java Tue Jul 3 05:02:43 2007
@@ -19,264 +19,246 @@
package org.apache.axis2.tools.java2wsdl;
import org.apache.axis2.tools.bean.WsdlgenBean;
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+
import javax.swing.*;
-import java.awt.event.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
-import java.awt.event.MouseListener ;
-import java.awt.event.MouseEvent ;
import java.awt.*;
import java.io.File;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.module.Module;
-public class OutputPanel extends JPanel implements ActionListener,MouseListener {
-
- JLabel lblTitle;
- JLabel lblLocation;
- JLabel lblFileName;
-
- JRadioButton rbtnAdd;
- JRadioButton rbtnSave;
-
- JTextField txtLocation;
- JTextField txtFileName;
-
- JButton btnBrowes;
+/** this class java 2 wsdl output wizard panel */
+public class OutputPanel extends WizardPanel {
+ private JRadioButton rbtnAdd;
+ private JRadioButton rbtnSave;
+ private JComboBox cmbCurrentProject;
+ private JComboBox cmbModuleSrc;
+ private JTextField txtLocation;
+ private JTextField txtFileName;
+ private JButton btnBrowes;
final JFileChooser DirChooser=new JFileChooser();
+ private Project project;
private WsdlgenBean wsdlgenBean;
- private Java2WSDLFrame java2WSDLFrame;
-
- public OutputPanel(Java2WSDLFrame java2WSDLFrame,WsdlgenBean wsdlgenBean){
+ /**
+ * Constructor
+ * @param wizardComponents
+ * @param wsdlgenBean
+ * @param project
+ */
+ public OutputPanel(WizardComponents wizardComponents,WsdlgenBean wsdlgenBean, Project project){
+ super(wizardComponents, "Option was choosed");
+ setPanelTopTitle("WSDl file output location");
+ setPanelBottomTitle("Select the location for the generated WSDL");
this.wsdlgenBean=wsdlgenBean;
- this.java2WSDLFrame=java2WSDLFrame;
- OutputLayout customLayout=new OutputLayout();
- setLayout(customLayout);
-
- setFont(new Font("Helvetica", Font.PLAIN, 12));
-
- // Add label and textfield
- lblTitle =new JLabel("Select the location where to put the output");
- add(lblTitle );
-
- rbtnAdd =new JRadioButton("Browes and Add the WSDL to a project on current workspace");
- add(rbtnAdd );
- rbtnAdd .setSelected(false);
- rbtnAdd .addActionListener(this);
-
-
- rbtnSave =new JRadioButton("Browes and Save the WSDL file on local filesystem ");
- add(rbtnSave );
- rbtnSave .addActionListener(this);
- rbtnSave .setSelected(true);
-
-
-
- lblLocation =new JLabel("OutPut Location");
- add(lblLocation );
-
- txtLocation =new JTextField();
- add(txtLocation );
- txtLocation .setEnabled(true);
- txtLocation .addActionListener(this);
- txtLocation.addMouseListener(this);
-
-
- btnBrowes=new JButton("Browse...");
- add(btnBrowes);
- btnBrowes.setEnabled(true);
- btnBrowes.addActionListener(this);
-
-
- lblFileName =new JLabel("OutPut File Name");
- add(lblFileName );
-
- txtFileName =new JTextField();
- add(txtFileName );
- txtFileName .setEnabled(true);
- txtFileName .addActionListener(this);
- txtFileName .addMouseListener(this);
-
-
- setSize(getPreferredSize());
-
-
+ this.project=project;
+ init();
}
- protected void initializeDefaultSettings() {
-
- txtLocation.setText(wsdlgenBean.getOutputLocation() );
- txtFileName.setText(wsdlgenBean.getOutputWSDLName());
+ private void init(){
- }
- public void setOutput(){
+ rbtnAdd =new JRadioButton("Browes and Add the WSDL to a project on current Idea workspace",false);
- wsdlgenBean.setOutputLocation(txtLocation .getText() );
- wsdlgenBean.setOutputWSDLName(txtFileName .getText() );
+ rbtnSave =new JRadioButton("Browes and Save the WSDL file on local file system",true);
- }
+ cmbCurrentProject =new JComboBox();
+ cmbCurrentProject.setEnabled(false);
+ cmbModuleSrc=new JComboBox();
+ cmbModuleSrc.setEnabled(false);
+ ButtonGroup buttonGroup= new ButtonGroup();
+ buttonGroup.add(rbtnAdd );
+ buttonGroup.add(rbtnSave );
- public void actionPerformed(ActionEvent e){
- Object obj=e.getSource();
- if(obj==btnBrowes) {
- DirChooser .setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = DirChooser.showOpenDialog(this);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- DirChooser.setFileSelectionMode(JFileChooser .FILES_ONLY );
- File newfile = DirChooser.getSelectedFile();
- BottomPanel.setEnable(true,false, true, true);
- txtLocation.setText(newfile.getAbsolutePath());
- }
- } else if(obj == rbtnAdd ) {
- rbtnSave .setSelected(false);
- txtLocation .setEnabled(false);
- btnBrowes.setEnabled(false);
- txtFileName .setEnabled(false);
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setOutputLocation(java2WSDLFrame .getActiveProject().getProjectFilePath() );
- wsdlgenBean.setOutputWSDLName("Services.wsdl" );
- }else if(obj == rbtnSave ) {
- rbtnAdd .setSelected(false);
- txtLocation .setEnabled(true);
- btnBrowes.setEnabled(true);
- txtFileName .setEnabled(true);
-
- } else if(obj ==txtFileName ){
- if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtFileName.getText().trim());
- }
- } else if(obj ==txtLocation ){
- if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtLocation.getText().trim());
- }
- }
- }
- public void mouseClicked(MouseEvent e) {
- Object obj = e.getSource();
- if(obj ==txtFileName ){
- if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtFileName.getText().trim());
- }
- } else if(obj ==txtLocation ){
- if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtLocation.getText().trim());
- }
- }
- }
+ txtFileName =new JTextField();
- public void mouseEntered(MouseEvent e) {
- }
+ txtLocation=new JTextField();
- public void mouseExited(MouseEvent e) {
- Object obj = e.getSource();
- if(obj ==txtFileName ){
- if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtFileName.getText().trim());
- }
- } else if(obj ==txtLocation ){
- if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtLocation.getText().trim());
- }
- }
- }
-
- public void mousePressed(MouseEvent e) {
- Object obj = e.getSource();
- if(obj ==txtFileName ){
- if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtFileName.getText().trim());
- }
- } else if(obj ==txtLocation ){
- if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtLocation.getText().trim());
- }
- }
- }
+ btnBrowes=new JButton("Browse..");
- public void mouseReleased(MouseEvent e) {
- Object obj = e.getSource();
- if(obj ==txtFileName ){
- if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtFileName.getText().trim());
- }
- } else if(obj ==txtLocation ){
- if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
- BottomPanel.setEnable(true,false, true, true);
- wsdlgenBean.setServiceName(txtLocation.getText().trim());
- }
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(false);
+ setFinishButtonEnabled(false);
+ this.setLayout(new GridBagLayout());
+
+ this.add(new JLabel("Select the location where to put the output")
+ , new GridBagConstraints(0, 0, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 10), 0, 0));
+
+ this.add(rbtnAdd
+ , new GridBagConstraints(0, 1, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+ rbtnAdd.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ loadCmbCurrentProject();
+ cmbCurrentProject.setEnabled(true);
+ cmbModuleSrc.setEnabled(true);
+ txtLocation.setEnabled(false);
+ btnBrowes.setEnabled(false);
+ setFinishButtonEnabled(true);
+ update();
+ }
+ });
+
+ this.add(new JLabel("Select the Module")
+ , new GridBagConstraints(0, 2, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(cmbCurrentProject
+ , new GridBagConstraints(1, 2, GridBagConstraints.RELATIVE, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0,0), 0, 0));
+ cmbCurrentProject.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ loadcmbModuleSrcProject();
+ update();
+ }
+ });
+ this.add(new JLabel("Select the Directory")
+ , new GridBagConstraints(0, 3, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(cmbModuleSrc
+ , new GridBagConstraints(1, 3, GridBagConstraints.RELATIVE, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0,0), 0, 0));
+ cmbModuleSrc.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ update();
+ }
+ });
+
+ this.add(rbtnSave
+ , new GridBagConstraints(0, 4, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,0), 0, 0));
+ rbtnSave.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ cmbCurrentProject.setEnabled(false);
+ cmbModuleSrc.setEnabled(false);
+ txtLocation.setEnabled(true);
+ btnBrowes.setEnabled(true);
+ update();
+ }
+ });
+ this.add(new JLabel("OutPut Location")
+ , new GridBagConstraints(0, 5, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,0), 0, 0));
+
+ this.add(txtLocation
+ , new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(btnBrowes
+ , new GridBagConstraints(2, 5, 1, 1, 0.1, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 10), 0, 0));
+
+ btnBrowes.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ DirChooser .setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int returnVal = DirChooser.showOpenDialog(btnBrowes );
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ DirChooser.setFileSelectionMode(JFileChooser .FILES_ONLY );
+ File newfile = DirChooser.getSelectedFile();
+ txtLocation.setText(newfile.getAbsolutePath() );
+ }
+ update();
+ }
+ });
+
+ this.add(new JLabel("OutPut File Name")
+ , new GridBagConstraints(0, 6, 1, 1, 0.1, 1.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(txtFileName
+ , new GridBagConstraints(1, 6, 1, 1, 1.0, 1.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ wsdlgenBean.setProject(project);
+ }
+
+ public void loadCmbCurrentProject() {
+ Module modules[] = wsdlgenBean.getModules();
+
+ if (modules != null) {
+ for (int count = 0; count < modules.length; count++) {
+ cmbCurrentProject.addItem(modules[count].getName());
+ }
+ }else{
+ rbtnAdd.setEnabled(false);
+ }
+ }
+ public void loadcmbModuleSrcProject() {
+ String module = null;
+ module = (String) cmbCurrentProject.getSelectedItem();
+ cmbModuleSrc.removeAllItems();
+ int count = 0;
+ if (module != null) {
+ String src[] = wsdlgenBean.getModuleSrc(module);
+ for ( count = 0; count < src.length; count++) {
+ cmbModuleSrc.addItem(src[count]);
+ }
+ count = src.length;
+ }else{
+ rbtnAdd.setEnabled(false);
+ cmbCurrentProject.setEnabled(false);
+ cmbModuleSrc.setEnabled(false);
+ }
+
+
+ }
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_OPTION_B );
+ }
+
+ public void next() {
+
+ }
+
+ public void update(){
+ if(rbtnSave.isSelected()){
+ if(txtFileName.getText() !=null && txtLocation.getText() !=null) {
+ wsdlgenBean.setOutputWSDLName(txtFileName.getText());
+ wsdlgenBean.setOutputLocation(txtLocation.getText());
+ setFinishButtonEnabled(true);
+ }else if(txtLocation.getText() !=null){
+ wsdlgenBean.setOutputLocation(txtLocation.getText());
+ setFinishButtonEnabled(false);
+ }else if(txtFileName.getText() !=null){
+ wsdlgenBean.setOutputWSDLName(txtFileName .getText());
+ setFinishButtonEnabled(false);
+ } else
+ setFinishButtonEnabled(false);
+ }else if(rbtnAdd.isSelected()){
+ if(txtFileName.getText() !=null && cmbModuleSrc.getSelectedItem() !=null){
+ wsdlgenBean.setOutputWSDLName(txtFileName.getText());
+ wsdlgenBean.setOutputLocation(cmbModuleSrc.getSelectedItem().toString());
+ setFinishButtonEnabled(true);
+ }else if(txtFileName .getText() !=null){
+ wsdlgenBean.setOutputWSDLName(txtFileName .getText());
+ setFinishButtonEnabled(false);
+ }else
+ setFinishButtonEnabled(false);
}
- }
-}
-
-
-class OutputLayout implements LayoutManager{
-
- public OutputLayout (){
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(false);
}
-
- public void addLayoutComponent(String name, Component comp) {
- }
- public void removeLayoutComponent(Component comp) {
- }
- public Dimension preferredLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
-
- Insets insets = parent.getInsets();
- dim.width = 400 + insets.left + insets.right;
- dim.height = 400 + insets.top + insets.bottom;
-
- return dim;
- }
- public Dimension minimumLayoutSize(Container parent) {
- return new Dimension(0, 0);
- }
-
- public void layoutContainer(Container parent){
- Insets insets = parent.getInsets();
-
- Component c;
-
- c = parent.getComponent(0);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 10, 400, 24);
- }
- c = parent.getComponent(1);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 40, 400, 24);
- }
- c = parent.getComponent(2);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 70, 400, 24);
- }
- c = parent.getComponent(3);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 110, 100, 24);
- }
- c = parent.getComponent(4);
- if (c.isVisible()) {
- c.setBounds(insets.left + 130, insets.top + 110, 290, 24);
- }
- c = parent.getComponent(5);
- if (c.isVisible()) {
- c.setBounds(insets.left + 420, insets.top + 110, 80, 24);
- }
- c = parent.getComponent(6);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 150, 100, 24);
- }
- c = parent.getComponent(7);
- if (c.isVisible()) {
- c.setBounds(insets.left + 130, insets.top + 150, 290, 24);
- }
+ public int getPageType() {
+ return WizardPanel.JAVA_2_WSDL_TYPE;
}
}
+
\ No newline at end of file
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/CodegenFrame.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/CodegenFrame.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/CodegenFrame.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/CodegenFrame.java Tue Jul 3 05:02:43 2007
@@ -24,25 +24,29 @@
import org.apache.axis2.tools.idea.ChooserPanel;
import org.apache.axis2.tools.component.Utilities;
import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.java2wsdl.MiddlePanel;
+import org.apache.axis2.tools.java2wsdl.OptionPanel;
+import org.apache.axis2.tools.java2wsdl.OutputPanel;
+import com.intellij.openapi.project.Project;
/**
* codeaFrame class
*/
public class CodegenFrame extends WizardFrame{
+ /**
+ * variable
+ */
public static final int PANEL_CHOOSER = 0;
public static final int PANEL_FIRST_A = 1; //
- public static final int PANEL_FIRST_B = 2;
+ public static final int PANEL_FIRST_B = 1;
public static final int PANEL_OPTION_A =2;
- public static final int PANEL_OPTION_B = 3;
+ public static final int PANEL_OPTION_B = 2;
public static final int PANEL_LAST_A = 3;
- public static final int PANEL_LAST_B = 6;
+ public static final int PANEL_LAST_B = 3;
- private WsdlgenBean wsdlgenBean;
- private CodegenBean codegenBean;
-
- public CodegenFrame() {
- super();
+ public CodegenFrame(Project project) {
+ super(project);
init();
}
@@ -59,23 +63,23 @@
/*
panel = new FirstPanel(getWizardComponents(),codegenBean);
getWizardComponents().addWizardPanel(PANEL_FIRST_A , panel);
-
- panel = new J2WFristWizardPanel(getWizardComponents(),wsdlgenBean );
+ */
+ panel = new MiddlePanel(getWizardComponents(),wsdlgenBean );
getWizardComponents().addWizardPanel(PANEL_FIRST_B, panel);
- panel = new SecondPanel(getWizardComponents(),codegenBean);
+ /* panel = new SecondPanel(getWizardComponents(),codegenBean);
getWizardComponents().addWizardPanel(PANEL_OPTION_A , panel);
-
- panel = new J2WOptionWizardPanel(getWizardComponents(),wsdlgenBean);
+ */
+ panel = new OptionPanel(getWizardComponents(),wsdlgenBean);
getWizardComponents().addWizardPanel(PANEL_OPTION_B , panel);
-
+ /*
panel = new OutPutPanel(getWizardComponents(),codegenBean);
getWizardComponents().addWizardPanel(PANEL_LAST_A , panel);
+ */
+ panel = new OutputPanel(getWizardComponents(),wsdlgenBean,project);
+ getWizardComponents().addWizardPanel(PANEL_LAST_B , panel);
- panel = new J2WLocationWizardPanel(getWizardComponents(),wsdlgenBean);
- getWizardComponents().addWizardPanel(PANEL_LAST_B , panel);*/
-
- setSize(650, 600);
+ setSize(550,700);
Utilities.centerComponentOnScreen(this);
}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/WizardFrame.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/WizardFrame.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/WizardFrame.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/WizardFrame.java Tue Jul 3 05:02:43 2007
@@ -19,6 +19,9 @@
package org.apache.axis2.tools.wizardframe;
import org.apache.axis2.tools.component.*;
+import org.apache.axis2.tools.bean.WsdlgenBean;
+import org.apache.axis2.tools.bean.CodegenBean;
+import org.apache.axis2.tools.idea.ProgressBarPanel;
import javax.swing.*;
import java.awt.*;
@@ -26,6 +29,10 @@
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.TimerTask;
+import java.io.*;
+
+import com.intellij.openapi.project.Project;
/**
* wizardFrame class
@@ -41,8 +48,13 @@
private JLabel errorLabel;
private JPanel errorPanel;
private WizardComponents wizardComponents;
+ protected WsdlgenBean wsdlgenBean;
+ protected CodegenBean codegenBean;
+ protected Project project;
+ private ProgressBarPanel progress;
- public WizardFrame() {
+ public WizardFrame(Project project) {
+ this.project=project;
init();
}
@@ -63,13 +75,14 @@
this.getContentPane().add(wizardComponents.getWizardPanelsContainer()
, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0
- , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.BOTH
, new Insets(10, 0, 0, 0), 0, 0));
- /* this.getContentPane().add(new ProgressBarPanel(wizardComponents)
+ progress =new ProgressBarPanel();
+ this.getContentPane().add(progress
, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0
- , GridBagConstraints.CENTER, GridBagConstraints.NONE
- , new Insets(10, 0, 0, 0), 0, 0)); */
+ , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL
+ , new Insets(10, 5, 5, 5), 0, 0));
this.getContentPane().add(new JSeparator()
, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0
@@ -79,10 +92,11 @@
this.getContentPane().add(createButtonPanel(),
new GridBagConstraints(0, 5, 1, 1, 1.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE,
- new Insets(20, 20, 20, 20), 0, 0));
+ new Insets(10, 10, 10, 10), 0, 0));
ImageIcon img=new ImageIcon("icons/icon.png");
this.setIconImage(img.getImage());
+ this.setFont(new Font("Helvetica", Font.PLAIN, 8));
wizardComponents.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
@@ -139,6 +153,7 @@
panel.setBackground(Color.white );
panelTopTitleLabel = new JLabel();
+ panelTopTitleLabel.setFont(new Font("Helvetica", Font.BOLD, 12));
panelBottomTitleLabel=new JLabel();
@@ -168,7 +183,7 @@
, new Insets(10,20, 0, 0), 0, 0));
panel.add(panelImageLabel
- , new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
+ , new GridBagConstraints(1, 0, 1,2, 0.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.BOTH
, new Insets(0, 0, 0, 0), 0, 0));
@@ -194,7 +209,26 @@
return new FinishAction(wizardComponents) {
public void performAction() {
System.out.println("FinishAction performed");
- dispose();
+ try {
+ wizardComponents.getCurrentPanel().update();
+ switch (wizardComponents.getCurrentPanel().getPageType()) {
+ case WizardPanel .WSDL_2_JAVA_TYPE:
+ doFinishWSDL2Java();
+ System.out.println("FinishAction WSDL2Java performed");
+ break;
+ case WizardPanel.JAVA_2_WSDL_TYPE:
+ doFinishJava2WSDL();
+ System.out.println("FinishAction Java2WSDL performed");
+ break;
+ case WizardPanel.UNSPECIFIED_TYPE:
+ break; //Do nothing
+ default:
+ throw new RuntimeException("Invalid state!");
+ }
+ } catch (Exception e) {
+ dispose();
+ }
+
}
};
}
@@ -215,5 +249,134 @@
wizardComponents.getCancelAction().performAction();
}
});
+ }
+
+ protected void handlePragress(){
+ progress.setVisible(true);
+ progress.aboutToDisplayPanel();
+ progress.displayingPanel();
+ new java.util.Timer(true).schedule(new TimerTask() {
+ public void run() {
+ progress .requestStop();
+ }
+ }, 1000);
+ }
+
+ protected void handleSuccess(){
+ StringWriter writer = new StringWriter();
+ JOptionPane.showMessageDialog(errorPanel ,
+ "Code genaration Successful !" + writer.toString(),
+ "Axis2 code generation",
+ JOptionPane.INFORMATION_MESSAGE );
+ }
+
+ protected void handleError(){
+ StringWriter writer = new StringWriter();
+ JOptionPane.showMessageDialog(errorPanel ,
+ "Code genaration failed! !" + writer.toString(),
+ "Axis2 code generation",
+ JOptionPane.ERROR_MESSAGE );
+ }
+
+ private void addLibsToProjectLib(String libDirectory, String outputLocation){
+ String newOutputLocation = outputLocation+File.separator+"aaaa";
+ //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();
+ }
+ protected void doFinishWSDL2Java(){
+ handlePragress();
+ new java.util.Timer(true).schedule(new TimerTask() {
+ public void run() {
+ try {
+ // wsdlgenBean.generate(); ToDO
+ progress.setVisible(false);
+ handleSuccess();
+ dispose();
+ } catch (Exception e1) {
+ progress.setVisible(false);
+ handleError();
+ dispose();
+ }
+
+ }
+ }, 3100);
+ }
+ protected void doFinishJava2WSDL(){
+ handlePragress();
+ new java.util.Timer(true).schedule(new TimerTask() {
+ public void run() {
+ try {
+ wsdlgenBean.generate();
+ progress.setVisible(false);
+ handleSuccess();
+ dispose();
+ } catch (Exception e1) {
+ progress.setVisible(false);
+ handleError();
+ dispose();
+ }
+ }
+ }, 3100);
}
}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/Axi2PluginPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/Axi2PluginPage.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/Axi2PluginPage.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/Axi2PluginPage.java Tue Jul 3 05:02:43 2007
@@ -19,8 +19,7 @@
package org.apache.ideaplugin.frames;
import com.intellij.openapi.project.Project;
-import org.apache.axis2.tools.idea.Java2CodeFrame;
-import org.apache.axis2.tools.java2wsdl.Java2WSDLFrame;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
import org.apache.axis2.tools.wizardframe.CodegenFrame;
@@ -131,9 +130,9 @@
this.hide();
setVisible(false);
if (codeGen.isSelected()) {
- codegenFrame = new CodegenFrame();
+ codegenFrame = new CodegenFrame(project);
codegenFrame.setVisible(true);
- codegenFrame .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ codegenFrame .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}else{
ServiceArciveFrame window = new ServiceArciveFrame();
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org