Formatting can also be triggered via the pop-up menu of several views, like the Projects or Files window. Note that the item only appears for folder nodes or Java source files.
If it happens that a file has an open editor, this editor will be updated, not the actual file. You have to save the editor first, to see the physical file updated.