Sam Seymour
Sam Seymour

Reputation: 103

How do I turn off auto-generated code in eclipse?

I just started using eclipse classic (v3.7.2), and I admit I am still pretty lost. What I am trying to do now is turn off ALL the auto-generated code eclipse comes up with when I create a class (and if it does it any other time, I would like that gone too.) I'm not talking about suggestions--it can give me drop down boxes with suggestions all it wants, but I do not want it writing ANY of my code for me--not even braces and parentheses. I want a blank screen when I create a class, and for the most part (pretty much except for auto-indentations and the drop down suggestions) I want eclipse to just mind its own business until I ASK it for something.

I managed to get rid of most of the auto-generated stuff through the window > preferences > java > code style > code templates options, but It still generates the class name and closing braces when I create a class:

public class Contact
{

}

Also, I cannot figure out how to get it to stop completing the braces and parentheses.

Thanks.

Upvotes: 0

Views: 1951

Answers (3)

Jayan
Jayan

Reputation: 1

Simply hit escape when it appears if you do not want the suggestions it will not auto type on your code anything and box will disappear, otherwise it is not a good idea to get rid of it.

Upvotes: 0

E-Riz
E-Riz

Reputation: 33034

In Preferences > Java > Editor > Typing you can disable auto-closing of various things, including braces, strings, etc. But you can not get rid of the package declaration or type declaration portions of the "New Class" template. The only option I can think of is, instead of selecting to create a new Java class, instead create a plain file (which will be empty) in the appropriate source folder according to your package structure.

Having said that, I've been programming for over 20 years and I can't imagine any sane reason why you'd not want a tool to insert boilerplate, even minimal boilerplate like the class declaration. The bottom line is that Eclipse will not generate an invalid class that won't compile, and an empty file is NOT a valid class. If you don't want it to create a class, don't ask it to create a class, ask it to create an empty file instead.

Upvotes: 2

Marko Topolnik
Marko Topolnik

Reputation: 200296

ctrl-3, type Code Templates, select Code Templates -- Java/Code Style. A property page will open where you can edit the templates to empty.

Upvotes: 1

Related Questions