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.

Bug 122942 - Use PrivilegedTemplates filter-mechanism on nodes and projects
Summary: Use PrivilegedTemplates filter-mechanism on nodes and projects
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Milos Kleint
: 55329 (view as bug list)
Depends on: 130921
  Show dependency tree
Reported: 2007-11-28 10:01 UTC by schmidtm
Modified: 2008-07-21 13:09 UTC (History)
1 user (show)

See Also:
Exception Reporter:

api change patch (8.42 KB, patch)
2008-03-17 15:52 UTC, Milos Kleint
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description schmidtm 2007-11-28 10:01:26 UTC
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.
Comment 1 Milos Kleint 2008-03-10 14:39:43 UTC
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?
Comment 2 Milos Kleint 2008-03-10 16:42:10 UTC
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..
Comment 3 Milan Kuchtiak 2008-03-17 13:08:54 UTC
In case of web services, we have a Web Services and Web Service References nodes (top level nodes in project's logical
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.
Comment 4 Milos Kleint 2008-03-17 15:51:36 UTC
I'm going the the solution of ignoring last used templates on nodes with privilegedtemplates in lookup..
Comment 5 Milos Kleint 2008-03-17 15:52:32 UTC
Created attachment 58495 [details]
api change patch
Comment 6 Milos Kleint 2008-03-17 15:53:47 UTC
please review
Comment 7 Milos Kleint 2008-03-20 14:55:55 UTC
thanks for review, I will integrate shortly
Comment 8 Milos Kleint 2008-03-21 09:41:11 UTC
Comment 9 Milos Kleint 2008-07-21 13:09:36 UTC
*** Issue 55329 has been marked as a duplicate of this issue. ***