blob: b0ade6259b74242ce2bb769352dc91244ab696a7 [file] [log] [blame]
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../../../../../../default_style.css" type="text/css">
<link rel="stylesheet" href="../../../../../../webtools/wtp.css" type="text/css">
<title>WST Common Snippets subcomponent Overview</title>
</head>
<body>
<table width="100%" cellspacing="5" cellpadding="2" border="0">
<tbody>
<tr>
<td width="60%" align="left"><font class="indextop">Snippets subcomponent</font>
<br>
<font class="indexsub">WST Common Snippets subcomponent Overview</font></td><td width="40%"><img width="120" hspace="50" height="86" align="middle" src="../../../../../../images/Idea.jpg"></td>
</tr>
</tbody>
</table>
<table width="100%" cellspacing="5" cellpadding="2" border="0">
<col width="16">
<col width="*">
<tbody>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<p>Last modified April 13, 2005</p>
</td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<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>
</td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<p></p>
</td>
</tr>
<tr>
<td valign="top" align="right"><img width="16" height="16" border="0" src="../../../../../../images/Adarrow.gif"></td><td>Core Concepts</td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<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
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>
</td>
</tr>
<tr>
<td valign="top" align="right"><img width="16" height="16" border="0" src="../../../../../../images/Adarrow.gif"></td><td>User Interface</td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<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>
</td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<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>
</td>
</tr>
<tr>
<td valign="top" align="right"><img width="16" height="16" border="0" src="../../../../../../images/Adarrow.gif"></td><td>Extension Points</td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<h4>SnippetContributions</h4>
</td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<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>
</td>
</tr>
<tr>
<td valign="top" align="right">&nbsp;</td><td valign="top">
<p>
For more information, see the reference document for this
extension point.
</p>
</td>
</tr>
</tbody>
</table>
</body>
</html>