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
fPaintManager= new PaintManager(getSourceViewer());
		
		if (isBracketHighlightingEnabled())
			startBracketHighlighting();
		if (isLineHighlightingEnabled())
			startLineHighlighting();
		if (isPrintMarginVisible())
			showPrintMargin();
		
		
		Iterator e= ANNOTATION_MAP.keySet().iterator();
		while (e.hasNext()) {
			AnnotationType type= (AnnotationType) e.next();
			if (isAnnotationIndicationEnabled(type))
				startAnnotationIndication(type);
		}
			
		if (isTabConversionEnabled())
			startTabConversion();
		if (isOverviewRulerVisible())
			showOverviewRuler();
			
			
		Preferences preferences= JavaCore.getPlugin().getPluginPreferences();
		preferences.addPropertyChangeListener(fPropertyChangeListener);			
		
		IPreferenceStore preferenceStore= getPreferenceStore();
		boolean closeBrackets= preferenceStore.getBoolean(CLOSE_BRACKETS);
		boolean closeStrings= preferenceStore.getBoolean(CLOSE_STRINGS);