"Format and save" works only for fie with extension: *.c, *.cpp, *.h, *....

I've moved the check for file type in NSDocument category, and do the check also for "format on save" options.