Snippet Model

org.eclipse.atf.templates.snippetModel

1.0

This plugin is used to contribute additional code snippets for a particular AJAX runtime personality. NOTE: The schema defined below is not enforced. It is provided below to give guidelines on how to use the existing snippet generation functions of the AJAX Toolkit Framework's personality builder. However, because of the fact that users can contribute new variable types and variable renderer types, we cannot, at this time, enforce a schema.

<!ELEMENT extension (model+)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT model (variables? , dialog , template)>

<!ATTLIST model

targetSnippet CDATA #REQUIRED>

Snippet model defines the data model and variable input presentation for a code snippet.



<!ELEMENT variables (variable+)>

Children are the variables or inputs that the snippet needs in order to complete the snippet template.



<!ELEMENT variable EMPTY>

<!ATTLIST variable

defaultValue CDATA #IMPLIED

value        CDATA #IMPLIED

displayName  CDATA #REQUIRED

name         CDATA #REQUIRED

type         CDATA #REQUIRED

options      CDATA #IMPLIED>

A defined input needed in order to create the code snippet. Usually, these variables are referenced in the snippet template.



<!ELEMENT dialog (description? , variableRef+)>

<!ATTLIST dialog

title CDATA #REQUIRED>

Provides the description of the snippet dialog and specifies which variables will show up as inputs.



<!ELEMENT description (#PCDATA)>

The description of the snippet dialog.



<!ELEMENT variableRef EMPTY>

<!ATTLIST variableRef

name CDATA #REQUIRED>

A reference to a previously declared "variable" element.



<!ELEMENT template EMPTY>

<!ATTLIST template

path CDATA #REQUIRED>

The template for the code snippet.



An example of a code snippet for the DoJo AJAX runtime:

<extension point=

"org.eclipse.atf.templates.snippetModel"

>

<model targetSnippet=

"org.eclipse.atf.personality.dojo.ui.snippet.snippet1"

>

<variables>

<variable defaultValue=

"50"

displayName=

"Minimum Size"

name=

"minSize"

type=

"String"

>

</variable>

</variables>

<dialog title=

"Insert SplitPanePanel"

>

<description>

Specify inputs for the code snippet

</description>

<variableRef name=

"minSize"

>

</variableRef>

</dialog>

<template path=

"/template/snippet/snippet1.template"

>

</template>

</model>

</extension>

The current AJAX Toolkit Framework provides contributions to this extension point by providing snippets for the Dojo and Rico AJAX personalities. These contributions are defined in the org.eclipse.atf.personality.dojo.ui and org.eclipse.atf.personality.rico.ui plugins respectively.