Flex Formatter is one of my favorite plugins for FlashBuilder, unfortunately there's no plugin version for IntelliJ.
But thanks to IntelliJ's "External Tools", you're able to use any tool that can be run from the command line (think apparat, sprouts, etc) and execute it with a keyboard shortcut within IntelliJ! The video below shows you how:
Running FlexFormatter from the Command Line:
http://sourceforge.net/apps/mediawiki/flexformatter/index.php?title=FormatterCommandLine
Download the files below:
FlexFormatterJars:
http://sourceforge.net/projects/flexformatter/files/flexformatter/0.8.4/FlexPrettyPrintCommand_0.8.4.zip/download
CommandLineSupportJars: http://sourceforge.net/projects/flexformatter/files/flexformatter/CommandLineSupportJars/commandLineSupportJars.zip/download
Sample Formatter.properties file:
https://github.com/as3/as3-utils/raw/master/res/flex-formatter.properties
Than you! Cool util!
ReplyDeleteI have long dreamed about the utility sorting methods.
Nice information and i got a lot from this video.,
ReplyDeletecool but IDEA already has ctrl + shift + L reformat code
ReplyDeleteFlexFormatter supports element reordering, attribute reordering, and other super advanced formatting features not found in IntelliJ's formatter.
ReplyDeleteAre you ok man ? Where are the old anf good tutorials ? ^ ^
ReplyDeleteYup, I'm alive and kickin'. Just been working on some side projects rather than tutorials recently. Too many things in life to do, eh?
ReplyDeleteWow thanks thats very nice. I am just making the switch form Flash Builder to intelliJ. Flex formatter was one of my favourite plugins from Flashbuilder so its awesome I can use it in my new IDE, handily I put my properties file in dropbox to share between my machines, so I can point the external tool at that and if i ever need to muck around with the settings I just open Flashbuilder on my work computer.
ReplyDeleteNice.. I was looking for that. Thank you, John!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI followed the same exact steps but I got the below exception. Any Idea ?
ReplyDeleteC:\Program Files\Java\jdk1.6.0_35\bin\javaw.exe" -Djava.ext.dirs=. utilities.CommandLine " C:\Users\cyeluri\Trellis\Branches\R2.1-DEV\OneLineDiagram\src\main\flex\com\avocent\trellis\domain\model\UserPreferencesModel.as" C:\Users\cyeluri\tools\flexFormatter\Formatter.properties 4 true
Error: File/Directory does not exist: C:\Users\cyeluri\Trellis\Branches\R2.1-DEV\OneLineDiagram\src\main\flex\com\avocent\trellis\domain\model\UserPreferencesModel.as
Usage:
[0]=full file/directory path, required parameter
[1]=location of property file with settings, default=empty property set
[2]=tabSize, default=3
[3]=true->format, false->indent, default=false
[4]=java charset name, ex. UTF8. Defaults to the default charset.