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.
BeanNode does not have a constructor that allows a Lookup to be defined. e.g. protected BeanNode(Object bean, Children children, Lookup lookup) This prevents the pattern recommended in http://www.netbeans.org/download/dev/javadoc/org-openide-nodes/org/openide/ nodes/Node.html#Node(org.openide.nodes.Children,%20org.openide.util.Lookup)
Created attachment 32826 [details] Implementation of the Lookup-accepting ctor.
I'm proposing to add BeanNode constructor accepting Lookup as one of its parameters. I have attached proposed (nontrivial) implementation of the proposal with tests covering both the new functionality and compatibility with previous usage patterns (that were not covered so far). I believe the proposal is noncontroversonal (hence the API_REVIEW_FAST keyword). The only questions I see is: 1. Whether to make new ctor protected (as is the (bean, children) ctor) or public (which would allow passing additional context w/o subclassing). 2. the order of lookups in the proxy. Please review carefully as keeping real compatibility was not as trivial as one cound think.
Javadoc for new ctor needs a different summary line. @since org.openide.nodes 6.9 Perhaps it would be better to leave the Lookup alone if passed explicitly. I don't see a reason to forcibly add the bean to it. IMHO if I pass a Lookup I expect it to be used as is.
OK, I was affraid that some code in/around BeanNode expects the cookie to be present, but it seems this is not the case. Without the forced InstanceCookie, the patch will be quite simple.
Implemented as Jesse suggested. openide/nodes/apichanges.xml,v1.7 openide/nodes/nbproject/project.properties,v1.9 openide/nodes/src/org/openide/nodes/BeanNode.java,v1.11 openide/nodes/test/unit/src/org/openide/nodes/BeanNodeTest.java,v1.3
*** Issue 85507 has been marked as a duplicate of this issue. ***