You can run FlexFormatter from the command line for batch formatting.
Pros
- Better performance - while you can use the context menu on a Project or folder in Eclipse to run the formatter, that requires opening the file, operating on it, and closing it. This adds considerable overhead.
- You can operate on files that aren't part of an open FlexBuilder project
Cons
- If you operate from the command line on a FlexBuilder project, you may cause breakpoints and other line markers to be lost or shifted to incorrect positions
Instructions
- Download the .zip file command line support jars from here: | CommandLineSupportJars
- Download the desired version of the FlexFormatter distribution.
- Create a directory on your hard disk, and extract the contents of both zip files into that directory
- From a shell, issue a command similar to the following:
- java -Djava.ext.dirs=. utilities.CommandLine c:\sourceDir c:\tools\Formatter.properties 4 true
- c:\sourceDir -> the root directory where your source files are located. Everything underneath is formatted recursively. Or, you can specify the path to a single file, in which case that will be the only file processed.
- c:\tools\Formatter.properties -> the properties to use for formatting, as saved out from the FlexFormatter preference page, with the Export button
- Note: if you want to use the mxml formatter on different file extensions, add the following property to the end of the file: MXML.additionalXMLExtensions=xxx,yyy (where after the '=' is a comma-separated lower-case list of file extensions)
- 4 -> The size of a tab character, in spaces
- true -> if true, then format, otherwise indent