This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 124412
Collapse All | Expand All

(-)versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java (-14 / +8 lines)
Lines 90-95 Link Here
90
import org.netbeans.api.project.ProjectUtils;
90
import org.netbeans.api.project.ProjectUtils;
91
import org.netbeans.api.project.Sources;
91
import org.netbeans.api.project.Sources;
92
import org.netbeans.api.project.SourceGroup;
92
import org.netbeans.api.project.SourceGroup;
93
import org.netbeans.api.project.FileOwnerQuery;
93
import org.netbeans.api.queries.SharabilityQuery;
94
import org.netbeans.api.queries.SharabilityQuery;
94
import org.openide.awt.HtmlBrowser;
95
import org.openide.awt.HtmlBrowser;
95
import org.openide.util.Utilities;
96
import org.openide.util.Utilities;
Lines 551-574 Link Here
551
552
552
    public static Project getProject(VCSContext context){
553
    public static Project getProject(VCSContext context){
553
        if (context == null) return null;
554
        if (context == null) return null;
554
        Node [] nodes = context.getElements().lookupAll(Node.class).toArray(new Node[0]);
555
        File [] files = context.getRootFiles().toArray(new File[context.getRootFiles().size()]);
555
        for (Node node : nodes) {
556
            Node tmpNode = node;
557
556
558
            Project project = (Project) tmpNode.getLookup().lookup(Project.class);
557
        for (File file : files) {
559
            while (project == null) {
558
            Project p = FileOwnerQuery.getOwner(FileUtil.toFileObject(file));
560
                tmpNode = tmpNode.getParentNode();
559
            if (p != null) {
561
                if (tmpNode ==  null) {
560
                return p;
561
            } else {
562
                    Mercurial.LOG.log(Level.FINE, "HgUtils.getProjectFile(): No project for {0}",  // NOI18N
562
                    Mercurial.LOG.log(Level.FINE, "HgUtils.getProjectFile(): No project for {0}",  // NOI18N
563
                        node.toString());
563
                    file);
564
                    break;
565
                }
564
                }
566
                project = (Project) tmpNode.getLookup().lookup(Project.class);
567
            } 
565
            } 
568
            if (project != null) {
569
                return project;
570
            }
571
        }
572
        return null;
566
        return null;
573
    }
567
    }
574
    
568
    

Return to bug 124412