|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.web.project.ui.customizer; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.swing.DefaultListModel; import javax.swing.JComponent; import javax.swing.JPanel; import org.openide.ErrorManager; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.loaders.DataObject; import org.openide.loaders.DataObjectNotFoundException; import org.openide.loaders.TemplateWizard; import org.openide.util.NbBundle; import org.openide.filesystems.Repository; import org.openide.loaders.DataFolder; import org.netbeans.api.java.platform.JavaPlatform; import org.netbeans.api.java.platform.JavaPlatformManager; import org.netbeans.api.java.platform.PlatformsCustomizer; import org.netbeans.api.java.platform.Specification; import org.openide.util.HelpCtx; /** Customizer for general project attributes. * * @author phrebejk */ public class CustomizerGeneral extends JPanel implements WebCustomizer.Panel, HelpCtx.Provider { private WebProjectProperties webProperties; private VisualPropertySupport vps; /** Creates new form CustomizerCompile */ public CustomizerGeneral(WebProjectProperties webProperties) { initComponents(); this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerGeneral.class, "ACS_CustomizeGeneral_A11YDesc")); //NOI18N this.webProperties = webProperties; vps = new VisualPropertySupport(webProperties); } public void initValues( ) { FileObject projectFolder = webProperties.getProject().getProjectDirectory(); File pf = FileUtil.toFile(projectFolder); jTextFieldProjectFolder.setText(pf == null ? "" : pf.getPath()); // NOI18N jTextFieldJ2EE.setText((String) webProperties.get(WebProjectProperties.J2EE_PLATFORM)); initPlatforms(vps); // XXX Listen to adding Projects artifacts DefaultListModel lm = new DefaultListModel(); for( Iterator it = webProperties.getSortedSubprojectsList().iterator(); it.hasNext(); ) { lm.addElement( it.next() ); } } private void initPlatforms(VisualPropertySupport vps) { // Read defined platforms JavaPlatform[] platforms = JavaPlatformManager.getDefault().getInstalledPlatforms(); List platformNames = new ArrayList (); for( int i = 0; i < platforms.length; i++ ) { Specification spec = platforms[i].getSpecification(); if ("j2se".equalsIgnoreCase (spec.getName())) { platformNames.add(platforms[i].getDisplayName()); } } vps.register(jComboBoxTarget, (String[]) platformNames.toArray(new String[platformNames.size()]), WebProjectProperties.JAVA_PLATFORM); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; jLabelProjectName = new javax.swing.JLabel(); jTextFieldProjectFolder = new javax.swing.JTextField(); jLabelTarget = new javax.swing.JLabel(); jComboBoxTarget = new javax.swing.JComboBox(); jButton1 = new javax.swing.JButton(); jLabelJ2EE = new javax.swing.JLabel(); jTextFieldJ2EE = new javax.swing.JTextField(); jPanel1 = new javax.swing.JPanel(); setLayout(new java.awt.GridBagLayout()); setBorder(new javax.swing.border.EtchedBorder()); jLabelProjectName.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "LBL_CustomizeGeneral_ProjectFolder_LabelMnemonic").charAt(0)); jLabelProjectName.setLabelFor(jTextFieldProjectFolder); jLabelProjectName.setText(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "LBL_CustomizeGeneral_ProjectFolder_JLabel")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 12); add(jLabelProjectName, gridBagConstraints); jTextFieldProjectFolder.setEditable(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(12, 0, 12, 12); add(jTextFieldProjectFolder, gridBagConstraints); jTextFieldProjectFolder.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "ACS_CustomizeGeneral_ProjectFolder_A11YDesc")); jLabelTarget.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "LBL_CustomizeGeneral_Platform_LabelMnemonic").charAt(0)); jLabelTarget.setLabelFor(jComboBoxTarget); jLabelTarget.setText(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "LBL_CustomizeGeneral_Platform_JLabel")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 12); add(jLabelTarget, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0); add(jComboBoxTarget, gridBagConstraints); jComboBoxTarget.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "ACS_CustomizeGeneral_Platform_A11YDesc")); jButton1.setMnemonic(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "LBL_CustomizeGeneral_PlatformEdit_LabelMnemonic").charAt(0)); jButton1.setText(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "LBL_CustomizeGeneral_Platform_JButton")); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { createNewPlatform(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 6, 12, 12); add(jButton1, gridBagConstraints); jButton1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "ACS_CustomizeGeneral_PlatformEdit_A11YDesc")); jLabelJ2EE.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "LBL_CustomizeGeneral_J2EEPlatform_LablelMnemonic").charAt(0)); jLabelJ2EE.setLabelFor(jTextFieldJ2EE); jLabelJ2EE.setText(NbBundle.getMessage(CustomizerGeneral.class, "LBL_CustomizeGeneral_J2EEPlatform_JLabel")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 12, 12, 12); add(jLabelJ2EE, gridBagConstraints); jTextFieldJ2EE.setEditable(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 12); add(jTextFieldJ2EE, gridBagConstraints); jTextFieldJ2EE.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerGeneral.class, "ACS_CustomizeGeneral_J2EEPlatform_A11YDesc")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weighty = 1.0; add(jPanel1, gridBagConstraints); }//GEN-END:initComponents private void createNewPlatform(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createNewPlatform PlatformsCustomizer.showCustomizer(null); initPlatforms (vps); }//GEN-LAST:event_createNewPlatform // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JComboBox jComboBoxTarget; private javax.swing.JLabel jLabelJ2EE; private javax.swing.JLabel jLabelProjectName; private javax.swing.JLabel jLabelTarget; private javax.swing.JPanel jPanel1; private javax.swing.JTextField jTextFieldJ2EE; private javax.swing.JTextField jTextFieldProjectFolder; // End of variables declaration//GEN-END:variables /** Help context where to find more about the paste type action. * @return the help context for this action */ public HelpCtx getHelpCtx() { return new HelpCtx(CustomizerGeneral.class); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.