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
*/
		public Object next() {
			try {
				IRegion region= fDocument.getLineInformation(fLineIndex++);
				return fDocument.get(region.getOffset(), region.getLength());
			} catch (BadLocationException e) {
				JavaPlugin.log(e);
				throw new NoSuchElementException();
			}
		}
		/*
		 * @see java.util.Iterator#remove()
		 */
		public void remove() {
			throw new UnsupportedOperationException();
		}
	}
	private static String createIndent(int level, boolean useSpaces) {
		StringBuffer buffer= new StringBuffer();
		if (useSpaces) {
			int tabWidth= getPreferenceStore().getInt(PreferenceConstants.EDITOR_TAB_WIDTH);
			int width= level * tabWidth;
			for (int i= 0; i != width; ++i)
				buffer.append(' ');
		} else {
			for (int i= 0; i != level; ++i)
				buffer.append('\t');
		}
		return buffer.toString();
	}