Paul Robertson's words, punctuated

Thoughts on development, user-centered design, code, etc. by Paul Robertson

Flash Builder 4.5 tip: Quick fixes for external classes and interfaces

The public beta of Flash Builder “Burrito” that was released at MAX included several “quick fix” features. For example, if you typed the name of a property or method that didn’t exist in the current class, you could hit Ctrl/Cmd+1 and create the missing item.

The final release of Flash Builder takes this much farther. Here are some of the additional quick fixes that I like the best:

Create class or interface

If you want to use a class that you haven’t created yet, there’s no need to break your train of thought. Go ahead and type in the class name:

var myObj:MyNewClass;

Also new since the MAX build, you’ll see yellow squigglies show up warning you that something’s wrong:

Flash Builder 4.5 showing a warning about a possible syntax error (an unrecognized class).

Move the cursor to the warning and hit Ctrl/Cmd+1 to see the new quick fix options:

Flash Builder 4.5 shows a menu of available.

If you choose “Create new Class” or “Create new Interface” the new class/new interface wizard appears, just as if you had chosen it from the menu.

Create property or method in external class

You can also now create properties (instance variables) and methods in an external class the same way:

myObj.someValue = 12;
Flash Builder 4.5 Create Class dialog box.

Just as with the class name, move the cursor to the relevant place and hit Ctrl/Cmd+1:

Flash Builder 4.5 quick fix for creating a method in an external class.

Hit Enter (or double-click) to create the new method. You don’t jump to the class automatically, but you can navigate to it in the usual ways to see the new class with the generated code:

The generated class with its generated property and method.

Unfortunately this doesn’t work for creating properties and methods in an interface. (The quick fix appears, but it just creates the method in the current class rather than in the interface.) Vote for the bug Generate from usage doesn’t generate interface methods so we can get it in the next version.