New Quick Assists in Flash Builder 4.7 Beta

Flash Builder 4.7 introduces new quick assists to increase productivity and faster refactoring. Those of you who don’t know about Quick Assist/Fix, please refer http://www.adobe.com/devnet/flash-builder/articles/flashbuilder45-coding-enhancements.html

To invoke Quick Assist, place cursor anywhere in editor and press CTRL+1 (CMD+1 on Mac).

1. Assign parameter to new field/existing field

It is mostly used in constructors’ parameters. Situations where you want to create a new instance variable and assign parameter to it. You can cycle through different variables and namespaces by pressing TAB. Press ENTER to come out of “Linked Mode”.

Before

After

2. Convert local variable to parameter.

This is very similar to ‘Convert local variable to field’ added in previous versions of Flash Builder. You use it whenever you want to quickly convert a local variable inside a function to function’s parameter.

Before

After

3.  Create new local variable with cast type

We obviously do lot of type casting in our programs. To make sure what we are casting on is compatible we usually verify it in runtime by using ‘is’ in an “if” statement. This quick assist allows you to create a new variable with casted type. Also available when invoked on “while” statements. Again, you can cycle through variable and its type by pressing TAB. Press ENTER to come out of it.

Before

After

4. Convert anonymous to named function

As the name suggests, this quick assist converts anonymous function to a named function. For example, you have an anonymous function as a parameter to addEventListener method call. As your code grows bigger inside this function, you will want to move this function to named function and use only function reference as parameter to increase code readability. Use this quick assist in those situations.

Before

After

5. Replace conditional with ‘if-else’ statement

Suppose in your code you have a conditional statement(using ternary operator ?:). You may want to use this quick assist to convert conditional to ‘if-else’ statements in situations where you want to add more statements if one condition is true or false.

Before

After

6. Add else, else if, catch, finally blocks.

No explanation needed i guess. Use it for quick generation of else, else-if, catch, finally blocks :-). Plus, add-elseif proposal uses local boolean variables in generated code when applied

Before

After

Make a habit of using ctrl+1. It saves time 🙂

Advertisements
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s