June 8th, 2007

The quest for the holy mxml/as3 snippets

Over the last several months I have been on a quest…I REALLY like developing my projects in Flex Builder, but there has been one bummer about it all along, code snippets.

During my quest I’ve tried out alternate IDEs:

Sepy FlashDevelop FDT

But to my dismay there was always something about them that to me seemed pale in comparison to the features and functionality of Flex Builder for Flex/Apollo development.

So…the search continued…

The next thing I though about doing was leveraging the CFEclipse plugin’s Snip Tree View with AS3/MXML. This proved to be very promising…works pretty well with .as files in the Flex Development perspective:

Snip Tree View with AS3

Snip Tree View with AS3 Inserted

However, the Cfeclipse Snip Tree View did not work at all with MXML files… basically, the mxml editor disables the insertion of the snippet after populating necessary variables.

So after tedious toil I gave up for a couple weeks…time passes…

Today I was working on an app and was getting sick of typing in the same code over and over again. I decided that although snippet tools with support for dynamic variables was not something I had succeeded in finding, I figured I could just find a little code clipboard plugin to paste in some of the more common code structures. (Then I could use Replace/Find to populate the dynamic pieces.)

I found a promising clipboard app called Multi Clipboard by an author who has a pretty bad-ass Regular Expression plugin called QuickREx , so I installed Multi Clipboard. After the plugin installation, I restarted my workbench and went to Window menu –> Other Views to add the Multi Clipboard to my Flex Development perspective.

For some reason I though that the Multi Clipboard would be listed under General views, which it wasn’t, but luckily for me I stumbled upon something interesting called Snippets:

Once the Snippets view was in view, I quickly realized that I had stumbled upon the holy grail of mxml/as3 snippet creation in Flex Builder…are you skeptical? Check out these screenshots:
WST Snippets Config

Insert Snippet into AS3 file img 1

Insert Snippet into AS3 file img 2

Below is the crowning feature, dynamic snippet with MXML files, woo-hoo!!

Insert Snippet into MXML file img 1

Insert Snippet into MXML file img 2

So…if you’ve read this far, I’m sure you’re liking what you see…here’s the deal, to get this functionality, download the Eclipse Web Standard Tools (WST) Project. Mine’s version 1.5.4…

Now I just need to find a Shrubbery…

-Jun

8 Responses

  1. nwebb.co.uk » Blog Archive » FlexBuilder (standalone & plugin run button bug) Says:

    [...] following Jun’s comment and blog post about snippets today I decided to take the plunge, expecting it to be a fairly quick job. I kept [...]

  2. jun :: realeyes media » Blog Archive » UPDATE: Installing WST within Flex Builder Standalone Says:

    [...] in June I had blogged about how cool WST was for creating dynamic MXML and AS Snippets. Recently my blog post had caused some pain and torment to a fellow Flex developer due to Eclipse [...]

  3. PeZ Says:

    I’m desperately trying to put my hand on a snippet tutorial but haven’t found anything yet.

    Any chance chance you post a tutorial or a link you might know?

    Thanks.

    —————————————————-

    PeZ,

    Sorry to take so long to respond…been pretty swamped lately with a big project so my blog has been pretty tumbleweed lately.

    As far as existing tutorials…none that I know of.

    Anyway, I can’t guarantee anything, but I will put this suggestion into my pool of blog ideas. Right now I got a good backlog, but since I do like using WST Snippets, this would be a good candidate.

    -Jun

  4. FlashGen Says:

    Jun, nice post, I was playing with the idea of using the snippets panel at the end of last year. I use a macro app on the Mac called TextExpander to perform similar operations.

    Thanks for the heads up I’ve got something to play with over the coming weekend now :D

    ================================

    Thanks, yeah, I love the Snippets panel, especially for comments or Cairngorm stuff. I hope it works for you. :) Also, I’ve had comments from users in the past that my post was incomplete, so if you find yourself with any questions about getting up and running with it feel free to hit me up.

    -Jun

  5. » Blog Archive » Snippets in FlexBuilder Says:

    [...] this time last year I read an excellent blog post from fellow developer Jun, regarding snippets in Eclipse (read:FlexBuilder), but I had some issues [...]

  6. BClover Says:

    Thanks, you just made this developer VERY happy…and much more productive! You’re my hero!

    ——————————————————————————————–

    Awesome, glad to help!
    -Jun

  7. Tim Says:

    Hi,

    This is really cool, but I’d like to get access to the Eclipse variables so we can easily insert stuff like today’s date, file name, project name, etc. I’ve been looking for hours, but I can’t find anything. It seems to me this must be possible, but… any ideas?

    t

  8. jun Says:

    Hi Tim,

    Thanks for the kind words.

    Unfortunately I have not seen any eclipse snippet tools out there that have access to Eclipse variables. If you do find one, please share. :)

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Community Jun

Ignite Denver Committee

Written Jun

Flex Authority Vol. 1 Issue 2
InsideRIA
Fusion Authority Quarterly Update

Gamer Jun

Categories

Credits