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
int docLength= document.getLength();
		if (command.offset == -1 || docLength == 0)
			return 0;
		try {
			
			int p= (command.offset == docLength ? command.offset - 1 : command.offset);
			int line= document.getLineOfOffset(p);
			IRegion region= document.getLineInformation(line);
			String string= document.get(region.getOffset(), command.offset - region.getOffset());
			if (line != 0 && string.trim().length() == 0)
				--line;
			
			while (line != 0 && isLineEmpty(document, line))
				--line;
			int start= document.getLineOffset(line);
			
			
			ITypedRegion typedRegion= TextUtilities.getPartition(document, fPartitioning, start);
			if (IJavaPartitions.JAVA_DOC.equals(typedRegion.getType())) {
				start= document.getLineInformationOfOffset(typedRegion.getOffset()).getOffset();
			} else if (IJavaPartitions.JAVA_SINGLE_LINE_COMMENT.equals(typedRegion.getType())) {
				buffer.append(COMMENT);
				start += 2;
			}
			
			int whiteend= findEndOfWhiteSpace(document, start, command.offset);
			buffer.append(document.get(start, whiteend - start));
			if (getBracketCount(document, start, command.offset, true) > 0) {
				buffer.append(createIndent(1, useSpaces()));
			}