Bug 40772 [plan item] Smart tab on empty lines
When having the caret on an empty line, pressing tab cleans up the line and sets the caret it the right indentation column.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaAutoIndentStrategy.java
depth++;
				else
					depth--;
				
				if (depth == 0)
					return position;
			}
		} catch (BadLocationException e) {
			return -1;
		}
	}
	private static IRegion getSurroundingBlock(IDocument document, int offset, String partitioning) {
		if (offset < 1 || offset >= document.getLength())
			return null;
			
		int begin= searchForOpeningPeer(document, offset - 1, partitioning, '{', '}');
		int end= searchForClosingPeer(document, offset, partitioning, '{', '}');
		if (begin == -1 || end == -1)
			return null;
		return new Region(begin, end + 1 - begin);
	}
	private static CompilationUnitInfo getCompilationUnitForMethod(IDocument document, int offset, String partitioning) {
		try {	
			
			IRegion sourceRange= getSurroundingBlock(document, offset, partitioning);
			if (sourceRange == null)
				return null;
			String source= document.get(sourceRange.getOffset(), sourceRange.getLength());
	
			StringBuffer contents= new StringBuffer();