Bug 43228 Encoding Support for Java editor broken
I20030916 This has been broken with the introduction of ExtendedTextEditor.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
/**
	 * Quick format action to format the enclosing java element.
	 * 
	 * @since 3.0
	 */
	protected class QuickFormatAction extends Action {
		/**
		 * Formats the range of the source viewer document.
		 * 
		 * @param viewer The source viewer to operate on
		 * @param offset The offset of the range to be formatted
		 * @param length The length of the range to be formatted
		 * @param normalize <code>true</code> iff the region should be block normalized, <code>false</code> otherwise
		 */
		protected void format(final JavaSourceViewer viewer, int offset, int length, boolean normalize) {
			final IDocument document= viewer.getDocument();
			final Point selection= viewer.getSelectedRange();
			viewer.saveSelection(selection.x, selection.y);
			if (normalize) {
				try {
					final ITypedRegion region= TextUtilities.getPartition(document, IJavaPartitions.JAVA_PARTITIONING, offset);
					if (region.getType() != IDocument.DEFAULT_CONTENT_TYPE) {
						final int delta= region.getOffset() + region.getLength() - offset + 2;
						offset += delta;
						length -= delta;
					}
					final IRegion line= document.getLineInformationOfOffset(offset);
					final int delta= offset - line.getOffset();
					offset -= delta;
					length += delta;