1 19 20 package org.netbeans.modules.j2ee.archive.customizer; 21 22 import java.util.ArrayList ; 23 import javax.swing.JPanel ; 24 import org.netbeans.modules.j2ee.archive.project.ArchiveProjectProperties; 25 import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment; 26 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; 27 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform; 28 import org.openide.util.HelpCtx; 29 import org.openide.util.NbBundle; 30 31 public final class CustomizerRun extends JPanel implements ArchiveCustomizerPanel, HelpCtx.Provider { 32 33 private transient final VisualPropertySupport vps; 35 36 private String [] serverInstanceIDs; 37 private String [] serverNames; 38 boolean initialized = false; 39 40 41 public CustomizerRun(final ArchiveProjectProperties apProperties) { 42 initComponents(); 43 this.getAccessibleContext().setAccessibleDescription( 44 NbBundle.getMessage(CustomizerRun.class, "ACS_CustomizeRun_A11YDesc")); vps = new VisualPropertySupport(apProperties); 46 } 47 48 49 public void initValues() { 50 initialized = false; 51 initServerInstances(); 52 53 vps.register(jComboBoxServer, serverNames, serverInstanceIDs, ArchiveProjectProperties.J2EE_SERVER_INSTANCE); 54 55 initialized = true; 56 } 57 58 59 60 65 private void initComponents() { 67 java.awt.GridBagConstraints gridBagConstraints; 68 69 jLabelServer = new javax.swing.JLabel (); 70 jComboBoxServer = new javax.swing.JComboBox (); 71 filler = new javax.swing.JLabel (); 72 73 jLabelServer.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/archive/customizer/Bundle").getString("MNM_Server_Label").charAt(0)); 74 jLabelServer.setLabelFor(jComboBoxServer); 75 org.openide.awt.Mnemonics.setLocalizedText(jLabelServer, NbBundle.getMessage(CustomizerRun.class, "LBL_CustomizeRun_Server_JLabel")); 76 77 jComboBoxServer.addActionListener(new java.awt.event.ActionListener () { 78 public void actionPerformed(java.awt.event.ActionEvent evt) { 79 jComboBoxServerActionPerformed(evt); 80 } 81 }); 82 83 jComboBoxServer.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/archive/customizer/Bundle").getString("ACS_CustomizeRun_Server_A11YDesc")); 84 85 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 86 this.setLayout(layout); 87 layout.setHorizontalGroup( 88 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 89 .add(layout.createSequentialGroup() 90 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 91 .add(filler) 92 .add(layout.createSequentialGroup() 93 .add(jLabelServer) 94 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 95 .add(jComboBoxServer, 0, 203, Short.MAX_VALUE))) 96 .addContainerGap()) 97 ); 98 layout.setVerticalGroup( 99 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 100 .add(layout.createSequentialGroup() 101 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 102 .add(filler) 103 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 104 .add(jLabelServer) 105 .add(jComboBoxServer, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) 106 .add(21, 21, 21)) 107 ); 108 } 110 private void jComboBoxServerActionPerformed(java.awt.event.ActionEvent evt) { 112 } 114 private javax.swing.JLabel filler; 116 private javax.swing.JComboBox jComboBoxServer; 117 private javax.swing.JLabel jLabelServer; 118 120 123 public HelpCtx getHelpCtx() { 124 return new HelpCtx(CustomizerRun.class); 125 } 126 127 private void initServerInstances() { 128 String [] servInstIDs = Deployment.getDefault().getServerInstanceIDs(); 129 java.util.List servInstIDsList = new ArrayList (); 130 java.util.List servNamesList = new ArrayList (); 131 Deployment deployment = Deployment.getDefault(); 132 for (int i = 0; i < servInstIDs.length; i++) { 133 String instanceID = servInstIDs[i]; 134 J2eePlatform j2eePlat = deployment.getJ2eePlatform(instanceID); 135 String servInstDisplayName = Deployment.getDefault().getServerInstanceDisplayName(servInstIDs[i]); 136 if (servInstDisplayName != null 137 && j2eePlat != null 138 && j2eePlat.getSupportedModuleTypes().contains(J2eeModule.WAR)) 139 { servInstIDsList.add(instanceID); 141 servNamesList.add(servInstDisplayName); 142 } 143 } 144 serverInstanceIDs = (String []) servInstIDsList.toArray(new String [servInstIDsList.size()]); 145 serverNames = (String []) servNamesList.toArray(new String [servNamesList.size()]); 146 } 147 148 } 149 | Popular Tags |