001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * If you wish your version of this file to be governed by only the CDDL
025: * or only the GPL Version 2, indicate your decision by adding
026: * "[Contributor] elects to include this software in this distribution
027: * under the [CDDL or GPL Version 2] license." If you do not indicate a
028: * single choice of license, a recipient has the option to distribute
029: * your version of this file under either the CDDL, the GPL Version 2 or
030: * to extend the choice of license to its licensees as provided above.
031: * However, if you add GPL Version 2 code and therefore, elected the GPL
032: * Version 2 license, then the option applies only if the new code is
033: * made subject to such option by the copyright holder.
034: *
035: * Contributor(s):
036: *
037: * Portions Copyrighted 2007 Sun Microsystems, Inc.
038: */
039:
040: package org.netbeans.modules.ant.freeform.ui;
041:
042: import org.netbeans.modules.ant.freeform.FreeformProjectGenerator;
043:
044: import org.netbeans.modules.ant.freeform.spi.support.Util;
045: import org.netbeans.spi.project.support.ant.AntProjectHelper;
046: import org.netbeans.spi.project.support.ant.PropertyEvaluator;
047:
048: import org.openide.filesystems.FileObject;
049: import org.openide.filesystems.FileUtil;
050:
051: /**
052: *
053: * @author Milan Kubec
054: */
055: public class GeneralInformationPanel extends javax.swing.JPanel {
056:
057: /** Creates new form GeneralInformationPanel */
058: public GeneralInformationPanel(AntProjectHelper helper,
059: PropertyEvaluator evaluator) {
060: initComponents();
061: projectFolderTextField.setText(FileUtil
062: .getFileDisplayName(helper.getProjectDirectory()));
063: FileObject baseFolderFO = FileUtil.toFileObject(Util
064: .getProjectLocation(helper, evaluator));
065: contentsFolderTextField.setText(FileUtil
066: .getFileDisplayName(baseFolderFO));
067: FileObject antScriptFO = FreeformProjectGenerator.getAntScript(
068: helper, evaluator);
069: if (antScriptFO != null) {
070: buildScriptTextField.setText(FileUtil
071: .getFileDisplayName(antScriptFO));
072: }
073: }
074:
075: /** This method is called from within the constructor to
076: * initialize the form.
077: * WARNING: Do NOT modify this code. The content of this method is
078: * always regenerated by the Form Editor.
079: */
080: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
081: private void initComponents() {
082: java.awt.GridBagConstraints gridBagConstraints;
083:
084: panelLabel = new javax.swing.JLabel();
085: projectFolderLabel = new javax.swing.JLabel();
086: contentsFolderLabel = new javax.swing.JLabel();
087: buildScriptLabel = new javax.swing.JLabel();
088: buildScriptTextField = new javax.swing.JTextField();
089: contentsFolderTextField = new javax.swing.JTextField();
090: projectFolderTextField = new javax.swing.JTextField();
091:
092: setPreferredSize(new java.awt.Dimension(560, 450));
093: setLayout(new java.awt.GridBagLayout());
094:
095: panelLabel.setText(org.openide.util.NbBundle.getMessage(
096: GeneralInformationPanel.class,
097: "GeneralInformationPanel.panelLabel.text")); // NOI18N
098: gridBagConstraints = new java.awt.GridBagConstraints();
099: gridBagConstraints.gridwidth = 2;
100: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
101: add(panelLabel, gridBagConstraints);
102:
103: projectFolderLabel
104: .setText(org.openide.util.NbBundle
105: .getMessage(GeneralInformationPanel.class,
106: "GeneralInformationPanel.projectFolderLabel.text")); // NOI18N
107: gridBagConstraints = new java.awt.GridBagConstraints();
108: gridBagConstraints.gridx = 0;
109: gridBagConstraints.gridy = 1;
110: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
111: gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
112: add(projectFolderLabel, gridBagConstraints);
113:
114: contentsFolderLabel
115: .setText(org.openide.util.NbBundle
116: .getMessage(GeneralInformationPanel.class,
117: "GeneralInformationPanel.contentsFolderLabel.text")); // NOI18N
118: gridBagConstraints = new java.awt.GridBagConstraints();
119: gridBagConstraints.gridx = 0;
120: gridBagConstraints.gridy = 2;
121: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
122: gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0);
123: add(contentsFolderLabel, gridBagConstraints);
124:
125: buildScriptLabel.setText(org.openide.util.NbBundle.getMessage(
126: GeneralInformationPanel.class,
127: "GeneralInformationPanel.buildScriptLabel.text")); // NOI18N
128: gridBagConstraints = new java.awt.GridBagConstraints();
129: gridBagConstraints.gridx = 0;
130: gridBagConstraints.gridy = 3;
131: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
132: gridBagConstraints.weighty = 1.0;
133: gridBagConstraints.insets = new java.awt.Insets(8, 0, 0, 0);
134: add(buildScriptLabel, gridBagConstraints);
135:
136: buildScriptTextField.setEditable(false);
137: gridBagConstraints = new java.awt.GridBagConstraints();
138: gridBagConstraints.gridx = 1;
139: gridBagConstraints.gridy = 3;
140: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
141: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
142: gridBagConstraints.weightx = 1.0;
143: gridBagConstraints.weighty = 1.0;
144: gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
145: add(buildScriptTextField, gridBagConstraints);
146:
147: contentsFolderTextField.setEditable(false);
148: gridBagConstraints = new java.awt.GridBagConstraints();
149: gridBagConstraints.gridx = 1;
150: gridBagConstraints.gridy = 2;
151: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
152: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
153: gridBagConstraints.weightx = 1.0;
154: gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
155: add(contentsFolderTextField, gridBagConstraints);
156:
157: projectFolderTextField.setEditable(false);
158: gridBagConstraints = new java.awt.GridBagConstraints();
159: gridBagConstraints.gridx = 1;
160: gridBagConstraints.gridy = 1;
161: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
162: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
163: gridBagConstraints.weightx = 1.0;
164: gridBagConstraints.insets = new java.awt.Insets(10, 6, 0, 0);
165: add(projectFolderTextField, gridBagConstraints);
166: }// </editor-fold>//GEN-END:initComponents
167:
168: // Variables declaration - do not modify//GEN-BEGIN:variables
169: private javax.swing.JLabel buildScriptLabel;
170: private javax.swing.JTextField buildScriptTextField;
171: private javax.swing.JLabel contentsFolderLabel;
172: private javax.swing.JTextField contentsFolderTextField;
173: private javax.swing.JLabel panelLabel;
174: private javax.swing.JLabel projectFolderLabel;
175: private javax.swing.JTextField projectFolderTextField;
176: // End of variables declaration//GEN-END:variables
177:
178: }
|