Translate

2011/08/13

[轉] Code Formatting in Flash Builder

Follow these steps to set up automatic code formatting within flash builder.
Note that this is specific to your workspace so you should store the file somewhere on
your system and become familiar with the steps to initialize these tools.

The install process is the same as anyone installing plugins on Flash Builder.
If you are familiar with this process feel free to just utilize the links to the
software below.

1. Help>Install New Software
2. In the work with input use the URL and click add
Note – use the name Flex Formatter
3. Select Flex Formatter
4. Click next
5. Click next
6. Accept the term of use
7. Click Finish
8. Click okay if you get a message about installing unsigned software
9. Wait to restart flash builder.

Install Any Edit
In flash builder go to http://andrei.gmxhome.de/eclipse/

10. Help>Install New Software
11. In the work with input use the URL and click add
Note – use the name AnyEdit
12. Click on the dropdown for Eclipse 3.5-3.7 plugins
13. Select AnyEditTools
14. Click next
15. Click next
16. Accept the term of use
17. Click Finish
18. Click okay if you get a message about installing unsigned software
19. Restart Flash Builder

Flex Formatter setup
1. Download the formatting.properties file attached to this page. Store it
somewhere you can reference down the road.
2. Flash Builder > Preferences > Flex Formatter
3. Select the radio button to indent using spaces
4. Select import at the bottom and point to the file “formatting.properties”
5. Click on the Flex Formatter arrow in the left hand navigation
6. Select Auto Format
7. Check the box to format ActionScript files on save
8. Select the radio box “format” instead of indent for ActionScript files
9. Do the same for MXML files
10. Click Apply

Any Edit Setup
1. Flash Builder > Preferences > General > Editors > AnyEditTools
2. Check the box “remove trailing whitespace”
3. Check the box “create new line at the end of the file”
4. Check the box “Convert tabs <-> spaces
5. Click on the “Convert” tab in the tabbar navigation at the top
6. Change the Tabwidth/number of spaces for tab to 4 instead of 2
7. Click Apply