1 19 20 package org.netbeans.modules.websvc.core.jaxws.nodes; 21 22 import org.openide.DialogDisplayer; 23 import org.openide.NotifyDescriptor; 24 import org.openide.util.NbBundle; 25 26 30 public class RefreshWsDialog extends javax.swing.JPanel { 31 32 static final int CLOSE = 0; 33 static final int DO_NOTHING = 1; 34 static final int DOWNLOAD_WSDL = 2; 35 static final int REGENERATE_IMPL_CLASS = 3; 36 static final int DO_ALL = 4; 37 38 private String implClass,url; 39 private boolean downloadWsdl; 40 41 private RefreshWsDialog(boolean downloadWsdl, String implClass, String url) { 42 this.downloadWsdl=downloadWsdl; 43 this.implClass = implClass; 44 this.url=url; 45 initComponents(); 46 if (!downloadWsdl) { 48 downloadWsdlCheckBox.setVisible(false); 49 jLabel1.setVisible(false); 50 } 51 } 52 53 public static int open(boolean downloadWsdl, String implClass, String url) { 54 String title = NbBundle.getMessage(RefreshWsDialog.class, "MSG_ConfirmServiceRefresh"); 55 RefreshWsDialog delDialog = new RefreshWsDialog(downloadWsdl, implClass, url); 56 NotifyDescriptor desc = new NotifyDescriptor.Confirmation(delDialog, title, NotifyDescriptor.YES_NO_OPTION); 57 Object result = DialogDisplayer.getDefault().notify(desc); 58 if (result.equals(NotifyDescriptor.CLOSED_OPTION)) { 59 return CLOSE; 60 } else if (result.equals(NotifyDescriptor.NO_OPTION)) { 61 return CLOSE; 62 } else if (delDialog.downloadWsdl() && delDialog.regenerate()) { 63 return DO_ALL; 64 } else if (delDialog.downloadWsdl()) { 65 return DOWNLOAD_WSDL; 66 } else if (delDialog.regenerate()) { 67 return REGENERATE_IMPL_CLASS; 68 } else return DO_NOTHING; 69 70 } 71 72 77 public static int openWithOKButtonOnly(boolean downloadWsdl, String implClass, String url){ 78 String title = NbBundle.getMessage(RefreshWsDialog.class, "MSG_ConfirmServiceRefresh"); 79 RefreshWsDialog delDialog = new RefreshWsDialog(downloadWsdl, implClass, url); 80 NotifyDescriptor desc = new NotifyDescriptor.Message(delDialog, NotifyDescriptor.INFORMATION_MESSAGE); 81 DialogDisplayer.getDefault().notify(desc); 82 if(delDialog.regenerate()){ 83 return REGENERATE_IMPL_CLASS; 84 } 85 return DO_NOTHING; 86 } 87 88 89 private boolean downloadWsdl() { 90 if (!downloadWsdl) return false; 91 return downloadWsdlCheckBox.isSelected(); 92 } 93 94 private boolean regenerate() { 95 return regenerateCheckBox.isSelected(); 96 } 97 98 103 private void initComponents() { 105 java.awt.GridBagConstraints gridBagConstraints; 106 107 downloadWsdlCheckBox = new javax.swing.JCheckBox (); 108 regenerateCheckBox = new javax.swing.JCheckBox (); 109 jLabel1 = new javax.swing.JLabel (); 110 jLabel2 = new javax.swing.JLabel (); 111 jLabel3 = new javax.swing.JLabel (); 112 113 setLayout(new java.awt.GridBagLayout ()); 114 115 downloadWsdlCheckBox.setMnemonic(org.openide.util.NbBundle.getMessage(RefreshWsDialog.class, "MSG_DownloadWsdl_mnem").charAt(0)); 116 downloadWsdlCheckBox.setText(org.openide.util.NbBundle.getMessage(RefreshWsDialog.class, "MSG_DownloadWsdl", new Object [] {url})); 117 gridBagConstraints = new java.awt.GridBagConstraints (); 118 gridBagConstraints.gridx = 0; 119 gridBagConstraints.gridy = 1; 120 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 121 gridBagConstraints.weightx = 1.0; 122 add(downloadWsdlCheckBox, gridBagConstraints); 123 124 regenerateCheckBox.setMnemonic(org.openide.util.NbBundle.getMessage(RefreshWsDialog.class, "MSG_RegenerateImplClass_mnem").charAt(0)); 125 regenerateCheckBox.setSelected(true); 126 regenerateCheckBox.setText(org.openide.util.NbBundle.getMessage(RefreshWsDialog.class, "MSG_RegenerateImplClass")); 127 gridBagConstraints = new java.awt.GridBagConstraints (); 128 gridBagConstraints.gridx = 0; 129 gridBagConstraints.gridy = 3; 130 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 131 gridBagConstraints.weightx = 1.0; 132 gridBagConstraints.insets = new java.awt.Insets (10, 0, 0, 0); 133 add(regenerateCheckBox, gridBagConstraints); 134 135 jLabel1.setText(org.openide.util.NbBundle.getMessage(RefreshWsDialog.class, "HINT_DownloadWsdl")); 136 gridBagConstraints = new java.awt.GridBagConstraints (); 137 gridBagConstraints.gridx = 0; 138 gridBagConstraints.gridy = 2; 139 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 140 gridBagConstraints.insets = new java.awt.Insets (0, 22, 0, 0); 141 add(jLabel1, gridBagConstraints); 142 143 jLabel2.setText(org.openide.util.NbBundle.getMessage(RefreshWsDialog.class, "HINT_RegenerateImplClass", new Object [] {implClass+".java.old"})); 144 gridBagConstraints = new java.awt.GridBagConstraints (); 145 gridBagConstraints.gridx = 0; 146 gridBagConstraints.gridy = 4; 147 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 148 gridBagConstraints.insets = new java.awt.Insets (0, 22, 0, 0); 149 add(jLabel2, gridBagConstraints); 150 151 jLabel3.setText(org.openide.util.NbBundle.getMessage(RefreshWsDialog.class, "HINT_RefreshService")); 152 gridBagConstraints = new java.awt.GridBagConstraints (); 153 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 154 gridBagConstraints.insets = new java.awt.Insets (0, 0, 20, 0); 155 add(jLabel3, gridBagConstraints); 156 157 } 159 160 private javax.swing.JCheckBox downloadWsdlCheckBox; 162 private javax.swing.JLabel jLabel1; 163 private javax.swing.JLabel jLabel2; 164 private javax.swing.JLabel jLabel3; 165 private javax.swing.JCheckBox regenerateCheckBox; 166 168 } 169 | Popular Tags |