Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij new Java Class opening a different dialog than usual

When creating a new java class via new -> Java Class while using IntelliJ IDE, a random Dialog started appearing, and I can't find how to disable it.

enter image description here

This is the strange dialog that started showing, a sort of a wizard. Clicking the help button get's me There is no help for this dialog message.

How can I disable this window in the Intellij IDEA?

like image 788
MoisesCol Avatar asked Jul 21 '17 18:07

MoisesCol


2 Answers

I too had the same problem, the exact same dialog. In my case, it actually ended up not being a bug, but IJ acting properly (kinda).

TL;DR: The template code for creating a "Class" object got automagically changed after an IJ update so that it would prompt for answers from the coder when creating a new class file. Changing it back in "Settings/File and Code Templates" to the default template code removes the problem, as the default template code does not use any variables that are prompted for upon class object creation (ex.: ${IMPORT_BLOCK}).

Long version ...

Bring up the Settings dialog for IJ, and in the search field type "template", and then select the "File and Code Templates" option. You'll see on the right side of the dialog the "Editor > File and Code Templates" area. If you select "Class" from the list of template types, to the right of that list of template types you'll see the template used when you create a class ...

Settings/Editor/File and Code Templates/Class

Now I don't know why, but after a particular IJ update some months back, via their Toolbox app, the default template text/code was different, so that it looked like this ...

enter image description here

... and that latter template code/text caused the second dialog to appear that you see.

To fix the problem, highlight the "Class" template from the list, then click on the "Reset to Default" button that appears below the Files/Includes/Code/Other tabs (looks like a piece of paper with a 180 degree curving arrow on top of it), so that the template text goes back to what I have showing in the first screenshot, and then select the OK button.

Assuming your "default" template for the Class template is not corrupted/bad, you should no longer see the dialog that you asked about.

like image 118
Adrian Romanelli Avatar answered Nov 14 '22 03:11

Adrian Romanelli


Go to Settings/File and Code Templates -> class and change it to:

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
}

You can also try hitting the reset to default button, as Adrian Romanelli suggested.

like image 23
Ilya Gazman Avatar answered Nov 14 '22 02:11

Ilya Gazman