Eclipse 3.5 indents this code correctly:
addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(WindowEvent e)
{
dispose();
}
});
but as you can see, it indents this code incorrectly:
final Action closewindowaction = new AbstractAction("Close window")
{
public void actionPerformed(ActionEvent e)
{
dispose();
}
};
The obvious difference is that the second example uses an assignment, but I’ve set assignment in line wrapping to use default indentation and I’ve set that default indentation to zero, so I don’t see any reason why it should be misbehaving. Any idea how to fix this?
What is your line wrap set to in the formatter? the second line is close to 67 characters long (it will obviously be more depending on the initial indentation), IIRC 80 is the default for line wrapping, so it might be Eclipse is wrapping the line for the opening brace.
Update: Based on your posted settings. It looks like you’ve got Never join lines in Line Wrapping->General Settings checked. If I uncheck that option I get the indentation you expected.