1

I'm working with a large Actionscript project, and every file needs to have it's imports organized.

I noticed that you can achieve this easily in the Java version of eclipse, but that doesn't seem to work in Flash Builder.

Is there a simple way to organise imports for the entire project?

Community
  • 1
  • 1
sashmackinnon
  • 61
  • 1
  • 3
  • Do you want this to organize imports for the project as a whole, or are you fine with organizing imports for each AS file individually? – IQAndreas Nov 16 '11 at 19:26

3 Answers3

0

This doesn't appear to be possible with the current version (4.7) of Flash Builder. It's sad. I want it too. The closest I have found to any recursive cleanup tool is the command line tool of FlexFormatter: http://sourceforge.net/apps/mediawiki/flexformatter/index.php?title=FormatterCommandLine

Haven't tried it myself though, and I don't believe it does import cleanups.

Taytay
  • 11,063
  • 5
  • 43
  • 49
0

This is not possible in FlashBuilder 4.7. However if you are tenatious enough, you can work around the problem as I did:

  1. Associate .as files with your FlashBuilder workspace. FlashBuilder->Window->Preferences->Flash_Builder->File_Associations and click ActionScript Files (*.as).
  2. Identify all .as files in your project and open them in Builder. I did this with cygwin, using this command: find . -type f -name '*.as' -exec cygstart {} ';'
  3. Use a macro program to type Control-Shift-O, Control-S, Control-W to: organize imports, save file, close file.
  4. Setup your macro to loop.

One warning, FlashBuilder takes a little time to organize the imports, and if your macro types too fast much of it will get lost, and bad things will happen in the source code. Put delays into your macro so that FB has time to catch up with the organizing, saving, and closing of files. I used 200ms between each step in the macro and it worked fine. I just launched the macro, and went to have some lunch.

Craig
  • 459
  • 4
  • 10
-2

Pressing Ctrl+1 should bring up a Quick Assist menu which allows you to (among other things) organize imports.

IQAndreas
  • 8,060
  • 8
  • 39
  • 74
  • You will have to let me know if this works or not, as I'm unable to test it at the moment. The tip was taken from http://www.adobe.com/devnet/flash-builder/articles/tips-tricks.html – IQAndreas Nov 16 '11 at 19:28
  • ctrl-shift-O does immediately. But only for the current document. I think the question is about doing it for all documents in a project at once. – frankhermes Nov 16 '11 at 21:23
  • 2
    Seems to only work for one document, not for the entire project – sashmackinnon Nov 27 '11 at 00:03