Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Eclipse from automatically folding the import statements

Tags:

java

eclipse

I searched the Eclipse settings, the web and StackOverflow, but I couldn't find an answer. Eclipse always folds the import statements and I can't turn it off.

like image 576
Lenar Hoyt Avatar asked Oct 10 '11 21:10

Lenar Hoyt


People also ask

How do I fix all imports in Eclipse?

Press: CTRL + SHIFT + O and you should see below dialog boxes. Choose your desired import package and click next. It will prompt you for your next import and thats it. You are done.

How do I manage imports in Eclipse?

Go to Window > Preferences > Java > Editor > Save Actions. Select Perform the selected actions on save (off by default). Ensure that Organize imports is selected (on by default).

Does Eclipse auto import?

Auto Import Java Class In Single Java File. Input the class name in the java source file. Click Source —> Organize Imports menu item or Shift+Ctrl+O in Eclipse, then the java class will be imported in the java source file automatically.

Why import option is not working in Eclipse?

Try this: Go to Preferences » Java » Editor » Content Assist » Advanced. Make sure Other Java Proposals is ticked/checked. If that does not work simply close the project and reopen it.


2 Answers

Go to Window / Preferences, type "import" into the search box, find the "Folding" section and untick "Imports".

(I love the preferences search feature. Alternatively, you can go to Java / Editor / Folding and untick it that way.)

like image 147
Jon Skeet Avatar answered Sep 21 '22 12:09

Jon Skeet


From the menu

Window -> preferences -> java -> editor -> Folding -> "Uncheck box for imports" 

Reopen files if necessary.

like image 43
fmucar Avatar answered Sep 20 '22 12:09

fmucar