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.
This is a regression. Newly created JavaApp project isn't expanded and Main.java isn't selected in Projects window.
Easy reproducible, this regression has appeared between 10/26 and 10/28 build.
It's not reproducible on each project creation, a little random, depends if the logical view is active or not, how many projects are created in a row. The project/ui/ProjectUtilities.openAndSelectNewObject() is correctly called, sometimes fails ProjectTab.selectNode(). Looks as a race condition. Petr, do you have any suspicion why selectNode() sometimes fails?
I haven't seen again after bugfix #50327.
Unluckily, still reproducible in NB40 and in recent dev builds too. Almost 100% doesn't work if a first project opened, next project opens correctly. Maybe, long delay due to initially parsing breaks ProjectTab.selectNode().
Evaluation: Finding & selecting newly created file works good from scratch projectui/ProjectUtilities.openAndSelectNewObject() -> ... -> java/project/spi/PackageRootNode.PathFinder.findPath(). A problem is that findPath() calls openide/NodeOp.findPath(), it works on children which couldn't be calculated yet. NodeOp.findPath throws NodeNotFoundException in this case, it's swallowed in PathFinder. The proposed patch forces calculation of nodes before find. NodeOp.findPath() should work only fully initialized children.
Created attachment 19024 [details] proposed patch
Yardo, please consider the attached patch of NodeOp. The patch fixes this defect. Thanks
I guess the proper fix would be to change the findChild method of the children that do lazy calculations. Of course, this can be more work than the fix in NodeOp, but I would still prefer it, because the default replacement for getNodes(true) used to be findChild(null); getNodes(); I am closing this as wontfix, in a hope that doing the fix in the children is better idea. If it is not, please reopen, and we can consider changes in NodeOp. Btw. simple testcase would be very useful.
:-) This is a UI issue. Jirka only suggested a fix for that, so please don't close this issue if the fix isn't correct ;-). Somebody should try to find a different fix.
Yarda points out the fix should be addressed to children of nodes in PackageView rather than generally do fix of NodeOp.findPath(). I'll change findChild() in java/project/support/PackageViewChildren to init children before start finding.
fixed in java/project/src/org/netbeans/spi/java/project/support/ui/PackageViewChildren.java; /cvs/java/project/src/org/netbeans/spi/java/project/support/ui/PackageViewChildren.java,v <-- PackageViewChildren.java new revision: 1.48; previous revision: 1.47 done
*** Issue 50600 has been marked as a duplicate of this issue. ***