Snippet Model
Identifier:
org.eclipse.atf.templates.snippetModel
Since:
1.0
Description:
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.
Configuration Markup:
<!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.
- targetSnippet - The item id of the org.eclipse.wst.common.snippets.SnippetContributions contribution that this snippet model applies to.
<!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.
- defaultValue - The default value of the variable (DEPRECATED - use the "value" attribute instead).
- value - Used to define a default value for the variable.
- displayName - The variable's name as it will appear in the snippet dialog window.
- name - The unique name of this variable.
- type - The type of the variable. The type corresponds to any valid org.eclipse.atf.templates.variableFactory contribution.
- options - (Currently only used with the "StringOptions" variable type) Used to specify a ',' or '|' delimited list of options for the variable (i.e. top,bottom or left|right).
<!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.
- title - The title of the dialog window.
<!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.
- name - Specifies which variable this variableRef is referencing. Corresponds to the referenced variable's "name" attribute.
<!ELEMENT template EMPTY>
<!ATTLIST template
path CDATA #REQUIRED>
The template for the code snippet.
- path - The path to the template file. This file may or may not have variable references in it (i.e. ${varname} notation) which will be substituted with the variable inputs from the user at runtime. The file may also contain JET notation and constructs.
Examples:
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>
Supplied Implementation:
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.
Licensed Materials - Property of IBM
AJAX Toolkit Framework 6-28-496-8128
Copyright(c) IBM Corp. 2006 All Rights Reserved.
U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.