# 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/util/HgUtils.java --- versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java Base (1.26) +++ versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java Locally Modified (Based On 1.26) @@ -90,6 +90,7 @@ import org.netbeans.api.project.ProjectUtils; import org.netbeans.api.project.Sources; import org.netbeans.api.project.SourceGroup; +import org.netbeans.api.project.FileOwnerQuery; import org.netbeans.api.queries.SharabilityQuery; import org.openide.awt.HtmlBrowser; import org.openide.util.Utilities; @@ -551,24 +552,17 @@ public static Project getProject(VCSContext context){ if (context == null) return null; - Node [] nodes = context.getElements().lookupAll(Node.class).toArray(new Node[0]); - for (Node node : nodes) { - Node tmpNode = node; + File [] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]); - Project project = (Project) tmpNode.getLookup().lookup(Project.class); - while (project == null) { - tmpNode = tmpNode.getParentNode(); - if (tmpNode == null) { + for (File file : files) { + Project p = FileOwnerQuery.getOwner(FileUtil.toFileObject(file)); + if (p != null) { + return p; + } else { Mercurial.LOG.log(Level.FINE, "HgUtils.getProjectFile(): No project for {0}", // NOI18N - node.toString()); - break; + file); } - project = (Project) tmpNode.getLookup().lookup(Project.class); } - if (project != null) { - return project; - } - } return null; }