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
protected void layout(Composite composite, boolean flushCache) {
			Rectangle clArea= composite.getClientArea();
			if (fAdaptedSourceViewer.isVerticalRulerVisible()) {
				
				StyledText textWidget= fAdaptedSourceViewer.getTextWidget();
				Rectangle trim= textWidget.computeTrim(0, 0, 0, 0);
				int scrollbarHeight= trim.height;
				
				IVerticalRuler vr= fAdaptedSourceViewer.getVerticalRuler();
				int vrWidth=vr.getWidth();
				
				int orWidth= 0;
				if (fAdaptedSourceViewer.isOverviewRulerVisible()) {
					OverviewRuler or= fAdaptedSourceViewer.getOverviewRuler();
					orWidth= or.getWidth();
					or.getControl().setBounds(clArea.width - orWidth, scrollbarHeight, orWidth, clArea.height - 3*scrollbarHeight);
				}
				
				textWidget.setBounds(vrWidth + fGap, 0, clArea.width - vrWidth - orWidth - 2*fGap, clArea.height);
				vr.getControl().setBounds(0, 0, vrWidth, clArea.height - scrollbarHeight);
				
			} else {
				StyledText textWidget= fAdaptedSourceViewer.getTextWidget();
				textWidget.setBounds(0, 0, clArea.width, clArea.height);
			}
		}
	};
	
	class AdaptedSourceViewer extends JavaCorrectionSourceViewer  {