This can be done very easily with a macro if you have a parser or processor that can be run from the Windows command line against a file via your own custom function.
For example, you can pass the currently selected text to a function that cleans up the code for whatever default syntax you are using.
mysyntax = document.ConfigName;
mycode = document.selection.Text;
myresult = MyCleanupSyntax(mysyntax,mycode);
document.selection.Text = myresult;
The hard part will be finding a code-formatter that you can plug into your MyCleanupSyntax function. I am sure there are plenty available for Java-style syntax.