When I open any .java or .html IntelliJ (12.x) code file, it resets the code, and I always need to expand everything.
How to create default code?
In the settings ( ctrl+ alt+ son my machine) in the section Editoryou will find an entry with a name Code Folding. There you can choose what to fold by default. In your case, you probably want to remove all the defaults.
Editor
Code Folding