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
/*
		 * @see org.eclipse.swt.custom.VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent)
		 */
		public void verifyKey(VerifyEvent event) {			
			if (!event.doit)
				return;
			final ISourceViewer sourceViewer= getSourceViewer();
			IDocument document= sourceViewer.getDocument();
			final Point selection= sourceViewer.getSelectedRange();
			final int offset= selection.x;
			final int length= selection.y;
			switch (event.character) {
			case '(':
				if (hasCharacterToTheRight(document, offset + length, '('))
					return;
				
			case '[':
					if (!fCloseBrackets)
						return;
 					if (hasIdentifierToTheRight(document, offset + length))
 						return;
			
				
			
			case '"':
				if (event.character == '"') {
					if (!fCloseStrings)
						return;
 					if (hasIdentifierToTheLeft(document, offset) || hasIdentifierToTheRight(document, offset + length))
 						return;