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
}
		return line.substring(0, i);
	}
	/**
	 * Returns the indent of the first non empty line.
	 * A line is considered empty if it only consists of whitespaces or if it
	 * begins with a single line comment followed by whitespaces only.
	 */
	private static int getIndentSizeOfFirstLine(String paragraph, boolean includeFirstLine, int tabWidth) {
		for (final Iterator iterator= new LineIterator(paragraph); iterator.hasNext();) {
			final String line= (String) iterator.next();
			
			if (!includeFirstLine) {
				includeFirstLine= true;
				continue;
			}			
			String indent= null;
			if (line.startsWith(COMMENT)) {
				String commentedLine= line.substring(2);
				
				
				if (commentedLine.trim().length() == 0)
					continue;
				indent= COMMENT + getIndentOfLine(commentedLine);
				 
			} else {
				
				if (line.trim().length() == 0)
					continue;
				indent= getIndentOfLine(line);