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 sa...@apache.org on 2007/07/27 06:59:57 UTC
svn commit: r560098 [2/2] - in
/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin:
plugin/resources/ src/main/java/org/apache/axis2/tools/bean/
src/main/java/org/apache/axis2/tools/component/
src/main/java/org/apache/axis2/tools/idea/ src/mai...
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java?view=auto&rev=560098
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java Thu Jul 26 21:59:54 2007
@@ -0,0 +1,205 @@
+package org.apache.ideaplugin.frames;
+
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+import org.apache.axis2.tools.java2wsdl.JarFileFilter;
+import org.apache.ideaplugin.bean.ArchiveBean;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.io.File;
+
+
+public class LibraryAddingPage extends WizardPanel {
+
+ private JTextField txtJarLocation;
+ private JButton butSelect;
+ private JButton butAdd;
+ private JButton butRemove;
+ private JList listPathDisply;
+ private DefaultListModel listModel;
+ private JButton btnHint;
+ private JTextArea txaHint;
+ private boolean flag=false;
+ private String hint ="";
+ private ArchiveBean archiveBean;
+ private final JFileChooser fileChooser=new JFileChooser();
+
+
+ public LibraryAddingPage(WizardComponents wizardComponents, ArchiveBean archiveBean) {
+ super(wizardComponents, "Axis2 Idea Plugin Service Archiver Creator Wizards");
+ setPanelTopTitle("Service Archiver");
+ setPanelBottomTitle("Add any external Jar");
+ this.archiveBean=archiveBean;
+ init();
+ }
+
+ private void init(){
+ txaHint =new JTextArea();
+ txaHint.setBorder(null);
+ txaHint.setFocusable(false);
+ txaHint.setLineWrap(true);
+ txaHint.setWrapStyleWord(true);
+ txaHint.setOpaque(false);
+
+ btnHint =new JButton("Hint >>");
+ btnHint.setBorder(new EmptyBorder(new Insets(0,0,0,0)));
+ txtJarLocation=new JTextField();
+ butSelect =new JButton("Browse..");
+ butAdd =new JButton("Add ->");
+ butRemove=new JButton("Remove <-");
+ listModel =new DefaultListModel();
+ listPathDisply =new JList(listModel);
+ listPathDisply.setAutoscrolls(true);
+ listPathDisply.setOpaque(false);
+ listPathDisply.setBorder(BorderFactory.createBevelBorder(1) );
+ listPathDisply.setFocusable(false);
+
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(true);
+ setFinishButtonEnabled(false);
+ setPageComplete(false);
+
+ this.setLayout(new GridBagLayout());
+
+ this.add(new JLabel("Jar file location")
+ , new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+
+ this.add(txtJarLocation
+ , new GridBagConstraints(1, 0, GridBagConstraints.RELATIVE , 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 0, 10), 0, 0));
+
+ txtJarLocation.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ update();
+ }
+ });
+
+ this.add(butSelect
+ , new GridBagConstraints(2, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.NONE
+ , new Insets(5, 10, 1,10), 0, 0));
+
+ butSelect.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ broswseJarFile();
+ update();
+ }
+ });
+
+ this.add(butAdd
+ , new GridBagConstraints(0, 1, 1, 1, 0.1, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 1,1), 0, 0));
+ butAdd.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ listModel.addElement(txtJarLocation.getText() );
+ txtJarLocation.setText("");
+ update();
+ }
+ });
+
+ this.add(butRemove
+ , new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 1, 1,1), 2, 0));
+ butRemove .addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleRemove();
+ update();
+ }
+ });
+
+ this.add(new JScrollPane(listPathDisply)
+ , new GridBagConstraints(0, 2, GridBagConstraints.REMAINDER, 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 1,10), 0, 0));
+
+ this.add(btnHint
+ , new GridBagConstraints(0, 3, 1, 1, 0.1,0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 10), 0, 0));
+ btnHint.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(flag){
+ btnHint.setText("Hint >>");
+ txaHint.setText("");
+ flag=false;
+ }else{
+ btnHint.setText("Hint <<");
+ txaHint.setText(hint);
+ flag=true;
+ }
+ update();
+ }
+ });
+
+ this.add(txaHint
+ , new GridBagConstraints(0, 4, GridBagConstraints.REMAINDER, 1, 0.1,1.0
+ , GridBagConstraints.CENTER , GridBagConstraints.BOTH
+ , new Insets(5, 10, 10, 10), 0, 0));
+
+ }
+ //next
+ public void next() {
+ switchPanel(CodegenFrame.PANEL_FOURTH_C );
+
+ }
+ //back
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_SECOND_C );
+ }
+ //update
+ public void update() {
+ fillBean();
+ setPageComplete(true);
+ setNextButtonEnabled(true);
+ }
+
+ //get page type
+ public int getPageType() {
+ return WizardPanel.SERVICE_ARCHIVE_TYPE ;
+ }
+
+ private void broswseJarFile(){
+ fileChooser.setFileFilter(new JarFileFilter() );
+ int returnVal= fileChooser.showOpenDialog(butAdd);
+ if(returnVal == JFileChooser .APPROVE_OPTION ){
+ File file = fileChooser.getSelectedFile();
+ txtJarLocation.setText(file.getAbsolutePath());
+ }
+ }
+ private void handleRemove() {
+ int[] selectionIndices = listPathDisply .getSelectedIndices() ;
+ for (int i=0;i<selectionIndices.length;i++){
+ listModel .remove(selectionIndices[i]);
+ }
+ }
+ private void fillBean(){
+ ArrayList tempList=archiveBean.getLibs();
+ tempList.addAll(getJarPathlist());
+ archiveBean.addLibs(tempList);
+ URL urllist[] = new URL[listModel.size() + 1];
+ ClassLoader cls = new URLClassLoader(urllist , LibraryAddingPage.class.getClassLoader());
+ archiveBean.setClassLoader(cls);
+ }
+ //get class path list
+ public ArrayList getJarPathlist(){
+ Object [] listObject = listModel.toArray() ;
+ ArrayList listString =new ArrayList();
+ for(int i=0 ;i<listObject.length ;i++){
+ listString.add(listObject[i].toString()) ;
+ }
+ return listString ;
+ }
+}
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ParameterDialog.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ParameterDialog.java?view=auto&rev=560098
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ParameterDialog.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ParameterDialog.java Thu Jul 26 21:59:54 2007
@@ -0,0 +1,84 @@
+package org.apache.ideaplugin.frames;
+
+import org.apache.ideaplugin.bean.ParameterObj;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class ParameterDialog extends JDialog {
+ private static ParameterDialog dialog;
+ private static ParameterObj para =new ParameterObj("","");
+ private JTextField txtName;
+ private JTextField txtValue;
+
+ public static void initialize(Component comp,
+ String title) {
+ Frame frame = JOptionPane.getFrameForComponent(comp);
+ dialog = new ParameterDialog(frame,title);
+ dialog.setResizable(false);
+ dialog.setSize(250,150);
+ }
+
+ public static ParameterObj showDialog(String title) {
+ if (dialog != null) {
+ dialog.setTitle(title);
+ dialog.setVisible(true);
+ }
+ return para;
+ }
+
+
+ private ParameterDialog(Frame frame, String title) {
+ super(frame, title, true);
+
+ //buttons
+ final JButton cancelButton = new JButton("Cancel");
+ final JButton setButton = new JButton(" OK ");
+ cancelButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ ParameterDialog .dialog.setVisible(false);
+ }
+ });
+ setButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ ParameterDialog.para.setName(txtName.getText());
+ ParameterDialog.para.setValue(txtValue.getText());
+ ParameterDialog.dialog.setVisible(false);
+ }
+ });
+ getRootPane().setDefaultButton(setButton);
+ getRootPane().setDefaultButton(cancelButton);
+ //main part of the dialog
+
+ txtName =new JTextField();
+ txtValue =new JTextField();
+
+ JPanel listPane = new JPanel();
+ listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
+ listPane.add(Box.createRigidArea(new Dimension(10,0)));
+ listPane.add(new JLabel("Name:"));
+ listPane.add(txtName);
+ listPane.add(new JLabel("Value:"));
+ listPane.add(txtValue );
+ listPane.setBorder(BorderFactory.createEmptyBorder(0,10,10,10));
+
+ //Lay out the buttons from left to right.
+ JPanel buttonPane = new JPanel();
+ buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
+ buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
+ buttonPane.add(Box.createHorizontalGlue());
+ buttonPane.add(cancelButton);
+ buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
+ buttonPane.add(setButton);
+
+ //Put everything together, using the content pane's BorderLayout.
+ Container contentPane = getContentPane();
+ contentPane.add(listPane, BorderLayout.CENTER);
+ contentPane.add(buttonPane, BorderLayout.SOUTH);
+
+ pack();
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceArchiveOutputLocationPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceArchiveOutputLocationPage.java?view=auto&rev=560098
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceArchiveOutputLocationPage.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceArchiveOutputLocationPage.java Thu Jul 26 21:59:54 2007
@@ -0,0 +1,151 @@
+package org.apache.ideaplugin.frames;
+
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+import org.apache.ideaplugin.bean.ArchiveBean;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.io.File;
+
+
+public class ServiceArchiveOutputLocationPage extends WizardPanel {
+
+ private JTextField txtLocation;
+ private JTextField txtFileName;
+ private JButton btnBrowes;
+ private JButton btnHint;
+ private JTextArea txaHint;
+ private boolean flag=false;
+ final JFileChooser DirChooser=new JFileChooser();
+ public static final String hint="";
+ private ArchiveBean archiveBean;
+ /**
+ * Constructor
+ * @param wizardComponents
+ */
+ public ServiceArchiveOutputLocationPage(WizardComponents wizardComponents, ArchiveBean archiveBean){
+ super(wizardComponents, "Axis2 Idea Plugin Service Archiver Creator Wizards");
+ setPanelTopTitle("Service Archiver");
+ setPanelBottomTitle("Select the location for the generated Archiver");
+ this.archiveBean=archiveBean;
+ init();
+ }
+ private void init(){
+ txaHint =new JTextArea();
+ txaHint.setBorder(null);
+ txaHint.setFocusable(false);
+ txaHint.setLineWrap(true);
+ txaHint.setWrapStyleWord(true);
+ txaHint.setOpaque(false);
+
+ btnHint =new JButton("Hint >>");
+ btnHint.setBorder(new EmptyBorder(new Insets(0,0,0,0)));
+
+ txtFileName =new JTextField("Service_Archiver");
+
+ txtLocation=new JTextField();
+
+ btnBrowes=new JButton("Browse..");
+
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(false);
+ setFinishButtonEnabled(false);
+ this.setLayout(new GridBagLayout());
+
+ this.add(new JLabel("OutPut File Name")
+ , new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(txtFileName
+ , new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(new JLabel("OutPut Location")
+ , new GridBagConstraints(0, 1, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,0), 0, 0));
+
+ this.add(txtLocation
+ , new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(btnBrowes
+ , new GridBagConstraints(2, 1, 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(btnHint,
+ new GridBagConstraints(0, 2, 1, 1, 0.1,0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 10), 0, 0));
+ btnHint.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(flag){
+ btnHint.setText("Hint >>");
+ txaHint.setText("");
+ flag=false;
+ }else{
+ btnHint.setText("Hint <<");
+ txaHint.setText(hint);
+ flag=true;
+ }
+ update();
+ }
+ });
+
+ this.add(txaHint
+ , new GridBagConstraints(0, 3, GridBagConstraints.REMAINDER, 1, 0.1,1.0
+ , GridBagConstraints.CENTER , GridBagConstraints.BOTH
+ , new Insets(5, 10, 10, 10), 0, 0));
+ }
+
+
+ public void back() {
+ if(!((ServiceXMLFileSelectionPage)getWizardComponents().getWizardPanel(CodegenFrame.PANEL_FOURTH_C)).isIncludeXml()){
+ switchPanel(CodegenFrame.PANEL_FOURTH_C );
+ }else{
+ switchPanel(CodegenFrame.PANEL_OPTION_C );
+ }
+ }
+
+ public void next() {
+
+ }
+
+ public void update(){
+ if(!txtFileName.getText() .equals("")){
+ archiveBean.setArchiveName(txtFileName.getText());
+ }
+ if(!txtLocation .getText() .equals("")){
+ if(new File(txtLocation.getText()).isDirectory())
+ archiveBean.setOutPath(txtLocation.getText());
+ }
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(false);
+
+ }
+ public int getPageType() {
+ return WizardPanel.SERVICE_ARCHIVE_TYPE;
+ }
+}
+
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLEditPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLEditPage.java?view=auto&rev=560098
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLEditPage.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLEditPage.java Thu Jul 26 21:59:54 2007
@@ -0,0 +1,193 @@
+package org.apache.ideaplugin.frames;
+
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+import org.apache.ideaplugin.bean.ArchiveBean;
+import org.apache.ideaplugin.bean.ParameterObj;
+import org.apache.ideaplugin.bean.ValidateXMLFile;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+
+public class ServiceXMLEditPage extends WizardPanel {
+ protected JTextArea desArea;
+ protected JButton addpara;
+ protected JButton addModuleRef;
+ protected JButton validateXML;
+ private JButton reGenerate;
+ protected JScrollPane sp;
+ private JLabel lblerror;
+ private ArchiveBean archiveBean;
+
+ public ServiceXMLEditPage(WizardComponents wizardComponents, ArchiveBean archiveBean){
+ super(wizardComponents, "Axis2 Idea Plugin Service Archiver Creator Wizards");
+ setPanelTopTitle("Service Archiver");
+ setPanelBottomTitle("Edit the generated service.xml");
+ this.archiveBean=archiveBean;
+ init();
+ }
+ public void init(){
+ ParameterDialog.initialize(addpara, "Parameter Dialog");
+ addpara = new JButton("+Parameter ");
+ addpara.setEnabled(false);
+ addModuleRef = new JButton("+ModuleRef ");
+ addModuleRef.setEnabled(false);
+ validateXML =new JButton("Validate XML");
+ reGenerate=new JButton("ReGenerate XML");
+ lblerror=new JLabel();
+ desArea = new JTextArea("");
+ sp = new JScrollPane(desArea);
+ sp.setAutoscrolls(true);
+ this.setLayout(new GridBagLayout());
+ setDefaultEnabled();
+
+ this.add(addpara
+ , new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.NONE
+ , new Insets(5, 1, 0, 10), 0, 0));
+
+ addpara.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ ParameterObj selectedName=ParameterDialog.showDialog("Parameter Dialog");
+ setParameter(selectedName);
+ setEnabledToNotValidate();
+ update();
+ }
+ });
+
+ this.add(addModuleRef
+ , new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.NONE
+ , new Insets(5, 10, 1,10), 0, 0));
+
+ addModuleRef.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ String moduleName = (String)JOptionPane.showInputDialog(
+ addModuleRef,
+ "Module Name","Module Dialog",
+ JOptionPane.PLAIN_MESSAGE);
+ setModule(moduleName);
+ setEnabledToNotValidate();
+ update();
+ }
+ });
+ this.add(validateXML
+ , new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.NONE
+ , new Insets(5, 10, 1,10), 0, 0));
+
+ validateXML.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(new ValidateXMLFile().Validate("<?xml version=\"1.0\"?>\n"+desArea.getText())) {
+ setEnabledToValidate();
+ lblerror.setText("Service XML file validation successfully");
+ } else{
+ setEnabledToNotValidate();
+ lblerror.setText("Error! Service XML file validation Error");
+ }
+ update();
+ }
+ });
+ this.add(reGenerate
+ , new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.NONE
+ , new Insets(5, 10, 1,10), 0, 0));
+
+ reGenerate.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ desArea.setText("");
+ desArea.setText(archiveBean.getServiceXML());
+ update();
+ }
+ });
+ this.add(sp
+ , new GridBagConstraints(0, 1,GridBagConstraints.REMAINDER, 1, 1.0, 1.0
+ , GridBagConstraints.WEST , GridBagConstraints.BOTH
+ , new Insets(5, 10, 10,10), 0, 0));
+ desArea.addMouseListener(new MouseListener(){
+ public void mouseClicked(MouseEvent e){
+ addpara.setEnabled(true);
+ addModuleRef.setEnabled(true);
+ }
+ public void mousePressed(MouseEvent e){}
+ public void mouseReleased(MouseEvent e){}
+ public void mouseEntered(MouseEvent e){}
+ public void mouseExited(MouseEvent e){}
+ });
+ this.add(lblerror
+ , new GridBagConstraints(0,2,GridBagConstraints.REMAINDER, 1, 1.0,0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 20, 10,10), 0, 0));
+
+ }
+
+ //next
+ public void next() {
+ if(!archiveBean.getServiceXML().equals("") ){
+ archiveBean.setServiceXML(desArea.getText());
+ }
+ switchPanel(CodegenFrame.PANEL_LAST_C );
+
+ }
+ //back
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_LOAD_C );
+ }
+ //update
+ public void update() {
+
+ }
+
+ //get page type
+ public int getPageType() {
+ return WizardPanel.SERVICE_ARCHIVE_TYPE;
+ }
+
+ public void setDescription(String descrip){
+ this.desArea.setText(descrip);
+ update();
+ }
+
+ private void setEnabledToValidate(){
+ setNextButtonEnabled(true);
+ reGenerate.setEnabled(false);
+ addpara.setEnabled(false);
+ addModuleRef.setEnabled(false);
+ setPageComplete(true);
+ }
+ private void setEnabledToNotValidate(){
+ reGenerate.setEnabled(true);
+ setNextButtonEnabled(false);
+ setPageComplete(false);
+ addpara.setEnabled(false);
+ addModuleRef.setEnabled(false);
+ }
+ public void setDefaultEnabled(){
+ lblerror.setText("");
+ addpara.setEnabled(false);
+ addModuleRef.setEnabled(false);
+ validateXML.setEnabled(true);
+ reGenerate.setEnabled(false);
+ setNextButtonEnabled(false);
+ }
+ private void setParameter(ParameterObj obj){
+ int position = desArea.getCaretPosition();
+ System.out.println(desArea.getLineCount());
+ System.out.println(desArea.getCaretPosition());
+ String str = " <parameter name=\"" + obj.getName() + "\" locked=\"false\">"
+ + obj.getValue() +
+ "</parameter>\n";
+ desArea.insert(str, position + 1);
+ }
+ private void setModule(String module){
+ int position = desArea.getCaretPosition();
+ String str = " <module ref=\"" + module + "\" />\n";
+ desArea .insert(str, position + 1);
+ }
+}
+
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLFileSelectionPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLFileSelectionPage.java?view=auto&rev=560098
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLFileSelectionPage.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLFileSelectionPage.java Thu Jul 26 21:59:54 2007
@@ -0,0 +1,221 @@
+package org.apache.ideaplugin.frames;
+
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+import org.apache.ideaplugin.bean.ArchiveBean;
+import org.apache.ideaplugin.bean.XmlFileFilter;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: shivantha
+ * Date: 17/07/2007
+ * Time: 09:45:03
+ * To change this template use File | Settings | File Templates.
+ */
+public class ServiceXMLFileSelectionPage extends WizardPanel {
+ /**
+ * varialbales
+ */
+ private JLabel lblXmlLocation;
+ private JTextField txtServiceXml;
+ private JButton butSelect;
+ private JCheckBox chkBoxIncludeXml;
+ private JButton btnHint;
+ private JTextArea txaHint;
+ private boolean flag=false;
+ private String hint ="";
+ private final JFileChooser fileChooser=new JFileChooser();
+ private ArchiveBean archiveBean;
+ private String value;
+ /**
+ * Constructor
+ * @param wizardComponents
+ */
+ public ServiceXMLFileSelectionPage(WizardComponents wizardComponents,ArchiveBean archiveBean ) {
+ super(wizardComponents, "Axis2 Idea Plugin Service Archiver Creator Wizards");
+ setPanelTopTitle("Service Archiver");
+ setPanelBottomTitle("Select the service.xml file");
+ this.archiveBean=archiveBean;
+ init();
+ }
+
+ /**
+ * initiate panel
+ */
+ private void init(){
+
+ txaHint =new JTextArea();
+ txaHint.setBorder(null);
+ txaHint.setFocusable(false);
+ txaHint.setLineWrap(true);
+ txaHint.setWrapStyleWord(true);
+ txaHint.setOpaque(false);
+
+ btnHint =new JButton("Hint >>");
+ btnHint.setBorder(new EmptyBorder(new Insets(0,0,0,0)));
+ lblXmlLocation=new JLabel("set the Service XML file");
+ lblXmlLocation.setEnabled(false);
+ txtServiceXml =new JTextField();
+ txtServiceXml.setEnabled(false);
+ butSelect=new JButton("Browse..");
+ butSelect.setEnabled(false);
+ chkBoxIncludeXml = new JCheckBox("Generate service xml automatically", true) ;
+
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(false);
+ setFinishButtonEnabled(false);
+ setPageComplete(false);
+
+ this.setLayout(new GridBagLayout());
+
+
+ this.add(chkBoxIncludeXml
+ , new GridBagConstraints(0, 0, GridBagConstraints.REMAINDER, 1,0.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 1,1), 0, 0));
+ chkBoxIncludeXml.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ setChangeEnabled();
+ update();
+ }
+ });
+ this.add(lblXmlLocation
+ , new GridBagConstraints(0, 1, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,0), 0, 0));
+
+ this.add(txtServiceXml
+ , new GridBagConstraints(1, 1, GridBagConstraints.RELATIVE , 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 0, 0), 0, 0));
+
+ txtServiceXml.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ update();
+ }
+ });
+
+ this.add(butSelect
+ , new GridBagConstraints(2, 1, 1, 1, 0.1, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.NONE
+ , new Insets(5, 0, 1,10), 0, 0));
+
+ butSelect.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ browseXmlFile();
+ setNextButtonEnabled(true);
+ setPageComplete(true);
+ update();
+ }
+ });
+ this.add(btnHint,
+ new GridBagConstraints(0, 2, GridBagConstraints.REMAINDER, 1, 0.1,0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 10), 0, 0));
+ btnHint.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(flag){
+ btnHint.setText("Hint >>");
+ txaHint.setText("");
+ flag=false;
+ }else{
+ btnHint.setText("Hint <<");
+ txaHint.setText(hint);
+ flag=true;
+ }
+ update();
+ }
+ });
+
+ this.add(txaHint
+ , new GridBagConstraints(0, 3, GridBagConstraints.REMAINDER, 1, 0.1,1.0
+ , GridBagConstraints.CENTER , GridBagConstraints.BOTH
+ , new Insets(5, 10, 10, 10), 0, 0));
+
+ }
+
+ //next
+ public void next() {
+ if(!chkBoxIncludeXml.isSelected()){
+ switchPanel(CodegenFrame.PANEL_LAST_C);
+ } else{
+ switchPanel(CodegenFrame.PANEL_LOAD_C);
+ }
+ setNextButtonEnabled(false);
+
+ }
+ //back
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_THIRD_C );
+ }
+ //update
+ public void update() {
+ fillBean();
+ setPageComplete(true);
+ setNextButtonEnabled(true);
+ }
+
+ //get page type
+ public int getPageType() {
+ return WizardPanel.SERVICE_ARCHIVE_TYPE ;
+ }
+
+ private void browseXmlFile(){
+ fileChooser.setFileFilter(new XmlFileFilter() );
+ fileChooser.setCurrentDirectory(archiveBean.getClassLoc());
+ int returnVal= fileChooser.showOpenDialog(butSelect);
+ if(returnVal == JFileChooser .APPROVE_OPTION ){
+ File xmlfile = fileChooser.getSelectedFile();
+ txtServiceXml.setText(xmlfile.getAbsolutePath());
+ byte[] buf = new byte[1024];
+ int read;
+ ByteArrayOutputStream out;
+ try {
+ FileInputStream in = new FileInputStream(xmlfile);
+
+ out = new ByteArrayOutputStream();
+ while ((read = in.read(buf)) > 0) {
+ out.write(buf, 0, read);
+ }
+ in.close();
+ value = new String(out.toByteArray());
+ } catch (IOException e1) {
+ }
+
+ } else {
+ txtServiceXml.setText("");
+ }
+ }
+ private void setChangeEnabled(){
+ if(chkBoxIncludeXml.isSelected()){
+ lblXmlLocation.setEnabled(false);
+ txtServiceXml .setEnabled(false);
+ butSelect.setEnabled(false);
+ }else{
+ lblXmlLocation.setEnabled(true);
+ txtServiceXml.setEnabled(true);
+ butSelect.setEnabled(true);
+ }
+ }
+ private void fillBean(){
+ if(!chkBoxIncludeXml.isSelected()){
+ if(value!=null)
+ archiveBean.setServiceXML(value);
+ }
+
+ }
+ public boolean isIncludeXml(){
+ return this.chkBoxIncludeXml.isSelected();
+ }
+}
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLGenerationPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLGenerationPage.java?view=auto&rev=560098
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLGenerationPage.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/ServiceXMLGenerationPage.java Thu Jul 26 21:59:54 2007
@@ -0,0 +1,338 @@
+package org.apache.ideaplugin.frames;
+
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+import org.apache.ideaplugin.bean.ArchiveBean;
+import org.apache.ideaplugin.bean.OperationObj;
+import org.apache.ideaplugin.bean.ServiceObj;
+import org.apache.ideaplugin.bean.ClassFileFilter;
+import org.apache.ideaplugin.frames.table.ArchiveTableModel;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import javax.swing.table.TableModel;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.awt.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.MalformedURLException;
+import java.io.File;
+
+
+public class ServiceXMLGenerationPage extends WizardPanel {
+
+ private JTextField txtServiceName;
+ private JTextField txtClassName;
+ private JCheckBox chkBoxSearchMethod;
+ private JButton btnLoad;
+ private JButton btnBrowse;
+ private JTable table;
+ private JLabel lblTable;
+ private JScrollPane scrollPane;
+ private HashMap operations;
+ private String fileName;
+ private int count = 1;
+ private ArrayList servicelsit;
+ private String sgXMl;
+ private final JFileChooser fileChooser=new JFileChooser();
+ private ArchiveBean archiveBean;
+ /**
+ * Constructor
+ * @param wizardComponents
+ */
+ public ServiceXMLGenerationPage(WizardComponents wizardComponents, ArchiveBean archiveBean){
+ super(wizardComponents, "Axis2 Idea Plugin Service Archiver Creator Wizards");
+ setPanelTopTitle("Service Archiver");
+ setPanelBottomTitle("Service XML Generation");
+ this.archiveBean=archiveBean;
+ init();
+ }
+ private void init(){
+
+ txtServiceName =new JTextField();
+ txtClassName =new JTextField();
+
+ btnBrowse=new JButton("Browse");
+ btnLoad =new JButton("Load");
+
+ chkBoxSearchMethod=new JCheckBox("Search declared method only",true);
+
+ lblTable=new JLabel("Mark operation you do not want to publish ");
+ operations = new HashMap();
+ ArchiveTableModel myModel=new ArchiveTableModel(operations);
+ table=new JTable(myModel);
+ table.setOpaque(true);
+ table.setBackground(getBackground());
+ table.setShowGrid(true);
+ table.setSize(getPreferredSize());
+
+ scrollPane =new JScrollPane(table);
+ scrollPane.setBorder(new EmptyBorder(0,0,0,0));
+ scrollPane.setSize(table.getSize());
+ scrollPane.setOpaque(true);
+ scrollPane.setBackground(getBackground());
+ scrollPane.getViewport().setBackground(getBackground());
+ scrollPane.setViewportBorder(new EmptyBorder(0,0,0,0));
+
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(false);
+ setFinishButtonEnabled(false);
+ setPageComplete(false);
+ this.setLayout(new GridBagLayout());
+
+ this.add(new JLabel("Class Name")
+ , new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(txtClassName
+ , new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 0, 0, 0), 0, 0));
+ this.add(btnBrowse
+ , new GridBagConstraints(2, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.NORTH , GridBagConstraints.NONE
+ , new Insets(5, 1, 1, 1), 0, 0));
+ btnBrowse .addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ browseClassFile();
+ update();
+ }
+ });
+ this.add(btnLoad
+ , new GridBagConstraints(3, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.NORTH , GridBagConstraints.NONE
+ , new Insets(5, 1, 1, 10), 0, 0));
+
+ btnLoad .addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ updateTable();
+ update();
+ }
+ });
+ this.add(new JLabel("Service Name")
+ , new GridBagConstraints(0, 1, 1, 1, 0.1, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,0), 0, 0));
+ this.add(txtServiceName
+ , new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 0, 0, 0), 0, 0));
+
+ this.add(chkBoxSearchMethod
+ , new GridBagConstraints(0, 2, GridBagConstraints.RELATIVE, 1, 0.0, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0, 10), 0, 0));
+ chkBoxSearchMethod .addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ updateTable();
+ update();
+ }
+ });
+ this.add(lblTable
+ , new GridBagConstraints(0, 3, GridBagConstraints.RELATIVE, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0, 10), 0, 0));
+
+ this.add(scrollPane
+ , new GridBagConstraints(0, 4, GridBagConstraints.REMAINDER , 1, 1.0, 1.0
+ , GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH
+ , new Insets(5, 10, 10, 10), 0, 0));
+
+ setPageComplete(true);
+ }
+
+
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_FOURTH_C );
+ }
+
+ public void next() {
+ setNextButtonEnabled(false);
+ checkautoGeneration();
+ switchPanel(CodegenFrame.PANEL_OPTION_C );
+ ((ServiceXMLEditPage)getWizardComponents().getWizardPanel(CodegenFrame.PANEL_OPTION_C )).setDescription(archiveBean.getServiceXML());
+ ((ServiceXMLEditPage)getWizardComponents().getWizardPanel(CodegenFrame.PANEL_OPTION_C )).setDefaultEnabled();
+ }
+
+ public void update(){
+
+ }
+ public int getPageType() {
+ return WizardPanel.SERVICE_ARCHIVE_TYPE;
+ }
+
+
+ private void updateTable() {
+ //get a URL from the class file location
+ try {
+ String classFileLocation = archiveBean.getClassLoc().getPath();
+ URL classFileURL = new File(classFileLocation).toURL();
+
+ ArrayList listofURLs = new ArrayList();
+ listofURLs.add(classFileURL);
+
+ //get the libraries from the lib page and load it
+ ArrayList libList=archiveBean.getLibs();
+ String[] libFileList=new String[libList.size()];
+ for (int i = 0; i < libList.size(); i++) {
+ libFileList[i] = (String )libList.get(i);
+ }
+
+ if (libFileList!=null){
+ int count = libFileList.length;
+ for (int i=0;i<count;i++){
+ listofURLs.add(new File(libFileList[i]).toURL());
+ }
+ }
+ txtServiceName.setText("MyService" + count);
+ ClassLoader loader = new URLClassLoader((URL[])listofURLs.toArray(new URL[listofURLs.size()]));
+ Class clazz = Class.forName(fileName ,true,loader);
+ Method[] methods = null;
+ if (chkBoxSearchMethod.isSelected()){
+ methods = clazz.getDeclaredMethods();
+ }else{
+ methods = clazz.getMethods();
+ }
+
+ int methodCount = methods.length;
+ if (methodCount > 0) {
+ try {
+ table.removeAll();
+ table.setVisible(true);
+ operations.clear();
+ } catch (Exception e1) {
+ }
+ for (int i = 0 ; i < methodCount; i++){
+ Method method = methods[i];
+ OperationObj operationobj = new OperationObj(method.getName(),
+ method.getReturnType().toString(),
+ new Integer(method.getParameterTypes().length), new Boolean(true));
+ operations.put(method.getName(), operationobj);
+ }
+
+ ArchiveTableModel myModel=new ArchiveTableModel(operations);
+ table.setModel(myModel);
+ scrollPane.repaint();
+ this.repaint();
+ setNextButtonEnabled(true);
+ }
+
+ } catch (MalformedURLException e) {
+ setNextButtonEnabled(false);
+ JOptionPane.showMessageDialog(btnLoad, "The specified file is not a valid java class",
+ "Error!", JOptionPane.ERROR_MESSAGE);
+ } catch (ClassNotFoundException e) {
+ setNextButtonEnabled(false);
+ JOptionPane.showMessageDialog(btnLoad, "The specified file is not a valid java class",
+ "Error!", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ private void browseClassFile(){
+ fileChooser.setFileFilter(new ClassFileFilter() );
+ fileChooser.setCurrentDirectory(archiveBean.getClassLoc());
+ int returnVal = fileChooser.showOpenDialog(this);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File tempfile = fileChooser .getSelectedFile();
+ String newFile = tempfile.getPath();
+ int index = newFile.indexOf(archiveBean.getClassLoc().getAbsolutePath().trim());
+ if (index >= 0) {
+ int lastindex = archiveBean.getClassLoc().getAbsolutePath().trim().length();
+ newFile = newFile.substring(lastindex + 1);
+ char ch = File.separatorChar;
+ char newch = '.';
+ int cindex = newFile.indexOf(ch);
+ while (cindex >= 0) {
+ newFile = newFile.replace(ch, newch);
+ cindex = newFile.indexOf(ch);
+ }
+ fileName = newFile;
+ int classIndex = fileName.lastIndexOf(".");
+ fileName = fileName.substring(0, classIndex);
+ txtClassName .setText(fileName);
+ }
+ }
+ }
+ private void serviceGroupProcess(){
+
+ ArrayList ops = new ArrayList();
+ Iterator opitr = operations.values().iterator();
+ while (opitr.hasNext()) {
+ OperationObj operationObj = (OperationObj) opitr.next();
+ if (operationObj.getSelect().booleanValue()) {
+ ops.add(operationObj.getOpName());
+ }
+ }
+
+ ServiceObj service = new ServiceObj(txtServiceName.getText(), fileName, ops);
+ archiveBean.addToServicelsit(service);
+ if (!archiveBean.isSingleService()) {
+ int valu = JOptionPane.showConfirmDialog(this, "Do you want to add an another service to group", "Service Archive",
+ JOptionPane.YES_NO_OPTION);
+ if (valu == 0) {
+ fileName = "";
+ txtClassName.setText("");
+ txtServiceName.setText("");
+ operations.clear();
+ setNextButtonEnabled(false);
+ switchPanel(CodegenFrame.PANEL_FIRST_C);
+ count++;
+ this.repaint();
+ } else {
+ servicelsit =archiveBean.getServicelsit();
+ System.out.println(servicelsit.size());
+ sgXMl = "<serviceGroup>\n";
+ for (int i = 0; i < servicelsit.size(); i++) {
+ ServiceObj serviceObj = (ServiceObj) servicelsit.get(i);
+ sgXMl = sgXMl + serviceObj.toString();
+ }
+ sgXMl = sgXMl + "</serviceGroup>";
+ archiveBean.setServiceXML(sgXMl);
+ sgXMl="";
+ switchPanel(CodegenFrame.PANEL_OPTION_C );
+ }
+ } else {
+ servicelsit = archiveBean.getServicelsit();
+ sgXMl = "<serviceGroup>\n";
+ for (int i = 0; i < servicelsit.size(); i++) {
+ ServiceObj serviceObj = (ServiceObj) servicelsit.get(i);
+ sgXMl = sgXMl + serviceObj.toString();
+ }
+ sgXMl = sgXMl + "</serviceGroup>";
+ archiveBean.setServiceXML(sgXMl);
+ sgXMl="";
+ switchPanel(CodegenFrame.PANEL_OPTION_C );
+ }
+ }
+
+ private void checkautoGeneration(){
+ ArrayList ops = new ArrayList();
+ Iterator opitr = operations.values().iterator();
+ while (opitr.hasNext()) {
+ OperationObj operationObj = (OperationObj) opitr.next();
+ if (operationObj.getSelect().booleanValue()) {
+ ops.add(operationObj.getOpName());
+ }
+ }
+ txtServiceName.setText(txtServiceName.getText());
+ ServiceObj service = new ServiceObj(txtServiceName.getText(), fileName, ops);
+ archiveBean.addToServicelsit(service);
+ servicelsit = archiveBean.getServicelsit();
+ sgXMl="<serviceGroup>";
+ for (int i = 0; i < servicelsit.size(); i++) {
+ ServiceObj serviceObj = (ServiceObj) servicelsit.get(i);
+ sgXMl = sgXMl + serviceObj.toString();
+ }
+ sgXMl = sgXMl + "</serviceGroup>";
+ archiveBean.setServiceXML(sgXMl);
+ sgXMl="";
+ }
+}
+
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/WSDLFileSelectionPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/WSDLFileSelectionPage.java?view=auto&rev=560098
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/WSDLFileSelectionPage.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/WSDLFileSelectionPage.java Thu Jul 26 21:59:54 2007
@@ -0,0 +1,207 @@
+package org.apache.ideaplugin.frames;
+
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+import org.apache.axis2.tools.idea.WSDLFileFilter;
+import org.apache.ideaplugin.bean.ArchiveBean;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.WSDLException;
+import java.awt.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.io.File;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: shivantha
+ * Date: 16/07/2007
+ * Time: 11:20:00
+ * To change this template use File | Settings | File Templates.
+ */
+public class WSDLFileSelectionPage extends WizardPanel {
+
+ private JLabel lblWSDL;
+ private JCheckBox chkBoxSkip;
+ private JCheckBox chkBoxSelect;
+ private JTextField txtWSDL;
+ private JButton btnBrowse;
+ private JButton btnHint;
+ private JTextArea txaHint;
+ private boolean flag=false;
+ private String hint ="";
+ private final JFileChooser fileChooser=new JFileChooser();
+ private ArchiveBean archiveBean;
+ /**
+ * Constructor
+ * @param wizardComponents
+ */
+ public WSDLFileSelectionPage(WizardComponents wizardComponents, ArchiveBean archiveBean){
+ super(wizardComponents,"Axis2 Idea Plugin Service Archiver Creator Wizards");
+ setPanelTopTitle("Service Archiver");
+ setPanelBottomTitle("Add the WSDL file");
+ this.archiveBean=archiveBean;
+ init();
+ }
+ private void init(){
+ txaHint =new JTextArea();
+ txaHint.setBorder(null);
+ txaHint.setFocusable(false);
+ txaHint.setLineWrap(true);
+ txaHint.setWrapStyleWord(true);
+ txaHint.setOpaque(false);
+
+ btnHint =new JButton("Hint >>");
+ btnHint.setBorder(new EmptyBorder(new Insets(0,0,0,0)));
+
+ lblWSDL=new JLabel("Select a WSDL file");
+
+ chkBoxSkip =new JCheckBox("Skip WSDL",true);
+
+ chkBoxSelect =new JCheckBox("Select WSDL",false) ;
+
+ ButtonGroup buttonGroup= new ButtonGroup();
+ buttonGroup.add(chkBoxSkip );
+ buttonGroup.add(chkBoxSelect );
+
+ txtWSDL=new JTextField();
+
+ btnBrowse=new JButton("Browse..");
+
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(true);
+ setFinishButtonEnabled(false);
+ this.setLayout(new GridBagLayout());
+
+ this.add(chkBoxSkip
+ , new GridBagConstraints(0, 0, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+ chkBoxSkip .addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ update();
+ }
+ });
+
+ this.add(chkBoxSelect
+ , new GridBagConstraints(0, 1, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,0), 0, 0));
+ chkBoxSelect.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ update();
+ }
+ });
+ this.add(lblWSDL
+ , new GridBagConstraints(0, 2, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,0), 0, 0));
+
+ this.add(txtWSDL
+ , new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(btnBrowse
+ , new GridBagConstraints(2, 2, 1, 1, 0.1, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 10), 0, 0));
+
+ btnBrowse.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ browseWSDLFile();
+ checkWSDLFile();
+ update();
+ }
+ });
+
+ this.add(btnHint
+ , new GridBagConstraints(0, 3, 1, 1, 0.1,0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 10), 0, 0));
+ btnHint.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(flag){
+ btnHint.setText("Hint >>");
+ txaHint.setText("");
+ flag=false;
+ }else{
+ btnHint.setText("Hint <<");
+ txaHint.setText(hint);
+ flag=true;
+ }
+ update();
+ }
+ });
+
+ this.add(txaHint
+ , new GridBagConstraints(0, 4, GridBagConstraints.REMAINDER, 1, 0.1,1.0
+ , GridBagConstraints.CENTER , GridBagConstraints.BOTH
+ , new Insets(5, 10, 10, 10), 0, 0));
+
+
+ }
+
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_FIRST_C);
+ }
+
+ public void next() {
+ switchPanel(CodegenFrame.PANEL_THIRD_C );
+ }
+
+ public void update(){
+ setChangeEnabled();
+ fillBean();
+ setPageComplete(true);
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(true);
+ }
+ public int getPageType() {
+ return WizardPanel.SERVICE_ARCHIVE_TYPE;
+ }
+
+ private void setChangeEnabled(){
+ if(chkBoxSkip.isSelected()){
+ lblWSDL.setEnabled(false);
+ txtWSDL .setEnabled(false);
+ btnBrowse.setEnabled(false);
+ }else{
+ lblWSDL.setEnabled(true);
+ txtWSDL.setEnabled(true);
+ btnBrowse.setEnabled(true);
+ }
+ }
+
+ private void fillBean(){
+ if(chkBoxSelect.isSelected()){
+ if(!txtWSDL.getText().equals(""))
+ archiveBean.addWsdls(new File(txtWSDL.getText()));
+ }
+ }
+ private void checkWSDLFile(){
+ if (txtWSDL.getText().equals("") ) {
+ try{
+ WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ reader.readWSDL(txtWSDL.getText().trim()) ;
+ }catch(WSDLException e1) {
+ txtWSDL.setText("");
+ JOptionPane.showMessageDialog(btnBrowse , "The file selected is not a valid WSDLfile",
+ "Axis2 ServiceArchieve creation", JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+ private void browseWSDLFile(){
+ fileChooser.setFileFilter(new WSDLFileFilter());
+ fileChooser.setCurrentDirectory(archiveBean.getClassLoc());
+ int returnVal = fileChooser.showOpenDialog(btnBrowse);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fileChooser.getSelectedFile();
+ txtWSDL.setText(file.getAbsolutePath());
+ }
+ }
+}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/plugin/Axis2IdeaPlugin.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/plugin/Axis2IdeaPlugin.java?view=diff&rev=560098&r1=560097&r2=560098
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/plugin/Axis2IdeaPlugin.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/plugin/Axis2IdeaPlugin.java Thu Jul 26 21:59:54 2007
@@ -22,13 +22,13 @@
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
-import org.apache.ideaplugin.frames.Axi2PluginPage;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
import javax.swing.*;
import javax.xml.stream.XMLInputFactory;
public class Axis2IdeaPlugin implements ApplicationComponent, Configurable {
- private Axi2PluginPage form;
+ private CodegenFrame form;
private ImageIcon myIcon;
/**
@@ -45,8 +45,8 @@
}
if (form == null) {
- form = new Axi2PluginPage();
- form.setResizable(false);
+ form = new CodegenFrame();
+ form.setResizable(true);
form.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
if (myIcon == null) {
@@ -85,7 +85,7 @@
public JComponent createComponent() {
if (form == null) {
- form = new Axi2PluginPage();
+ form = new CodegenFrame();
}
return form.getRootComponent();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org
Re: svn commit: r560098 [2/2] - in /webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin:
plugin/resources/ src/main/java/org/apache/axis2/tools/bean/ src/main/java/org/apache/axis2/tools/component/
src/main/java/org/apache/axis2/tools/idea/ src/mai...
Posted by Deepal Jayasinghe <de...@opensource.lk>.
Dont we need to commit this change to branch ?
Thanks
Deepal
sandakith@apache.org wrote:
> Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java?view=auto&rev=560098
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java (added)
> +++
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org
Re: svn commit: r560098 [2/2] - in /webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin:
plugin/resources/ src/main/java/org/apache/axis2/tools/bean/ src/main/java/org/apache/axis2/tools/component/
src/main/java/org/apache/axis2/tools/idea/ src/mai...
Posted by Deepal Jayasinghe <de...@opensource.lk>.
Dont we need to commit this change to branch ?
Thanks
Deepal
sandakith@apache.org wrote:
> Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java?view=auto&rev=560098
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/LibraryAddingPage.java (added)
> +++
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org