# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/Bundle.properties --- versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/Bundle.properties Base (1.18) +++ versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/Bundle.properties Locally Modified (Based On 1.18) @@ -90,3 +90,4 @@ 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 Index: versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java --- versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java Base (1.19) +++ versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java Locally Modified (Based On 1.19) @@ -125,7 +125,8 @@ performClone(source, target, projIsRepos, projFile, false); } - private static void performClone(final String source, final String target, boolean projIsRepos, File projFile, final boolean isLocalClone) { + private static void performClone(final String source, final String target, + boolean projIsRepos, File projFile, final boolean isLocalClone) { final Mercurial hg = Mercurial.getInstance(); final ProjectManager projectManager = ProjectManager.getDefault(); final File prjFile = projFile; @@ -137,7 +138,11 @@ final String prjName = projName; File cloneProjFile; if (!prjIsRepos) { - String name = prjFile.getAbsolutePath().substring(source.length() + 1); + String name = null; + if(prjFile != null) + name = prjFile.getAbsolutePath().substring(source.length() + 1); + else + name = target; cloneProjFile = new File (normalizedCloneFolder, name); } else { cloneProjFile = normalizedCloneFolder; @@ -148,17 +153,27 @@ HgProgressSupport support = new HgProgressSupport() { Runnable doOpenProject = new Runnable () { public void run() { - // Open and set focus on the cloned project + // Open and set focus on the cloned project if possible try { FileObject cloneProj = FileUtil.toFileObject(clonePrjFile); - Project prj = projectManager.findProject(cloneProj); + Project prj = null; + if(clonePrjFile != null && cloneProj != null) + prj = projectManager.findProject(cloneProj); + if(prj != null){ HgProjectUtils.openProject(prj, this, HgModuleConfig.getDefault().getSetMainProject()); hg.versionedFilesChanged(); hg.refreshAllAnnotations(); + }else{ + HgUtils.outputMercurialTabInRed( NbBundle.getMessage(CloneAction.class, + "MSG_EXTERNAL_CLONE_PRJ_NOT_FOUND_CANT_SETASMAIN")); // NOI18N + } } catch (java.lang.Exception ex) { NotifyDescriptor.Exception e = new NotifyDescriptor.Exception(new HgException(ex.toString())); DialogDisplayer.getDefault().notifyLater(e); + } finally{ + HgUtils.outputMercurialTabInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N + HgUtils.outputMercurialTab(""); // NOI18N } } }; @@ -195,7 +210,6 @@ } HgUtils.outputMercurialTab(""); // NOI18N - FileObject cloneProj = FileUtil.toFileObject(clonePrjFile); if (isLocalClone){ SwingUtilities.invokeLater(doOpenProject); } else if (HgModuleConfig.getDefault().getShowCloneCompleted()) { @@ -232,11 +246,12 @@ } } } - + if(!isLocalClone){ HgUtils.outputMercurialTabInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_DONE")); // NOI18N HgUtils.outputMercurialTab(""); // NOI18N } } + } }; support.start(rp, source, org.openide.util.NbBundle.getMessage(CloneAction.class, "LBL_Clone_Progress", source)); // NOI18N } Index: versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneCompleted.java --- versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneCompleted.java Base (1.1) +++ versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneCompleted.java Locally Modified (Based On 1.1) @@ -161,8 +161,8 @@ FileObject projectFolder = FileUtil.toFileObject(projectDir); if (projectFolder != null) { try { + if(projectFolder != null){ Project p = ProjectManager.getDefault().findProject(projectFolder); - if (p != null) { openProject(p); } } catch (IOException e1) { @@ -173,9 +173,6 @@ } } } else { - if (projectToBeOpened == null) { - return; - } openProject(projectToBeOpened); } } else if (panel.createButton.equals(src)) { @@ -184,6 +181,8 @@ } private void openProject(Project p) { + if(p == null) return; + Project[] projects = new Project[]{p}; OpenProjects.getDefault().open(projects, false); Index: versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/ProjectUtilities.java --- versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/ProjectUtilities.java Base (1.1) +++ versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/clone/ProjectUtilities.java Locally Modified (Based On 1.1) @@ -121,6 +121,8 @@ * */ public static void newProjectWizard(File workingDirectory) { + if(workingDirectory == null) return; + Action action = CommonProjectActions.newProjectAction(); if (action != null) { File original = ProjectChooser.getProjectsFolder(); @@ -146,7 +148,7 @@ } private static List scanForProjectsRecursively(FileObject scanRoot, int deep) { - if (deep <= 0) return Collections.emptyList(); + if (scanRoot == null || deep <= 0) return Collections.emptyList(); List projects = new LinkedList(); ProjectManager projectManager = ProjectManager.getDefault(); if (scanRoot.isFolder() && projectManager.isProject(scanRoot)) { Index: versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgProjectUtils.java --- versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgProjectUtils.java Base (1.11) +++ versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgProjectUtils.java Locally Modified (Based On 1.11) @@ -122,9 +122,8 @@ } String res = null; - if (projectManager.isProject(rootFileObj)){ - try { + try { Project prj = projectManager.findProject(rootFileObj); res = getProjectName(prj);