Home  >  

Flex Builder Enhancements

Author photo
| | Comments (14)
AddThis Social Bookmark Button

If you came to Flex from the Java world, like me you were probably excited to hear that Flex Builder was built on Eclipse. Your heart swelled at the prospect of building sweet, beautiful, interactive applications using the same great platform that was the shining light of your dark development years in the salt mines of the Java empire.

Like me, you were probably also very disheartened to learn that many, if not most, of these features were not available in Flex Builder. It turns out fate had dealt you a nasty card, and most of those blessed features were part of the Java Development Tookit and not part of Eclipse itself. Try as they might, Adobe has been slow to implement them, though major strides have been made in Flex 3. It turns out things like Snippets and TODO, refactoring and auto-generating getter and setter methods were harder than you thought.

Well, my friend, I have some good news for you. Since Flex Builder is still Eclipse under the covers, some enterprising individuals have found good, easy, simple ways of dropping in a few jars and returning some of those features you loved.

TODO / FIXME:

The "TODO" and "FIXME" features in the JDT were nice ways to leave and find reminders in your code. You can read more on adding this feature to Flex Builder here. Though this post is for Flex 2, it works for Flex 3 also. Thanks to Drew McLean for tipping me off to this.

Snippets:

Snippets are a handy way to insert templatized code and are part of the Eclipse "Web Standard Tools." The interface is a little awkward, but you get used to it. After adding this jar to your FlexBuilder>Plugins directory, restart Flex Builder. Add the snippets view. Here's the most awkward part: to create a new snippet, you'll need to highlight some text, copy it, and then click the little "down" arrow in the upper right corner of the snippets view. Select "Paste as Snippet". Whether you want to use that text in your snippet or not is irrelevant.

Paste a snippet

Now you're ready to make a snippet. Snippets use ANT syntax to specify variables in the code. Here's your Snippets interface:

blank snippet
A blank snippet view

I made a getter/setter snippet like this:

private var _${PROP_NAME};
[Bindable]
public function set ${PROP_NAME}(temp:${PROP_TYPE}):void{
_${PROP_NAME} = temp;
}
public function get ${PROP_NAME}():${PROP_TYPE}{
return _${PROP_NAME};
}

finished snippet
Finished Snippet

To add the snippet, double click the snippet of your choice in the snippets view. You'll be prompted with this interface:

Add a snippet
Add a snippet view

Fill in your variable names in the table and click "Insert." Congratulations - you've just made a snippet, and while you probably didn't save any time at all this first time, you probably will later. Probably.

Thanks to Andy McIntosh for tipping me off to this.

For more on adding the entire WST, check out this post from Jun at RealEyes Media.

Mylyn plugin for Trac integration

If you use Flex Builder and Trac, you might want to look into the Mylyn plugin. Mylyn lets you easily see and update all of your Trac tickets from within Flex Builder through a much better interface than the web-based version Trac uses by default.

Adam Flater has an extensive post up (with broken images at the moment) on using and installing Mylyn, so I won't reproduce his work here.

Mylyn uses too many of the JDT jars to be easily dropped into the standalone version of Flex Builder, as far as I know. If someone figures out which it requires post it in the comments and I'll add an update.

Fix the "Open Resource" Menu

Andy McIntosh has a great post up about fixing the Open Resource menu in Flex Builder, as it crashes Flex Builder 3 on Macs running Leopard. I'm including the fix because like the features above it's a single jar you drop into your Flex Builder installation. If you've been having this problem, get the fix here. Adobe's documented the bug here and this fix should be included in a patch soon.

Read more from RJ Owen. RJ Owen's Atom feed rjowen on Twitter

Comments

14 Comments

Thanks for the pointers RJ

I also use Subclipse for subversion with FlexBuilder http://subclipse.tigris.org/

christian said:

Did someone know why they didn't implement templates as FDT and Java? Those are great!

A. said:

what about auto formatting???

Adrian said:

I would give my firstborn for auto formatting, especially where we can say ahead of time "put the opening curly brace at the end of the line!". Oh my.

I find FB3's biggest let down is the long list of Eclipse features not supported. Here's hoping FB4 addresses this. Refactoring (pull up, push down, extract interface, etc), getter and setter auto generation, code formatting, the list goes on.

But lest we forget - a HUGE thank you for posting how to get snippets up and running again! :-) thanks!

Paul Whitelock said:

Thanks for the tip about Snippets. I discovered that if you right-click in the Snippets window and choose "Customize..." a palette is displayed that lets you create Snippet categories and items from scratch without the need to use the "select and copy" trick.

Zach Stepek said:

I find that the Select Required button in the Find/Install Updates dialog in Eclipse is my best friend when I'm trying to get dependencies figured out. Makes it a ton easier to install things.

ZaBlanc said:

Thanks for the writeup. The snippet is a good example, but needs a slight fix and might as well make it adopt Adobe coding standards. :-) Here's another version:


private var _${PROP_NAME}:${PROP_TYPE};

[Bindable]
public function set ${PROP_NAME}(value:${PROP_TYPE}):void {
_${PROP_NAME} = value;
}

public function get ${PROP_NAME}():${PROP_TYPE} {
return _${PROP_NAME};
}

Leif Wells said:

Re: Source Formatting:
http://bugs.adobe.com/jira/browse/FB-8297

Go vote on the enhancement if you want it to happen!

Leif
Atlanta

Leif Wells said:

I am not recommending the snippets plugin that you recommend in this enty. Compared to other implementation of this feature for Java or JavaScript.

This snippets plugin, in my opinion, is unusable. In fact, I'd say it's harmful.

Please vote for true code template functionality for Flex Builder: http://bugs.adobe.com/jira/browse/FB-11842

Leif
Atlanta

enhancer said:

Very nice plugin. I've been using this method for quite some time but thanks for covering it again in further details.

Handy stuff! Thanks! I was just looking for a getter/setter in FB3. Thanks again!

fredi said:

For usability sake, if anything.

Programmers find every way possible to avoid typing. When writing a trace statement, a programmer is probably already upset that something isn't going on as expected, and having to type out whatever details they need into trace(s).

You're implying that you want us to type more? domain name registration Visually clutter up the code even more? Add another tab column so we have to scroll right for long statements even more often? Add more time to our compile times?

CONFIG::debugtrace {
trace("ClassName functionName expected value: " + val1 + " actual used value: " composedVarName.attribute.value);
}

Just so that the next person in line who picks up the project who may not be as advanced as a programmer as us will handily compile a SWF that has hundreds of different trace statements in it because they don't know how to flag/unflag an mxmlc conditional? (nor even know such a thing exists) web design

Flex has tons of useability features for novices / intermediate skill developers, yet the hard core AS3/Flex search engine optimization users are expected to work... harder? This seems like an overall conflict of ideals.

The last feature enhancement item I suggested, generating getters/setters, also got prioritized to "never", even though almost every other OOP-based Flex perspective has a similar feature because it *saves time*.

Please Adobe, don't forget the hardcore guys. We're coding all day, and want to save minutes here and there because at the end of the week that stacks up to saving hours.

Marcos said:

Those tips are great!
Is there another way doing snippets Flex Buider?

Thanks.
Great post!

Marcos
otimização de sites

princess said:

thanks for covering this issue.......... i myself wanted to talk about it. though i am a Web Designer i find java quite interesting so its good to read this piece.

Leave a comment


Tag Cloud

Question of the Week: Dream App

If you had an unlimited budget and unlimited resources what application would you build and why would you build it?

Answer

Latest Features

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.