Follow this:
Window -> Preferences -> Java -> Code Style -> Formatter -> [Edit...] -> Braces
There you can configure it!
Pregunta
Currently my eclipse follows this code format:
public class TempClass {
public static void main(String[] args) {
}
}
So when I select all code and press Ctrl + Shift + F , it formatts the code in above style.
Is there any way I can set my default code format to this:
public class TempClass
{
public static void main(String[] args)
{
}
}
Solución
Follow this:
Window -> Preferences -> Java -> Code Style -> Formatter -> [Edit...] -> Braces
There you can configure it!
Otros consejos
Right click on project->java -> code Style->Formatter->Configure Workspace Settings..(link on top right)>Select Active Profile->Edit->Braces(Tab)
Look for Brace Position:
You can change the brace position, for eg) constructor declaration to next line
You can create a new profile as well if you want(instead of using the Eclipse Built-in]
Change the sample code.
and Apply changes.
Version:Helios Service Release 2