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.
According to the feedback on dev@projects it seems that design of ContentDescriptor and ContainersList has serious flaws. In particular the problems are: 1. ContentDescriptor.getContents() returns Collection which is used as a kind of union type structure 2. ContentDescriptor can support more MIME types which makes anybody using it to write code like the one below: ContainersList l = project.getContainersList().search("mimetype"); ContentDescriptor[] descs = l.getContents(); for (int i = 0; i < descs.length; i++) { Collection c = descs.getContents("mimetype"); } 3. it's hard to access ContentDescriptors provided by single ProjectObject, one has to write: Lookup.Result res = container.getEnvironment().lookup(new Lookup.Template(ContentDescriptor.class)); for (Iterator it = res.allInstances().iterator(); it.hasNext(); ) { ContentDescriptor cd = (ContentDescriptor)it.next(); Collection c = cd.getContents(mimetype); for (Iterator it2 = c.iterator(); it2.hasNext(); ) { Object item = it2.next(); // do some stuff with the item } } See the discussion on http://projects.netbeans.org/servlets/ReadMsg?msgId=388662&listName=dev
Done. ad 1. getContent() returns Object, the type of returned instance is part of MIME type definition contract. For basic mime types defined by infrastructure the instance of FileSet must be returned. ad 2. ContentDescriptor can be registered for exactly one MIME type, thus there is no need to pass the MIME type to methods of ContentDescriptor anymore. ad 3. Two ContainersList.findFor methods has been introduced, they take Project and ProjectMember respectively. The code mentioned in this point can be rewritten to: ContentDescriptor cd [] = ContainersList.findFor(container).search(mimeType); Object item = cd[0].getContent(); ad 4. (mentioned on dev@projects) - the getVisualObject method still exists, it helps implementors of ContentDescriptor contract to return different visualObjects from different instances of single implementation of ContentDescriptor, otherwise they would have to create several classes extending CD. CDs can be provided by either ProjectEnvironmentProviders or directly by DataObjects on PFS (e.g. build targets). In latter case you can either provide single instance of CD as a cookie or you can provide instance of Lookup.Provider as a cookie and put several CDs in the lookup.
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.