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.
Created attachment 119453 [details] sample project to reproduce the bug To reproduce (see attach project): - Create a new file type - Add AbstractNode(s) with empty lookup to the children of the associated DataNode (customize MyDataObject.createNodeDelegate). Result: - Nodes are not shown in the favorite tab. Expected result: - Child nodes (Foo and Bar in the attached example) should be visibles. Unless I'm wrong the bug has been introduced by http://hg.netbeans.org/main-silver/rev/514ab78f8045. It ignore the case of nodes that contains neither DataObject nor FileObject in their lookup. I guess the following change would fix it. - if (obj == null) { - return null; - } - fo = obj.getPrimaryFile(); + fo = obj == null ? null : obj.getPrimaryFile();
fix: http://hg.netbeans.org/core-main/rev/8145b4e68211
i applied your suggested modification. But i do not think that will help: 1) subnodes are not displaed in Projects or Files view either 2) e.g. *.zip files seem to be fine even in Favorites, they can be expanded and display their inner nodes When did this actually work?
It's been working from 6.7 to 7.0.1 and stop working with 7.1.
Created attachment 119470 [details] Sample project with dependencies compatible with netbeans 7.0.1 I attach a sample project with dependencies compatible with netbeans 7.0.1 to help testing that it works with netbeans 7.0.1.
The result of DataObject.createNodeDelegate must have the DataObject (and its primaryFile) in its lookup. Many UI features are likely be broken if this constraint is not followed. (In reply to comment #0) > Unless I'm wrong the bug has been introduced by 514ab78f8045. No, c90de9858e34 introduced the behavioral change; 514ab78f8045 merely fixed a resulting NPE, which this 8145b4e68211 should fix more robustly.
Thank you for this explanation ! I've changed some of my createNodeDelegate this way and it works: - protected Node createNodeDelegate() { - Node n1 = new AbstractNode(Children.LEAF); - n1.setDisplayName("Foo"); - Node n2 = new AbstractNode(Children.LEAF); - n2.setDisplayName("Bar"); - return new DataNode(this, new MyChildren(n1, n2), getLookup()); - } + protected Node createNodeDelegate() { + Node n1 = new AbstractNode(Children.LEAF, Lookups.singleton(this)); + n1.setDisplayName("Foo"); + Node n2 = new AbstractNode(Children.LEAF, Lookups.singleton(this)); + n2.setDisplayName("Bar"); + return new DataNode(this, new MyChildren(n1, n2), getLookup()); + }
Integrated into 'main-golden', will be available in build *201205160400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/8145b4e68211 User: Ondrej Vrabec <ovrabec@netbeans.org> Log: #212510 - Favorites tab no longer display child nodes which are not DataNode