Adding Git source, NetBeans project files, GPL v2 LICENSE, ant build file.
[nbgit.git] / src / org / netbeans / modules / git / ui / wizards / ClonePathsPanel.java
blob9799dab44b860c303eeb8b16121f95edb1d3cdad
1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common
8 * Development and Distribution License("CDDL") (collectively, the
9 * "License"). You may not use this file except in compliance with the
10 * License. You can obtain a copy of the License at
11 * http://www.netbeans.org/cddl-gplv2.html
12 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13 * specific language governing permissions and limitations under the
14 * License. When distributing the software, include this License Header
15 * Notice in each file and include the License file at
16 * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17 * particular file as subject to the "Classpath" exception as provided
18 * by Sun in the GPL Version 2 section of the License file that
19 * accompanied this code. If applicable, add the following below the
20 * License Header, with the fields enclosed by brackets [] replaced by
21 * your own identifying information:
22 * "Portions Copyrighted [year] [name of copyright owner]"
24 * Contributor(s):
26 * The Original Software is NetBeans. The Initial Developer of the Original
27 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28 * Microsystems, Inc. All Rights Reserved.
29 * Portions Copyright 2008 Alexander Coles (Ikonoklastik Productions).
31 * If you wish your version of this file to be governed by only the CDDL
32 * or only the GPL Version 2, indicate your decision by adding
33 * "[Contributor] elects to include this software in this distribution
34 * under the [CDDL or GPL Version 2] license." If you do not indicate a
35 * single choice of license, a recipient has the option to distribute
36 * your version of this file under either the CDDL, the GPL Version 2 or
37 * to extend the choice of license to its licensees as provided above.
38 * However, if you add GPL Version 2 code and therefore, elected the GPL
39 * Version 2 license, then the option applies only if the new code is
40 * made subject to such option by the copyright holder.
42 package org.netbeans.modules.git.ui.wizards;
44 import java.awt.event.ActionEvent;
45 import java.awt.event.ActionListener;
46 import javax.swing.JPanel;
47 import org.openide.util.NbBundle;
49 public final class ClonePathsPanel extends JPanel implements ActionListener {
50 private String message;
52 /** Creates new form CloneVisualPanel2 */
53 public ClonePathsPanel() {
54 initComponents();
57 public String getName() {
58 if (pathsPanel == null) {
59 return null;
61 return pathsPanel.getName();
64 public String getPullPath() {
65 return defaultPullPathField.getText();
68 public String getPushPath() {
69 return defaultPushPathField.getText();
72 public String getMessage() {
73 return message;
76 public boolean isValid() {
77 String pullPath = defaultPullPathField.getText();
78 String pushPath = defaultPushPathField.getText();
79 if ((pullPath == null || pullPath.equals("")) && (pushPath == null || pushPath.equals(""))) {
80 message = NbBundle.getMessage(CloneRepositoryPanel.class, "MSG_NO_PATHS_SPECIFIED_USE_DEFAULTS"); // NOI18N
81 return false;
82 } else {
83 if (pullPath == null || pullPath.equals("")) {
84 pullPath = pushPath;
86 if (pushPath == null || pushPath.equals("")) {
87 pushPath = pullPath;
89 message = "";
90 return true;
94 /** This method is called from within the constructor to
95 * initialize the form.
96 * WARNING: Do NOT modify this code. The content of this method is
97 * always regenerated by the Form Editor.
99 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
100 private void initComponents() {
102 pathsPanel = new javax.swing.JPanel();
103 defaultPullPathLabel = new javax.swing.JLabel();
104 defaultPushPathLabel = new javax.swing.JLabel();
105 jLabel1 = new javax.swing.JLabel();
107 pathsPanel.setName(org.openide.util.NbBundle.getMessage(ClonePathsPanel.class, "pathsPanel.Name")); // NOI18N
109 defaultPullPathLabel.setLabelFor(defaultPullPathField);
110 org.openide.awt.Mnemonics.setLocalizedText(defaultPullPathLabel, org.openide.util.NbBundle.getMessage(ClonePathsPanel.class, "defaultPullLabel.Name")); // NOI18N
112 defaultPullPathField.addActionListener(new java.awt.event.ActionListener() {
113 public void actionPerformed(java.awt.event.ActionEvent evt) {
114 defaultPullPathFieldActionPerformed(evt);
118 defaultPushPathLabel.setLabelFor(defaultPushPathField);
119 org.openide.awt.Mnemonics.setLocalizedText(defaultPushPathLabel, org.openide.util.NbBundle.getMessage(ClonePathsPanel.class, "defaultPushLabel.Name")); // NOI18N
121 org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ClonePathsPanel.class, "defaultLabel.Name")); // NOI18N
123 org.jdesktop.layout.GroupLayout pathsPanelLayout = new org.jdesktop.layout.GroupLayout(pathsPanel);
124 pathsPanel.setLayout(pathsPanelLayout);
125 pathsPanelLayout.setHorizontalGroup(
126 pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
127 .add(pathsPanelLayout.createSequentialGroup()
128 .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
129 .add(pathsPanelLayout.createSequentialGroup()
130 .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
131 .add(defaultPushPathLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
132 .add(defaultPullPathLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
133 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
134 .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
135 .add(defaultPullPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
136 .add(defaultPushPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)))
137 .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 605, Short.MAX_VALUE))
138 .addContainerGap())
140 pathsPanelLayout.setVerticalGroup(
141 pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
142 .add(pathsPanelLayout.createSequentialGroup()
143 .add(jLabel1)
144 .add(20, 20, 20)
145 .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
146 .add(defaultPullPathLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
147 .add(defaultPullPathField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
148 .add(28, 28, 28)
149 .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
150 .add(defaultPushPathLabel)
151 .add(defaultPushPathField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
152 .add(125, 125, 125))
155 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
156 this.setLayout(layout);
157 layout.setHorizontalGroup(
158 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
159 .add(pathsPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
161 layout.setVerticalGroup(
162 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
163 .add(layout.createSequentialGroup()
164 .add(pathsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
165 .addContainerGap(68, Short.MAX_VALUE))
167 }// </editor-fold>//GEN-END:initComponents
169 private void defaultPullPathFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_defaultPullPathFieldActionPerformed
170 // TODO add your handling code here:
171 }//GEN-LAST:event_defaultPullPathFieldActionPerformed
173 public void actionPerformed(ActionEvent evt) {
176 // Variables declaration - do not modify//GEN-BEGIN:variables
177 final javax.swing.JTextField defaultPullPathField = new javax.swing.JTextField();
178 private javax.swing.JLabel defaultPullPathLabel;
179 final javax.swing.JTextField defaultPushPathField = new javax.swing.JTextField();
180 private javax.swing.JLabel defaultPushPathLabel;
181 private javax.swing.JLabel jLabel1;
182 private javax.swing.JPanel pathsPanel;
183 // End of variables declaration//GEN-END:variables