Kulkarni NCDEVCON2011 CFBuilder Ext

Embed Size (px)

Citation preview

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    1/36

    White Master

    Replace witha graphic

    5.5 Tall & 4.3 Wide

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 1

    White Master

    Replace witha graphic

    5.5 Tall & 4.3 Wide

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 1

    Building ColdFusionBuilder Extensions

    Ram Kulkarni,

    Sr. Computer Scientist,

    Adobe

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    2/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 2

    Agenda

    What is ColdFusion Builder Extension

    Demo: CFC Generator

    Developing ExtensionsExtension Metadata

    Installer Wizard

    Project Contribution

    Menu Contributions

    Generating UI from handler

    Extension in View

    Contributing to Code AssistCallback Commands

    Using Extension Builder

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    3/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 3

    ColdFusion Builder Extensions

    Extend functionality of ColdFusion Builder

    Write extensions using CFML

    Extension is executed on the Server

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    4/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 4

    How CFB Extension works

    Extension is installed on the server and configured in the Builder

    Lets you add menu options inNavigator

    RDS Data View

    Outline View

    Project Wizard

    Write Handler CFM for each menu option

    Invoking menu option executes Handler CFM on the server

    Handler CFM canCreate HTML UI

    Send commands back to ColdFusion Builder to perform some actions

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    5/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 5

    Extension View in ColdFusion Builder

    Extension view lists all installed extensions

    Install extension by clicking icon

    Import extension that is already in wwwroot by clicking

    To delete and extension. Select it in the extensions view and click

    If you changed ide_config.xml (e.g. during development), you need torefresh extensions by clicking

    You can see details of selected extension by clicking

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    6/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 6

    Demo

    ORM CFC Generator

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    7/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 7

    ColdFusion Builder Extension

    Install Extension

    InvokeMenu

    Input Dialog(optional)

    Enter Data

    Call handler cfm Post data as ideeveninfo

    Display UI (Optional)

    Submit & Close

    Call onClose Handler(optional)

    IDE Callback commands

    Session 1

    Session 2

    Session 3

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    8/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 8

    Extension Zip File:

    Extension.ziphandlers: all handler cfm files go in this folder

    ide_config.xml: Extension configuration file

    ide_config.xml

    Name of the Extension Name of author(s)

    License text or name of the file in

    handlers folder

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    9/36Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 9

    Demo Extension1

    Create an Extension withonly extension info inide_config.xml

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    10/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 10

    ide_config.xml Installer Input

    Adding input pages to extension installer :

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    11/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 11

    Input Field Attributes :Attribute Descriptionname Name of the input field

    label Input field labeltooltip Tip on mouse hovertype dir , string , boolean , file , password , projectdir ,

    projectfile , and list *

    required true / false

    pattern RegEx for validating input dataerrormessage Displayed when validation fails

    helpmessage Displayed in the title area

    defaultDefault value for the given input type

    checked Applicable if type if boolean

    * If type is list then input field can have option tags. For example,

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    12/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 12

    ideeventinfo - Input XML to Extension Handler

    http://localhost:59355/index.cfm?extension=extension_name

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    13/36Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 13

    Demo Extension2

    Create an Extension withInstaller Input

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    14/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 14

    ide_config.xml: Events

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    15/36Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 15

    Demo Extension3

    Create a project from atemplate using theonProjectCreate event

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    16/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 16

    ide_config.xml: Menu Contributions

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    17/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 17

    Keywords for Default Values of Input Fields

    projectlocation

    projectname

    serverhome

    wwwroot

    Example :

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    18/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 18

    Creating Dialog for Input Fields

    Dialogs are not necessary for inputs

    Use dialog when you specifyTitle

    Image

    Width and height

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    19/36Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 19

    Demo Extension4

    Menu contribution toRDSView, Navigator, andOutlineView

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    20/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 20

    Creating UI from Extension

    Set showresponse attribute to true in action tag in ide_config.xml

    Set content type in Handler CFM to text/xml

    Create the following XML response from the Hander CFM:

    Create UI in the redirected CFM

    (Optional) Create application.cfm/cfc in the handler folder to passideeventinfo to the redirected CFM

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    21/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 21

    Sample code for creating response -

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    22/36Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 22

    Demo Extension5

    Create UI from the HandlerCFM file

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    23/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 23

    Running Extension in a View

    By default, extensions run in a modal dialog box

    Sometimes you need to refer to both extension and other views/editorsin ColdFusion Builder

    ColdFusion Builder 2 lets you run extension in a view

    Two ways to run extension in a view:In response to invoking extension menu actions

    Invoking from the Eclipse option Window >Show View menu

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    24/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 24

    Configuring View in IDE_config.xml

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    25/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 25

    Creating view from Handler CFM

    Note : The view tag above can have attributes such as title , id , or icon . It can also have toolbaritem child tags

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    26/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 26

    Demo Extension6

    Extension running in a View

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    27/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 27

    Code Assist Contributions

    You can add proposals to Code Assist window using extensions

    Code Assist contribution could be forArguments of function; could be UDF or function call on a CFC

    Members of any variable, for example functions or member variables

    Steps to contribute to Code AssistAdd Code Assist contribution tag in the IDE_config.xml

    Specify function names and argument number for which extension adds Code Assistproposals

    Specify variable for which extension adds Code Assist proposals

    Specify handlers for Code Assist contributions

    In the Handler CFM file, return valid code assist proposals in an XML response

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    28/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 28

    Code Assist Contribution: IDE_config.xml

    Configuring View in IDE_config.xml

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    29/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 29

    Returning CA proposals from handler

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    30/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 30

    Demo Extension7

    Code Assist Contribution

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    31/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 31

    Callback Commands

    Callback command lets extension handler to run commands inColdeFusion Builder

    List of callback commands:

    ColdFusion Builder 1 lets call back commands only on closing the

    extension window (using onclose handler)

    ColdFusion Builder 2 lets call back commands to be invoked any timefrom the Handler CFM using callback URL

    refreshFile refreshFolder

    refreshProject openFile

    insertText getServers

    getDatasources getTables

    getTable searchFile

    getFunctionsAndVariables

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    32/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 32

    Creating commads xml in Handler CFM

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    33/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 33

    Sending commands using cfhttp

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    34/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 34

    Demo Extension8

    Callback Commands

    &

    Extension Builder

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    35/36

    Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 35

    Troubleshooting Extensions

    Unable to install extension

    Incorrect packagingDirectory name is not unique

    Clicking extension menu does not trigger any actionVerify the URL, path, and server specifications

    Handler does not match the corresponding actions handlerid

    Using extension results in exceptionsVerify the log in Error Log View of ColdFusion Builder

    Page not found error when running extension in a view

    Make sure you specify complete URLs

  • 8/2/2019 Kulkarni NCDEVCON2011 CFBuilder Ext

    36/36

    Thank you

    [email protected]