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 84384 - Not able to retrieve the class child nodes for java node programatically
Summary: Not able to retrieve the class child nodes for java node programatically
Status: RESOLVED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jan Pokorsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-06 23:20 UTC by Peter Zavadsky
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Zavadsky 2006-09-06 23:20:14 UTC
Using the Node API.
Having uninited node instance which is of JavaNode type (retrieved from
DataObject representing the java source):
1) Node javaNode = dataObject.getNodeDelegate();
2) Node[] childNodes = javaNode.getChildren().getNodes(true);
3) Then the childNodes contain only the wait node (Please wait...).

One would expect when calling the getNodes(true) (optimalResut == true!) that it
will retrieve the real class nodes and not only the waiting node.

I am not sure what is the contract of the API (or hack between showing the wait
node and the real nodes), but there doesn't seem to be a possiblity safely to
retrieve the class nodes from the uninited java node programatically, which I
believe was getNodes(true) designed for.
Comment 1 Peter Zavadsky 2006-09-06 23:25:16 UTC
This is probably about the SourceChildren code.
Comment 2 Jan Pokorsky 2006-09-07 11:42:35 UTC
Sorry, but your expectations are odd. There is no such api contract that
underneath JavaNode should appear any node. It is just a default implementation
to provide some children that can be filtered by whatever view. By no means it
is intended to access the java model.

The Please Wait node is used to be able to lazy initialize children. Later it is
replaced. But again it is an implementation detail not the api contract.

As you can read in Children.getNodes(boolean) javadoc:
"...But in general if you are trying to get useful data by calling this method,
you are probably doing something wrong. Usually you should be asking some
underlying model for information, not the nodes for children..."

If you like send me more details about what you want to do and I will try to
help you find a solution.

Closing as invalid.
Comment 3 Peter Zavadsky 2006-09-08 19:55:47 UTC
I am not saying that there should appear any certain nodes (that is part of a
hack), but I am saying that getNodes(null) should return the inited nodes, not
the temporary please wait ones. Also the findChild(name) should go via inited
nodes, not the temporary ones. That is my API understanding.

To solve the issue you could implement that if you will waitFinished for that
task you spawn for model creation.

To explain.
I am using this as a hack, basically I need to get to the Bean Patterns node and
reuse its NewTypes.

I know that it sounds strange, but that seems to be ony possibility how to fix
our problem (to provide the add property etc. action for other nodes then bean
pattern node).

Anyway, if there is other way then that to get to the NewTypes of bean pattern
node, then please let me know. I didn't find other, more appropriate (Beans
module doesn't provide any API).
Comment 4 Jan Pokorsky 2006-09-12 10:14:03 UTC
Yes, getNodes(true) have to return real nodes. It seems to be broken.

IMO better solution of your problem would be to register an own NodeFactory
before the beans module's one and there you could override createClassNode the
same way like the beans module does and use FilterChildren. At least you do not
hurt the lazy initialization and you will workaround this issue.
Comment 5 Peter Zavadsky 2006-09-14 17:55:03 UTC
OK, thanks for accepting this issue.

To our problem. The problem is not about how to override the actual new types of
certain node (class node), but about override thoes new types by which new types. 
I.e. how to get to the new types which create the bean properties.

There is no such api from the beans module. That's why I was hacking this the
way, somehow to find the bean node, and reuse its new types.

Or is your suggestion to get the Beans node factory and gets the nodes from there?
Comment 6 Jan Becicka 2007-09-11 12:48:04 UTC
This issue is no more valid. JavaNode does not have any children in 6.0.