Bug 49461 [preferences] code formatter not configured with Java project options
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitEditor.java
if (isValidSelection(startOffset, endOffset - startOffset))
					selectAndReveal(startOffset, endOffset - startOffset);
			} finally {
				fStartOffset.clear();
				fEndOffset.clear();
			}
		}
		private boolean isValidSelection(int offset, int length) {
			IDocumentProvider provider= getDocumentProvider();
			if (provider != null) {
				IDocument document= provider.getDocument(getEditorInput());
				if (document != null) {
					int end= offset + length;
					int documentLength= document.getLength();
					return 0 <= offset  && offset <= documentLength && 0 <= end && end <= documentLength;
				}
			}
			return false;
		}
		
	}
	/**
	 * Remembers additional data for a given
	 * offset to be able restore it later.
	 * 
	 * @since 3.0
	 */
	private class RememberedOffset {