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.
I tried it for examples/HelloWord FO, and null was returned.
Verified. The problem is the FileObject handling code in Project.knowsObject(Object object) : if (object instanceof FileObject) { try { objFS = ((FileObject) object).getFileSystem (); } catch (FileStateInvalidException e) { objFS = null; } if (objFS == filesystem) { HelloWorld's FileSystem is not the project file system, but ExLocalFileSystem (my root directory, /.) What's more, when I have multiple projects open, all the source files report the same ExLocalFileSystem, not each of their own ProjectFileSystems. So, the FileObject recognition code needs to get enhanced. One quick fix is to do DataObject.find(fileobject) and look for the DataObject (that works) but DataObject.find may be slow (I've never looked at the implementation so I don't know). Alternatively, perhaps we have a quick way to check the project contents using filesets?
One more note: while projectObject.getProject() works, Project.find(projectObject) returns null. Probably not a big deal.
1. Semantics of Project.find and Project.findAll has been changed according to issue #27189 (see details there). Basicaly, the Project.findAll method should be used to get the list of projects containing file. This method accept both DataObjects and FileObjects, when DO is passed in the methods operates on primary file of that DO. 2. Project.find(ProjectObject) returns the same as ProjectObject.getProject()
Verified
As described in http://www.netbeans.org/servlets/ReadMsg?msgId=619519&listName=nbdiscuss the current work on projects prototype has been stopped. Marking issue as CLOSED.