Is there a way to generate multiple files / classes using intellij code / file templates?

I like intellij code / file templates, they work very well for me for single files, but it would be great to be able to create multiple files / classes at once.

I found this question , but since several years have passed since I hoped that everything could change.

We use the mvp template in our application, so every time we want to create a new view, this requires two classes and two interfaces, which are always in the same template. It would be great if we could create the entire infrastructure for this and link the classes.

Any suggestions or new information will be appreciated? Perhaps it's time to register a feature request with JetBrains ?

+45
intellij-idea code-generation vtl
Aug 08 '13 at
source share
4 answers

This feature is apparently available in ReSharper (another one). This is not yet possible in IDEA .

+5
Sep 21 '15 at 16:15
source share

The IDE does not currently support this feature. The most popular youtrack request has more than 60 votes, but it is still open (since 2012). You can use a third-party solution, for example this plugin.

+1
Mar 16 '17 at 13:48 on
source share

You can easily do this with JavaParser, but I'm not sure how you could call it from the IDEA interface

0
Nov 20 '15 at 22:26
source share

I think you are looking for this,

Open the desired file in the editor. From the main menu, select "Tools | Save the file as a template. In the" File and Code Templates "dialog box that appears, specify a new name for the template and edit the source code if necessary. Save the changes and close the dialog box.

-one
Sep 15 '15 at 8:36
source share



All Articles