Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial implementation of Clone

* Cloning of local repositories and remote (using git:// protocol)
  currently working.
* Caveats:
  * OutputLogger text needs cleaning up.
  * All protocols not testing.
  * URL validation not working correctly -- after entering an invalid
    URL, wizard must be cancelled.
  * GitProgressMonitor implementation of JGit's ProgressMonitor is
    not accurate, and needs better understanding of NetBeans progress
    support APIs.

Signed-off-by: Alex Coles <alex@alexcolesportfolio.com>
  • Loading branch information...
commit 1b180301736ab27863af6fa0f0bf0d142c814fe3 1 parent b1c8ef5
@myabc authored
Showing with 4,983 additions and 1 deletion.
  1. +4 −0 src/org/nbgit/GitAnnotator.java
  2. +107 −0 src/org/nbgit/GitProgressMonitor.java
  3. +21 −0 src/org/nbgit/GitProgressSupport.java
  4. +98 −0 src/org/nbgit/ui/clone/Bundle.properties
  5. +118 −0 src/org/nbgit/ui/clone/Clone.java
  6. +302 −0 src/org/nbgit/ui/clone/CloneAction.java
  7. +84 −0 src/org/nbgit/ui/clone/CloneCompleted.java
  8. +60 −0 src/org/nbgit/ui/clone/CloneExternalAction.java
  9. +170 −0 src/org/nbgit/ui/clone/ClonePanel.form
  10. +257 −0 src/org/nbgit/ui/clone/ClonePanel.java
  11. +109 −0 src/org/nbgit/ui/repository/Bundle.properties
  12. +720 −0 src/org/nbgit/ui/repository/GitRepositoryUI.java
  13. +56 −0 src/org/nbgit/ui/repository/GitURIScheme.java
  14. +56 −0 src/org/nbgit/ui/repository/RepositoryDialogPanel.form
  15. +97 −0 src/org/nbgit/ui/repository/RepositoryDialogPanel.java
  16. +371 −0 src/org/nbgit/ui/repository/RepositoryPanel.form
  17. +243 −0 src/org/nbgit/ui/repository/RepositoryPanel.java
  18. +80 −0 src/org/nbgit/ui/wizards/Bundle.properties
  19. +153 −0 src/org/nbgit/ui/wizards/CloneDestinationDirectoryPanel.form
  20. +285 −0 src/org/nbgit/ui/wizards/CloneDestinationDirectoryPanel.java
  21. +197 −0 src/org/nbgit/ui/wizards/CloneDestinationDirectoryWizardPanel.java
  22. +146 −0 src/org/nbgit/ui/wizards/ClonePathsPanel.form
  23. +138 −0 src/org/nbgit/ui/wizards/ClonePathsPanel.java
  24. +312 −0 src/org/nbgit/ui/wizards/ClonePathsWizardPanel.java
  25. +432 −0 src/org/nbgit/ui/wizards/CloneRepositoryWizardPanel.java
  26. +172 −0 src/org/nbgit/ui/wizards/CloneWizardAction.java
  27. +176 −0 src/org/nbgit/ui/wizards/WizardStepProgressSupport.java
  28. +19 −1 src/org/nbgit/util/GitUtils.java
View
4 src/org/nbgit/GitAnnotator.java
@@ -52,6 +52,8 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Level;
import javax.swing.Action;
+import org.nbgit.ui.clone.CloneAction;
+import org.nbgit.ui.clone.CloneExternalAction;
import org.nbgit.ui.commit.CommitAction;
import org.nbgit.ui.custom.CustomMenu;
import org.nbgit.ui.diff.DiffAction;
@@ -254,12 +256,14 @@ public Image annotateIcon(Image icon, VCSContext context) {
actions.add(new ExportDiffAction(loc.getString("CTL_PopupMenuItem_ExportDiff"), ctx)); // NOI18N
actions.add(new ApplyDiffAction(loc.getString("CTL_PopupMenuItem_ImportDiff"), ctx)); // NOI18N
actions.add(null);
+ */
if (root != null) {
actions.add(new CloneAction(NbBundle.getMessage(GitAnnotator.class, "CTL_PopupMenuItem_CloneLocal", // NOI18N
root.getName()), ctx));
}
actions.add(new CloneExternalAction(loc.getString("CTL_PopupMenuItem_CloneOther"), ctx)); // NOI18N
actions.add(null);
+ /*
actions.add(new FetchAction(NbBundle.getMessage(GitAnnotator.class, "CTL_PopupMenuItem_FetchLocal"), ctx)); // NOI18N
actions.add(new PushAction(NbBundle.getMessage(GitAnnotator.class, "CTL_PopupMenuItem_PushLocal"), ctx)); // NOI18N
actions.add(new PushOtherAction(loc.getString("CTL_PopupMenuItem_PushOther"), ctx)); // NOI18N
View
107 src/org/nbgit/GitProgressMonitor.java
@@ -0,0 +1,107 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Alexander Coles (Ikonoklastik Productions).
+ *
+ * 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. 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.
+ *
+ * This particular file is 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):
+ *
+ * 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.nbgit;
+
+import org.netbeans.api.progress.aggregate.AggregateProgressFactory;
+import org.netbeans.api.progress.aggregate.AggregateProgressHandle;
+import org.netbeans.api.progress.aggregate.ProgressContributor;
+import org.spearce.jgit.lib.ProgressMonitor;
+
+/**
+ *
+ * @author alexbcoles
+ */
+public class GitProgressMonitor implements ProgressMonitor {
+
+ //private final GitProgressSupport support;
+ private final AggregateProgressHandle rootHandle;
+ private ProgressContributor contributor;
+ private boolean started = false;
+
+ public GitProgressMonitor(/*final GitProgressSupport support*/) {
+ //this.support = support;
+ // TODO: make this cancellable
+ rootHandle = AggregateProgressFactory.createHandle("Task", null, null, null);
+ }
+
+ public void start(int totalTasks) {
+ if (!started) {
+ rootHandle.start();
+ started = true;
+ }
+ }
+
+ public void beginTask(String title, int total) {
+ endTask();
+
+ contributor = AggregateProgressFactory.createProgressContributor(title + new java.util.Random());
+ rootHandle.addContributor(contributor);
+
+ if (total == UNKNOWN) {
+ contributor.start(1000);
+ } else {
+ contributor.start(total);
+ }
+ }
+
+ public void update(int completed) {
+ if (contributor == null) {
+ return;
+ }
+
+ contributor.progress(completed);
+ }
+
+ public void endTask() {
+ if (contributor != null) {
+ try {
+ contributor.finish();
+ } finally {
+ contributor = null;
+ }
+ }
+ }
+
+ public boolean isCancelled() {
+ // TODO: figure out how to implement this
+ return false;
+
+ //if (contributor != null) {
+ //
+ //}
+ }
+
+}
View
21 src/org/nbgit/GitProgressSupport.java
@@ -41,13 +41,17 @@
*/
package org.nbgit;
+import java.net.URISyntaxException;
import java.util.logging.Level;
+import javax.swing.JComponent;
import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory;
import org.openide.util.Cancellable;
+import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.openide.util.RequestProcessor;
import org.openide.util.TaskListener;
+import org.spearce.jgit.transport.URIish;
/**
*
@@ -79,6 +83,15 @@ public void taskFinished(org.openide.util.Task task) {
return task;
}
+ public JComponent getProgressComponent() {
+ return ProgressHandleFactory.createProgressComponent(getProgressHandle());
+ }
+
+ public void setRepositoryRoot(String repositoryRoot) {
+ this.repositoryRoot = repositoryRoot;
+ logger = null;
+ }
+
public void run() {
setProgress();
performIntern();
@@ -169,4 +182,12 @@ public OutputLogger getLogger() {
}
return logger;
}
+
+ public URIish getRepositoryRoot() {
+ try {
+ return new URIish(repositoryRoot);
+ } catch (URISyntaxException ex) {
+ return new URIish();
+ }
+ }
}
View
98 src/org/nbgit/ui/clone/Bundle.properties
@@ -0,0 +1,98 @@
+# 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.
+
+CTL_CloneExternalAction=Clone...
+MSG_CLONE_TITLE = Git Clone
+MSG_CLONE_TITLE_SEP = ---------------
+MSG_CLONE_FROM = INFO Clone From: {0} - {1}
+MSG_CLONE_TO = INFO To: {0} - {1}
+MSG_CLONE_DONE = INFO: End of Clone
+MSG_EXTERNAL_CLONE_FROM = INFO Clone From: {0}
+MSG_EXTERNAL_CLONE_TO = INFO To: {0}
+MSG_CLONE_NOTHING = Nothing yet comitted, so nothing to Clone.
+
+LBL_Clone_Progress=Cloning {0}...
+ClonePanel.fromLabel.text=Source Repository:
+ClonePanel.toLabel.text=&Parent Directory:
+ClonePanel.browseButton.text=&Browse...
+
+CTL_CloneForm_Action_Clone=C&lone
+ACSN_CloneForm_Action_Clone=Clone
+ACSD_CloneForm_Action_Clone=Clone
+CTL_CloneForm_Action_Cancel=Can&cel
+ACSN_CloneForm_Action_Cancel=Cancel
+ACSD_CloneForm_Action_Cancel=Cancel
+CTL_CloneDialog=Clone Repository
+ACSD_CloneDialog=Clone Repository
+
+ACSD_BrowseFolder = Lets you browse for directory for target git repository.
+Browse_title=Browse for the Parent Directory
+OK_Button=OK
+Folders=Folders
+
+#CloneCompleted
+ACSD_CloneCompleted_Dialog = This dialog lets you choose further actions to do after you successfully clone a repository.
+BK3001=<html><b>Clone Completed</b><p>\nYou can continue with: <ul><li>opening an existing NetBeans project or <li>creating a new one from cloned sources.</ul>
+BK3002=Do Not Show This Message Again
+BK3003=Open Project..
+BK3004=Create Project...
+BK3005=&Close
+BK3008=Clone Completed
+# {0} contains number
+BK3009=<html>{0} projects were cloned.<p>Do you want to open a project?
+BK3010=<html>Do you want to create an IDE project from the cloned sources?
+# {0} project name
+BK3011=<html>{0} project was cloned.<p>Do you want to set cloned project as Main project?
+BK3012=Open Project
+BK1014=Can not find project for {0}
+
+
+TT_Close=Dismiss the dialog
+TT_OpenProject=Go to file explorer and select a project to open from cloned sources
+TT_CreateProject=Go to project wizard to create a new project from cloned sources
+ClonePanel.toName.text=Clone &Name:
+
+destinationLabel.text=Destination:
+openCheckbox.text=&Set Cloned Project as Main
+MSG_EXTERNAL_CLONE_PRJ_NOT_FOUND_CANT_SETASMAIN = INFO: Unable to open project.\nINFO: This is either not a top level NetBeans Project or all the NetBeans project files have not been committed in the source Project.\n\n
+ACSD_Browse=Browse for parent of destination repository
+ACSD_setMainCheckBox=The cloned project will be set as Main project
+ACSD_toCloneField=Specifies name of cloned project
+ACSD_toTextField=Specifies the parent directory of cloned project
+ACSD_fromTextField=Specifies the repository to be cloned
View
118 src/org/nbgit/ui/clone/Clone.java
@@ -0,0 +1,118 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2009 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-2009 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2009 Alexander Coles (Ikonoklastik Productions).
+ *
+ * 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.nbgit.ui.clone;
+
+
+import java.awt.Dialog;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import javax.swing.JButton;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import org.openide.DialogDescriptor;
+import org.openide.DialogDisplayer;
+import org.openide.util.HelpCtx;
+
+
+public class Clone implements PropertyChangeListener {
+
+ private final ClonePanel panel;
+ private final JButton okButton;
+ private final JButton cancelButton;
+ private final DocumentListener listener;
+
+ public Clone(File repository, File to) {
+ panel = new ClonePanel(repository, to);
+ okButton = new JButton();
+ org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(CloneAction.class, "CTL_CloneForm_Action_Clone"));
+ okButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(Clone.class, "ACSN_CloneForm_Action_Clone")); // NOI18N
+ okButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(Clone.class, "ACSD_CloneForm_Action_Clone")); // NOI18N
+
+ cancelButton = new JButton();
+ org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(CloneAction.class, "CTL_CloneForm_Action_Cancel"));
+ cancelButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(Clone.class, "ACSD_CloneForm_Action_Cancel")); // NOI18N
+ cancelButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(Clone.class, "ACSN_CloneForm_Action_Cancel")); // NOI18N
+
+ this.listener = new DocumentListener() {
+ public void insertUpdate(DocumentEvent e) { nameChange(); }
+ public void removeUpdate(DocumentEvent e) { nameChange(); }
+ public void changedUpdate(DocumentEvent e) { nameChange(); }
+ };
+ panel.toTextField.getDocument().addDocumentListener(listener);
+ }
+
+ public boolean showDialog() {
+ DialogDescriptor dialogDescriptor = new DialogDescriptor(panel, org.openide.util.NbBundle.getMessage(Clone.class, "CTL_CloneDialog"), // NOI18N
+ true, new Object[]{okButton, cancelButton}, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(this.getClass()), null);
+ dialogDescriptor.setValid(false);
+
+ Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
+ dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(Clone.class, "ACSD_CloneDialog")); // NOI18N
+ dialog.setVisible(true);
+ dialog.setResizable(false);
+ boolean ret = dialogDescriptor.getValue() == okButton;
+ return ret;
+ }
+
+ private void nameChange() {
+ if (panel.toTextField.getText().trim().length() > 0)
+ okButton.setEnabled(true);
+ else
+ okButton.setEnabled(false);
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if(okButton != null) {
+ boolean valid = ((Boolean)evt.getNewValue()).booleanValue();
+ okButton.setEnabled(valid);
+ }
+ }
+
+ public File getTargetDir() {
+ if (panel == null) {
+ return null;
+ }
+ return panel.getTargetDir();
+ }
+
+}
View
302 src/org/nbgit/ui/clone/CloneAction.java
@@ -0,0 +1,302 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2009 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-2009 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2009 Alexander Coles (Ikonoklastik Productions).
+ *
+ * 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.nbgit.ui.clone;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import javax.swing.SwingUtilities;
+import org.nbgit.Git;
+import org.nbgit.GitModuleConfig;
+import org.nbgit.GitProgressMonitor;
+import org.nbgit.GitProgressSupport;
+import org.nbgit.OutputLogger;
+import org.nbgit.ui.ContextAction;
+import org.nbgit.util.GitProjectUtils;
+import org.nbgit.util.GitUtils;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.modules.versioning.spi.VCSContext;
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Exceptions;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.spearce.jgit.errors.NotSupportedException;
+import org.spearce.jgit.errors.TransportException;
+import org.spearce.jgit.lib.Commit;
+import org.spearce.jgit.lib.Constants;
+import org.spearce.jgit.lib.GitIndex;
+import org.spearce.jgit.lib.Ref;
+import org.spearce.jgit.lib.RefUpdate;
+import org.spearce.jgit.lib.Repository;
+import org.spearce.jgit.lib.RepositoryConfig;
+import org.spearce.jgit.lib.Tree;
+import org.spearce.jgit.lib.WorkDirCheckout;
+import org.spearce.jgit.transport.FetchResult;
+import org.spearce.jgit.transport.RefSpec;
+import org.spearce.jgit.transport.RemoteConfig;
+import org.spearce.jgit.transport.Transport;
+import org.spearce.jgit.transport.URIish;
+
+public class CloneAction extends ContextAction {
+
+ public CloneAction(String name, VCSContext context) {
+ super(name, context);
+ }
+
+ @Override
+ protected void performAction(ActionEvent event) {
+ final File root = GitUtils.getRootFile(context);
+ if (root == null) return;
+
+ // Get unused Clone Folder name
+ File tmp = root.getParentFile();
+ File projFile = GitUtils.getProjectFile(context);
+ String folderName = root.getName();
+ Boolean projIsRepos = true;
+ if (!root.equals(projFile)) {
+ // Git Repository is not the same as project root
+ projIsRepos = false;
+ }
+
+ for (int i = 0; i < 10000; i++) {
+ if (!new File(tmp, folderName + "_clone" + i).exists()) { // NOI18N
+ tmp = new File(tmp, folderName + "_clone" + i); // NOI18N
+ break;
+ }
+ }
+ Clone clone = new Clone(root, tmp);
+ if (!clone.showDialog()) {
+ return;
+ }
+
+ URIish source = null;
+ try {
+ source = new URIish(root.toURL());
+ } catch (MalformedURLException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+ performClone(source, clone.getTargetDir(), projIsRepos, projFile, true, true);
+ }
+
+ public static RequestProcessor.Task performClone(final URIish source, final File target, boolean projIsRepos,
+ File projFile, boolean scanForProjects) {
+ return performClone(source, target, projIsRepos, projFile, false, scanForProjects);
+ }
+
+ private static RequestProcessor.Task performClone(
+ final URIish source,
+ final File target,
+ final Boolean projIsRepos,
+ final File projFile,
+ final boolean isLocalClone,
+ final boolean scanForProjects) {
+
+ RequestProcessor rp = Git.getInstance().getRequestProcessor(source.toString());
+ final GitProgressSupport support = new GitProgressSupport() {
+
+ Repository repo = Git.getInstance().getRepository(target);
+
+ @Override
+ protected void perform() {
+ String projName = (projFile != null)
+ ? GitProjectUtils.getProjectName(projFile)
+ : null;
+ OutputLogger logger = getLogger();
+ try {
+
+ if (projName != null) {
+ logger.outputInRed(
+ NbBundle.getMessage(CloneAction.class,
+ "MSG_CLONE_FROM", projName, source)); // NOI18N
+ logger.outputInRed(
+ NbBundle.getMessage(CloneAction.class,
+ "MSG_CLONE_TO", projName, target)); // NOI18N
+ } else {
+ logger.outputInRed(
+ NbBundle.getMessage(CloneAction.class,
+ "MSG_EXTERNAL_CLONE_FROM", source)); // NOI18N
+ logger.outputInRed(
+ NbBundle.getMessage(CloneAction.class,
+ "MSG_EXTERNAL_CLONE_TO", target)); // NOI18N
+ }
+ logger.output(""); // NOI18N
+
+ doInit(repo, source, logger);
+ FetchResult r = doFetch(repo, logger);
+ Ref branch = r.getAdvertisedRef(Constants.HEAD);
+ if (branch == null) {
+ this.cancel();
+ }
+ doCheckout(repo, branch, logger);
+
+ if (isLocalClone) {
+ Git git = Git.getInstance();
+ ProjectManager projectManager = ProjectManager.getDefault();
+ File normalizedCloneFolder = FileUtil.normalizeFile(target);
+ File cloneProjFile;
+ if (!projIsRepos) {
+ String name = (projFile != null)
+ ? projFile.getAbsolutePath().substring(source.getPath().length() + 1)
+ : target.getAbsolutePath();
+ cloneProjFile = new File(normalizedCloneFolder, name);
+ } else {
+ cloneProjFile = normalizedCloneFolder;
+ }
+ openProject(cloneProjFile, projectManager, git);
+ } else if (scanForProjects) {
+ CloneCompleted cc = new CloneCompleted(target);
+ if (isCanceled()) {
+ return;
+ }
+ cc.scanForProjects(this);
+ }
+
+ } catch (URISyntaxException usex) {
+ NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(usex);
+ DialogDisplayer.getDefault().notifyLater(e);
+ } catch (IOException ex) {
+ NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ex);
+ DialogDisplayer.getDefault().notifyLater(e);
+ } finally {
+ if (!isLocalClone) {
+ logger.outputInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N
+ logger.output(""); // NOI18N
+ }
+ }
+ }
+
+ private void openProject(final File cloneProjFile, final ProjectManager projectManager, final Git git) {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ public void run() {
+ // Open and set focus on the cloned project if possible
+ OutputLogger logger = getLogger();
+ try {
+ FileObject cloneProj = FileUtil.toFileObject(cloneProjFile);
+ Project proj = null;
+ if (cloneProjFile != null && cloneProj != null) {
+ proj = projectManager.findProject(cloneProj);
+ }
+ if (proj != null) {
+ GitProjectUtils.openProject(proj, this, false);
+ // TODO: GitModuleConfig.getDefault().getSetMainProject()
+ git.versionedFilesChanged();
+ git.refreshAllAnnotations();
+ } else {
+ logger.outputInRed(NbBundle.getMessage(CloneAction.class, "MSG_EXTERNAL_CLONE_PRJ_NOT_FOUND_CANT_SETASMAIN")); // NOI18N
+ }
+ } catch (IOException ioe) {
+ NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(ioe);
+ DialogDisplayer.getDefault().notifyLater(e);
+ } finally {
+ logger.outputInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N
+ logger.output(""); // NOI18N
+ }
+ }
+ });
+ }
+ };
+
+ //support.setRepositoryRoot(source);
+
+ return support.start(rp, source.toString(), org.openide.util.NbBundle.getMessage(CloneAction.class, "LBL_Clone_Progress", source)); // NO
+ }
+
+
+ public static void doInit(Repository repo, URIish uri, OutputLogger logger) throws IOException, URISyntaxException {
+ repo.create();
+
+ repo.getConfig().setBoolean("core", null, "bare", false);
+ repo.getConfig().save();
+
+ logger.output("Initialized empty Git repository in " + repo.getWorkDir().getAbsolutePath());
+ logger.flushLog();
+
+ // save remote
+ final RemoteConfig rc = new RemoteConfig(repo.getConfig(), "origin");
+ rc.addURI(uri);
+ rc.addFetchRefSpec(new RefSpec().setForceUpdate(true).setSourceDestination(Constants.R_HEADS + "*",
+ Constants.R_REMOTES + "origin" + "/*"));
+ rc.update(repo.getConfig());
+ repo.getConfig().save();
+ }
+
+ public static FetchResult doFetch(Repository repo, OutputLogger logger) throws NotSupportedException, TransportException, URISyntaxException {
+ final FetchResult r;
+ final Transport tn = Transport.open(repo, "origin");
+ try {
+ r = tn.fetch(new GitProgressMonitor(), null);
+ } finally {
+ tn.close();
+ }
+ logger.output("--- Fetch Completed ---");
+ return r;
+ }
+
+ public static void doCheckout(Repository repo, Ref branch, OutputLogger logger) throws IOException {
+
+ final GitIndex index = new GitIndex(repo);
+ final Commit mapCommit = repo.mapCommit(branch.getObjectId());
+ final Tree tree = mapCommit.getTree();
+ final RefUpdate u;
+ final WorkDirCheckout co;
+
+ u = repo.updateRef(Constants.HEAD);
+ u.setNewObjectId(mapCommit.getCommitId());
+ u.forceUpdate();
+
+ // checking out files
+ co = new WorkDirCheckout(repo, repo.getWorkDir(), index, tree);
+ co.checkout();
+ // writing index
+ index.write();
+ }
+
+}
View
84 src/org/nbgit/ui/clone/CloneCompleted.java
@@ -0,0 +1,84 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2009 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-2009 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2009 Alexander Coles (Ikonoklastik Productions).
+ *
+ * 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.nbgit.ui.clone;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.nbgit.GitProgressSupport;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.versioning.util.ProjectUtilities;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+/**
+ *
+ *
+ * @author Tomas Stupka
+ * @author alexbcoles
+ */
+class CloneCompleted {
+
+ private final File workingFolder;
+
+ CloneCompleted(File workingFolder) {
+ this.workingFolder = workingFolder;
+ }
+
+ void scanForProjects(GitProgressSupport support) {
+ Map<Project, Set<Project>> checkedOutProjects = new HashMap<Project, Set<Project>>();
+ checkedOutProjects.put(null, new HashSet<Project>()); // initialize root project container
+ File normalizedWorkingFolder = FileUtil.normalizeFile(workingFolder);
+ FileObject fo = FileUtil.toFileObject(normalizedWorkingFolder);
+ if (fo != null) {
+ ProjectUtilities.scanForProjects(fo, checkedOutProjects);
+ }
+ if (support != null && support.isCanceled()) {
+ return;
+ }
+ // open project selection
+ ProjectUtilities.openCheckedOutProjects(checkedOutProjects, workingFolder);
+ }
+
+}
View
60 src/org/nbgit/ui/clone/CloneExternalAction.java
@@ -0,0 +1,60 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2009 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-2009 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2009 Alexander Coles (Ikonoklastik Productions).
+ *
+ * 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.nbgit.ui.clone;
+
+import java.awt.event.ActionEvent;
+import org.nbgit.ui.ContextAction;
+import org.nbgit.ui.wizards.CloneWizardAction;
+import org.netbeans.modules.versioning.spi.VCSContext;
+
+public class CloneExternalAction extends ContextAction {
+
+ public CloneExternalAction(String name, VCSContext context) {
+ super(name, context);
+ }
+
+ @Override
+ protected void performAction(ActionEvent event) {
+ CloneWizardAction wiz = CloneWizardAction.getInstance();
+ wiz.performAction();
+ }
+}
View
170 src/org/nbgit/ui/clone/ClonePanel.form
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.5" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="destinationLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="fromLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="12" pref="12" max="12" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="toNameLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+ <Component id="setMainCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <Group type="102" attributes="0">
+ <EmptySpace min="12" pref="12" max="12" attributes="0"/>
+ <Component id="toLabel" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="fromTextField" alignment="0" pref="428" max="32767" attributes="0"/>
+ <Group type="102" alignment="1" attributes="0">
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="toCloneField" alignment="1" pref="319" max="32767" attributes="0"/>
+ <Component id="toTextField" alignment="1" pref="319" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="browseButton" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="fromLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="fromTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Component id="destinationLabel" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="browseButton" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="toTextField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="toLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="toCloneField" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="toNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="setMainCheckBox" min="-2" pref="21" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="fromLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="fromTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="ClonePanel.fromLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="toLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="toTextField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="ClonePanel.toLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="toTextField">
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="ACSD_toTextField" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </AccessibilityProperties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="16"/>
+ </AuxValues>
+ </Component>
+ <Component class="javax.swing.JButton" name="browseButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="ClonePanel.browseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="ACSD_Browse" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </AccessibilityProperties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="fromTextField">
+ <Properties>
+ <Property name="editable" type="boolean" value="false"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="ACSD_fromTextField" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </AccessibilityProperties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="toNameLabel">
+ <Properties>
+ <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
+ <ComponentRef name="toCloneField"/>
+ </Property>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="ClonePanel.toName.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="toCloneField">
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="ACSD_toCloneField" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </AccessibilityProperties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="destinationLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="destinationLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="setMainCheckBox">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="openCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/clone/Bundle.properties" key="ACSD_setMainCheckBox" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </AccessibilityProperties>
+ </Component>
+ </SubComponents>
+</Form>
View
257 src/org/nbgit/ui/clone/ClonePanel.java
@@ -0,0 +1,257 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2009 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-2009 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2009 Alexander Coles (Ikonoklastik Productions).
+ *
+ * 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.nbgit.ui.clone;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.filechooser.FileFilter;
+import org.nbgit.GitModuleConfig;
+import org.netbeans.modules.versioning.util.AccessibleJFileChooser;
+import org.netbeans.spi.project.ui.support.ProjectChooser;
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author alexbcoles
+ */
+class ClonePanel extends JPanel implements ActionListener {
+
+ private File repository;
+
+ ClonePanel(File respository, File to) {
+ this.repository = respository;
+ initComponents();
+ browseButton.addActionListener(this);
+ setMainCheckBox.addActionListener(this);
+ fromTextField.setText(respository.getAbsolutePath());
+ toTextField.setText(to.getParent());
+ toCloneField.setText(to.getName());
+ //setMainCheckBox.setSelected(GitModuleConfig.getDefault().getSetMainProject());
+ }
+
+ public File getTargetDir() {
+ return new File(toTextField.getText(), toCloneField.getText());
+ }
+
+ /** 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.
+ */
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ fromLabel = new javax.swing.JLabel();
+ toLabel = new javax.swing.JLabel();
+ browseButton = new javax.swing.JButton();
+ fromTextField = new javax.swing.JTextField();
+ toNameLabel = new javax.swing.JLabel();
+ toCloneField = new javax.swing.JTextField();
+ destinationLabel = new javax.swing.JLabel();
+ setMainCheckBox = new javax.swing.JCheckBox();
+
+ fromLabel.setLabelFor(fromTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(fromLabel, org.openide.util.NbBundle.getMessage(ClonePanel.class, "ClonePanel.fromLabel.text")); // NOI18N
+
+ toLabel.setLabelFor(toTextField);
+ org.openide.awt.Mnemonics.setLocalizedText(toLabel, org.openide.util.NbBundle.getMessage(ClonePanel.class, "ClonePanel.toLabel.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(ClonePanel.class, "ClonePanel.browseButton.text")); // NOI18N
+
+ fromTextField.setEditable(false);
+
+ toNameLabel.setLabelFor(toCloneField);
+ org.openide.awt.Mnemonics.setLocalizedText(toNameLabel, org.openide.util.NbBundle.getMessage(ClonePanel.class, "ClonePanel.toName.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(destinationLabel, org.openide.util.NbBundle.getMessage(ClonePanel.class, "destinationLabel.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(setMainCheckBox, org.openide.util.NbBundle.getMessage(ClonePanel.class, "openCheckbox.text")); // NOI18N
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(destinationLabel)
+ .add(fromLabel)
+ .add(layout.createSequentialGroup()
+ .add(12, 12, 12)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(toNameLabel)
+ .add(setMainCheckBox)))
+ .add(layout.createSequentialGroup()
+ .add(12, 12, 12)
+ .add(toLabel)))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(fromTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+ .add(toCloneField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
+ .add(toTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(browseButton)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(fromLabel)
+ .add(fromTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .add(18, 18, 18)
+ .add(destinationLabel)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(browseButton)
+ .add(toTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(toLabel))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(toCloneField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(toNameLabel))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(setMainCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
+
+ toTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ClonePanel.class, "ACSD_toTextField")); // NOI18N
+ browseButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ClonePanel.class, "ACSD_Browse")); // NOI18N
+ fromTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ClonePanel.class, "ACSD_fromTextField")); // NOI18N
+ toCloneField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ClonePanel.class, "ACSD_toCloneField")); // NOI18N
+ setMainCheckBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ClonePanel.class, "ACSD_setMainCheckBox")); // NOI18N
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource() == browseButton) {
+ onBrowseClick();
+ } else if (evt.getSource() == setMainCheckBox) {
+ //GitModuleConfig.getDefault().setSetMainProject(setMainCheckBox.isSelected());
+ }
+ }
+
+ private void onBrowseClick() {
+ File oldFile = defaultWorkingDirectory();
+ JFileChooser fileChooser = new AccessibleJFileChooser(NbBundle.getMessage(ClonePanel.class, "ACSD_BrowseFolder"), oldFile); // NO I18N
+ fileChooser.setDialogTitle(NbBundle.getMessage(ClonePanel.class, "Browse_title")); // NO I18N
+ fileChooser.setMultiSelectionEnabled(false);
+ FileFilter[] old = fileChooser.getChoosableFileFilters();
+ for (int i = 0; i < old.length; i++) {
+ FileFilter fileFilter = old[i];
+ fileChooser.removeChoosableFileFilter(fileFilter);
+
+ }
+ fileChooser.addChoosableFileFilter(new FileFilter() {
+ public boolean accept(File f) {
+ return f.isDirectory();
+ }
+ public String getDescription() {
+ return NbBundle.getMessage(ClonePanel.class, "Folders");// NOI18N
+ }
+ });
+ fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ fileChooser.showDialog(this, NbBundle.getMessage(ClonePanel.class, "OK_Button")); // NO I18N
+ File f = fileChooser.getSelectedFile();
+ if (f != null) {
+ toTextField.setText(f.getAbsolutePath());
+ }
+ }
+ /**
+ * Returns file to be initally used.
+ * <ul>
+ * <li>first is takes text in workTextField
+ * <li>then recent project folder
+ * <li>finally <tt>user.home</tt>
+ * <ul>
+ */
+ private File defaultWorkingDirectory() {
+ File defaultDir = null;
+ String current = toTextField.getText();
+ if (current != null && !(current.trim().equals(""))) { // NOI18N
+ File currentFile = new File(current);
+ while (currentFile != null && currentFile.exists() == false) {
+ currentFile = currentFile.getParentFile();
+ }
+ if (currentFile != null) {
+ if (currentFile.isFile()) {
+ defaultDir = currentFile.getParentFile();
+ } else {
+ defaultDir = currentFile;
+ }
+ }
+ }
+
+ if (defaultDir == null) {
+ File projectFolder = ProjectChooser.getProjectsFolder();
+ if (projectFolder.exists() && projectFolder.isDirectory()) {
+ defaultDir = projectFolder;
+ }
+
+ }
+
+ if (defaultDir == null) {
+ defaultDir = new File(System.getProperty("user.home")); // NOI18N
+ }
+
+ return defaultDir;
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton browseButton;
+ private javax.swing.JLabel destinationLabel;
+ private javax.swing.JLabel fromLabel;
+ private javax.swing.JTextField fromTextField;
+ private javax.swing.JCheckBox setMainCheckBox;
+ private javax.swing.JTextField toCloneField;
+ private javax.swing.JLabel toLabel;
+ private javax.swing.JLabel toNameLabel;
+ final javax.swing.JTextField toTextField = new javax.swing.JTextField();
+ // End of variables declaration//GEN-END:variables
+
+}
View
109 src/org/nbgit/ui/repository/Bundle.properties
@@ -0,0 +1,109 @@
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2009 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-2009 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.
+
+## RepositoryPanel.java
+BK0001=Specify Subversion repository location\:
+BK0002=&Repository URL\:
+BK0003=&User\:
+BK0004=&Password\:
+BK0005=(leave blank for anonymous access)
+BK0006=Pro&xy Configuration...
+BK0007=Save Username and Password
+BK0009=Use External Tunnel
+BK0010=Tunnel Command\:
+BK0011=Saves your Username and Password
+
+ACSN_RepositoryURL=Repository URL
+ACSD_RepositoryURL=Recently used Repository URLs
+
+TT_svn_xxx=<html><body><tt><dl>\
+<dt>on Windows:</dt><dd>plink -l username -pw password<br>plink -l username -i C:\\Path\\To\\Private.key</dd>\
+<dt>on Unixes:</dt><dd>ssh -l username -i path/to/privateKey</dd>\
+</tt></body></html>
+
+TT_UserName=Your username
+TT_Password=Your password used for authentication
+ACSD_RepositoryPanel= In this panel you specify the Repository URL and any parameters needed for making connection to it.
+
+BK2018=Repository
+
+ACSD_ProxyDialog=This dialog lets you specify network connection parameters to use when connection to a given Git server. Possible options include: HTTP proxy, SOCKS proxy, direct connection or system default.
+
+MSG_Repository_WrongRevision = Wrong revision number: {0}
+MSG_Repository_OnlyHEADRevision = The only revision allowed here is HEAD!
+
+MSG_Repository_Url_Help = \
+ <html><body>IDE directly supports the following Git URL types:\
+ <dl><dt><tt>{0}</tt></dt><dd>for local git repository access</dd>\
+ <dt><tt>{1}</tt></dt><dd>for connecting git repository via HTTP protocol</dd>\
+ <dt><tt>{2}</tt></dt><dd>for connecting git repository via HTTP protocol with SSL encryption</dd>\
+ <dt><tt>{3}</tt></dt><dd>for connecting git repository via GIT protocol</dd>\
+ <dt><tt>{4}</tt></dt><dd>for connecting git repository via GIT protocol over SSH</dd>\
+ <dt><tt>{5}</tt></dt><dd>for connecting git repository via SSH protocol</dd>\
+ </dl></body></html>
+
+ACSD_RepositoryPanel_Title=Specify Git repository location
+
+ACSD_InfoLabel=informational message
+
+#
+MSG_INVALID_URL = Invalid git url: {0}
+MSG_UNSUPPORTED_PROTOCOL = Unsupported schema/protocol: {0}
+ChangesetPanel.jPanel1.border.title=Details
+ChangesetPanel.jLabel1.text=&Description:
+ChangesetPanel.jLabel2.text=A&uthor:
+ChangesetPanel.jLabel3.text=Dat&e:
+ChangesetPanel.jTextField1.text=
+ChangesetPanel.jTextField2.text=
+ChangesetPanel.jTextField3.text=
+UserPasswordPanel.lblUsername.text=&Username:
+UserPasswordPanel.lblPassword.text=Pass&word:
+ACSN_UserPasswordPanel_Username=Username
+ACSN_UserPasswordPanel_Password=Password
+UserPasswordPanel.cbRememberPassword.text=&Save as defaults in gitconfig
+ACSN_UserPasswordPanel_Remember=Save as defaults in gitconfig
+ACSD_UserPasswordPanel_Remember=Saves values as part of default URLs in gitconfig file
+UserPasswordPanel.cbRememberPassword.AccessibleContext.accessibleName=
+UserPasswordPanel.cbRememberPassword.AccessibleContext.accessibleDescription=
+UserPasswordPanel.lblMessage.text=
+MSG_UserPasswordPanel_AuthRequired=<html>Authentication is required for repository at:<br>{0}</html>
+CTL_UserPasswordPanel_AuthRequired=Authentication required
+ChangesetPanel.jTextField1.AccessibleContext.accessibleDescription=N/A
+ChangesetPanel.jTextField2.AccessibleContext.accessibleDescription=N/A
+ChangesetPanel.jTextField3.AccessibleContext.accessibleDescription=N/A
View
720 src/org/nbgit/ui/repository/GitRepositoryUI.java
@@ -0,0 +1,720 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2009 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-2009 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2009 Alexander Coles (Ikonoklastik Productions).
+ *
+ * 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.nbgit.ui.repository;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Vector;
+import javax.swing.ComboBoxEditor;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JPanel;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.Document;
+import javax.swing.text.JTextComponent;
+import org.nbgit.GitModuleConfig;
+import org.netbeans.api.options.OptionsDisplayer;
+
+import org.netbeans.modules.versioning.util.DialogBoundsPreserver;
+import org.openide.DialogDescriptor;
+import org.openide.DialogDisplayer;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+import org.openide.util.Utilities;
+import org.spearce.jgit.transport.Transport;
+import org.spearce.jgit.transport.URIish;
+
+/**
+ * @author Tomas Stupka
+ * @author Marian Petras
+ */
+public class GitRepositoryUI implements ActionListener, FocusListener, ItemListener {
+
+ public final static int FLAG_URL_ENABLED = 4;
+ public final static int FLAG_ACCEPT_REVISION = 8;
+ public final static int FLAG_SHOW_HINTS = 32;
+ public final static int FLAG_SHOW_PROXY = 64;
+
+ private final static String LOCAL_URL_HELP = "file:///repository_path"; // NOI18N
+ private final static String HTTP_URL_HELP = Utilities.isWindows()?
+ "http://[DOMAIN%5C]hostname/repository_path": // NOI18N
+ "http://hostname/repository_path"; // NOI18N
+ private final static String HTTPS_URL_HELP = Utilities.isWindows()?
+ "https://[DOMAIN%5C]hostname/repository_path": // NOI18N
+ "https://hostname/repository_path"; // NOI18N
+ private final static String GIT_URL_HELP = "git://hostname/repository_path"; // NOI18N
+ private final static String GIT_SSH_URL_HELP = "git@hostname:repository_path"; // NOI18N
+ private final static String SSH_URL_HELP = "ssh://hostname/repository_path"; // NOI18N
+
+ private RepositoryPanel repositoryPanel;
+ private boolean valid = true;
+ private List<ChangeListener> listeners;
+ private final ChangeEvent changeEvent = new ChangeEvent(this);
+
+ private Transport repositoryConnection;
+ private URIish url;
+
+ public static final String PROP_VALID = "valid"; // NOI18N
+
+ private String message;
+ private int modeMask;
+ private Dimension maxNeededSize;
+ private boolean bPushPull;
+ private static int GIT_PUSH_PULL_VERT_PADDING = 30;
+
+ private JTextComponent urlComboEditor;
+ private Document urlDoc, usernameDoc, passwordDoc, tunnelCmdDoc;
+ private boolean urlBeingSelectedFromPopup = false;
+
+ public GitRepositoryUI(int modeMask, String titleLabel, boolean bPushPull) {
+
+ this.modeMask = modeMask;
+
+ initPanel();
+
+ repositoryPanel.titleLabel.setText(titleLabel);
+
+ repositoryPanel.urlComboBox.setEnabled(isSet(FLAG_URL_ENABLED));
+ repositoryPanel.tunnelHelpLabel.setVisible(isSet(FLAG_SHOW_HINTS));
+ repositoryPanel.tipLabel.setVisible(isSet(FLAG_SHOW_HINTS));
+
+ //repositoryPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
+
+ // retrieve the dialog size for the largest configuration
+ if(bPushPull)
+ updateVisibility("foo:"); // NOI18N
+ else
+ updateVisibility("https:"); // NOI18N
+ maxNeededSize = repositoryPanel.getPreferredSize();
+
+ //TODO: implement this
+ //repositoryPanel.savePasswordCheckBox.setSelected(GitModuleConfig.getDefault().getSavePassword());
+ repositoryPanel.schedulePostInitRoutine(new Runnable() {
+ public void run() {
+ refreshUrlHistory();
+ }
+ });
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ assert e.getSource() == repositoryPanel.proxySettingsButton;
+
+ onProxyConfiguration();
+ }
+
+ private void onProxyConfiguration() {
+ OptionsDisplayer.getDefault().open("General"); // NOI18N
+ }
+
+ private void initPanel() {
+ repositoryPanel = new RepositoryPanel();
+
+ urlComboEditor = (JTextComponent) repositoryPanel.urlComboBox
+ .getEditor().getEditorComponent();
+ urlDoc = urlComboEditor.getDocument();
+ usernameDoc = repositoryPanel.userTextField.getDocument();
+ passwordDoc = repositoryPanel.userPasswordField.getDocument();
+ tunnelCmdDoc = repositoryPanel.tunnelCommandTextField.getDocument();
+
+ DocumentListener documentListener = new DocumentChangeHandler();
+ urlDoc.addDocumentListener(documentListener);
+ passwordDoc.addDocumentListener(documentListener);
+ usernameDoc.addDocumentListener(documentListener);
+ tunnelCmdDoc.addDocumentListener(documentListener);
+
+ repositoryPanel.savePasswordCheckBox.addItemListener(this);
+ repositoryPanel.urlComboBox.addItemListener(this);
+
+ repositoryPanel.proxySettingsButton.addActionListener(this);
+
+ repositoryPanel.userPasswordField.addFocusListener(this);
+
+ tweakComboBoxEditor();
+ }
+
+ private void tweakComboBoxEditor() {
+ final ComboBoxEditor origEditor = repositoryPanel.urlComboBox.getEditor();
+
+ if (origEditor.getClass() == UrlComboBoxEditor.class) {
+ /* attempt to tweak the combo-box multiple times */
+ assert false;
+ return;
+ }
+
+ repositoryPanel.urlComboBox.setEditor(new UrlComboBoxEditor(origEditor));
+ }
+
+ /**
+ * Customized combo-box editor for displaying/modification of URL
+ * of a Git repository.
+ * It is customized in the following aspects:
+ * <ul>
+ * <li>When a RepositoryConnection is selected, displays its URL
+ * without user data (name and password).</li>
+ * <li>If a {@code RepositoryConnection} is set via method
+ * {@code setItem}, it holds a reference to it until another item
+ * is set via method {@code setItem()} or until the user modifies
+ * the text. This allows method {@code getItem()} to return
+ * the same item ({@code RepositoryConnection}).
+ * The allows the combo-box to correctly detect whether the item
+ * has been changed (since the last call of {@code setItem()}
+ * or not.</li>
+ * </ul>
+ */
+ private final class UrlComboBoxEditor implements ComboBoxEditor,
+ DocumentListener {
+
+ private final ComboBoxEditor origEditor;
+ private Reference<Transport> repoConnRef;
+
+ private UrlComboBoxEditor(ComboBoxEditor originalEditor) {
+ this.origEditor = originalEditor;
+ ((JTextComponent) originalEditor.getEditorComponent())
+ .getDocument().addDocumentListener(this);
+ }
+
+ public void setItem(Object anObject) {
+ urlBeingSelectedFromPopup = true;
+ try {
+ setItemImpl(anObject);
+ } finally {
+ urlBeingSelectedFromPopup = false;
+ }
+ }
+
+ private void setItemImpl(Object anObject) {
+ assert urlBeingSelectedFromPopup;
+
+ if (anObject instanceof Transport) {
+ Transport repoConn = (Transport) anObject;
+ repoConnRef = new WeakReference<Transport>(repoConn);
+ origEditor.setItem(repoConn.getURI().toString());
+ } else {
+ clearRepoConnRef();
+ origEditor.setItem(anObject);
+ }
+ }
+
+ public Component getEditorComponent() {
+ return origEditor.getEditorComponent();
+ }
+ public Object getItem() {
+ Transport repoConn = getRepoConn();
+ if (repoConn != null) {
+ return repoConn;
+ }
+
+ return origEditor.getItem();
+ }
+ public void selectAll() {
+ origEditor.selectAll();
+ }
+ public void addActionListener(ActionListener l) {
+ origEditor.addActionListener(l);
+ }
+ public void removeActionListener(ActionListener l) {
+ origEditor.removeActionListener(l);
+ }
+
+ public void insertUpdate(DocumentEvent e) {
+ textChanged();
+ }
+ public void removeUpdate(DocumentEvent e) {
+ textChanged();
+ }
+ public void changedUpdate(DocumentEvent e) {
+ textChanged();
+ }
+ private void textChanged() {
+ if (urlBeingSelectedFromPopup) {
+ return;
+ }
+ clearRepoConnRef();
+ }
+
+ private Transport getRepoConn() {
+ if (repoConnRef != null) {
+ Transport repoConn = repoConnRef.get();
+ if (repoConn != null) {
+ return repoConn;
+ }
+ }
+ return null;
+ }
+
+ private void clearRepoConnRef() {
+ if (repoConnRef != null) {
+ repoConnRef.clear();
+ }
+ }
+
+ }
+
+ public void refreshUrlHistory() {
+ repositoryPanel.urlComboBox.setModel(
+ new DefaultComboBoxModel(createPresetComboEntries()));
+
+ urlComboEditor.selectAll();
+ }
+
+ private Vector<?> createPresetComboEntries() {
+ assert repositoryPanel.urlComboBox.isEditable();
+
+ Vector<Object> result;
+
+ List<Transport> recentUrls = new ArrayList<Transport>(); // TODO: implement GitModuleConfig.getDefault().getRecentUrls();
+ GitURIScheme[] schemes = GitURIScheme.values();
+
+ result = new Vector<Object>(recentUrls.size() + schemes.length);
+ result.addAll(recentUrls);
+ for (GitURIScheme scheme : schemes) {
+ result.add(createURIPrefixForScheme(scheme));
+ }
+
+ return result;
+ }
+
+ private static String createURIPrefixForScheme(GitURIScheme scheme) {
+ if (scheme == GitURIScheme.FILE) {
+ return scheme + ":/"; //NOI18N
+ } else {
+ return scheme + "://"; //NOI18N
+ }
+ }
+
+ private final class DocumentChangeHandler implements DocumentListener {
+
+ DocumentChangeHandler() { }
+
+ 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) {
+ assert EventQueue.isDispatchThread();
+
+ Document modifiedDocument = e.getDocument();
+
+ assert modifiedDocument != null;
+ assert (modifiedDocument == urlDoc) || !urlBeingSelectedFromPopup;
+
+ if (modifiedDocument == urlDoc) {
+ onUrlChange();
+ } else if (modifiedDocument == usernameDoc) {
+ onUsernameChange();
+ } else if (modifiedDocument == passwordDoc) {
+ onPasswordChange();
+ } else if (modifiedDocument == tunnelCmdDoc) {
+ onTunnelCommandChange();
+ }
+ }
+
+ }
+
+ /**
+ * Always updates UI fields visibility.
+ */
+ private void onUrlChange() {
+ if (!urlBeingSelectedFromPopup) {
+ repositoryConnection = null;
+ url = null;
+
+ repositoryPanel.userTextField.setText(null);
+ repositoryPanel.userPasswordField.setText(null);
+ repositoryPanel.tunnelCommandTextField.setText(null);
+ repositoryPanel.savePasswordCheckBox.setSelected(false);
+ }
+ // TODO: implementation of validation quickValidateUrl();
+ updateVisibility();
+ }
+
+ private void updateVisibility() {
+ updateVisibility(getUrlString());
+ }
+
+ /** Shows proper fields depending on Git connection method. */
+ private void updateVisibility(String selectedUrlString) {
+
+ boolean authFields = false;
+ boolean proxyFields = false;
+ boolean sshFields = false;
+ if(selectedUrlString.startsWith("http:")) { // NOI18N
+ repositoryPanel.tipLabel.setText(HTTP_URL_HELP);
+ authFields = true;
+ proxyFields = true;
+ } else if(selectedUrlString.startsWith("https:")) { // NOI18N
+ repositoryPanel.tipLabel.setText(HTTPS_URL_HELP);
+ //authFields = true;
+ proxyFields = true;
+ } else if (selectedUrlString.startsWith("git:")) { // NOI18N
+ repositoryPanel.tipLabel.setText(GIT_URL_HELP);
+ } else if(selectedUrlString.startsWith("git@")) { // NOI18N
+ repositoryPanel.tipLabel.setText(GIT_SSH_URL_HELP);
+ authFields = true;
+ proxyFields = true;
+ } else if(selectedUrlString.startsWith("ssh")) { // NOI18N
+ repositoryPanel.tipLabel.setText(SSH_URL_HELP);
+ sshFields = true;
+ } else if(selectedUrlString.startsWith("file:")) { // NOI18N
+ repositoryPanel.tipLabel.setText(LOCAL_URL_HELP);
+ } else {
+ repositoryPanel.tipLabel.setText(NbBundle.getMessage(GitRepositoryUI.class, "MSG_Repository_Url_Help", new Object [] { // NOI18N
+ LOCAL_URL_HELP, HTTP_URL_HELP, HTTPS_URL_HELP, GIT_URL_HELP, GIT_SSH_URL_HELP, SSH_URL_HELP
+ }));
+ }
+
+ repositoryPanel.userPasswordField.setVisible(authFields);
+ repositoryPanel.passwordLabel.setVisible(authFields);
+ repositoryPanel.userTextField.setVisible(authFields);
+ repositoryPanel.leaveBlankLabel.setVisible(authFields);
+ repositoryPanel.userLabel.setVisible(authFields);
+ //repositoryPanel.savePasswordCheckBox.setVisible(authFields);
+ repositoryPanel.savePasswordCheckBox.setVisible(false);
+ repositoryPanel.proxySettingsButton.setVisible(proxyFields && ((modeMask & FLAG_SHOW_PROXY) != 0));
+
+ repositoryPanel.savePasswordCheckBox.setVisible(false);
+ repositoryPanel.tunnelCommandTextField.setVisible(false);
+ repositoryPanel.tunnelCommandLabel.setVisible(false);
+ repositoryPanel.tunnelLabel.setVisible(false);
+ repositoryPanel.tunnelHelpLabel.setVisible(false);
+ }
+
+ public void setEditable(boolean editable) {
+ assert EventQueue.isDispatchThread();
+
+ repositoryPanel.urlComboBox.setEnabled(editable && isSet(FLAG_URL_ENABLED));
+ repositoryPanel.userTextField.setEnabled(editable && valid);
+ repositoryPanel.userPasswordField.setEnabled(editable && valid);
+ repositoryPanel.savePasswordCheckBox.setEnabled(editable && valid);
+ repositoryPanel.tunnelCommandTextField.setEnabled(editable && valid);
+ repositoryPanel.proxySettingsButton.setEnabled(editable && valid);
+ }
+
+ /**
+ * Load selected root from Swing structures (from arbitrary thread).
+ * @return null on failure
+ */
+ public String getUrlString() {
+ return urlComboEditor.getText().trim();
+ }
+
+ private String getUsername() {
+ return repositoryPanel.userTextField.getText().trim();
+ }
+
+ private String getPassword() {
+ char[] password = repositoryPanel.userPasswordField.getPassword();
+ String result = new String(password);
+ Arrays.fill(password, (char) 0);
+ return result;
+ }
+
+ private String getExternalCommand() {
+ return repositoryPanel.tunnelCommandTextField.getText();
+ }
+
+ private boolean isSavePassword() {
+ return repositoryPanel.savePasswordCheckBox.isSelected();
+ }
+
+ public URIish getUrl() throws URISyntaxException, MalformedURLException {
+ prepareUrl();
+ assert (url != null);
+ return url;
+ }
+
+ public Transport getRepositoryConnection() throws URISyntaxException {
+ prepareRepositoryConnection();
+ assert (repositoryConnection != null);
+ return repositoryConnection;
+ }
+
+ private void prepareUrl() throws URISyntaxException, MalformedURLException {
+ if (url != null) {
+ return;
+ }
+
+ String urlString = getUrlString();
+ String username = getUsername();
+
+ if (username.length() == 0) {
+ url = new URIish(urlString);
+ } else {
+ // Parse the URL, create a URI and convert back to URL just to
+ // add the user + password.
+ URL jurl = new URL(urlString);
+
+ String protocol = jurl.getProtocol();
+ String host = jurl.getHost();
+ int port = jurl.getPort();
+ String path = jurl.getPath();
+ String userInfo = username + ":" + getPassword();
+
+ URI juri = new URI(protocol, userInfo, host, port, path, null, null);
+ url = new URIish(juri.toURL());
+ }
+ }
+
+ private void prepareRepositoryConnection() {
+ if (repositoryConnection != null) {
+ return;
+ }
+ String extCommand = getExternalCommand();
+ boolean savePassword = isSavePassword();
+
+ //repositoryConnection = new Transport(url, extCommand, savePassword);
+ // FIXME: we need the local repository
+ }
+
+ private void onUsernameChange() {
+ repositoryConnection = null;
+ url = null;
+ }
+
+ private void onPasswordChange() {
+ repositoryConnection = null;
+ url = null;
+ }
+
+ private void onTunnelCommandChange() {
+ repositoryConnection = null;
+ }
+
+ private void onSavePasswordChange() {
+ repositoryConnection = null;
+ }
+
+ public RepositoryPanel getPanel() {
+ return repositoryPanel;
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ private void setValid() {
+ setValid(true, ""); //NOI18N
+ }
+
+ public void setInvalid() {
+ setValid(false, "");
+ }
+
+ private void setValid(boolean valid, String message) {
+ if ((valid == this.valid) && message.equals(this.message)) {
+ return;
+ }
+
+ if (valid != this.valid) {
+ repositoryPanel.proxySettingsButton.setEnabled(valid);
+ repositoryPanel.userPasswordField.setEnabled(valid);
+ repositoryPanel.userTextField.setEnabled(valid);
+ //repositoryPanel.savePasswordCheckBox.setEnabled(valid);
+ }
+
+ this.valid = valid;
+ this.message = message;
+
+ fireStateChanged();
+ }
+
+ private void fireStateChanged() {
+ if ((listeners != null) && !listeners.isEmpty()) {
+ for (ChangeListener l : listeners) {
+ l.stateChanged(changeEvent);
+ }
+ }
+ }
+
+ public void addChangeListener(ChangeListener l) {
+ if(listeners==null) {
+ listeners = new ArrayList<ChangeListener>(4);
+ }
+ listeners.add(l);
+ }
+
+ public void removeChangeListener(ChangeListener l) {
+ if(listeners==null) {
+ return;
+ }
+ listeners.remove(l);
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void focusGained(FocusEvent focusEvent) {
+ if(focusEvent.getSource()==repositoryPanel.userPasswordField) {
+ repositoryPanel.userPasswordField.selectAll();
+ }
+ }
+
+ public void focusLost(FocusEvent focusEvent) {
+ // do nothing
+ }
+
+ public void itemStateChanged(ItemEvent evt) {
+ Object source = evt.getSource();
+
+ if (source == repositoryPanel.urlComboBox) {
+ if(evt.getStateChange() == ItemEvent.SELECTED) {
+ comboBoxItemSelected(evt.getItem());
+ }
+ } else if (source == repositoryPanel.savePasswordCheckBox) {
+ onSavePasswordChange();
+ } else {
+ assert false;
+ }
+ }
+
+ private void comboBoxItemSelected(Object selectedItem) {
+ if (selectedItem.getClass() == String.class) {
+ urlPrefixSelected();
+ } else if (selectedItem instanceof Transport) {
+ repositoryConnectionSelected((Transport) selectedItem);
+ } else {
+ assert false;
+ }
+ }
+
+ private void urlPrefixSelected() {
+ repositoryPanel.userTextField.setText(null);
+ repositoryPanel.userPasswordField.setText(null);
+ repositoryPanel.tunnelCommandTextField.setText(null);
+ repositoryPanel.savePasswordCheckBox.setSelected(false);
+
+ url = null;
+ repositoryConnection = null;
+ }
+
+ private void repositoryConnectionSelected(Transport rc) {
+ url = rc.getURI();
+ repositoryPanel.userTextField.setText(url.getUser());
+ repositoryPanel.userPasswordField.setText(url.getPass());
+
+ repositoryConnection = rc;
+ }
+
+ public void setTipVisible(Boolean flag) {
+ repositoryPanel.tipLabel.setVisible(flag);
+ }
+
+ public boolean show(String title, HelpCtx helpCtx, boolean setMaxNeddedSize) {
+ RepositoryDialogPanel corectPanel = new RepositoryDialogPanel();
+ corectPanel.panel.setLayout(new BorderLayout());
+ JPanel p = getPanel();
+ if(setMaxNeddedSize) {
+ if(bPushPull){
+ maxNeededSize.setSize(maxNeededSize.width, maxNeededSize.height + GIT_PUSH_PULL_VERT_PADDING);
+ }
+ p.setPreferredSize(maxNeededSize);
+ }
+ corectPanel.panel.add(p, BorderLayout.NORTH);
+ DialogDescriptor dialogDescriptor = new DialogDescriptor(corectPanel, title); // NOI18N
+ showDialog(dialogDescriptor, helpCtx, null);
+ return dialogDescriptor.getValue() == DialogDescriptor.OK_OPTION;
+ }
+
+ public Object show(String title, HelpCtx helpCtx, Object[] options, boolean setMaxNeededSize, String name) {
+ RepositoryDialogPanel corectPanel = new RepositoryDialogPanel();
+ corectPanel.panel.setLayout(new BorderLayout());
+ corectPanel.panel.add(getPanel(), BorderLayout.NORTH);
+ DialogDescriptor dialogDescriptor = new DialogDescriptor(corectPanel, title); // NOI18N
+ JPanel p = getPanel();
+ if(setMaxNeededSize) {
+ if(bPushPull){
+ maxNeededSize.setSize(maxNeededSize.width, maxNeededSize.height + GIT_PUSH_PULL_VERT_PADDING);
+ }
+ p.setPreferredSize(maxNeededSize);
+ }
+ if(options!= null) {
+ dialogDescriptor.setOptions(options); // NOI18N
+ }
+ showDialog(dialogDescriptor, helpCtx, name);
+ return dialogDescriptor.getValue();
+ }
+
+ private void showDialog(DialogDescriptor dialogDescriptor, HelpCtx helpCtx, String name) {
+ dialogDescriptor.setModal(true);
+ dialogDescriptor.setHelpCtx(helpCtx);
+
+ Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
+ if (name != null) {
+ dialog.addWindowListener(new DialogBoundsPreserver(GitModuleConfig.getDefault().getPreferences(), name)); // NOI18N
+ }
+ dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(GitRepositoryUI.class, "ACSD_RepositoryPanel"));
+
+ dialog.setVisible(true);
+ }
+
+ private boolean isSet(int flag) {
+ return (modeMask & flag) != 0;
+ }
+
+}
View
56 src/org/nbgit/ui/repository/GitURIScheme.java
@@ -0,0 +1,56 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Alexander Coles (Ikonoklastik Productions).
+ *
+ * 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. 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.
+ *
+ * This particular file is 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):
+ *
+ * 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.nbgit.ui.repository;
+
+/**
+ *
+ * @author alexbcoles
+ */
+public enum GitURIScheme {
+
+ FILE("file"),
+ HTTP("http"),
+ HTTPS("https"),
+ GIT("git"),
+ SSH("ssh");
+
+ private final String name;
+
+ GitURIScheme(String name) {
+ this.name = name;
+ }
+
+}
View
56 src/org/nbgit/ui/repository/RepositoryDialogPanel.form
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="panel" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="panel" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="panel">
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="16"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="702" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="378" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ </Container>
+ </SubComponents>
+</Form>
View
97 src/org/nbgit/ui/repository/RepositoryDialogPanel.java
@@ -0,0 +1,97 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2009 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-2009 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2009 Alexander Coles (Ikonoklastik Productions).
+ *
+ * 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.nbgit.ui.repository;
+
+/**
+ *
+ * @author Tomas Stupka
+ */
+public class RepositoryDialogPanel extends javax.swing.JPanel {
+
+ /** Creates new form CorectAuthPanel */
+ public RepositoryDialogPanel() {
+ initComponents();
+ }
+
+ /** 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.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ org.jdesktop.layout.GroupLayout panelLayout = new org.jdesktop.layout.GroupLayout(panel);
+ panel.setLayout(panelLayout);
+ panelLayout.setHorizontalGroup(
+ panelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 702, Short.MAX_VALUE)
+ );
+ panelLayout.setVerticalGroup(
+ panelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(0, 378, Short.MAX_VALUE)
+ );
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(panel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(panel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ }// </editor-fold>//GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ final javax.swing.JPanel panel = new javax.swing.JPanel();
+ // End of variables declaration//GEN-END:variables
+
+}
View
371 src/org/nbgit/ui/repository/RepositoryPanel.form
@@ -0,0 +1,371 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <Properties>
+ <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
+ <Dimension value="[480, 160]"/>
+ </Property>
+ <Property name="name" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/repository/Bundle.properties" key="BK2018" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </Property>
+ <Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/nbgit/ui/repository/Bundle.properties" key="ACSD_RepositoryPanel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </AccessibilityProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generat