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 197864
Collapse All | Expand All

(-)a/projectui/src/org/netbeans/modules/project/ui/PhysicalView.java (-36 / +2 lines)
Lines 113-164 Link Here
113
        SourceGroup[] groups = s.getSourceGroups(Sources.TYPE_GENERIC);
113
        SourceGroup[] groups = s.getSourceGroups(Sources.TYPE_GENERIC);
114
                
114
                
115
        FileObject projectDirectory = p.getProjectDirectory();
115
        FileObject projectDirectory = p.getProjectDirectory();
116
        SourceGroup projectDirGroup = null;
117
        
118
        // First find the source group which will represent the project
119
        for( int i = 0; i < groups.length; i++ ) {
120
            FileObject groupRoot = groups[i].getRootFolder();
121
            if ( projectDirectory.equals( groupRoot ) ||
122
                 FileUtil.isParentOf( groupRoot, projectDirectory ) ) {
123
                if ( projectDirGroup != null ) {
124
                    // more than once => Illegal
125
                    projectDirGroup = null;
126
                    break;
127
                }
128
                else {
129
                    projectDirGroup = groups[i];
130
                }
131
            }
132
        }
133
        
134
        if ( projectDirGroup == null ) {
135
            // Illegal project
136
            LOG.log(Level.WARNING, "Project {0} either does not contain its project directory under generic source groups or the directory is under more than one source group", p);
137
            return new Node[0];
138
        }
139
140
        FileObject rootFolder = projectDirGroup.getRootFolder();
141
        if (/* #150018 */!rootFolder.isValid() || /* #181323 */!rootFolder.isFolder()) {
142
            return new Node[0];
143
        }
144
        
145
        // Create the nodes
146
        ArrayList<Node> nodesList = new ArrayList<Node>( groups.length );
116
        ArrayList<Node> nodesList = new ArrayList<Node>( groups.length );
147
        nodesList.add(new ProjectIconNode(new GroupNode(p, projectDirGroup, true, DataFolder.findFolder(rootFolder)), true));
148
        
117
        
149
        for (SourceGroup group : groups) {
118
        for (SourceGroup group : groups) {
150
            if (group == projectDirGroup) {
151
                continue;
152
            }
153
            if ("sharedlibraries".equals(group.getName())) { //NOI18N
119
            if ("sharedlibraries".equals(group.getName())) { //NOI18N
154
                //HACK - ignore shared libs group in UI, it's only useful for version control commits.
120
                //HACK - ignore shared libs group in UI, it's only useful for version control commits.
155
                continue;
121
                continue;
156
            }
122
            }
157
            rootFolder = group.getRootFolder();
123
            FileObject rootFolder = group.getRootFolder();
158
            if (!rootFolder.isValid() || !rootFolder.isFolder()) {
124
            if (!rootFolder.isValid() || !rootFolder.isFolder()) {
159
                continue;
125
                continue;
160
            }
126
            }
161
            nodesList.add(new ProjectIconNode(new GroupNode(p, group, false, DataFolder.findFolder(rootFolder)), true));
127
            nodesList.add(new ProjectIconNode(new GroupNode(p, group, projectDirectory.equals(rootFolder) || FileUtil.isParentOf(rootFolder, projectDirectory), DataFolder.findFolder(rootFolder)), true));
162
        }
128
        }
163
        
129
        
164
        Node nodes[] = new Node[ nodesList.size() ];
130
        Node nodes[] = new Node[ nodesList.size() ];
(-)a/projectui/src/org/netbeans/modules/project/ui/ProjectsRootNode.java (-7 / +7 lines)
Lines 556-574 Link Here
556
                } else {
556
                } else {
557
                    Node[] arr = PhysicalView.createNodesForProject(newProj);
557
                    Node[] arr = PhysicalView.createNodesForProject(newProj);
558
                    OpenProjectList.log(Level.FINER, "physical view {0}", Arrays.asList(arr));
558
                    OpenProjectList.log(Level.FINER, "physical view {0}", Arrays.asList(arr));
559
                    if (arr.length > 1) {
559
                    for (Node one : arr) {
560
                        if (PhysicalView.isProjectDirNode(one)) {
561
                            n = one;
562
                            break;
563
                        }
564
                    }
565
                    if (arr.length > 1 || n == null) {
560
                        pair.project = newProj;
566
                        pair.project = newProj;
561
                        OpenProjectList.log(Level.FINER, "refreshing for {0}", newProj);
567
                        OpenProjectList.log(Level.FINER, "refreshing for {0}", newProj);
562
                        ch.refresh(newProj);
568
                        ch.refresh(newProj);
563
                        OpenProjectList.log(Level.FINER, "refreshed for {0}", newProj);
569
                        OpenProjectList.log(Level.FINER, "refreshed for {0}", newProj);
564
                        return;
570
                        return;
565
                    }
571
                    }
566
                    for (Node one : arr) {
567
                        if (PhysicalView.isProjectDirNode(one)) {
568
                            n = one;
569
                            break;
570
                        }
571
                    }
572
                    if (n == null) {
572
                    if (n == null) {
573
                        OpenProjectList.log(Level.WARNING, "newProject yields null node: " + newProj);
573
                        OpenProjectList.log(Level.WARNING, "newProject yields null node: " + newProj);
574
                        n = Node.EMPTY;
574
                        n = Node.EMPTY;

Return to bug 197864