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.
If one's doing CommonProjectActions.newFileAction() he's getting an Action interface to create new file artifacts in NetBeans. If one wants to limit this list of all new file actions registered in the template system one can use PrivilegedTemplates and RecommendedTemplates. But this filtering works only on whole projects. This RFE is about to query this Filter ( probably in addition ) from Nodes to have a fine control about which artifacts can be created where. This also will increase the re-use of all the pre-registered templates and the corresponding wizards. *BEWARE*: Please refrain from Displaying the "NEW->" Menu in case we have but only *one* resulting Action.
one possible problem with the workflow: let's say the Node on which the new file action is invoked supplies the Recomendedtemplates and PrivilegedTemplates. We use that information to construct the list. However if the user goes back to the first panel, (s)he can change the project in the combo on top. Then miraculously the list is populated from the new project.I suppose that's fine.. even in the case someone switches back to the original project.. BTW: do we want to limit the list of privileged templates only (the ones on popup on directory by default) or even the recommended ones (appear in the list in the first panel of the wizard).. Doing just privileged ones feels safer to do.. if you access from the main menu or toolbar (or you just want something else than the privileged ones) you can still override it and create whatever you like. Would PrivilegedTemplates overriding be enough for your usecase?
I have a prototype for custom PrivilegedTemplates. it works fine in the beginning when no template was yet created but slowly deteriorates as people start creating files. Lets take an example. I create a custom instance for use in "Web Pages" node of web projects. I return just html and jsp files. Once the user creates a servlet file in "Sources" for example, the servlet template starts appearing in the "Web Pages" context as well. An option would be to suppress the appearance of used templates in this case or use also the RecommendedTemplates to limit scope of used templates appearing..
In case of web services, we have a Web Services and Web Service References nodes (top level nodes in project's logical view). For those nodes, the only templates categories that have sense are "web-service" and "web-service-client" category. I think, ability to specify privileged templates on node level is fine. The node's privileged templates are, as I expect, the subset of project's recommended templates.
I'm going the the solution of ignoring last used templates on nodes with privilegedtemplates in lookup..
Created attachment 58495 [details] api change patch
please review
thanks for review, I will integrate shortly
done. http://hg.netbeans.org/main/rev/e7e2e6360bc0
*** Issue 55329 has been marked as a duplicate of this issue. ***