Saturday, May 7, 2011

How to add custom Quick Assist options to FlashBuilder 4.5 ?

Adding custom quick assist options to FlashBuilder 4.5.1 is easy.

Here is a sample plugin I created to show how this can be done. Copy this plugin into the dropins folder found under the "Adobe FlashBuilder 4.5" folder of the installation. In FB pressing Ctrl+1 inside a ActionScript class or script block of MXML file should bring up the "Override/Implment Methods" quick assist option as shown below.

One needs to implement the "com.adobe.flexbuilder.as.editor.quickAssistProvider" extension point to add custom quick assist providers in a custom plugin. The extension point requires the IQuickAssistProvider interface to be implemented by a class and supply this as a "class" value to the extension point description.

Step by step instructions on how to do this:

1. Create a new workspace and import the following plugins from FlashBuilder plugins folder. (These are the basic plugins which are required for the example. You may need to import more plugins based on the exact quick assist you want to implement.)

com.adobe.flash.codemodel.core

com.adobe.flexbuilder.as.editor

com.adobe.flexbuilder.codemodel

com.adobe.flexbuilder.editorcore

com.adobe.flexbuilder.editors.derived

com.adobe.flexide.as.core

com.adobe.flexide.editorcore

2. Create a new plugin called say "com.adobe.flashbuilder.extras"

3. Add the extension point "com.adobe.flexbuilder.as.editor.quickAssistProvider"

4. Create a class implementing the interface IQuickAssistProvider by clicking the class link. Add the necessary code for the required functionality in the class following the example source given.

The interface has only one method getProposals which needs to return a list of proposals that need to be displayed at the particular offset at which the user has invoked the quick assist. Using the information available in the IQuickAssistInvocationContext and other code model APIs the code can arrive at this list.

5. Export the new plugin and place the jar in the dropins folder under the FB installation.

Caution : In case you find that quick assist functionality of FB stops working check the logs to see if the new plugin is causing any exceptions causing this.

The example source is available here.

8 comments:

dineshkumar said...

Hi Sreenivas ,
I am dinesh .I need your kind help regarding the FB plugin.I am developing an plugin where it adds the code to the model.I am able to add attributes to components and containers but not able to add to this .Can you please help me.My development has stopped with this and i am not able to proceed also not getting examples.my id dineshkumar.tm@gmail.com

Thanks,
Dinesh

dineshkumar said...

Hi Sreenivas ,
I am dinesh .I need your kind help regarding the FB plugin.I am developing an plugin where it adds the code to the model.I am able to add attributes to components and containers but not able to add to this .Can you please help me.My development has stopped with this and i am not able to proceed also not getting examples.my id dineshkumar.tm@gmail.com

Thanks,
Dinesh

dineshkumar said...

hi here i meant this as mx:object tag..

Unknown said...

Hi, I am Thom. I try it in the FlashBuilder 4.6, But it dose not work. I just want to develop flex use code_behind pattern. Generating the componnets' event handler in the as file. Could you help me realize it. Thank you, email: moushuai00@hotmail.com

KhoyungNET said...

Thanks for your sharing, this a great post,

read my blog to ya,

Panduan Komputer

Unknown said...

Wow amazing blog.I always love to read these kind of blogs.
Adobe Illustrator Patch Free Download

Unknown said...

Hi,
Thank you for sharing such a useful information related to flash builder with us.It will helpful to so many users.
Thank you.
oracle R12 training

hrroman said...

If you are stuck with your marketing assignment then in this case you can opt for our Marketing Assignments. we provide the bestOnline marketing expert.We also provide Sales and Promotion help for students across the globe. for more information contact us +16692714848.