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.

Bug 212510 - Favorites tab no longer display child nodes which are not DataNode
Summary: Favorites tab no longer display child nodes which are not DataNode
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Favorites (show other bugs)
Version: 7.1.1
Hardware: PC All
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks: 199391 199603
  Show dependency tree
 
Reported: 2012-05-15 09:06 UTC by jeromerobert
Modified: 2012-05-16 11:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
sample project to reproduce the bug (2.57 KB, application/octet-stream)
2012-05-15 09:06 UTC, jeromerobert
Details
Sample project with dependencies compatible with netbeans 7.0.1 (2.53 KB, application/octet-stream)
2012-05-15 12:15 UTC, jeromerobert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jeromerobert 2012-05-15 09:06:26 UTC
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();
Comment 1 Ondrej Vrabec 2012-05-15 11:52:02 UTC
fix: http://hg.netbeans.org/core-main/rev/8145b4e68211
Comment 2 Ondrej Vrabec 2012-05-15 11:56:15 UTC
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?
Comment 3 jeromerobert 2012-05-15 12:08:50 UTC
It's been working from 6.7 to 7.0.1 and stop working with 7.1.
Comment 4 jeromerobert 2012-05-15 12:15:57 UTC
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.
Comment 5 Jesse Glick 2012-05-15 21:51:22 UTC
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.
Comment 6 jeromerobert 2012-05-16 07:54:34 UTC
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());
+	}
Comment 7 Quality Engineering 2012-05-16 11:09:25 UTC
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