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.
In a web module project you have many different contexts in which you can create files: Source Packages, Unit Tests, Web Pages. The list of priviledged templates is the same for all which means it is getting long. But you do _not_ want to put any file anywhere (and the wizard will limit the choices of target location anyway). If the list could be context sensitive it would be shorter and more useful. See #54228 for an example.
No plans to implement any time soon.
*** Issue 58131 has been marked as a duplicate of this issue. ***
Having the ability to filter the list of available templates based on the node context is a significant usability issue, especially for web apps. Requesting that this be implemented for promotion F.
In my experience with NetBeans, new web application developers do not know where to place files like Applet Classes, CSS, Java Files, images, JSP pages, etc. in their web application One way to guide the users is to provide "hints" as to the appropriate items to place under a Project's logical node. Enabling the IDE to show different "privileged" items for different logical nodes in the project view will help.
Solution could be to enhance the PrivilegedTemplates and RecommendedTemplates API, i.e. to overload the existing method by adding one paramterer, providing info about the node asking for those templates, e.g.: PrivilegedTemplates#getPrivilegedTemplates(Node); RecommendedTemplates#getRecommendedTypes(Node); Then each project could customize the templates per its node (not just per project). It shouldn't be a problem to implement, and hopefully it would be acceptable API enhancement.
If users do not know where to put various types of files then making the list different for different nodes may actually be counter productive. If the user wants to create a Servlet, for example, the template is currently available everywhere but then we guide the user to choose the right target location. If we only display the Servlet template on Java Souces node it will be harder to find and thus regression in usability. I still think that different templates on different nodes would work better for expert users, but reading your comments makes me wonder if we really want to make it harder for novice users. BTW: Sometimes we restrict to target location too much. For example you cannot create an html file in java sources using the Web/Html template (although in this case there is a workaround, you can use Other/Html template:-). There are cases when you do want to create html file in src.
Re. "Sometimes we restrict to target location too much. For example you cannot create an html file in java sources using the Web/Html template (although in this case there is a workaround, you can use Other/Html template:-). There are cases when you do want to create html file in src.": 1. You can also create an empty file in any location and give it an .html extension. 2. The Other/html template could perhaps be removed anyway; Web/html should include whatever is most appropriate for a new HTML page in a web app, whereas there should be a separate template for package.html in a Java source root (already filed separately in javadoc module).
Jesse, there are web apps frameworks in which it is typical to put html files into src. In vanilla web apps it is not. But this should be soved in web/html. I agree with removing Other/html, no problem for web apps.
To clarify -- I'm not asking to restrict creating items in a particular location, I'm just asking for the privileged templates that are shown to the user to be different. Clicking on New -> Files/Folders... would still present the whole list. As it stands, the privileged list changes when the user adds new items, so it is not designed to be a static list. This is also a request for a platform change, not necessarily a change to the NB UI. It should be up to the product and/or project type to determine which privileged items should appear by *default* on the New context menu cascade, and it should be possible to have that be different depending on the node. Perhaps what I am asking for is actually a different issue, (perhaps http://www.netbeans.org/issues/show_bug.cgi?id=58131, which was closed as a dup of this one...)
pbuzek wrote: > If users do not know where to put various types of files then making the list > different for different nodes may actually be counter productive. If the user > wants to create a Servlet, for example, the template is currently available > everywhere but then we guide the user to choose the right target location. If we > only display the Servlet template on Java Souces node it will be harder to find > and thus regression in usability. AFAIK opinion of our HIE is exactly the opposite on this, i.e. that it would improve usability. Actually what is the advantage to be able to create objects (e.g. the servlets) at locations where those are not supposed to live and won't work in that case? Moreover this shouldn't be the question here. There no requirement to change the NB IDE behaviour. The question is more NB platform-like. Whether you agree to provide the possibility to control the list of the items per node or not (for project type impls).
Apparently I did not express myself clearly because I am missunderstood. Here is another attempt: You are proposing to have different priviledged templates for Java Sources, different for Web Pages, different for Unit Tests, etc. Is this correct? I am using netbeans examples, bcs I do now know you examples. What I was trying to say is that IF the user goes to Java Sources to create Servlet or Filter, but goes to Web Pages to create a JSP, Html files, etc. then this proposal would make sense. But if the user does not understand what is the appropriate location for certain file types then how will she know where to right-click to create a Servlet, for example? She will have to go to the new File/Folder to find the Servlet template. Now it is very straight forward - just right click everywhere and get the most typical (or MRU) templates. This has nothing to do with the fact that _after_ you select the template the IDE selects the correct location. I am just pointing to what seems to be a logical contradiction. And I do not see why creator and netbeans should be different in this regard. Are creator users more advanced then netbeans users? I am not mandating a decision, just presenting an argument.
(1) Users tend to click around (2) Once they're in the wizard, the fact that the default might actually put the new node it in the right place is not expected -- users expect that items that they create from a node in the project will be created below that node. (3) Showing an object in the privileged list for a node that it doesn't belong under will be confusing. This happens before the user ever gets to the wizard. (4) Showing the same privileged list under each node will not enable the user to distinguish the different purposes of the logical nodes in a project. That's about all I can say on the subject, so I've copied Jano in case he has any data on this.
I agree with both points of view. Pavel's: --- If users do not know where to put various types of files then making the list different for different nodes may actually be counter productive. If the user wants to create a Servlet, for example, the template is currently available everywhere but then we guide the user to choose the right target location. If we only display the Servlet template on Java Souces node it will be harder to find and thus regression in usability. --- And Jeff's: --- (1) Users tend to click around (2) Once they're in the wizard, the fact that the default might actually put the new node it in the right place is not expected -- users expect that items that they create from a node in the project will be created below that node. (3) Showing an object in the privileged list for a node that it doesn't belong under will be confusing. This happens before the user ever gets to the wizard. (4) Showing the same privileged list under each node will not enable the user to distinguish the different purposes of the logical nodes in a project. --- We had the same concern as Pavel when we designed the original privileged list. I think we had in mind previous NetBeans versions and previous project system studies, where the UI was too context sensitive and the user wasn't sure where to click and in many cases she couldn't find the right menu item. In order to proceed with this towards context sensitive privileged list, *somebody* has to look at all file templates and all project types and logical nodes and come up with a list of initial privileged list. In addition that *somebody* should propose behavior of privileged list once recent items are added. I'm willing to do that once it is properly planned for some release.
Please do not make this issue contingent upon a unified definition of what should appear in the privliged templates list. This is a request for an API to allow point products to do what they deem necessary for their target audience. Whether or not NetBeans itself decides to exploit the API is another matter and should be dealt with as a separate issue.
Okay, makes sense. I just want to point out, that at some point somebody would have to do this (privileged and *recent* templates) exercise and maybe it is better to do it before the API is implemented.
implemented as #122942 since 6.1 *** This issue has been marked as a duplicate of 122942 ***