Disable Source > Format (Ctrl + Shift + F) in Zend Eclipse PDT

It became a total mess when I selected the entire root directory of my project and accidentally clicked Source > Format in Zend Eclipse PDT. All the files were instantly re-formatted and saved in a manner I wasn’t comfortable with and there didn’t seem any easy way to undo these changes that had been applied across nearly a hundred files in different folders.

They definitely should have prompted up a dialog box asking the developer’s confirmation. They probably will in future but for now, I need to do something to prevent this from happening again.

Disable Source > Format

First we will disable / hide this menu item or we will probably accidentally click on it again. Without any prompt nor confirmation, PDT simply goes on formatting the selected items silently. When you are in a single file that would be fine cause’ you just use Ctrl + Z to undo the change, however if you are selecting an entire directory or the entire project, this command would go ahead and format ALL the files under it and automatically SAVE THEM all onto the hard drive. The next thing you find yourself doing is opening and reverting each and every one of the files one by one.

Enough talk. To disable this menu item:

Window > Customize Perspective > Menu Visibility > “Source” > “Format” (disable this) > OK

Disable Ctrl + Shift + F

We should also disable this short cut keys combination which can also be inadvertently treaded on. Go to:

Window > Preferences > General > Keys > Select all “Format” entries and click “Unbind Command”

Done. Now the only way to format a page or a selected portion or a resource / item in PHP Explorer is to right click on the target and select Source > Format.

Scroll to Top