1 19 20 package org.netbeans.modules.websvc.core.webservices.ui; 21 22 import org.openide.DialogDisplayer; 23 import org.openide.NotifyDescriptor; 24 import org.openide.util.NbBundle; 25 26 30 public class DeleteWsDialog extends javax.swing.JPanel { 31 32 public static final String DELETE_NOTHING = "deleteNothing"; public static final String DELETE_ALL = "deleteALL"; public static final String DELETE_WS = "deleteWebService"; public static final String DELETE_PACKAGE = "deletePackage"; public static final String DELETE_WSDL = "deleteWsdl"; 38 private String wsName, packageName, wsdlName; 39 40 private DeleteWsDialog(String wsName, String packageName, String wsdlName) { 41 this.wsName = wsName; 42 this.packageName=packageName; 43 this.wsdlName=wsdlName; 44 initComponents(); 45 if (wsdlName==null) deleteWsdlCheckBox.setVisible(false); 47 } 48 49 public static String open(String wsName, String packageName, String wsdlName) { 50 String title = NbBundle.getMessage(DeleteWsDialog.class, "MSG_ConfirmDeleteObjectTitle"); 51 DeleteWsDialog delDialog = new DeleteWsDialog(wsName, packageName, wsdlName); 52 NotifyDescriptor desc = new NotifyDescriptor.Confirmation(delDialog, title, NotifyDescriptor.YES_NO_OPTION); 53 Object result = DialogDisplayer.getDefault().notify(desc); 54 if (result.equals(NotifyDescriptor.CLOSED_OPTION)) { 55 return DELETE_NOTHING; 56 } else if (result.equals(NotifyDescriptor.NO_OPTION)) { 57 return DELETE_NOTHING; 58 } else if (delDialog.deletePackage() && delDialog.deleteWsdl()) { 59 return DELETE_ALL; 60 } else if (delDialog.deletePackage()) { 61 return DELETE_PACKAGE; 62 } else if (delDialog.deleteWsdl()) { 63 return DELETE_WSDL; 64 } else return DELETE_WS; 65 66 } 67 68 private boolean deletePackage() { 69 return deletePackageCheckBox.isSelected(); 70 } 71 72 private boolean deleteWsdl() { 73 if (wsdlName==null) return false; 74 else return deleteWsdlCheckBox.isSelected(); 75 } 76 77 82 private void initComponents() { 84 java.awt.GridBagConstraints gridBagConstraints; 85 86 jLabel1 = new javax.swing.JLabel (); 87 deletePackageCheckBox = new javax.swing.JCheckBox (); 88 deleteWsdlCheckBox = new javax.swing.JCheckBox (); 89 90 setLayout(new java.awt.GridBagLayout ()); 91 92 jLabel1.setText(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_ConfirmDeleteObject", new Object [] {wsName})); 93 gridBagConstraints = new java.awt.GridBagConstraints (); 94 gridBagConstraints.gridx = 0; 95 gridBagConstraints.gridy = 0; 96 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 97 gridBagConstraints.weightx = 1.0; 98 gridBagConstraints.insets = new java.awt.Insets (0, 0, 8, 0); 99 add(jLabel1, gridBagConstraints); 100 101 deletePackageCheckBox.setMnemonic(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_DeletePackage_mnem").charAt(0)); 102 deletePackageCheckBox.setText(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_DeletePackage", new Object [] {packageName})); 103 gridBagConstraints = new java.awt.GridBagConstraints (); 104 gridBagConstraints.gridx = 0; 105 gridBagConstraints.gridy = 1; 106 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 107 gridBagConstraints.weightx = 1.0; 108 add(deletePackageCheckBox, gridBagConstraints); 109 110 deleteWsdlCheckBox.setMnemonic(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_DeleteWsdl_mnem").charAt(0)); 111 deleteWsdlCheckBox.setSelected(true); 112 deleteWsdlCheckBox.setText(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_DeleteWsdl", new Object [] {wsdlName})); 113 gridBagConstraints = new java.awt.GridBagConstraints (); 114 gridBagConstraints.gridx = 0; 115 gridBagConstraints.gridy = 2; 116 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 117 gridBagConstraints.weightx = 1.0; 118 add(deleteWsdlCheckBox, gridBagConstraints); 119 120 } 121 123 124 private javax.swing.JCheckBox deletePackageCheckBox; 126 private javax.swing.JCheckBox deleteWsdlCheckBox; 127 private javax.swing.JLabel jLabel1; 128 130 } 131 | Popular Tags |