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.
Currently the privileged templates are hard-coded in org.netbeans.modules.web.project.WebProject.PRIVILEGED_NAMES. There is no API for framework to add more privileged templates into the list. This feature is now becoming more important for the users because of the increased framework implementations. I use 'DEFECT' instead of 'ENHANCEMENT' because many users feel it's a serious bug when they don't find their expected items listed.
I feel this is a serious usability issue for visual web, and likely for other frameworks as well. Please commit this for NB 6.
I'm going to do it on branch.
The functionality is commited to the branch frameworksupport60. If you want to try it you have to checkout/update from this branch Web API and Web Projects. There is one new method in WebFrameworkProvider class: public String[] getPrivilegedTemplates(WebModule webModule){ return new String[0]; } Your web framework has to overwrite this method. The web project asks to the frameworks during opening project or adding framework to the project for the privileged templates. The templates are added at the beginning of the list of privileged templates. The number of the templates is not limited, which means that if we will have 5 frameworks and every framework will add 5 templates, then there can be 35 templates(5*5 + 10 templates from web project itself) offered in the context menu. I'm not sure whether this is real problem, but it can be limited for the certain number of templates. The good think is that the functionality doesn't influence performance during creating the context menu at all. The wrong thing is that I wasn't able to test the functionality during adding a framework to the already existing project due to the issue #10650. It will be merged to the trunk after M9 stabilization phase.
We definitely have to limit the number of items in the popup New> menu. I think the limit should be 10 + the "Other..." item. If there are too many items the list should be cut off. Framework templates should be given priority over the templates offered by the standard web project so up to 10 framework's preferred templates can be displayed. If there are multiple frameworks I would take first 3 from each framework. If there are more then 3 frameworks I would do the same, i.e. the list would just be cut off after 10 items no matter what. We could in theory do 5+5 for 2 frameworks, 4+3+3 for 3, etc., but I would not thinker about it too much as we will not get it absolutely right by any algorithm. A user who uses many frameworks will hopefully figure out how to use Other and the preferred list will get populated later.
I definitely agree that there has to be an limit. Probably 10. On the other hand now the JavaEE5 Web projects has more than 10 by default.
I'm sorry, the issue, which I mentioined in my previous comment is #101650
I partially change the api for privileged templates. It's not a part of WebFrameworkProvider class. Instead there is a new interface public interface WebPrivilegedTemplates { public String[] getPrivilegedTemplates(WebModule webModule); } An instance should be placed in j2ee/webtier/templates folder in a module XML layer file. The reason for these change was to separate it from the frameworks. Now the functionality is independent on the framework. From the framework implementation side the FrameworkProvider can implement this interface and then can be registered in both folders (j2ee/webtier/templates and j2ee/webtier/framework) through a factory method. The change is done at the branch frameworksupport60. If there will not be any objections, I'm going to commit this to the trunk on Friday.
The new version of the api is in the trunk now.