Bug 21047 code formatter availability inconsistent
Sometimes the hotkey (ctrl-shift-f) and the menu entry for formatting the source code are disabled, while the entry in the context menu is enabled and works as expected. I didn't find any patterns on when this occurs till now.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitEditor.java
fIsOverviewRulerVisible= true;
			Control control= getControl();
			if (control instanceof Composite) {
				Composite composite= (Composite) control;
				composite.layout();
			}
			ensureOverviewHoverManagerInstalled();
		}
		
		public boolean isOverviewRulerVisible() {
			return fIsOverviewRulerVisible;
		}
		
		/*
		 * @see ISourceViewer#setDocument(IDocument, IAnnotationModel, int, int)
		 */
		public void setDocument(IDocument document, IAnnotationModel annotationModel, int visibleRegionOffset, int visibleRegionLength) {
			super.setDocument(document, annotationModel, visibleRegionOffset, visibleRegionLength);
			fOverviewRuler.setModel(annotationModel);
		}
		
		
		public void updateIndentationPrefixes() {
			SourceViewerConfiguration configuration= getSourceViewerConfiguration();
			String[] types= configuration.getConfiguredContentTypes(this);
			for (int i= 0; i < types.length; i++) {
				String[] prefixes= configuration.getIndentPrefixes(this, types[i]);
				if (prefixes != null && prefixes.length > 0)
					setIndentPrefixes(prefixes, types[i]);
			}