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 67098 - Missing constructor in BeanNode
Summary: Missing constructor in BeanNode
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Petr Nejedly
URL: http://www.netbeans.org/download/dev/...
Keywords:
: 85507 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-10-19 09:42 UTC by timdudgeon
Modified: 2008-12-22 18:15 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Implementation of the Lookup-accepting ctor. (7.17 KB, patch)
2006-08-11 13:45 UTC, Petr Nejedly
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description timdudgeon 2005-10-19 09:42:18 UTC
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)
Comment 1 Petr Nejedly 2006-08-11 13:45:47 UTC
Created attachment 32826 [details]
Implementation of the Lookup-accepting ctor.
Comment 2 Petr Nejedly 2006-08-11 13:52:51 UTC
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.
Comment 3 Jesse Glick 2006-08-11 17:57:14 UTC
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.
Comment 4 Petr Nejedly 2006-08-15 15:45:23 UTC
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.
Comment 5 Petr Nejedly 2006-08-18 19:05:38 UTC
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
Comment 6 Jaroslav Tulach 2006-09-22 09:04:56 UTC
*** Issue 85507 has been marked as a duplicate of this issue. ***