Home  >  Development  >  blogs

Flex Builder Enhancements

| | Comments (9)
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.

Comments

9 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

Leave a comment


Type the characters you see in the picture above.

Tag Cloud

Related Books

Development Series

Get an overview of the tools and technologies that work together to allow developers to build Rich Internet Applications (RIAs) quickly and easily.

Anatomy of an Enterprise Flex RIA

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.

About Us
Meet the Experts
Meet Our Contributors
Send Us Feedback