It tooks me a while to see how can I use a custom java file template, and they messed the kind combobox default contributions

Hello IntelliJ comunity

I've created a couple of file templates with Tools>Save File as Template menu item for Spring/JPA stuff. And tooks me a while to see how can I create a file templates based on existing java file. One can get this support using Find Action popup and entering file template or scanning each and every menu (very time consuming). I wonder why such of useful support is not contributed to context menu for java editor and as context menu contribution on java item in package view. Moreover if one select a valid java file in package explorer view the  Tools>Save File as Template becomes grayed out (strange....)

Any way this was the easy part. The hard part was to use them. I remembered I did used once such of java file template, and I also remembered (but I can be wrong) the contributions were exposed in New... popup (Alt-Insert). So this was the first place where I looked for my custom templates. But unfortunatelly they did not contributed there.
So I seached the online idea help, but unfortunatelly  the http://www.jetbrains.com/idea/webhelp/file-templates.html#h2when_are_the_file_templates_used? doesn't help me at all. I generally find the idea online help not very useful, but this is my personal feeling.
So I try the new Java Class popup, and I noticed the custom java file templates contribute to kind combobox, messing  them up, and felt sorry I created them in the first place.   The IntelliJ Development team did manage to hide the use of custom java templates so well.

Many times I thought that the live template is mush less powerful as its couterpart live template. If I remember well I file an enhancement in youtrack in order to make file templates more appealing to IntelliJ users.

Idea Team please don't mess up the Kind default java type with our custom java file templates or use the second key stroke to filter out further:

  1. 1st Alt-Insert reveal only default types and
  2. 2nd filter-in our java contributions.


Best regards  

3 comments
Comment actions Permalink

jtonic wrote:

I wonder why such of useful support is not contributed to context menu for java editor and as context menu contribution on java item in package view.

A context menu is for items/tasks that are routinely used/performed. Creating a new file template is an occasional task. So it should not clutter upon context menu. The context menus you refer to are already rather heavily populated. There are hundreds of very useful actions available in IDEA. They all can't go in the context menu. :)

jtonic wrote:

So I try the new Java Class popup, and I noticed the custom java file templates contribute to kind combobox, messing  them up, and felt sorry I created them in the first place.   

Can you explain what you mean by "messing them up". I use dozens of Java based file templates and the fact that they are accessed via a combo box does not break them in anyway. As a side note, the Java based file templates use to appear directly in the alt+Insert context menu. But the context menu was too full and cluttered. So they moved then to where they are now. And in a lot of ways it makes sense. Regardless of what type of Java class I want to create -- a generic one, one from a bundled template, or one from a custom template -- I do the same thing. To me that is a good UI design.

0
Comment actions Permalink

A context menu is for items/tasks that are routinely used/performed. Creating a new file template is an occasional task. So it should not clutter upon context menu. The context menus you refer to are already rather heavily populated. There are hundreds of very useful actions available in IDEA. They all can't go in the context menu. :)

Thank you for the comment. You are right, it is not so frequentelly used. Simply took me a while to figured out where the save file as template is.

Can you explain what you mean by "messing them up". I use dozens of Java based file templates and the fact that they are accessed via a combo box does not break them in anyway. As a side note, the Java based file templates use to appear directly in the alt+Insert context menu. But the context menu was too full and cluttered. So they moved then to where they are now. And in a lot of ways it makes sense. Regardless of what type of Java class I want to create -- a generic one, one from a bundled template, or one from a custom template -- I do the same thing. To me that is a good UI design.


Messing them up means the items is ordered in alphabetical order and the default items (Class, Interface, Enum ...) are mixed with custom java templates. I know there is a filer support for it. But if I have a couple of templates starting with Ca (Cb...Cl) they will be placed before Class in kind checkbox. Moreover most of my java templates are related with Spring and JPA, but I am also working  with non-jpa and non-spring projects, and the custom templates stay in the way of quick selecting the plain Class/Interface Kind in New Class. IMHO it will be great if the New Class popup will provide the support for filtering the custom templates out, as many other popups already provide, like [X] Filter out the custome java templates.  Other solution preventing poluting the Alt-Insert popus is to provide a category for each file template and the Alt-Insert popup creating a submenu for each category under which will reside the file templates for that menu. If the user doesn;t provide a category Idea attach a default one.  

Also I noticed that IntelliJ Configuration Server plugin does not synchronise the file templates.

Thank you in advance for further useful details
0
Comment actions Permalink

jtonic wrote:

Messing them up means the items is ordered in alphabetical order and the default items (Class, Interface, Enum ...) are mixed with custom java templates. I know there is a filer support for it. But if I have a couple of templates starting with Ca (Cb...Cl) they will be placed before Class in kind checkbox.

Strange. For me, the primary standard templates, Class, Interface, Enum, and Annotation are shown first, in that order, then the other built-in templates & my custom templates intermixed in alphabetical order. My one co-worker who also uses file templates is off today, but I'll have to check and see what he gets in his.

jtonic wrote:
IMHO it will be great if the New Class popup will provide the support for filtering the custom templates out, as many other popups already provide, like [X] Filter out the custome java templates.

An interesting suggestion. You could make a feature request for that.

jtonic wrote:

Other solution preventing poluting the Alt-Insert popus is to provide a category for each file template and the Alt-Insert popup creating a submenu for each category under which will reside the file templates for that menu. If the user doesn;t provide a category Idea attach a default one.

You might want to take a look at (and vote for) this feature request: IDEA-27486 Make file templates per-project It's a popular request. There are a couple of related suggestions in there. One suggestion in the comments, which I like as well, was to allow for the grouping of file templates and to then be able to run groups on and off for a project. Not sure if JetBrains would want to place the groups in the Alt+Insert context menu. I remember a while back there was some discussion in the forums here where they commented that they were trying to reduce the clutter in the context menus. Thus the reason Java based templates moved into the New Class pop-up.

jtonic wrote:

Simply took me a while to figured out where the save file as template is.

This is a struggle for any feature rich application. How to let people know about everything that is available without cluttering the UI. From my understanding, this was a driving factor behind Microsoft's Ribbon UI in Office (and now other applications). Studies showed that most users only knew about 20% (or something like that) of the features available in Word.

0

Please sign in to leave a comment.