Bug 42279 unwanted indents after if()/for()/while()....
Since 3.0m3 (and one or two integration builds before it) i get an automatic indent after controll statements like if()+new line. So my code looks like this (only automatic indents): public class Main { void someMethod() { if(true) { // this doesn't look good } else if(1==1) { // this is getting even worse } // oh my god :( } } After running the code formater the code looks like expected public class Main { void someMethod() { if (true) { // this doesn't look good } else if (1 == 1) { // this is getting even worse } // oh my god :( } } If there is a switch i didn't didn't find: sorry. If not: please fix it asap
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
} catch (BadLocationException e) {
			JavaPlugin.log(e);
		}
		
		return calculateDisplayedWidth(buffer.toString(), getTabWidth());
	}
	
	private String getBlockIndent(IDocument d, DocumentCommand c) {
		if (c.offset < 0 || d.getLength() == 0)
			return null;
		try {
			int p= (c.offset == d.getLength() ? c.offset - 1 : c.offset);
			int line= d.getLineOfOffset(p);
			
			int indLine= findMatchingOpenBracket(d, line, c.offset, 1);
			if (indLine != -1)
				
				return getIndentOfLine(d, indLine);
		} catch (BadLocationException e) {
			JavaPlugin.log(e);
		}
		return null;
	}
	private String createIndent(int level, boolean useSpaces) {
		StringBuffer buffer= new StringBuffer();
		if (useSpaces) {
            
			int width= level * getTabWidth();
			for (int i= 0; i != width; ++i)
				buffer.append(' ');