Bug 29909 Incorrect indentation after newline
I have my preferences set as follows: Java | Editor | Displayed tab width: 8 Java | Code formatter | Insert tabs for indentation: No Java | Code formatter | Number of spaces representing an indentation level: 4 When I have the following code: class ContainerSelection extends Selection { } and I position the caret after the { and press Enter, Eclipse inserts a new line and 8 spaces. It should only insert 4.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
String insideBlockIndent= blockIndent == null ? "" : blockIndent + createIndent(1, useSpaces()); 
			int insideBlockIndentSize= calculateDisplayedWidth(insideBlockIndent, getTabWidth());
			int previousIndentSize= getIndentSize(document, command);
			int newIndentSize= insideBlockIndentSize < previousIndentSize
				? insideBlockIndentSize
				: previousIndentSize;
							
			if (startsWithClosingBrace(pastedText)) {
				int outsideBlockIndentSize= blockIndent == null ? 0 : calculateDisplayedWidth(blockIndent, getTabWidth());
				newIndentSize = outsideBlockIndentSize;				
			}
			
			int offset= command.offset;
			int line= document.getLineOfOffset(offset);
			int lineOffset= document.getLineOffset(line);
			String prefix= document.get(lineOffset, offset - lineOffset);
			boolean formatFirstLine= prefix.trim().length() == 0;
			String formattedParagraph= format(pastedText, newIndentSize, lineDelimiter, formatFirstLine);
			
			if (formatFirstLine) {
				int end= command.offset + command.length;
				command.offset= lineOffset;
				command.length= end - command.offset;
			}
			command.text= formattedParagraph;
		} catch (BadLocationException e) {
			JavaPlugin.log(e);
		}
	}
	private static String getIndentOfLine(String line) {