# HG changeset patch
# User jrice@netbeans.org
# Date 1202916209 0
# Node ID cf1fe73564b0dc911fe6b897e116d5267fcfdef5
# Parent 2f6a7ba13e746a84d462c327fc56bd3a4e5fd6f3
#126357: Clone Other - add support to specify the default push and pull paths as another Wizard step, defaults to repository URI.
diff -r 2f6a7ba13e74 -r cf1fe73564b0 mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java
--- a/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java Wed Feb 13 12:17:28 2008 +0000
+++ b/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java Wed Feb 13 15:23:29 2008 +0000
@@ -107,16 +107,16 @@ public class CloneAction extends Context
if (!clone.showDialog()) {
return;
}
-
- performClone(root.getAbsolutePath(), clone.getOutputFileName(), projIsRepos, projFile, true);
+ performClone(root.getAbsolutePath(), clone.getOutputFileName(), projIsRepos, projFile, true, null, null);
}
- public static void performClone(final String source, final String target, boolean projIsRepos, File projFile) {
- performClone(source, target, projIsRepos, projFile, false);
+ public static void performClone(final String source, final String target, boolean projIsRepos,
+ File projFile, final String pullPath, final String pushPath) {
+ performClone(source, target, projIsRepos, projFile, false, pullPath, pushPath);
}
private static void performClone(final String source, final String target,
- boolean projIsRepos, File projFile, final boolean isLocalClone) {
+ boolean projIsRepos, File projFile, final boolean isLocalClone, final String pullPath, final String pushPath) {
final Mercurial hg = Mercurial.getInstance();
final ProjectManager projectManager = ProjectManager.getDefault();
final File prjFile = projFile;
@@ -219,6 +219,8 @@ public class CloneAction extends Context
HgConfigFiles hg = new HgConfigFiles(cloneFolder);
String defaultPull = hg.getDefaultPull(false);
String defaultPush = hg.getDefaultPush(false);
+ if(pullPath != null && !pullPath.equals("")) defaultPull = pullPath;
+ if(pushPath != null && !pushPath.equals("")) defaultPush = pushPath;
hg.setProperty(HgProperties.HGPROPNAME_DEFAULT_PULL, defaultPull);
hg.setProperty(HgProperties.HGPROPNAME_DEFAULT_PUSH, defaultPush);
diff -r 2f6a7ba13e74 -r cf1fe73564b0 mercurial/src/org/netbeans/modules/mercurial/ui/wizards/Bundle.properties
--- a/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/Bundle.properties Wed Feb 13 12:17:28 2008 +0000
+++ b/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/Bundle.properties Wed Feb 13 15:23:29 2008 +0000
@@ -44,16 +44,23 @@ Folders=Folders
Folders=Folders
OK_Button=OK
-CTL_Repository_Location=Specify the location of mercurial repository.
+CTL_Repository_Location=Specify the location of mercurial repository
CTL_Clone = Clone External Repository
destinationDirectoryPanel.Name=Destination Directory
-directoryLabel.Name=Specify Parent &Directory:
+directoryTitleLabel.Name=Specify the Parent Directory and Name for this Clone
+directoryLabel.Name= Parent &Directory:
directoryBrowseButton.Name=&Browse...
-nameLabel.Name=Specify Clone &Name:
+nameLabel.Name= Clone &Name:
+
+pathsPanel.Name = Mercurial Paths
+defaultLabel.Name = Specify the Default Pull and Push Paths for this repository
+defaultPullLabel.Name = Default Pu&ll Path:
+defaultPushLabel.Name = Default Pu&sh Path:
MSG_TARGET_EXISTS = Clone destination already exists, please specify a different name or parent directory
+MSG_NO_PATHS_SPECIFIED_USE_DEFAULTS = No default Pull/ Push Paths specified.\n\nUsing Mercurial defaults for Clone.
BK2022=Stop
BK2012=Connecting to Mercurial Repository...
diff -r 2f6a7ba13e74 -r cf1fe73564b0 mercurial/src/org/netbeans/modules/mercurial/ui/wizards/CloneDestinationDirectoryPanel.form
--- a/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/CloneDestinationDirectoryPanel.form Wed Feb 13 12:17:28 2008 +0000
+++ b/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/CloneDestinationDirectoryPanel.form Wed Feb 13 15:23:29 2008 +0000
@@ -47,13 +47,14 @@
-
-
+
+
+
@@ -62,7 +63,8 @@
-
+
+
@@ -137,6 +139,13 @@
+
+
+
+
+
+
+
diff -r 2f6a7ba13e74 -r cf1fe73564b0 mercurial/src/org/netbeans/modules/mercurial/ui/wizards/CloneDestinationDirectoryPanel.java
--- a/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/CloneDestinationDirectoryPanel.java Wed Feb 13 12:17:28 2008 +0000
+++ b/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/CloneDestinationDirectoryPanel.java Wed Feb 13 15:23:29 2008 +0000
@@ -108,6 +108,7 @@ public final class CloneDestinationDirec
directoryLabel = new javax.swing.JLabel();
directoryBrowseButton = new javax.swing.JButton();
nameLabel = new javax.swing.JLabel();
+ jLabel1 = new javax.swing.JLabel();
destinationDirectoryPanel.setName(org.openide.util.NbBundle.getMessage(CloneDestinationDirectoryPanel.class, "destinationDirectoryPanel.Name")); // NOI18N
@@ -128,6 +129,8 @@ public final class CloneDestinationDirec
scanForProjectsCheckBox.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(scanForProjectsCheckBox, org.openide.util.NbBundle.getMessage(CloneDestinationDirectoryPanel.class, "CTL_Scan_After_Clone")); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CloneDestinationDirectoryPanel.class, "directoryTitleLabel.Name")); // NOI18N
+
org.jdesktop.layout.GroupLayout destinationDirectoryPanelLayout = new org.jdesktop.layout.GroupLayout(destinationDirectoryPanel);
destinationDirectoryPanel.setLayout(destinationDirectoryPanelLayout);
destinationDirectoryPanelLayout.setHorizontalGroup(
@@ -140,17 +143,19 @@ public final class CloneDestinationDirec
.add(directoryLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(destinationDirectoryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE)
- .add(directoryField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE))
+ .add(nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE)
+ .add(directoryField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(directoryBrowseButton))
- .add(scanForProjectsCheckBox))
+ .add(scanForProjectsCheckBox)
+ .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 597, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
destinationDirectoryPanelLayout.setVerticalGroup(
destinationDirectoryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(destinationDirectoryPanelLayout.createSequentialGroup()
- .add(36, 36, 36)
+ .add(jLabel1)
+ .add(20, 20, 20)
.add(destinationDirectoryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(directoryLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(directoryBrowseButton)
@@ -263,6 +268,7 @@ public final class CloneDestinationDirec
private javax.swing.JButton directoryBrowseButton;
final javax.swing.JTextField directoryField = new javax.swing.JTextField();
private javax.swing.JLabel directoryLabel;
+ private javax.swing.JLabel jLabel1;
final javax.swing.JTextField nameField = new javax.swing.JTextField();
private javax.swing.JLabel nameLabel;
final javax.swing.JCheckBox scanForProjectsCheckBox = new javax.swing.JCheckBox();
diff -r 2f6a7ba13e74 -r cf1fe73564b0 mercurial/src/org/netbeans/modules/mercurial/ui/wizards/ClonePathsPanel.form
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/ClonePathsPanel.form Wed Feb 13 15:23:29 2008 +0000
@@ -0,0 +1,123 @@
+
+
+
diff -r 2f6a7ba13e74 -r cf1fe73564b0 mercurial/src/org/netbeans/modules/mercurial/ui/wizards/ClonePathsPanel.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/ClonePathsPanel.java Wed Feb 13 15:23:29 2008 +0000
@@ -0,0 +1,186 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ */
+package org.netbeans.modules.mercurial.ui.wizards;
+
+import javax.swing.JPanel;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import org.openide.util.NbBundle;
+
+public final class ClonePathsPanel extends JPanel implements ActionListener {
+ private String message;
+
+ /** Creates new form CloneVisualPanel2 */
+ public ClonePathsPanel() {
+ initComponents();
+ }
+
+ public String getName() {
+ if (pathsPanel == null) {
+ return null;
+ }
+ return pathsPanel.getName();
+ }
+
+ public String getPullPath() {
+ return defaultPullPathField.getText();
+ }
+
+ public String getPushPath() {
+ return defaultPushPathField.getText();
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public boolean isValid() {
+ String pullPath = defaultPullPathField.getText();
+ String pushPath = defaultPushPathField.getText();
+ if ((pullPath == null || pullPath.equals("")) && (pushPath == null || pushPath.equals(""))) {
+ message = NbBundle.getMessage(CloneRepositoryPanel.class, "MSG_NO_PATHS_SPECIFIED_USE_DEFAULTS"); // NOI18N
+ return false;
+ } else {
+ if (pullPath == null || pullPath.equals("")) {
+ pullPath = pushPath;
+ }
+ if (pushPath == null || pushPath.equals("")) {
+ pushPath = pullPath;
+ }
+ message = "";
+ return true;
+ }
+ }
+
+ /** 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.
+ */
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ pathsPanel = new javax.swing.JPanel();
+ defaultPullPathLabel = new javax.swing.JLabel();
+ defaultPushPathLabel = new javax.swing.JLabel();
+ jLabel1 = new javax.swing.JLabel();
+
+ pathsPanel.setName(org.openide.util.NbBundle.getMessage(ClonePathsPanel.class, "pathsPanel.Name")); // NOI18N
+
+ defaultPullPathLabel.setLabelFor(defaultPullPathField);
+ org.openide.awt.Mnemonics.setLocalizedText(defaultPullPathLabel, org.openide.util.NbBundle.getMessage(ClonePathsPanel.class, "defaultPullLabel.Name")); // NOI18N
+
+ defaultPullPathField.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ defaultPullPathFieldActionPerformed(evt);
+ }
+ });
+
+ defaultPushPathLabel.setLabelFor(defaultPushPathField);
+ org.openide.awt.Mnemonics.setLocalizedText(defaultPushPathLabel, org.openide.util.NbBundle.getMessage(ClonePathsPanel.class, "defaultPushLabel.Name")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ClonePathsPanel.class, "defaultLabel.Name")); // NOI18N
+
+ org.jdesktop.layout.GroupLayout pathsPanelLayout = new org.jdesktop.layout.GroupLayout(pathsPanel);
+ pathsPanel.setLayout(pathsPanelLayout);
+ pathsPanelLayout.setHorizontalGroup(
+ pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pathsPanelLayout.createSequentialGroup()
+ .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pathsPanelLayout.createSequentialGroup()
+ .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
+ .add(defaultPushPathLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(defaultPullPathLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(defaultPullPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
+ .add(defaultPushPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)))
+ .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 605, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ pathsPanelLayout.setVerticalGroup(
+ pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pathsPanelLayout.createSequentialGroup()
+ .add(jLabel1)
+ .add(20, 20, 20)
+ .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(defaultPullPathLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(defaultPullPathField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .add(28, 28, 28)
+ .add(pathsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(defaultPushPathLabel)
+ .add(defaultPushPathField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .add(125, 125, 125))
+ );
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(pathsPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(pathsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(68, Short.MAX_VALUE))
+ );
+ }// //GEN-END:initComponents
+
+ private void defaultPullPathFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_defaultPullPathFieldActionPerformed
+ // TODO add your handling code here:
+}//GEN-LAST:event_defaultPullPathFieldActionPerformed
+
+ public void actionPerformed(ActionEvent evt) {
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ final javax.swing.JTextField defaultPullPathField = new javax.swing.JTextField();
+ private javax.swing.JLabel defaultPullPathLabel;
+ final javax.swing.JTextField defaultPushPathField = new javax.swing.JTextField();
+ private javax.swing.JLabel defaultPushPathLabel;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JPanel pathsPanel;
+ // End of variables declaration//GEN-END:variables
+
+}
+
diff -r 2f6a7ba13e74 -r cf1fe73564b0 mercurial/src/org/netbeans/modules/mercurial/ui/wizards/ClonePathsWizardPanel.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/ClonePathsWizardPanel.java Wed Feb 13 15:23:29 2008 +0000
@@ -0,0 +1,198 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ */
+package org.netbeans.modules.mercurial.ui.wizards;
+
+import java.io.File;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.awt.Component;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.SwingUtilities;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import org.openide.WizardDescriptor;
+import org.openide.util.HelpCtx;
+
+public class ClonePathsWizardPanel implements WizardDescriptor.Panel, DocumentListener {
+
+ /**
+ * The visual component that displays this panel. If you need to access the
+ * component from this class, just use getComponent().
+ */
+ private ClonePathsPanel component;
+ private boolean valid;
+ private String errorMessage;
+ private String repositoryOrig;
+ // Get the visual component for the panel. In this template, the component
+ // is kept separate. This can be more efficient: if the wizard is created
+ // but never displayed, or not all panels are displayed, it is better to
+ // create only those which really need to be visible.
+ public Component getComponent() {
+ if (component == null) {
+ component = new ClonePathsPanel();
+ valid();
+ }
+ return component;
+ }
+
+ public HelpCtx getHelp() {
+ return new HelpCtx(ClonePathsWizardPanel.class);
+ }
+
+ //public boolean isValid() {
+ // If it is always OK to press Next or Finish, then:
+ //return true;
+ // If it depends on some condition (form filled out...), then:
+ // return someCondition();
+ // and when this condition changes (last form field filled in...) then:
+ // fireChangeEvent();
+ // and uncomment the complicated stuff below.
+ //}
+
+ public void insertUpdate(DocumentEvent e) {
+ textChanged(e);
+ }
+
+ public void removeUpdate(DocumentEvent e) {
+ textChanged(e);
+ }
+
+ public void changedUpdate(DocumentEvent e) {
+ textChanged(e);
+ }
+
+ private void textChanged(final DocumentEvent e) {
+ // repost later to AWT otherwise it can deadlock because
+ // the document is locked while firing event and we try
+ // synchronously access its content
+ Runnable awt = new Runnable() {
+ public void run() {
+ if (e.getDocument() == component.defaultPullPathField.getDocument () ||
+ e.getDocument() == component.defaultPushPathField.getDocument()) {
+ if (component.isValid()) {
+ valid(component.getMessage());
+ } else {
+ invalid(component.getMessage());
+ }
+ }
+ }
+ };
+ SwingUtilities.invokeLater(awt);
+ }
+
+ private final Set listeners = new HashSet(1); // or can use ChangeSupport in NB 6.0
+ public final void addChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.add(l);
+ }
+ }
+ public final void removeChangeListener(ChangeListener l) {
+ synchronized (listeners) {
+ listeners.remove(l);
+ }
+ }
+ protected final void fireChangeEvent() {
+ Iterator it;
+ synchronized (listeners) {
+ it = new HashSet(listeners).iterator();
+ }
+ ChangeEvent ev = new ChangeEvent(this);
+ while (it.hasNext()) {
+ it.next().stateChanged(ev);
+ }
+ }
+
+ protected final void valid() {
+ setValid(true, null);
+ }
+
+ protected final void valid(String extErrorMessage) {
+ setValid(true, extErrorMessage);
+ }
+
+ protected final void invalid(String message) {
+ setValid(false, message);
+ }
+
+ public final boolean isValid() {
+ return valid;
+ }
+
+ public final String getErrorMessage() {
+ return errorMessage;
+ }
+
+ private void setValid(boolean valid, String errorMessage) {
+ boolean fire = this.valid != valid;
+ fire |= errorMessage != null && (errorMessage.equals(this.errorMessage) == false);
+ this.valid = valid;
+ this.errorMessage = errorMessage;
+ if (fire) {
+ fireChangeEvent();
+ }
+ }
+
+ // You can use a settings object to keep track of state. Normally the
+ // settings object will be the WizardDescriptor, so you can use
+ // WizardDescriptor.getProperty & putProperty to store information entered
+ // by the user.
+ public void readSettings(Object settings) {
+ if (settings instanceof WizardDescriptor) {
+ String repository = (String) ((WizardDescriptor) settings).getProperty("repository"); // NOI18N
+ boolean repoistoryChanged = repositoryOrig == null || !repository.equals(repositoryOrig);
+ repositoryOrig = repository;
+
+ if(repoistoryChanged || component.defaultPullPathField.getText().equals(""))
+ component.defaultPullPathField.setText(repository);
+ if(repoistoryChanged || component.defaultPushPathField.getText().equals(""))
+ component.defaultPushPathField.setText(repository);
+ }
+ }
+ public void storeSettings(Object settings) {
+ if (settings instanceof WizardDescriptor) {
+ ((WizardDescriptor) settings).putProperty("defaultPullPath", ((ClonePathsPanel) component).getPullPath()); // NOI18N
+ ((WizardDescriptor) settings).putProperty("defaultPushPath", ((ClonePathsPanel) component).getPushPath()); // NOI18N
+ }
+ }
+}
+
diff -r 2f6a7ba13e74 -r cf1fe73564b0 mercurial/src/org/netbeans/modules/mercurial/ui/wizards/CloneWizardAction.java
--- a/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/CloneWizardAction.java Wed Feb 13 12:17:28 2008 +0000
+++ b/mercurial/src/org/netbeans/modules/mercurial/ui/wizards/CloneWizardAction.java Wed Feb 13 15:23:29 2008 +0000
@@ -74,6 +74,7 @@ public final class CloneWizardAction ext
private WizardDescriptor wizardDescriptor;
private CloneRepositoryWizardPanel cloneRepositoryWizardPanel;
private CloneDestinationDirectoryWizardPanel cloneDestinationDirectoryWizardPanel;
+ private ClonePathsWizardPanel clonePathsWizardPanel;
private PanelsIterator wizardIterator;
private String errorMessage;
@@ -103,8 +104,10 @@ public final class CloneWizardAction ext
final String password = (String) wizardDescriptor.getProperty("password"); // NOI18N
final String directory = (String) wizardDescriptor.getProperty("directory"); // NOI18N
final String cloneName = (String) wizardDescriptor.getProperty("cloneName"); // NOI18N
+ final String pullPath = (String) wizardDescriptor.getProperty("defaultPullPath"); // NOI18N
+ final String pushPath = (String) wizardDescriptor.getProperty("defaultPushPath"); // NOI18N
File cloneFile = new File(directory, cloneName);
- CloneAction.performClone(repository, cloneFile.getAbsolutePath(), true, null);
+ CloneAction.performClone(repository, cloneFile.getAbsolutePath(), true, null, pullPath, pushPath);
}
}
@@ -118,6 +121,8 @@ public final class CloneWizardAction ext
}
if (step == cloneRepositoryWizardPanel) {
errorMessage = cloneRepositoryWizardPanel.getErrorMessage();
+ } else if (step == clonePathsWizardPanel) {
+ errorMessage = clonePathsWizardPanel.getErrorMessage();
} else if (step == cloneDestinationDirectoryWizardPanel) {
errorMessage = cloneDestinationDirectoryWizardPanel.getErrorMessage();
}
@@ -156,9 +161,10 @@ public final class CloneWizardAction ext
protected WizardDescriptor.Panel[] initializePanels() {
WizardDescriptor.Panel[] panels = new WizardDescriptor.Panel[2];
cloneRepositoryWizardPanel = new CloneRepositoryWizardPanel();
+ clonePathsWizardPanel = new ClonePathsWizardPanel();
cloneDestinationDirectoryWizardPanel = new CloneDestinationDirectoryWizardPanel();
panels = new WizardDescriptor.Panel[] {
- cloneRepositoryWizardPanel, cloneDestinationDirectoryWizardPanel
+ cloneRepositoryWizardPanel, clonePathsWizardPanel, cloneDestinationDirectoryWizardPanel
};
panels[0].addChangeListener(CloneWizardAction.this);
panels[1].addChangeListener(CloneWizardAction.this);