| <?xml version="1.0" encoding="utf-8"?> |
| <?xml-stylesheet type="text/xsl" href="../../../../../wtp.xsl"?> |
| <html> |
| <head> |
| <meta name="root" content="../../../../../.." /> |
| <title>WST Common Snippets subcomponent Overview</title> |
| </head> |
| <body> |
| |
| <h1>Snippets subcomponent</h1> |
| |
| <p>Last modified April 13, 2005</p> |
| |
| <p> |
| <i> |
| This document is a work in progress. It is an attempt to |
| capture the key concepts of the WTP Snippets |
| subcomponent. Note that the concepts presented here may |
| differ from what is found in the currently released |
| code. This document describes the architecture, or "end |
| goal", of the Snippets subcomponent. Once finalized, the |
| intent is to bring the code and its specifications into |
| line with this document. |
| </i> |
| </p> |
| <p></p> |
| |
| <h3>Core Concepts</h3> |
| <p> |
| The Snippets subcomponent provides a simple way for users to |
| drag and drop chunks of text into source editors. The |
| snippets model refers to these insertable chunks as "Items" |
| and their containers as "Category"s. The actual text being |
| inserted can be affected by input from the user during the |
| "drop" part of the drag-and-drop operation and users are |
| free to create categories and items for themselves. Items |
| contributed from plug-ins may also provide customized<!-- editing and --> |
| insertion behavior, for example substituting wizards and |
| custom dialogs for the defaults that are provided. The user |
| interacts with graphical representations of the snippet |
| items directly, but any exposed APIs do not make specific |
| references to the current UI implementation. |
| </p> |
| <h3>User Interface</h3> |
| <p> |
| The Snippets view is based on the GEF PaletteViewer, |
| primarily because the Snippets view is a logical counterpart |
| to the built-in palette found in many graphical editors. |
| Snippet Items and Categories are shown as |
| PaletteTemplateEntrys and PaletteDrawers, although this |
| detail is hidden by the ISnippetItem and ISnippetCategory |
| interfaces. |
| </p> |
| <p> |
| The standard PaletteViewer user settings for appearance are |
| available and supported. The user is also given the ability |
| to show and hide individual PaletteDrawers as they wish. |
| While the user has full editing abiities for |
| PaletteTemplateEntrys and PaletteDrawers they created, those |
| originating from plug-in contributions are otherwise |
| unmodifiable. The user or a plug-in contributor may choose |
| for a drawer to have its visibility automatically controlled |
| according to the active editor part's input's platform |
| content type. |
| </p> |
| <h3>Extension Points</h3> |
| <h4>SnippetContributions</h4> |
| <p> |
| The org.eclipse.wst.common.snippets.SnippetContributions |
| extension point allows other plugins to provide new |
| categories and items (made visible as entries and drawers) |
| into the Snippets view. One keen notion to keep in mind is |
| that contributions provide only the attributes for a snippet |
| item or category, not its implementation. Similarly, the |
| insertion class is contributed (as this is a key part of a |
| snippet item's lifecycle) instead of insertion being |
| directly implemented on a provided snippet item |
| implementation. This arrangement was conceived to remove the |
| need and ability for contributions to maintain any |
| information between workbench sessions--the recording of a |
| contributed drawer's visibility, for instance. |
| </p> |
| <p> |
| For more information, see the reference document for this |
| extension point. |
| </p> |
| </body> |
| </html> |